playbook_ui 10.26.0.pre.alpha3 → 10.26.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/data/menu.yml +1 -0
  3. data/app/pb_kits/playbook/index.js +2 -1
  4. data/app/pb_kits/playbook/pb_badge/{_badge.jsx → _badge.tsx} +14 -15
  5. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +1 -1
  6. data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +1 -1
  8. data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -3
  9. data/app/pb_kits/playbook/pb_button/{_button.jsx → _button.tsx} +65 -46
  10. data/app/pb_kits/playbook/pb_button/docs/_button_options.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_caption/{_caption.jsx → _caption.tsx} +7 -8
  12. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -3
  13. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +4 -2
  14. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +37 -0
  16. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +37 -0
  17. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  18. data/app/pb_kits/playbook/pb_icon/{_icon.jsx → _icon.tsx} +40 -30
  19. data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +6 -8
  20. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +1 -1
  21. data/app/pb_kits/playbook/pb_pill/docs/_pill_variants.jsx +1 -1
  22. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +7 -0
  23. data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +6 -4
  24. data/app/pb_kits/playbook/pb_title/{_title.jsx → _title.tsx} +10 -12
  25. data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
  26. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
  27. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
  28. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
  29. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
  30. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
  31. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
  32. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
  33. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
  34. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
  35. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
  36. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
  37. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
  38. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
  39. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
  40. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
  41. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
  42. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
  43. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
  44. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
  45. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
  46. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +43 -0
  47. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  48. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
  49. data/app/pb_kits/playbook/plugins/pb_chart.js +34 -0
  50. data/app/pb_kits/playbook/tokens/_display.scss +3 -3
  51. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +25 -5
  52. data/app/pb_kits/playbook/utilities/_display.scss +9 -42
  53. data/app/pb_kits/playbook/utilities/globalProps.ts +2 -2
  54. data/dist/reset.css +60 -1
  55. data/lib/playbook/display.rb +1 -1
  56. data/lib/playbook/version.rb +2 -2
  57. metadata +29 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eec4050a38ffdbc91288fa4d1ebe864edc0485bf814f1569b50a4df569e6c666
4
- data.tar.gz: 5967691eccad475c60406d60b9aca79ee520a2736bfde034b48e6db8c1de3316
3
+ metadata.gz: '048acddb29dd15f68b34839ca45ccd4df1d42336d4820e47de25dbe3ebc0249c'
4
+ data.tar.gz: 34eebfcebf6b68b56463789a1e38c1fb5984f3a84359b18e2443155cbe3ac8c8
5
5
  SHA512:
6
- metadata.gz: 8ea97fd90f89882ee7e54d80b46e468fa5beffa6ee2e9dc64475e14ebfe4cdcfef43dcf6b3dd0ab06db030da9fb04f4e35fae1e35dcba93a8009a80200d24fd5
7
- data.tar.gz: edbf22cf4988bf3ddc4f7872dce6fe51041dd8a8a657bd8b118196fe42c8a0c06428fbc5a1efcec55525d6ae4b769279a3438b12ad174d2e52497b7610e2260d
6
+ metadata.gz: 9c9c0665cee4d841bb9b4b404727e5a0912218f6e1f285996cb8c3de268380e7b5936a63f0befd150a0f5c9bfd6db55551da65a29d59269d3add7710f95d9c73
7
+ data.tar.gz: 3507fad3d27741a06660b2f50c8068e0a2736b80b9f07edb753a539c31f43cfa34b36e1d0e0251547c6262570ff7d02859b0ee69fa0377a0f63068b82f49b1a7
@@ -20,6 +20,7 @@ kits:
20
20
  - gauge
21
21
  - legend
22
22
  - line_graph
23
+ - treemap_chart
23
24
  - dialog
24
25
  - filter
25
26
  - fixed_confirmation_toast
@@ -4,7 +4,6 @@ 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'
8
7
  export { default as Avatar } from './pb_avatar/_avatar'
9
8
  export { default as AvatarActionButton } from './pb_avatar_action_button/_avatar_action_button'
10
9
  export { default as Background } from './pb_background/_background'
@@ -98,9 +97,11 @@ export { default as Title } from './pb_title/_title'
98
97
  export { default as TitleCount } from './pb_title_count/_title_count'
