playbook_ui 10.26.0.pre.alpha1 → 10.26.0.pre.alpha.sticky1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/data/menu.yml +0 -1
  3. data/app/pb_kits/playbook/index.js +1 -2
  4. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +0 -1
  5. data/app/pb_kits/playbook/pb_caption/{_caption.tsx → _caption.jsx} +8 -7
  6. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +0 -37
  7. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +0 -37
  8. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_kit/dateTime.js +2 -1
  10. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_table/_table.jsx +3 -0
  12. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +83 -0
  13. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +94 -0
  14. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +10 -0
  15. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  16. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
  18. data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +23 -0
  19. data/app/pb_kits/playbook/pb_table/table.rb +7 -1
  20. data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
  21. data/app/pb_kits/playbook/pb_title/{_title.tsx → _title.jsx} +12 -10
  22. data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
  23. data/app/pb_kits/playbook/playbook-doc.js +0 -2
  24. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +0 -2
  25. data/app/pb_kits/playbook/plugins/pb_chart.js +0 -34
  26. data/app/pb_kits/playbook/utilities/_flex_direction.scss +15 -28
  27. data/app/pb_kits/playbook/utilities/globalProps.ts +110 -94
  28. data/app/pb_kits/playbook/utilities/text.js +15 -0
  29. data/lib/playbook/flex_direction.rb +1 -7
  30. data/lib/playbook/version.rb +1 -1
  31. metadata +11 -27
  32. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +0 -79
  33. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +0 -5
  34. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +0 -37
  35. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +0 -48
  36. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +0 -2
  37. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +0 -37
  38. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +0 -47
  39. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +0 -3
  40. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +0 -79
  41. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +0 -90
  42. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +0 -1
  43. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +0 -54
  44. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +0 -65
  45. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +0 -3
  46. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +0 -37
  47. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +0 -48
  48. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +0 -3
  49. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +0 -15
  50. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +0 -5
  51. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +0 -1
  52. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +0 -43
  53. data/app/pb_kits/playbook/utilities/text.ts +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2189d1ada1c39446fecca8e67776e0e5b086e79d842fbfaf5ed800313c81f5df
4
- data.tar.gz: 4640c10e464c670714c67a3875412fcda9c79f06edbbea2a50cdd5ab330889ed
3
+ metadata.gz: cf78ed906a18245b33919539767b4548820b23c2e88196f790cc4cc3c928dde4
4
+ data.tar.gz: f4619a7704a66989d2dbc5221d904e0fe3bec27d6908ea8349247de683fc68b2
5
5
  SHA512:
6
- metadata.gz: 6d133f2ab6121d7f7a3895fe907a51f3713c48d1463a80cba165ae6c5fc6e1f64d6bf9ccb2b368f7f17304eee8e8a36a40c02a00b456044f4199e15c698e9d80
7
- data.tar.gz: 9515dbe37dab4c9d0a5a6e90c7074a3641ec9e31669b4fdd502e3b12e5ca6bf541ecf36eea0ec711c52710f3bd1cec017b3be76d68cb36b6e15aeb690c7185f9
6
+ metadata.gz: 27b1b9f29f502c1fb95cb03b6bd623ecd0a0c90cb3aad20b95fb687c9048f37c3a3e7737f27d14f54719f1dd0afa3455cfc46f2fdd0470e70b1879db59cdb615
7
+ data.tar.gz: 9d7a07450758941dc3c1427723d94508bfef0a9db8ebc227d5ad12af04556fc4fe2a5d0aaa12d7f273bcd3658b8c2733581b24ca4dba3ac4fed359fb2965ef56
@@ -20,7 +20,6 @@ kits:
20
20
  - gauge
21
21
  - legend
22
22
  - line_graph
23
- - treemap_chart
24
23
  - dialog
25
24
  - filter
26
25
  - fixed_confirmation_toast
@@ -4,6 +4,7 @@ import 'lazysizes/plugins/attrchange/ls.attrchange'
4
4
  import 'lazysizes'
5
5
 
6
6
  // vvv React Component JSX Imports from the React Kits vvv
7
+ export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
7
8
  export { default as Avatar } from './pb_avatar/_avatar'
8
9
  export { default as AvatarActionButton } from './pb_avatar_action_button/_avatar_action_button'
9
10
  export { default as Background } from './pb_background/_background'
