playbook_ui 14.8.0.pre.alpha.pbntr661createstickyleftprop4612 → 14.8.0.pre.alpha.play1648heightglobalprops4559

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +2 -2
  4. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +4 -0
  5. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +7 -84
  6. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -1
  7. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -0
  8. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +4 -0
  9. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.html.erb +2 -1
  10. data/app/pb_kits/playbook/pb_table/_table.tsx +24 -103
  11. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -1
  12. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -1
  13. data/app/pb_kits/playbook/pb_table/styles/_all.scss +0 -2
  14. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -3
  15. data/app/pb_kits/playbook/tokens/_height.scss +19 -0
  16. data/app/pb_kits/playbook/tokens/exports/_height.module.scss +37 -0
  17. data/app/pb_kits/playbook/utilities/_height.scss +29 -0
  18. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
  19. data/app/pb_kits/playbook/utilities/globalProps.ts +15 -0
  20. data/dist/chunks/{_typeahead-D0PihN_3.js → _typeahead-ZkBp8QRa.js} +1 -1
  21. data/dist/chunks/_weekday_stacked-BmqMRu1B.js +45 -0
  22. data/dist/chunks/vendor.js +1 -1
  23. data/dist/playbook-doc.js +1 -1
  24. data/dist/playbook-rails-react-bindings.js +1 -1
  25. data/dist/playbook-rails.js +1 -1
  26. data/dist/playbook.css +1 -1
  27. data/lib/playbook/classnames.rb +3 -0
  28. data/lib/playbook/height.rb +29 -0
  29. data/lib/playbook/kit_base.rb +6 -0
  30. data/lib/playbook/max_height.rb +29 -0
  31. data/lib/playbook/min_height.rb +29 -0
  32. data/lib/playbook/version.rb +1 -1
  33. metadata +10 -8
  34. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +0 -87
  35. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +0 -2
  36. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +0 -4
  37. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +0 -18
  38. data/dist/chunks/_weekday_stacked-CuBVpyZq.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 447188fd32d5d83aeaf14c246e24bbb2ded7d4ef68ec21db96a48fc115a50d49
4
- data.tar.gz: 4c1d2183a6df9ebefcb605e8aaeb52c097cdc1726c672a234237aa194b67c475
3
+ metadata.gz: ba9b61505396d83dda5a66f647455f7300ffc61aa1568378549a848cf0a3e52d
4
+ data.tar.gz: 9c7a4c59e621094cf9f5c8115529bfcd202615811b3f08e2757b20204951a514
5
5
  SHA512:
6
- metadata.gz: 99ea4d44f89369d8d928c441c86ebac5261bd849fda00bdb2490b209fb906232be43c480d49101c24f56c2fcacd23f662025e1dba331dd9472275e5d67040df5
7
- data.tar.gz: b5e4d90132d0d728c6fb9c023b9ceeaf8ac64a017cdac314b5d85c774917a806540eb97dab62d7690112cbff97a395e794c271fb7375d4a3c50e6e13afe1abbc
6
+ metadata.gz: f0e0bad5bbfc8b77967a3c379768451e525e1472e6bd64039070493bd045e1fe836f778f04d3b5a5b18b1af6b871c4182bbe3a3d9f3e1d493972a7394747a038
7
+ data.tar.gz: f6814ca019c793c26280102244bf5c65a4c9cd44c08f50ca55c8e6b57330714d66972766a6cbdbf29c7ed514e67ee9461158b53be9ab1c41d9e618765e772227
@@ -126,3 +126,4 @@
126
126
  @import 'utilities/overflow';
127
127
  @import 'utilities/truncate';
128
128
  @import 'utilities/vertical_align';
129
+ @import 'utilities/height';
@@ -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
+ }) %>
@@ -53,7 +53,6 @@
53
53
  }
54
54
 