99
98
  export { default as TitleDetail } from './pb_title_detail/_title_detail'
100
99
  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'
104
105
  export { default as WeekdayStacked } from './pb_weekday_stacked/_weekday_stacked'
105
106
  // ^^^ React Component JSX Imports from the React Kits ^^^
106
107
 
@@ -1,9 +1,7 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
6
- import { globalProps } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
7
5
  import {
8
6
  buildAriaProps,
9
7
  buildCss,
@@ -13,21 +11,22 @@ import {
13
11
  import Icon from '../pb_icon/_icon'
14
12
 
15
13
  type BadgeProps = {
16
- aria?: object,
14
+ aria?: {[key: string]: string},
17
15
  className?: string,
18
16
  closeProps?: {
19
- onClick?: EventHandler,
20
- onMouseDown?: EventHandler,
21
- onTouchEnd?: EventHandler,
17
+ onClick?: React.MouseEventHandler<HTMLSpanElement>,
18
+ onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
19
+ onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
22
20
  },
23
- data?: object,
21
+ data?: {[key: string]: string},
24
22
  id?: string,
25
- removeIcon?: Boolean,
26
- removeOnClick?: EventHandler,
23
+ removeIcon?: boolean,
24
+ removeOnClick?: React.MouseEventHandler<HTMLSpanElement>,
27
25
  rounded?: boolean,
28
26
  text?: string,
29
27
  variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
30
- }
28
+ } & GlobalProps
29
+
31
30
  const Badge = (props: BadgeProps) => {
32
31
  const {
33
32
  aria = {},
@@ -36,7 +35,7 @@ const Badge = (props: BadgeProps) => {
36
35
  data = {},
37
36
  id,
38
37
  removeIcon = false,
39
- removeOnClick = () => {},
38
+ removeOnClick,
40
39
  rounded = false,
41
40
  text,
42
41
  variant = 'neutral',
@@ -44,7 +43,7 @@ const Badge = (props: BadgeProps) => {
44
43
  const ariaProps = buildAriaProps(aria)
45
44
  const dataProps = buildDataProps(data)
46
45
  const css = classnames(
47
- buildCss('pb_badge_kit', variant, { rounded }),
46
+ buildCss('pb_badge_kit', variant, rounded ? 'rounded' : null),
48
47
  globalProps(props),
49
48
  className
50
49
  )
@@ -58,7 +57,7 @@ const Badge = (props: BadgeProps) => {
58
57
  >
59
58
  <span>
60
59
  {text}
61
- <If condition={removeIcon}>
60
+ {removeIcon && (
62
61
  <span
63
62
  onClick={removeOnClick}
64
63
  style={{ cursor: 'pointer' }}
@@ -69,7 +68,7 @@ const Badge = (props: BadgeProps) => {
69
68
  icon="times"
70
69
  />
71
70
  </span>
72
- </If>
71
+ )}
73
72
  </span>
74
73
  </div>
75
74
  )
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Badge from '../_badge.jsx'
2
+ import Badge from '../_badge'
3
3
 
4
4
  const BadgeColors = (props) => {
5
5
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Badge from '../_badge.jsx'
2
+ import Badge from '../_badge'
3
3
 
4
4
  const BadgeDefault = (props) => {
5
5
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Badge from '../_badge.jsx'
2
+ import Badge from '../_badge'
3
3
 
4
4
  const BadgeRounded = (props) => {
5
5
  return (
@@ -1,3 +1,3 @@
1
- export { default as BadgeDefault } from './_badge_default.jsx'
2
- export { default as BadgeRounded } from './_badge_rounded.jsx'
3
- export { default as BadgeColors } from './_badge_colors.jsx'
1
+ export { default as BadgeDefault } from './_badge_default'
2
+ export { default as BadgeRounded } from './_badge_rounded'
3
+ export { default as BadgeColors } from './_badge_colors'
@@ -1,18 +1,17 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
  import { buildAriaProps, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
5
+
6
+ import Icon from '../pb_icon/_icon'
7
7
 
8
- import Icon from '../pb_icon/_icon.jsx'
8
+ type EventHandler = (React.MouseEventHandler<HTMLElement>)
9
9
 
10
- type EventHandler = (SyntheticInputEvent<HTMLInputElement>) => void
11
10
  type ButtonPropTypes = {
12
- aria?: object,
13
- children?: array<React.ReactChild>,
14
- className?: string | array<string>,
15
- data?: object,
11
+ aria?: {[key: string]: string},
12
+ children?: React.ReactChild[] | React.ReactChild,
13
+ className?: string | string[],
14
+ data?: {[key: string]: string},
16
15
  disabled?: boolean,
17
16
  fixedWidth?: boolean,
18
17
  form?: string,
@@ -26,11 +25,11 @@ type ButtonPropTypes = {
26
25
  size?: 'sm' | 'md' | 'lg',
27
26
  text?: string,
28
27
  type: 'inline' | null,
29
- htmlType: string | 'button',
28
+ htmlType: 'submit' | 'reset' | 'button' | undefined,
30
29
  value?: string | null,
31
30
  variant: 'primary' | 'secondary' | 'link',
32
31
  wrapperClass: string,
33
- }
32
+ } & GlobalProps
34
33
 
35
34
  const buttonClassName = (props: ButtonPropTypes) => {
36
35
  const {
@@ -64,7 +63,7 @@ const Button = (props: ButtonPropTypes) => {
64
63
  icon = null,
65
64
  id,
66
65
  loading = false,
67
- onClick = () => {},
66
+ onClick,
68
67
  link = null,
69
68
  newWindow = false,
70
69
  text,
@@ -92,46 +91,66 @@ const Button = (props: ButtonPropTypes) => {
92
91
 
93
92
  const content = (
94
93
  <span className="pb_button_content">
95
- <If condition={icon !== null}>
94
+ {icon && (
96
95
  <i className={`pb_icon_kit far fa-${icon} fa-fw`} />
97
- {' '}
98
- </If>
96
+ )}
99
97
  <span>{text || children}</span>
100
98
  </span>
101
99
  )
102
100
 
101
+ const ifLoading = () => {
102
+ if (loading){
103
+ return(
104
+ <>
105
+ {loadingIcon}
106
+ </>
107
+ )
108
+ } else {
109
+ return (
110
+ content
111
+ )
112
+ }
113
+ }
114
+
115
+ const displayButton = () => {
116
+ if (link)
117
+ return (
118
+ <a
119
+ {...ariaProps}
120
+ {...dataProps}
121
+ className={css}
122
+ href={link}
123
+ id={id}
124
+ rel="noreferrer"
125
+ role="link"
126
+ target={newWindow ? '_blank' : null}
127
+ >
128
+ {ifLoading()}
129
+ </a>
130
+ )
131
+ else
132
+ return (
133
+ <button
134
+ {...ariaProps}
135
+ {...dataProps}
136
+ className={css}
137
+ disabled={disabled}
138
+ form={form}
139
+ id={id}
140
+ onClick={onClick}
141
+ role="button"
142
+ type={htmlType}
143
+ value={value}
144
+ >
145
+ {ifLoading()}
146
+ </button>
147
+ )
148
+ }
149
+
103
150
  return (
104
- <If condition={link !== null}>
105
- <a
106
- {...ariaProps}
107
- {...dataProps}
108
- className={css}
109
- href={link}
110
- id={id}
111
- rel="noreferrer"
112
- role="link"
113
- target={newWindow ? '_blank' : null}
114
- >
115
- <If condition={loading}>{loadingIcon}</If>
116
- {content}
117
- </a>
118
- <Else />
119
- <button
120
- {...ariaProps}
121
- {...dataProps}
122
- className={css}
123
- disabled={disabled}
124
- form={form}
125
- id={id}
126
- onClick={onClick}
127
- role="button"
128
- type={htmlType}
129
- value={value}
130
- >
131
- <If condition={loading}>{loadingIcon}</If>
132
- {content}
133
- </button>
134
- </If>
151
+ <>
152
+ {displayButton()}
153
+ </>
135
154
  )
136
155
  }
137
156
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Button from '../_button.jsx'
2
+ import Button from '../_button'
3
3
 
4
4
  const ButtonOptions = (props) => (
5
5
  <div>
@@ -1,24 +1,22 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { deprecatedProps, globalProps } from '../utilities/globalProps'
4
+ import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
7
5
 
8
6
  type CaptionProps = {
9
- aria?: object,
10
- children: array<React.ReactNode> | React.ReactNode,
7
+ aria?: {[key: string]: string},
8
+ children: React.ReactChild[],
11
9
  className?: string,
12
10
  color?: "default" | "light" | "lighter" | "success" | "error" | "link",
13
- data?: object,
11
+ data?: {[key: string]: string},
14
12
  id?: string,
15
13
  size?: "xs" | "sm" | "md" | "lg" | "xl",
16
14
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption",
17
15
  text?: string,
18
16
  variant?: null | "link",
19
- };
17
+ } & GlobalProps;
20
18
 
21
- const Caption = (props: CaptionProps) => {
19
+ const Caption = (props: CaptionProps): React.ReactElement => {
22
20
  if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
23
21
  const {
24
22
  aria = {},
@@ -32,6 +30,7 @@ const Caption = (props: CaptionProps) => {
32
30
  text,
33
31
  variant = null,
34
32
  } = props
33
+
35
34
  const tagOptions = [
36
35
  'h1',
37
36
  'h2',
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-multi-comp */
2
1
  /* @flow */
3
2
 
4
3
  import React from 'react'
@@ -30,7 +29,7 @@ type CardHeaderProps = {
30
29
  headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
31
30
  children: array<React.ReactNode> | React.ReactNode,
32
31
  className?: string,
33
- padding?: string
32
+ padding?: string,
34
33
  }
35
34
 
36
35
  type CardBodyProps = {
@@ -57,7 +56,6 @@ const Header = (props: CardHeaderProps) => {
57
56
  const Body = (props: CardBodyProps) => {
58
57
  const { children, padding = 'md', className } = props
59
58
  const bodyCSS = buildCss('pb_card_body_kit')
60
-
61
59
  const bodySpacing = globalProps(props, { padding })
62
60
 
63
61
  return (
@@ -35,12 +35,14 @@ const Icon = ({ collapsed }: IconProps) => {
35
35
  const CollapsibleMain = ({
36
36
  children,
37
37
  className,
38
+ cursor = 'pointer',
38
39
  padding = 'md',
40
+
39
41
  ...props
40
42
  }: CollapsibleMainProps) => {
41
43
  const context = useContext(CollapsibleContext)
42
44
  const mainCSS = buildCss('pb_collapsible_main_kit')
43
- const mainSpacing = globalProps(props, { padding })
45
+ const mainSpacing = globalProps(props, { cursor, padding })
44
46
 
45
47
  return (
46
48
  <div className={classnames(mainCSS, className, mainSpacing)}>
@@ -50,7 +52,7 @@ const CollapsibleMain = ({
50
52
  vertical="center"
51
53
  >
52
54
  <FlexItem>{children}</FlexItem>
53
- <FlexItem><Icon collapsed={context.collapsed} /></FlexItem>
55
+ <FlexItem><Icon collapsed={context.collapsed}/></FlexItem>
54
56
  </Flex>
55
57
  </div>
56
58
  </div>
@@ -4,7 +4,7 @@
4
4
  class: object.classname,
5
5
  aria: object.aria) do %>
6
6
 
7
- <%= pb_rails("flex", props: {vertical: "center", spacing: "between"}) do %>
7
+ <%= pb_rails("flex", props: {vertical: "center", spacing: "between", cursor: "pointer"}) do %>
8
8
  <%= pb_rails("flex/flex_item") do %>
9
9
  <%= content.presence %>
10
10
  <% end %>
@@ -209,6 +209,43 @@ 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
+ },
212
249
  },
213
250
  }
214
251
 
@@ -209,6 +209,43 @@ 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
+ },
212
249
  },
213
250
  }
214
251
 
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
- import Title from '../pb_title/_title.jsx'
5
- import Icon from '../pb_icon/_icon.jsx'
4
+ import Title from '../pb_title/_title'
5
+ import Icon from '../pb_icon/_icon'
6
6
  import Avatar from '../pb_avatar/_avatar'
7
7
  import { globalProps } from '../utilities/globalProps'
8
8
 
@@ -1,16 +1,14 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
  import { buildAriaProps, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
7
5
 
8
6
  type IconProps = {
9
- aria?: object,
10
- border?: boolean,
7
+ aria?: {[key: string]: string},
8
+ border?: string,
11
9
  className?: string,
12
- customIcon?: SVGElement,
13
- data?: object,
10
+ customIcon?: {[key: string] :SVGElement},
11
+ data?: {[key: string]: string},
14
12
  fixedWidth?: boolean,
15
13
  flip?: "horizontal" | "vertical" | "both" | "none",
16
14
  icon: string,
@@ -34,12 +32,13 @@ type IconProps = {
34
32
  | "9x"
35
33
  | "10x",
36
34
  spin?: boolean,
37
- }
35
+ } & GlobalProps
38
36
 
39
37
  const flipMap = {
40
38
  horizontal: 'fa-flip-horizontal',
41
39
  vertical: 'fa-flip-vertical',
42
40
  both: 'fa-flip-horizontal fa-flip-vertical',
41
+ none: ""
43
42
  }
44
43
 
45
44
  const Icon = (props: IconProps) => {
@@ -50,7 +49,7 @@ const Icon = (props: IconProps) => {
50
49
  customIcon,
51
50
  data = {},
52
51
  fixedWidth = true,
53
- flip = false,
52
+ flip = "none",
54
53
  icon,
55
54
  id,
56
55
  inverse = false,
@@ -90,31 +89,42 @@ const Icon = (props: IconProps) => {
90
89
  )
91
90
 
92
91
  aria.label ? null : aria.label = `${icon} icon`
93
- const ariaProps = buildAriaProps(aria)
94
- const dataProps = buildDataProps(data)
92
+ const ariaProps: {[key: string]: any} = buildAriaProps(aria)
93
+ const dataProps: {[key: string]: any} = buildDataProps(data)
95
94
 
96
95
  // Add a conditional here to show only the SVG if custom
96
+ const displaySVG = (customIcon: any) => {
97
+ if (customIcon)
98
+ return (
99
+ <>
100
+ {
101
+ React.cloneElement(customIcon, {
102
+ ...dataProps,
103
+ className: classes,
104
+ id,
105
+ })
106
+ }
107
+ </>
108
+ )
109
+ else
110
+ return (
111
+ <>
112
+ <i
113
+ {...dataProps}
114
+ className={classes}
115
+ id={id}
116
+ />
117
+ <span
118
+ {...ariaProps}
119
+ hidden
120
+ />
121
+ </>
122
+ )
123
+ }
124
+
97
125
  return (
98
126
  <>
99
- <If condition={customIcon}>
100
- {
101
- React.cloneElement(customIcon, {
102
- ...dataProps,
103
- className: classes,
104
- id,
105
- })
106
- }
107
- <Else />
108
- <i
109
- {...dataProps}
110
- className={classes}
111
- id={id}
112
- />
113
- <span
114
- {...ariaProps}
115
- hidden
116
- />
117
- </If>
127
+ {displaySVG(customIcon)}
118
128
  </>
119
129
  )
120
130
  }
@@ -1,21 +1,19 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
 
5
3
  import classnames from 'classnames'
6
- import Title from '../pb_title/_title.jsx'
4
+ import Title from '../pb_title/_title'
7
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
6
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
9
7
 
10
8
  type PillProps = {
11
- aria?: object,
9
+ aria?: {[key: string]: string},
12
10
  className?: string,
13
- data?: object,
11
+ data?: {[key: string]: string},
14
12
  id?: string,
15
13
  text: string,
16
14
  variant?: "success" | "warning" | "error" | "info" | "neutral",
17
15
  textTransform?: "none" | "lowercase"
18
- }
16
+ } & GlobalProps
19
17
 
20
18
  const Pill = (props: PillProps) => {
21
19
  const {
@@ -49,4 +47,4 @@ const Pill = (props: PillProps) => {
49
47
  )
50
48
  }
51
49
 
52
- export default Pill
50
+ export default Pill
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Pill from '../_pill.jsx'
2
+ import Pill from '../_pill'
3
3
 
4
4
  const PillDefault = (props) => {
5
5
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Pill from '../_pill.jsx'
2
+ import Pill from '../_pill'
3
3
 
4
4
  const PillVariants = (props) => {
5
5
  return (
@@ -1,3 +1,10 @@
1
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
2
 
3
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.