@@ -97,11 +98,9 @@ export { default as Title } from './pb_title/_title'
97
98
  export { default as TitleCount } from './pb_title_count/_title_count'
98
99
  export { default as TitleDetail } from './pb_title_detail/_title_detail'
99
100
  export { default as Toggle } from './pb_toggle/_toggle'
100
- export { default as TreemapChart } from './pb_treemap_chart/_treemap_chart'
101
101
  export { default as Typeahead } from './pb_typeahead/_typeahead'
102
102
  export { default as User } from './pb_user/_user'
103
103
  export { default as UserBadge } from './pb_user_badge/_user_badge'
104
- export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
105
104
  export { default as WeekdayStacked } from './pb_weekday_stacked/_weekday_stacked'
106
105
  // ^^^ React Component JSX Imports from the React Kits ^^^
107
106
 
@@ -2,4 +2,3 @@
2
2
  <%= pb_rails("button", props: { text: "Button Secondary", variant: "secondary" }) %>
3
3
  <%= pb_rails("button", props: { text: "Button Link", variant: "link" }) %>
4
4
  <%= pb_rails("button", props: { text: "Button Disabled", disabled: true }) %>
5
-
@@ -1,22 +1,24 @@
1
+ /* @flow */
2
+
1
3
  import React from 'react'
2
4
  import classnames from 'classnames'
3
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
- import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
6
+ import { deprecatedProps, globalProps } from '../utilities/globalProps'
5
7
 
6
8
  type CaptionProps = {
7
- aria?: {[key: string]: string},
8
- children: React.ReactChild[],
9
+ aria?: object,
10
+ children: array<React.ReactNode> | React.ReactNode,
9
11
  className?: string,
10
12
  color?: "default" | "light" | "lighter" | "success" | "error" | "link",
11
- data?: {[key: string]: string},
13
+ data?: object,
12
14
  id?: string,
13
15
  size?: "xs" | "sm" | "md" | "lg" | "xl",
14
16
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption",
15
17
  text?: string,
16
18
  variant?: null | "link",
17
- } & GlobalProps;
19
+ };
18
20
 
19
- const Caption = (props: CaptionProps): React.ReactElement => {
21
+ const Caption = (props: CaptionProps) => {
20
22
  if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
21
23
  const {
22
24
  aria = {},
@@ -30,7 +32,6 @@ const Caption = (props: CaptionProps): React.ReactElement => {
30
32
  text,
31
33
  variant = null,
32
34
  } = props
33
-
34
35
  const tagOptions = [
35
36
  'h1',
36
37
  'h2',
@@ -209,43 +209,6 @@ const highchartsDarkTheme = {
209
209
  threshold: null,
210
210
  },
211
211
  },
212
-
213
- //TREEMAP CHART STYLES
214
- treemap: {
215
- layoutAlgorithm: "squarified",
216
- allowTraversingTree: false,
217
- animationLimit: 1000,
218
- colors: [
219
- colors.data_1,
220
- colors.data_2,
221
- colors.data_3,
222
- colors.data_4,
223
- colors.data_5,
224
- colors.data_6,
225
- colors.data_7,
226
- colors.data_8,
227
- ],
228
- colorByPoint: true,
229
- dataLabels: {
230
- enabled: true,
231
- style: {
232
- fontFamily: typography.font_family_base,
233
- fontWeight: typography.bold,
234
- fontSize: typography.heading_4,
235
- },
236
- },
237
- levels: [
238
- {
239
- level: 1,
240
- dataLabels: {
241
- enabled: false,
242
- },
243
- },
244
- ],
245
- traverseUpButton: {
246
- position: { y: -40 },
247
- }
248
- },
249
212
  },
250
213
  }
251
214
 
@@ -209,43 +209,6 @@ const highchartsTheme = {
209
209
  threshold: null,
210
210
  },
211
211
  },