55
55
  .pb_dropdown_container {
56
- position: absolute;
57
56
  background-color: $white;
58
57
  overflow: hidden;
59
58
  box-shadow: $shadow_deep;
@@ -3,6 +3,7 @@
3
3
  class: object.classname,
4
4
  data: object.data,
5
5
  id: object.id,
6
+ style: object.container_style,
6
7
  **combined_html_options) do %>
7
8
  <%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
8
9
  <% if content.present? %>
@@ -7,6 +7,10 @@ module Playbook
7
7
  generate_classname("pb_dropdown_container", "close", separator: " ")
8
8
  end
9
9
 
10
+ def container_style
11
+ "position: absolute"
12
+ end
13
+
10
14
  def data
11
15
  Hash(prop(:data)).merge(dropdown_container: true)
12
16
  end
@@ -6,6 +6,7 @@
6
6
  value: "selected_with_icon",
7
7
  checked: true,
8
8
  icon: true,
9
+
9
10
  }) do %>
10
11
  Selected, with icon
11
12
  <% end %>
@@ -36,4 +37,4 @@
36
37
  Disabled
37
38
  <% end %>
38
39
 
39
- </div>
40
+ </div>
@@ -4,11 +4,11 @@ import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/pro
4
4
  import { globalProps, GlobalProps } from '../utilities/globalProps'
5
5
  import PbTable from '.'
6
6
  import {
7
- TableHead,
8
- TableHeader,
9
- TableBody,
10
- TableRow,
11
- TableCell,
7
+ TableHead,
8
+ TableHeader,
9
+ TableBody,
10
+ TableRow,
11
+ TableCell,
12
12
  } from "./subcomponents";
13
13
 