212
-
213
- //TREEMAP CHART STYLES
214
- treemap: {
215
- layoutAlgorithm: "squarified",
216
- allowTraversingTree: false,
217
- animationLimit: 1000,
218
- colors: [
219
- colors.data_1,
220
- colors.data_2,
221
- colors.data_3,
222
- colors.data_4,
223
- colors.data_5,
224
- colors.data_6,
225
- colors.data_7,
226
- colors.data_8,
227
- ],
228
- colorByPoint: true,
229
- dataLabels: {
230
- enabled: true,
231
- style: {
232
- fontFamily: typography.font_family_base,
233
- fontWeight: typography.bold,
234
- fontSize: typography.heading_4,
235
- },
236
- },
237
- levels: [
238
- {
239
- level: 1,
240
- dataLabels: {
241
- enabled: false,
242
- },
243
- },
244
- ],
245
- traverseUpButton: {
246
- position: { y: -40 },
247
- }
248
- },
249
212
  },
250
213
  }
251
214
 
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
- import Title from '../pb_title/_title'
4
+ import Title from '../pb_title/_title.jsx'
5
5
  import Icon from '../pb_icon/_icon.jsx'
6
6
  import Avatar from '../pb_avatar/_avatar'
7
7
  import { globalProps } from '../utilities/globalProps'
@@ -1,8 +1,9 @@
1
1
  /* @flow */
2
2
  /*eslint-disable flowtype/space-before-type-colon */
3
3
 
4
- import moment from 'moment-timezone'
4
+ import moment from 'moment'
5
5
  import 'moment-strftime'
6
+ import 'moment-timezone'
6
7
 