14
14
  type TableProps = {
@@ -28,7 +28,6 @@ type TableProps = {
28
28
  singleLine?: boolean,
29
29
  size?: "sm" | "md" | "lg",
30
30
  sticky?: boolean,
31
- stickyLeftcolumn?: string[],
32
31
  striped?: boolean,
33
32
  tag?: "table" | "div",
34
33
  verticalBorder?: boolean,
@@ -52,7 +51,6 @@ const Table = (props: TableProps): React.ReactElement => {
52
51
  singleLine = false,
53
52
  size = 'sm',
54
53
  sticky = false,
55
- stickyLeftcolumn = [],
56
54
  striped = false,
57
55
  tag = 'table',
58
56
  verticalBorder = false,
@@ -78,7 +76,6 @@ const Table = (props: TableProps): React.ReactElement => {
78
76
  'single-line': singleLine,
79
77
  'no-hover': disableHover,
80
78
  'sticky-header': sticky,
81
- 'sticky-left-column': stickyLeftcolumn,
82
79
  'striped': striped,
83
80
  [outerPaddingCss]: outerPadding !== '',
84
81
  },
@@ -88,56 +85,6 @@ const Table = (props: TableProps): React.ReactElement => {
88
85
  className
89
86
  )
90
87
 
91
- useEffect(() => {
92
- const handleStickyColumns = () => {
93
- let accumulatedWidth = 0;
94
-
95
- stickyLeftcolumn.forEach((colId, index) => {
96
- const isLastColumn = index === stickyLeftcolumn.length - 1;
97
- const header = document.querySelector(`th[id="${colId}"]`);
98
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
99
-
100
- if (header) {
101
- header.classList.add('sticky');
102
- (header as HTMLElement).style.left = `${accumulatedWidth}px`;
103
-
104
- if (!isLastColumn) {
105
- header.classList.add('with-border');
106
- header.classList.remove('sticky-shadow');
107
- } else {
108
- header.classList.remove('with-border');
109
- header.classList.add('sticky-shadow');
110
- }
111
-
112
- accumulatedWidth += (header as HTMLElement).offsetWidth;
113
- }
114
-
115
- cells.forEach((cell) => {
116
- cell.classList.add('sticky');
117
- (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
118
-
119
- if (!isLastColumn) {
120
- cell.classList.add('with-border');
121
- cell.classList.remove('sticky-shadow');
122
- } else {
123
- cell.classList.remove('with-border');
124
- cell.classList.add('sticky-shadow');
125
- }
126
- });
127
- });
128
- };
129
-
130
- setTimeout(() => {
131
- handleStickyColumns();
132
- }, 10);
133
-
134
- window.addEventListener('resize', handleStickyColumns);
135
-
136
- return () => {
137
- window.removeEventListener('resize', handleStickyColumns);
138
- };
139
- }, [stickyLeftcolumn]);
140
-
141
88
  useEffect(() => {
142
89
  const instance = new PbTable()
143
90
  instance.connect()
@@ -145,52 +92,26 @@ const Table = (props: TableProps): React.ReactElement => {
145
92
 
146
93
  return (
147
94
  <>
148
- {responsive === 'scroll' ? (
149
- <div className='table-responsive-scroll'>
150
- {isTableTag ? (
151
- <table
152
- {...ariaProps}
153
- {...dataProps}
154
- {...htmlProps}
155
- className={classNames}
156
- id={id}
157
- >
158
- {children}
159
- </table>
160
- ) : (
161
- <div
162
- {...ariaProps}
163
- {...dataProps}
164
- {...htmlProps}
165
- className={classNames}
166
- id={id}
167
- >
168
- {children}
169
- </div>
170
- )}
171
- </div>
95
+ {isTableTag ? (
96
+ <table
97
+ {...ariaProps}
98
+ {...dataProps}
99
+ {...htmlProps}
100
+ className={classNames}
101
+ id={id}
102
+ >
103
+ {children}
104
+ </table>
172
105
  ) : (
173
- isTableTag ? (
174
- <table
175
- {...ariaProps}
176
- {...dataProps}
177
- {...htmlProps}
178
- className={classNames}
179
- id={id}
180
- >
181
- {children}
182
- </table>
183
- ) : (
184
- <div
185
- {...ariaProps}
186
- {...dataProps}
187
- {...htmlProps}
188
- className={classNames}
189
- id={id}
190
- >
191
- {children}
192
- </div>
193
- )
106
+ <div
107
+ {...ariaProps}
108
+ {...dataProps}
109
+ {...htmlProps}
110
+ className={classNames}
111
+ id={id}
112
+ >
113
+ {children}
114
+ </div>
194
115
  )}
195
116
  </>
196
117
  )
@@ -33,7 +33,6 @@ examples:
33
33
  - table_md: Medium
34
34
  - table_lg: Large
35
35
  - table_sticky: Sticky Header
36
- - table_sticky_left_columns: Sticky Left Column
37
36
  - table_alignment_row: Row Alignment
38
37
  - table_alignment_column: Cell Alignment
39
38
  - table_alignment_shift_row: Row Shift
@@ -25,4 +25,3 @@ export { default as TableDiv } from './_table_div.jsx'
25
25
  export { default as TableWithSubcomponents } from './_table_with_subcomponents.jsx'
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
- export { default as TableStickyLeftColumns } from './_table_sticky_left_columns.jsx'
@@ -20,5 +20,3 @@
20
20
  @import "table_header";
21
21
  @import "striped";
22
22
  @import "outer_padding";
23
- @import "sticky_columns";
24
- @import "scroll";
@@ -2,7 +2,6 @@
2
2
  @import "../tokens/border_radius";
3
3
  @import "../tokens/spacing";
4
4
  @import "../tokens/shadows";
5
- @import "../tokens/positioning";
6
5
 
7
6
  [class^=pb_typeahead_kit] {
8
7
  .typeahead-kit-select__option {
@@ -100,7 +99,6 @@
100
99
  .typeahead-kit-select__menu {
101
100
  background-color: $bg_dark;
102
101
  color: $white;
103
- z-index: $z_1;
104
102
  }
105
103
  .typeahead-kit-select__option:hover {
106
104
  background-color: $active_dark;
@@ -184,7 +182,6 @@
184
182
  }
185
183
 
186
184
  .typeahead-kit-select__menu {
187
- z-index: $z_1;
188
185
  .typeahead-kit-select__menu-list {
189
186
  padding: 0;
190
187
  }
@@ -0,0 +1,19 @@
1
+
2
+ $height_auto: auto !default;
3
+ $height_xs: 320px !default;
4
+ $height_sm: 480px !default;
5
+ $height_md: 768px !default;
6
+ $height_lg: 1024px !default;
7
+ $height_xl: 1280px !default;
8
+ $height_2xl: 1440px !default;
9
+ $height_3xl: 1920px !default;
10
+ $heights: (
11
+ height_auto: $height_auto,
12
+ height_xs: $height_xs,
13
+ height_sm: $height_sm,
14
+ height_md: $height_md,
15
+ height_lg: $height_lg,
16
+ height_xl: $height_xl,
17
+ height_xxl: $height_2xl,
18
+ height_xxxl: $height_3xl
19
+ );
@@ -0,0 +1,37 @@
1
+ @import "../height";
2
+
3
+ :export {
4
+ @mixin export_height($height_list) {
5
+ @each $name, $value in $height_list {
6
+ .#{$name} {
7
+ height: $value;
8
+ }
9
+ }
10
+ }
11
+
12
+ @include export_height($heights);
13
+ }
14
+
15
+ :export {
16
+ @mixin export_max_height($height_list) {
17
+ @each $name, $value in $height_list {
18
+ .max_#{$name} {
19
+ max-height: $value;
20
+ }
21
+ }
22
+ }
23
+
24
+ @include export_max_height($heights);
25
+ }
26
+
27
+ :export {
28
+ @mixin export_min_height($height_list) {
29
+ @each $name, $value in $height_list {
30
+ .min_#{$name} {
31
+ min-height: $value;
32
+ }
33
+ }
34
+ }
35
+
36
+ @include export_min_height($heights);
37
+ }
@@ -0,0 +1,29 @@
1
+ @import "../tokens/exports/height.module";
2
+
3
+ @mixin export_height($height_list) {
4
+ @each $name, $value in $height_list {
5
+ .#{$name} {
6
+ height: $value;
7
+ }
8
+ }
9
+ }
10
+
11
+ @mixin export_max_height($height_list) {
12
+ @each $name, $value in $height_list {
13
+ .max_#{$name} {
14
+ max-height: $value;
15
+ }
16
+ }
17
+ }
18
+
19
+ @mixin export_min_height($height_list) {
20
+ @each $name, $value in $height_list {
21
+ .min_#{$name} {
22
+ min-height: $value;
23
+ }
24
+ }
25
+ }
26
+
27
+ @include export_height($heights);
28
+ @include export_max_height($heights);
29
+ @include export_min_height($heights);
@@ -7,7 +7,6 @@ export default [
7
7
  "right",
8
8
  "top",
9
9
  "hover",
10
- "groupHover",
11
10
  "zIndex",
12
11
  "verticalAlign",
13
12
  "truncate",
@@ -361,6 +361,21 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
361
361
  css += maxWidth ? `max_width_${filterClassName(maxWidth)} ` : ''
362
362
  return css.trimEnd()
363
363
  },
364
+ minHeightProps: ({ minHeight }: MinHeight) => {
365
+ let css = ''
366
+ css += minHeight ? `min_height_${filterClassName(minHeight)} ` : ''
367
+ return css.trimEnd()
368
+ },
369
+ maxHeightProps: ({ maxHeight }: MaxHeight) => {
370
+ let css = ''
371
+ css += maxHeight ? `max_height_${filterClassName(maxHeight)} ` : ''
372
+ return css.trimEnd()
373
+ },
374
+ heightProps: ({ height }: Height) => {
375
+ let css = ''
376
+ css += height ? `height_${filterClassName(height)} ` : ''
377
+ return css.trimEnd()
378
+ },
364
379
  zIndexProps: (zIndex: ZIndex) => {
365
380
  let css = ''
366
381
  Object.entries(zIndex).forEach((zIndexEntry) => {