7
8
  type DateTimeType = {
8
9
  value: String | Date,
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
 
5
5
  import classnames from 'classnames'
6
- import Title from '../pb_title/_title'
6
+ import Title from '../pb_title/_title.jsx'
7
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
8
  import { globalProps } from '../utilities/globalProps'
9
9
 
@@ -20,6 +20,7 @@ type TableProps = {
20
20
  responsive: "collapse" | "scroll" | "none",
21
21
  singleLine: boolean,
22
22
  size: "sm" | "md" | "lg",
23
+ sticky?: boolean,
23
24
  }
24
25
 
25
26
  const Table = (props: TableProps) => {
@@ -37,6 +38,7 @@ const Table = (props: TableProps) => {
37
38
  responsive = 'collapse',
38
39
  singleLine = false,
39
40
  size = 'sm',
41
+ sticky = false,
40
42
  } = props
41
43
 
42
44
  const ariaProps = buildAriaProps(aria)
@@ -60,6 +62,7 @@ const Table = (props: TableProps) => {
60
62
  'data_table': dataTable,
61
63
  'single-line': singleLine,
62
64
  'no-hover': disableHover,
65
+ 'sticky-header': sticky,
63
66
  },
64
67
  globalProps(props),
65
68
  tableCollapseCss,
@@ -0,0 +1,83 @@
1
+ <%= pb_rails("table", props: { sticky: true }) do %>
2
+ <thead>
3
+ <tr>
4
+ <th>Column 1</th>
5
+ <th>Column 2</th>
6
+ <th>Column 3</th>
7
+ <th>Column 4</th>
8
+ <th>Column 5</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <tr>
13
+ <td>Value 1</td>
14
+ <td>Value 2</td>
15
+ <td>Value 3</td>
16
+ <td>Value 4</td>
17
+ <td>Value 5</td>
18
+ </tr>
19
+ <tr>
20
+ <td>Value 1</td>
21
+ <td>Value 2</td>
22
+ <td>Value 3</td>
23
+ <td>Value 4</td>
24
+ <td>Value 5</td>
25
+ </tr>
26
+ <tr>
27
+ <td>Value 1</td>
28
+ <td>Value 2</td>
29
+ <td>Value 3</td>
30
+ <td>Value 4</td>
31
+ <td>Value 5</td>
32
+ </tr>
33
+ <tr>
34
+ <td>Value 1</td>
35
+ <td>Value 2</td>
36
+ <td>Value 3</td>
37
+ <td>Value 4</td>
38
+ <td>Value 5</td>
39
+ </tr>
40
+ <tr>
41
+ <td>Value 1</td>
42
+ <td>Value 2</td>
43
+ <td>Value 3</td>
44
+ <td>Value 4</td>
45
+ <td>Value 5</td>
46
+ </tr>
47
+ <tr>
48
+ <td>Value 1</td>
49
+ <td>Value 2</td>
50
+ <td>Value 3</td>
51
+ <td>Value 4</td>
52
+ <td>Value 5</td>
53
+ </tr>
54
+ <tr>
55
+ <td>Value 1</td>
56
+ <td>Value 2</td>
57
+ <td>Value 3</td>
58
+ <td>Value 4</td>
59
+ <td>Value 5</td>
60
+ </tr>
61
+ <tr>
62
+ <td>Value 1</td>
63
+ <td>Value 2</td>
64
+ <td>Value 3</td>
65
+ <td>Value 4</td>
66
+ <td>Value 5</td>
67
+ </tr>
68
+ <tr>
69
+ <td>Value 1</td>
70
+ <td>Value 2</td>
71
+ <td>Value 3</td>
72
+ <td>Value 4</td>
73
+ <td>Value 5</td>
74
+ </tr>
75
+ <tr>
76
+ <td>Value 1</td>
77
+ <td>Value 2</td>
78
+ <td>Value 3</td>
79
+ <td>Value 4</td>
80
+ <td>Value 5</td>
81
+ </tr>
82
+ </tbody>
83
+ <% end %>
@@ -0,0 +1,94 @@
1
+ import React from "react"
2
+
3
+ import Table from "../_table"
4
+
5
+ const TableSticky = (props) => (
6
+ <Table
7
+ sticky
8
+ {...props}
9
+ >
10
+ <thead>
11
+ <tr>
12
+ <th>{'Column 1'}</th>
13
+ <th>{'Column 2'}</th>
14
+ <th>{'Column 3'}</th>
15
+ <th>{'Column 4'}</th>
16
+ <th>{'Column 5'}</th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <tr>
21
+ <td>{'Value 1'}</td>
22
+ <td>{'Value 2'}</td>
23
+ <td>{'Value 3'}</td>
24
+ <td>{'Value 4'}</td>
25
+ <td>{'Value 5'}</td>
26
+ </tr>
27
+ <tr>
28
+ <td>{'Value 1'}</td>
29
+ <td>{'Value 2'}</td>
30
+ <td>{'Value 3'}</td>
31
+ <td>{'Value 4'}</td>
32
+ <td>{'Value 5'}</td>
33
+ </tr>
34
+ <tr>
35
+ <td>{'Value 1'}</td>
36
+ <td>{'Value 2'}</td>
37
+ <td>{'Value 3'}</td>
38
+ <td>{'Value 4'}</td>
39
+ <td>{'Value 5'}</td>
40
+ </tr>
41
+ <tr>
42
+ <td>{'Value 1'}</td>
43
+ <td>{'Value 2'}</td>
44
+ <td>{'Value 3'}</td>
45
+ <td>{'Value 4'}</td>
46
+ <td>{'Value 5'}</td>
47
+ </tr>
48
+ <tr>
49
+ <td>{'Value 1'}</td>
50
+ <td>{'Value 2'}</td>
51
+ <td>{'Value 3'}</td>
52
+ <td>{'Value 4'}</td>
53
+ <td>{'Value 5'}</td>
54
+ </tr>
55
+ <tr>
56
+ <td>{'Value 1'}</td>
57
+ <td>{'Value 2'}</td>
58
+ <td>{'Value 3'}</td>
59
+ <td>{'Value 4'}</td>
60
+ <td>{'Value 5'}</td>
61
+ </tr>
62
+ <tr>
63
+ <td>{'Value 1'}</td>
64
+ <td>{'Value 2'}</td>
65
+ <td>{'Value 3'}</td>
66
+ <td>{'Value 4'}</td>
67
+ <td>{'Value 5'}</td>
68
+ </tr>
69
+ <tr>
70
+ <td>{'Value 1'}</td>
71
+ <td>{'Value 2'}</td>
72
+ <td>{'Value 3'}</td>
73
+ <td>{'Value 4'}</td>
74
+ <td>{'Value 5'}</td>
75
+ </tr>
76
+ <tr>
77
+ <td>{'Value 1'}</td>
78
+ <td>{'Value 2'}</td>
79
+ <td>{'Value 3'}</td>
80
+ <td>{'Value 4'}</td>
81
+ <td>{'Value 5'}</td>
82
+ </tr>
83
+ <tr>
84
+ <td>{'Value 1'}</td>
85
+ <td>{'Value 2'}</td>
86
+ <td>{'Value 3'}</td>
87
+ <td>{'Value 4'}</td>
88
+ <td>{'Value 5'}</td>
89
+ </tr>
90
+ </tbody>
91
+ </Table>
92
+ )
93
+
94
+ export default TableSticky
@@ -0,0 +1,10 @@
1
+ React: Use `sticky` on a table to allow the table header to be fixed in place when the user scrolls up and down on the page.
2
+
3
+ Rails: Pass `sticky: true` to props.
4
+
5
+ If the table header is not sticking in the right place you will need to pass a inline `top` style to the `thead`.
6
+ React Example: `<thead style={{ top: "-16px" }}>`
7
+ Rails Example: `<thead style="top: -16px">`
8
+
9
+ ### Troubleshooting CSS Problems
10
+ Sticky may not work if any parent/ancestor of the sticky element has any of the `overflow` properties set. Additionally, specifying a height on the overflowing container provides measurement for this feature to work properly. In some cases, it may be necessary to set the same parent/ancestor container to `position: static` as well.
@@ -3,6 +3,7 @@ examples:
3
3
  - table_sm: Small
4
4
  - table_md: Medium
5
5
  - table_lg: Large
6
+ - table_sticky: Sticky Header
6
7
  - table_alignment_row: Row Alignment
7
8
  - table_alignment_column: Column Alignment
8
9
  - table_alignment_shift_row: Shift Row
@@ -25,6 +26,7 @@ examples:
25
26
  - table_sm: Small
26
27
  - table_md: Medium
27
28
  - table_lg: Large
29
+ - table_sticky: Sticky Header
28
30
  - table_alignment_row: Row Alignment
29
31
  - table_alignment_column: Column Alignment
30
32
  - table_alignment_shift_row: Shift Row
@@ -1,6 +1,7 @@
1
1
  export { default as TableSm } from './_table_sm.jsx'
2
2
  export { default as TableMd } from './_table_md.jsx'
3
3
  export { default as TableLg } from './_table_lg.jsx'
4
+ export { default as TableSticky } from './_table_sticky.jsx'
4
5
  export { default as TableSideHighlight } from './_table_side_highlight.jsx'
5
6
  export { default as TableContainer } from './_table_container.jsx'
6
7
  export { default as TableDataTable } from './_table_data_table.jsx'
@@ -16,3 +16,4 @@
16
16
  @import "mobile_collapse";
17
17
  @import "tablet_collapse";
18
18
  @import "desktop_collapse";
19
+ @import "sticky_header";
@@ -0,0 +1,23 @@
1
+ @import "../../tokens/colors";
2
+
3
+ [class^="pb_table"] {
4
+ &.sticky-header {
5
+ thead {
6
+ background: $white;
7
+ position: sticky;
8
+ top: 0;
9
+ z-index: 1;
10
+ }
11
+ }
12
+
13
+ &.dark {
14
+ &.sticky-header {
15
+ thead {
16
+ background: $bg_dark;
17
+ position: sticky;
18
+ top: 0;
19
+ z-index: 1;
20
+ }
21
+ }
22
+ }
23
+ }
@@ -21,11 +21,13 @@ module Playbook
21
21
  values: %w[sm md lg],
22
22
  default: "sm"
23
23
  prop :text
24
+ prop :sticky, type: Playbook::Props::Boolean,
25
+ default: false
24
26
 
25
27
  def classname
26
28
  generate_classname(
27
29
  "pb_table", "table-#{size}", single_line_class, dark_class,
28
- disable_hover_class, container_class, data_table_class, collapse_class,
30
+ disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
29
31
  "table-responsive-#{responsive}", separator: " "
30
32
  )
31
33
  end
@@ -55,6 +57,10 @@ module Playbook
55
57
  def collapse_class
56
58
  responsive != "none" ? "table-collapse-#{collapse}" : ""
57
59
  end
60
+
61
+ def sticky_class
62
+ sticky ? "sticky-header" : nil
63
+ end
58
64
  end
59
65
  end
60
66
  end
@@ -0,0 +1,17 @@
1
+ import { ensureAccessible, renderKit } from "../utilities/test-utils"
2
+
3
+ import Table from "./_table"
4
+
5
+ const props = {
6
+ data: { testid: "table" },
7
+ sticky: false
8
+ }
9
+
10
+ it("should be accessible", async () => {
11
+ ensureAccessible(Table, props)
12
+ })
13
+
14
+ test("when sticky is true", () => {
15
+ const kit = renderKit(Table, props, { sticky: true })
16
+ expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card sticky-header table-collapse-sm")
17
+ })
@@ -1,22 +1,24 @@
1
+ /* @flow */
2
+
1
3
  import React from 'react'
2
4
  import classnames from 'classnames'
3
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
- import { deprecatedProps, GlobalProps, globalProps } from '../utilities/globalProps'
6
+ import { deprecatedProps, globalProps } from '../utilities/globalProps'
5
7
 
6
8
  type TitleProps = {
7
- aria?: {[key: string]: string},
8
- children?: React.ReactChild[],
9
+ aria?: object,
10
+ children?: array<React.ReactNode> | React.ReactNode,
9
11
  className?: string,
10
12
  color?: "default" | "light" | "lighter" | "success" | "error" | "link",
11
- data?: {[key: string]: string},
13
+ data?: object,
12
14
  id?: string,
13
15
  size?: 1 | 2 | 3 | 4,
14
16
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
15
17
  text?: string,
16
18
  variant?: null | "link",
17
- } & GlobalProps
19
+ }
18
20
 
19
- const Title = (props: TitleProps): React.ReactElement => {
21
+ const Title = (props: TitleProps) => {
20
22
  if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
21
23
  const {
22
24
  aria = {},
@@ -31,14 +33,14 @@ const Title = (props: TitleProps): React.ReactElement => {
31
33
  variant = null,
32
34
  } = props
33
35
 
34
- const ariaProps: {[key: string]: string | number} = buildAriaProps(aria)
35
- const dataProps: {[key: string]: string | number} = buildDataProps(data)
36
+ const ariaProps = buildAriaProps(aria)
37
+ const dataProps = buildDataProps(data)
36
38
  const classes = classnames(
37
- buildCss('pb_title_kit', `size_${size}`, variant, color),
39
+ buildCss('pb_title_kit', size, variant, color),
38
40
  globalProps(props),
39
41
  className,
40
42
  )
41
- const Tag: React.ReactElement | any = `${tag}`
43
+ const Tag = `${tag}`
42
44
 
43
45
  return (
44
46
  <Tag
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
12
12
  )
13
13
 
14
14
  const kit = screen.getByTestId('primary-test')
15
- expect(kit).toHaveClass('pb_title_kit_size_3')
15
+ expect(kit).toHaveClass('pb_title_kit_3')
16
16
  })
17
17
 
18
18
  test('with colors', () => {
@@ -25,5 +25,5 @@ test('with colors', () => {
25
25
  )
26
26
 
27
27
  const kit = screen.getByTestId('primary-test')
28
- expect(kit).toHaveClass('pb_title_kit_size_3_success')
28
+ expect(kit).toHaveClass('pb_title_kit_3_success')
29
29
  })
@@ -91,7 +91,6 @@ import * as Title from 'pb_title/docs'
91
91
  import * as TitleCount from 'pb_title_count/docs'
92
92
  import * as TitleDetail from 'pb_title_detail/docs'
93
93
  import * as Toggle from 'pb_toggle/docs'
94
- import * as TreemapChart from 'pb_treemap_chart/docs'
95
94
  import * as Typeahead from 'pb_typeahead/docs'
96
95
  import * as User from 'pb_user/docs'
97
96
  import * as UserBadge from 'pb_user_badge/docs'
@@ -186,7 +185,6 @@ WebpackerReact.setup({
186
185
  ...TitleCount,
187
186
  ...TitleDetail,
188
187
  ...Toggle,
189
- ...TreemapChart,
190
188
  ...Typeahead,
191
189
  ...User,
192
190
  ...UserBadge,
@@ -13,7 +13,6 @@ import Legend from './pb_legend/_legend'
13
13
  import LineGraph from './pb_line_graph/_line_graph'
14
14
  import Passphrase from './pb_passphrase/_passphrase'
15
15
  import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
16
- import TreemapChart from './pb_treemap_chart/_treemap_chart'
17
16
  import Typeahead from './pb_typeahead/_typeahead'
18
17
 
19
18
  WebpackerReact.registerComponents({
@@ -27,7 +26,6 @@ WebpackerReact.registerComponents({
27
26
  LineGraph,
28
27
  Passphrase,
29
28
  RichTextEditor,
30
- TreemapChart,
31
29
  Typeahead,
32
30
  })
33
31