playbook_ui 14.6.2.pre.alpha.PLAY15814384 → 14.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -2
  3. data/app/pb_kits/playbook/pb_card/_card.tsx +4 -11
  4. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
  5. data/app/pb_kits/playbook/pb_currency/_currency.tsx +6 -16
  6. data/app/pb_kits/playbook/pb_currency/currency.rb +11 -38
  7. data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -35
  8. data/app/pb_kits/playbook/pb_currency/docs/example.yml +1 -3
  9. data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
  10. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -5
  11. data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -3
  12. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +2 -8
  13. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -3
  14. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -7
  15. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -6
  16. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +26 -30
  17. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +1 -24
  18. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +2 -25
  19. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
  20. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +8 -46
  21. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  22. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -67
  23. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +0 -1
  24. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -5
  26. data/app/pb_kits/playbook/pb_timeline/_item.tsx +23 -59
  27. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +0 -8
  28. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +1 -2
  29. data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
  30. data/app/pb_kits/playbook/pb_timeline/item.html.erb +21 -17
  31. data/app/pb_kits/playbook/pb_timeline/item.rb +0 -4
  32. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -84
  33. data/app/pb_kits/playbook/tokens/_typography.scss +0 -35
  34. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -3
  35. data/app/pb_kits/playbook/utilities/globalProps.ts +2 -39
  36. data/dist/chunks/_typeahead-BV_n6U5W.js +22 -0
  37. data/dist/chunks/_weekday_stacked-Cy__g00H.js +45 -0
  38. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  39. data/dist/chunks/vendor.js +1 -1
  40. data/dist/menu.yml +0 -3
  41. data/dist/playbook-doc.js +1 -1
  42. data/dist/playbook-rails-react-bindings.js +1 -1
  43. data/dist/playbook-rails.js +1 -1
  44. data/dist/playbook.css +1 -1
  45. data/lib/playbook/kit_base.rb +5 -43
  46. data/lib/playbook/version.rb +2 -2
  47. metadata +9 -43
  48. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +0 -7
  49. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +0 -18
  50. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +0 -3
  51. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +0 -3
  52. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +0 -1
  53. data/app/pb_kits/playbook/pb_link/_link.scss +0 -66
  54. data/app/pb_kits/playbook/pb_link/_link.tsx +0 -107
  55. data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +0 -30
  56. data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +0 -40
  57. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +0 -5
  58. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +0 -15
  59. data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +0 -15
  60. data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +0 -25
  61. data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +0 -35
  62. data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +0 -45
  63. data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +0 -5
  64. data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +0 -15
  65. data/app/pb_kits/playbook/pb_link/docs/example.yml +0 -16
  66. data/app/pb_kits/playbook/pb_link/docs/index.js +0 -5
  67. data/app/pb_kits/playbook/pb_link/link.html.erb +0 -21
  68. data/app/pb_kits/playbook/pb_link/link.rb +0 -44
  69. data/app/pb_kits/playbook/pb_link/link.test.jsx +0 -92
  70. data/app/pb_kits/playbook/pb_timeline/detail.html.erb +0 -3
  71. data/app/pb_kits/playbook/pb_timeline/detail.rb +0 -11
  72. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -43
  73. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -68
  74. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +0 -2
  75. data/app/pb_kits/playbook/pb_timeline/label.html.erb +0 -12
  76. data/app/pb_kits/playbook/pb_timeline/label.rb +0 -13
  77. data/app/pb_kits/playbook/pb_timeline/step.html.erb +0 -14
  78. data/app/pb_kits/playbook/pb_timeline/step.rb +0 -16
  79. data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +0 -29
  80. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -38
  81. data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +0 -42
  82. data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +0 -3
  83. data/dist/chunks/_typeahead-C-6MLSyC.js +0 -22
  84. data/dist/chunks/_weekday_stacked-CFhGhr9V.js +0 -45
  85. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99a985521715b9d9f16885c5dc378e0d7ef8eebcbad2a611a07b1d64430497ca
4
- data.tar.gz: 746ddd3bb48bac086703ef46dc0733126e3a192ea50be712662ebf9c2db4d77b
3
+ metadata.gz: 38967efe7f613ebe395182885e76a479a253d06b235e8bd97deb65a729280db2
4
+ data.tar.gz: ae918779c2270c3d255938c190d2458499b53cc96420e9697d517fa92fd87cac
5
5
  SHA512:
6
- metadata.gz: 1b78546cabdd8d4372db3fa8031a6d738d1357ddb8d0e860ed080b2f12fcdafc8ede1cfe0bbc8454465c488fdff6a373be95d70a81cca91711a966b0152cbb08
7
- data.tar.gz: 9fa3a3f4a1beb10625b7bd7774c9b9029436487c75b817d9e71667d3876fdd16c611cb3bbfed67ddec48e9d46ff260c795344df9d35a94f3b7bc11ef58360ddb
6
+ metadata.gz: f499509bb88d4ee1c130a23b40c9254b655bda121da66a084c48c7601b63b4c63113e1e35da272d92c20650a7e2ab27a65825a629c3c3082714d0a0662fffb3e
7
+ data.tar.gz: fa958023dcce99662705e2c3e108778cfd35ad051a03217e9d06725af4e267c8f9b4bb9884d81304df234d0316ca6f088384a9a171f2f7397972e11b3bbc83e8
@@ -30,7 +30,6 @@
30
30
  @import 'pb_dialog/dialog';
31
31
  @import 'pb_distribution_bar/distribution_bar';
32
32
  @import 'pb_draggable/draggable';
33
- @import 'pb_drawer/drawer';
34
33
  @import 'pb_dropdown/dropdown';
35
34
  @import 'pb_file_upload/file_upload';
36
35
  @import 'pb_filter/filter';
@@ -55,7 +54,6 @@
55
54
  @import 'pb_legend/legend';
56
55
  @import 'pb_lightbox/lightbox';
57
56
  @import 'pb_line_graph/line_graph';
58
- @import 'pb_link/link';
59
57
  @import 'pb_list/list';
60
58
  @import 'pb_loading_inline/loading_inline';
61
59
  @import 'pb_map/map';
@@ -108,6 +106,7 @@
108
106
  @import 'pb_user_badge/user_badge';
109
107
  @import 'pb_walkthrough/walkthrough';
110
108
  @import 'pb_weekday_stacked/weekday_stacked';
109
+ @import 'pb_drawer/drawer';
111
110
  @import 'utilities/mixins';
112
111
  @import 'utilities/spacing';
113
112
  @import 'utilities/cursor';
@@ -5,7 +5,7 @@ import { get } from 'lodash'
5
5
  import classnames from 'classnames'
6
6
 
7
7
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
8
- import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
8
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
9
9
  import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
10
10
 
11
11
  import Icon from '../pb_icon/_icon'
@@ -49,7 +49,6 @@ type CardBodyProps = {
49
49
  padding?: string,
50
50
  } & GlobalProps
51
51
 
52
-
53
52
  // Header component
54
53
  const Header = (props: CardHeaderProps) => {
55
54
  const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
@@ -108,10 +107,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
108
107
 
109
108
  // coerce to array
110
109
  const cardChildren = React.Children.toArray(children)
111
- const dynamicInlineProps = globalInlineProps(props);
112
- const { style: htmlStyle = {}, ...restHtmlProps } = htmlProps as { style?: React.CSSProperties };
113
- const mergedStyles: React.CSSProperties = { ...htmlStyle, ...dynamicInlineProps };
114
-
115
110
 
116
111
  const subComponentTags = (tagName: string) => {
117
112
  return cardChildren.filter((c: string) => (
@@ -127,7 +122,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
127
122
 
128
123
  const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
129
124
  const Tag = tagOptions.includes(tag) ? tag : 'div'
130
-
125
+
131
126
  return (
132
127
  <>
133
128
  {
@@ -138,9 +133,8 @@ const Card = (props: CardPropTypes): React.ReactElement => {
138
133
  <Tag
139
134
  {...ariaProps}
140
135
  {...dataProps}
136
+ {...htmlProps}
141
137
  className={classnames(cardCss, globalProps(props), className)}
142
- {...restHtmlProps}
143
- style={mergedStyles}
144
138
  >
145
139
  {subComponentTags('Header')}
146
140
  {
@@ -167,9 +161,8 @@ const Card = (props: CardPropTypes): React.ReactElement => {
167
161
  <Tag
168
162
  {...ariaProps}
169
163
  {...dataProps}
164
+ {...htmlProps}
170
165
  className={classnames(cardCss, globalProps(props), className)}
171
- {...restHtmlProps}
172
- style={mergedStyles}
173
166
  >
174
167
  {subComponentTags('Header')}
175
168
  {nonHeaderChildren}
@@ -28,7 +28,8 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
28
28
 
29
29
  @mixin pb_card_selected($border_color: $primary) {
30
30
  border-color: $border_color;
31
- border-width: $pb_card_border_width * 2;
31
+ border-width: $pb_card_border_width;
32
+ outline: 1px solid $border_color;
32
33
  }
33
34
 
34
35
  @mixin pb_card_selected_dark {
@@ -26,7 +26,6 @@ type CurrencyProps = {
26
26
  variant?: 'default' | 'light' | 'bold',
27
27
  unit?: string,
28
28
  unstyled?: boolean,
29
- commaSeparator?: boolean,
30
29
  }
31
30
 
32
31
  const sizes: {lg: 1, md: 3, sm: 4} = {
@@ -54,7 +53,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
54
53
  variant = 'default',
55
54
  dark = false,
56
55
  unstyled = false,
57
- commaSeparator = false,
58
56
  } = props
59
57
 
60
58
  const emphasizedClass = emphasized ? '' : '_deemphasized'
@@ -76,7 +74,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
76
74
  className
77
75
  )
78
76
 
79
- const getFormattedNumber = (input: number | any) => new Intl.NumberFormat('en-US', {
77
+ const getFormattedNumber = (input: number | any ) => new Intl.NumberFormat('en-US', {
80
78
  notation: 'compact',
81
79
  maximumFractionDigits: 1,
82
80
  }).format(input)
@@ -90,20 +88,12 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
90
88
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
91
89
  }
92
90
 
93
- const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
94
- const getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
91
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
92
+ getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
95
93
 
96
- const formatAmount = (amount: string) => {
97
- if (!commaSeparator) return amount;
98
-
99
- const [wholePart, decimalPart] = amount.split('.');
100
- const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
101
- return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
102
- }
103
-
104
- const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
105
- const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
106
- const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
94
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
95
+ getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
96
+ getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
107
97
 
108
98
  return (
109
99
  <div
@@ -43,9 +43,6 @@ module Playbook
43
43
  prop :unstyled, type: Playbook::Props::Boolean,
44
44
  default: false
45
45
 
46
- prop :comma_separator, type: Playbook::Props::Boolean,
47
- default: false
48
-
49
46
  def classname
50
47
  generate_classname("pb_currency_kit", align, size, dark_class)
51
48
  end
@@ -68,7 +65,7 @@ module Playbook
68
65
  def title_props
69
66
  {
70
67
  size: size_value,
71
- text: abbreviate ? abbreviated_value : formatted_amount,
68
+ text: abbreviate ? abbreviated_value : whole_value,
72
69
  classname: "pb_currency_value",
73
70
  dark: dark,
74
71
  }
@@ -99,38 +96,28 @@ module Playbook
99
96
  private
100
97
 
101
98
  def whole_value
102
- value = amount.split(".").first
103
- if comma_separator
104
- number_with_delimiter(value.gsub(",", ""))
105
- else
106
- value
107
- end
99
+ return amount if decimals == "matching"
100
+
101
+ amount.split(".").first.to_s
108
102
  end
109
103
 
110
- def decimal_value
111
- amount.split(".")[1] || "00"
104
+ def abbreviated_value(index = 0..-2)
105
+ value = amount.split(".").first.split(",").join("")
106
+ abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
107
+ abbreviated_num[index]
112
108
  end
113
109
 
114
110
  def units_element
115
111
  return "" if decimals == "matching" && !abbreviate && !unit
116
112
 
117
- if unit.nil? && !abbreviate
118
- if decimals == "matching"
119
- ""
120
- else
121
- ".#{decimal_value}"
122
- end
113
+ _, decimal_part = amount.split(".")
114
+ if unit.nil? && abbreviate == false
115
+ decimal_part.nil? ? ".00" : ".#{decimal_part}"
123
116
  else
124
117
  abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
125
118
  end
126
119
  end
127
120
 
128
- def abbreviated_value(index = 0..-2)
129
- value = amount.split(".").first.gsub(",", "").to_i
130
- abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
131
- abbreviated_num[index]
132
- end
133
-
134
121
  def size_value
135
122
  case size
136
123
  when "lg"
@@ -145,20 +132,6 @@ module Playbook
145
132
  def dark_class
146
133
  dark ? "dark" : nil
147
134
  end
148
-
149
- def formatted_amount
150
- return abbreviated_value if abbreviate
151
-
152
- if decimals == "matching"
153
- if comma_separator
154
- number_with_delimiter(amount.gsub(",", ""))
155
- else
156
- amount
157
- end
158
- else
159
- whole_value
160
- end
161
- end
162
135
  end
163
136
  end
164
137
  end
@@ -61,38 +61,3 @@ test('decimals default prop returns decimals as body text', () => {
61
61
  expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
62
62
  expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
63
63
  })
64
-
65
-
66
- test('commaSeparator prop returns comma separated amount', () => {
67
- render(
68
- <Currency
69
- amount="1234567890"
70
- commaSeparator
71
- data={{ testid: 'comma-test' }}
72
- />
73
- )
74
- expect(screen.getByTestId('comma-test')).toHaveTextContent('1,234,567,890')
75
- })
76
-
77
- test('commaSeparator prop returns comma separated amount with decimals', () => {
78
- render(
79
- <Currency
80
- amount="1234567890.12"
81
- commaSeparator
82
- data={{ testid: 'comma-test-decimals' }}
83
- />
84
- )
85
- expect(screen.getByTestId('comma-test-decimals')).toHaveTextContent('1,234,567,890.12')
86
- })
87
-
88
- test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
89
- render(
90
- <Currency
91
- amount="1234567890.12"
92
- commaSeparator
93
- data={{ testid: 'comma-test-decimals-matching' }}
94
- decimals="matching"
95
- />
96
- )
97
- expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
98
- })
@@ -8,8 +8,7 @@ examples:
8
8
  - currency_abbreviated: Abbreviate Larger Amounts
9
9
  - currency_matching_decimals: Matching Decimals
10
10
  - currency_unstyled: Unstyled
11
- - currency_comma_separator: Comma Separator
12
-
11
+
13
12
  react:
14
13
  - currency_variants: Variants
15
14
  - currency_size: Size
@@ -18,7 +17,6 @@ examples:
18
17
  - currency_abbreviated: Abbreviate Larger Amounts
19
18
  - currency_matching_decimals: Matching Decimals
20
19
  - currency_unstyled: Unstyled
21
- - currency_comma_separator: Comma Separator
22
20
 
23
21
  swift:
24
22
  - currency_size_swift: Size
@@ -5,4 +5,3 @@ export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
5
5
  export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
- export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
@@ -6,7 +6,7 @@ import classnames from "classnames";
6
6
  import Modal from "react-modal";
7
7
 
8
8
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
9
- import { globalProps, globalInlineProps } from "../utilities/globalProps";
9
+ import { globalProps } from "../utilities/globalProps";
10
10
 
11
11
  import Body from "../pb_body/_body";
12
12
  import Button from "../pb_button/_button";
@@ -91,8 +91,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
91
91
  beforeClose: "pb_dialog_overlay_before_close",
92
92
  };
93
93
 
94
- const dynamicInlineProps = globalInlineProps(props);
95
-
96
94
  const classes = classnames(
97
95
  buildCss("pb_dialog_wrapper"),
98
96
  globalProps(props),
@@ -186,7 +184,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
186
184
  overlayClassName={overlayClassNames}
187
185
  portalClassName={portalClassName}
188
186
  shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
189
- style={{ content: dynamicInlineProps }}
190
187
  >
191
188
  <>
192
189
  {title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
@@ -195,7 +192,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
195
192
  <Dialog.Body
196
193
  className="dialog_status_text_align"
197
194
  padding="md"
198
-
199
195
  >
200
196
  <Flex align="center"
201
197
  orientation="column"
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
- import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
5
5
  import { GenericObject, Sizes } from '../types'
6
6
 
7
7
  type FlexProps = {
@@ -61,7 +61,6 @@ const Flex = (props: FlexProps): React.ReactElement => {
61
61
  const alignSelfClass = alignSelf !== 'none' ? `align_self_${alignSelf}` : ''
62
62
  const dataProps = buildDataProps(data)
63
63
  const htmlProps = buildHtmlProps(htmlOptions)
64
- const dynamicInlineProps = globalInlineProps(props)
65
64
 
66
65
 
67
66
  return (
@@ -84,7 +83,6 @@ const Flex = (props: FlexProps): React.ReactElement => {
84
83
  globalProps(props),
85
84
  className
86
85
  )}
87
- style={dynamicInlineProps}
88
86
  {...dataProps}
89
87
  {...htmlProps}
90
88
  >
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildCss, buildHtmlProps } from '../utilities/props'
4
- import { globalProps, GlobalProps, globalInlineProps} from '../utilities/globalProps'
4
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
5
5
  type FlexItemPropTypes = {
6
6
  children: React.ReactNode[] | React.ReactNode,
7
7
  fixedSize?: string,
@@ -35,20 +35,14 @@ const FlexItem = (props: FlexItemPropTypes): React.ReactElement => {
35
35
  const fixedStyle =
36
36
  fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
37
37
  const orderClass = order !== 'none' ? `order_${order}` : null
38
- const dynamicInlineProps = globalInlineProps(props)
39
- const combinedStyles = {
40
- ...fixedStyle,
41
- ...dynamicInlineProps
42
- }
43
38
 
44
39
  const htmlProps = buildHtmlProps(htmlOptions)
45
40
 
46
-
47
41
  return (
48
42
  <div
49
43
  {...htmlProps}
50
44
  className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass, displayFlexClass), orderClass, alignSelfClass, globalProps(props), className)}
51
- style={combinedStyles}
45
+ style={fixedStyle}
52
46
  >
53
47
  {children}
54
48
  </div>
@@ -1,5 +1,8 @@
1
- <%= pb_content_tag(:div,
2
- style: object.inline_styles
3
- ) do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ style: object.style_value,
6
+ **combined_html_options) do %>
4
7
  <%= content.presence %>
5
8
  <% end %>
@@ -20,13 +20,8 @@ module Playbook
20
20
  generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + align_self_class
21
21
  end
22
22
 
23
- def inline_styles
24
- styles = []
25
- styles << "flex-basis: #{fixed_size};" if fixed_size.present?
26
- styles << "height: #{height};" if height.present?
27
- styles << "min-height: #{min_height};" if min_height.present?
28
- styles << "max-height: #{max_height};" if max_height.present?
29
- styles.join(" ")
23
+ def style_value
24
+ "flex-basis: #{fixed_size};" if fixed_size.present?
30
25
  end
31
26
 
32
27
  private
@@ -142,9 +142,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
142
142
  height: 12px !important;
143
143
  width: 12px !important;
144
144
  padding-right: $space_xs;
145
- + .pb_form_pill_text, + .pb_form_pill_tag,
146
- + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
147
- + div .pb_form_pill_text, + div .pb_form_pill_tag {
145
+ + .pb_form_pill_text, + .pb_form_pill_tag {
148
146
  padding-left: 0;
149
147
  }
150
148
  }
@@ -171,9 +169,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
171
169
  }
172
170
  .pb_form_pill_icon {
173
171
  padding-right: $space_xxs;
174
- + .pb_form_pill_text, + .pb_form_pill_tag,
175
- + .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
176
- + div .pb_form_pill_text, + div .pb_form_pill_tag {
172
+ + .pb_form_pill_text, + .pb_form_pill_tag {
177
173
  padding-left: 0;
178
174
  }
179
175
  }
@@ -3,7 +3,6 @@ import classnames from 'classnames'
3
3
  import Title from '../pb_title/_title'
4
4
  import Icon from '../pb_icon/_icon'
5
5
  import Avatar from '../pb_avatar/_avatar'
6
- import Tooltip from '../pb_tooltip/_tooltip'
7
6
  import { globalProps, GlobalProps } from '../utilities/globalProps'
8
7
  import { buildDataProps, buildHtmlProps } from '../utilities/props'
9
8
 
@@ -63,30 +62,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
63
62
  const dataProps = buildDataProps(data)
64
63
  const htmlProps = buildHtmlProps(htmlOptions)
65
64
 
66
- const renderTitle = (content: string, className: string) => {
67
- const titleComponent = (
68
- <Title
69
- className={className}
70
- size={4}
71
- text={content}
72
- truncate={props.truncate}
73
- />
74
- )
75
- if (props.truncate) {
76
- return (
77
- <Tooltip
78
- interaction
79
- placement="top"
80
- position="fixed"
81
- text={content}
82
- >
83
- {titleComponent}
84
- </Tooltip>
85
- )
86
- }
87
- return titleComponent
88
- }
89
-
90
65
  return (
91
66
  <div className={css}
92
67
  id={id}
@@ -102,7 +77,12 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
102
77
  size="xxs"
103
78
  status={null}
104
79
  />
105
- {renderTitle(name, "pb_form_pill_text")}
80
+ <Title
81
+ className="pb_form_pill_text"
82
+ size={4}
83
+ text={name}
84
+ truncate={props.truncate}
85
+ />
106
86
  </>
107
87
  )}
108
88
  {((name && icon && !text) || (name && icon && text)) && (
@@ -113,7 +93,12 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
113
93
  size="xxs"
114
94
  status={null}
115
95
  />
116
- {renderTitle(name, "pb_form_pill_text")}
96
+ <Title
97
+ className="pb_form_pill_text"
98
+ size={4}
99
+ text={name}
100
+ truncate={props.truncate}
101
+ />
117
102
  <Icon
118
103
  className="pb_form_pill_icon"
119
104
  color={color}
@@ -128,10 +113,22 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
128
113
  color={color}
129
114
  icon={icon}
130
115
  />
131
- {renderTitle(text, "pb_form_pill_tag")}
116
+ <Title
117
+ className="pb_form_pill_tag"
118
+ size={4}
119
+ text={text}
120
+ truncate={props.truncate}
121
+ />
132
122
  </>
133
123
  )}
134
- {(!name && !icon && text) && renderTitle(text, "pb_form_pill_tag")}
124
+ {(!name && !icon && text) && (
125
+ <Title
126
+ className="pb_form_pill_tag"
127
+ size={4}
128
+ text={text}
129
+ truncate={props.truncate}
130
+ />
131
+ )}
135
132
  <div
136
133
  className="pb_form_pill_close"
137
134
  onClick={onClick}
@@ -146,5 +143,4 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
146
143
  </div>
147
144
  )
148
145
  }
149
-
150
146
  export default FormPill
@@ -13,30 +13,7 @@
13
13
  id: "typeahead-form-pill",
14
14
  is_multi: true,
15
15
  options: names,
16
- label: "Truncation Within Typeahead",
16
+ label: "Names",
17
17
  pills: true,
18
18
  truncate: 1,
19
19
  }) %>
20
-
21
- <%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %>
22
- <%= pb_rails("card", props: { max_width: "xs" }) do %>
23
- <%= pb_rails("form_pill", props: {
24
- name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
25
- avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
26
- tabindex: 0,
27
- truncate: 1,
28
- id: "truncation-1"
29
- }) %>
30
- <%= pb_rails("form_pill", props: {
31
- icon: "badge-check",
32
- text: "icon and a very long tag to show truncation",
33
- tabindex: 0,
34
- truncate: 1,
35
- id: "truncation-2"
36
- }) %>
37
- <%= pb_rails("form_pill", props: {
38
- text: "form pill long tag no tooltip show truncation",
39
- tabindex: 0,
40
- truncate: 1,
41
- }) %>
42
- <% end %>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
2
+ import Typeahead from '../../pb_typeahead/_typeahead'
3
3
 
4
4
  const names = [
5
5
  { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
@@ -15,34 +15,11 @@ const FormPillTruncatedText = (props) => {
15
15
  <Typeahead
16
16
  htmlOptions={{ style: { maxWidth: "240px" }}}
17
17
  isMulti
18
- label="Truncation Within Typeahead"
18
+ label="Names"
19
19
  options={names}
20
20
  truncate={1}
21
21
  {...props}
22
22
  />
23
- <Caption text="Form Pill Truncation"/>
24
- <Card maxWidth="xs">
25
- <FormPill
26
- avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
27
- name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
28
- onClick={() => alert('Click!')}
29
- tabIndex={0}
30
- truncate={1}
31
- />
32
- <FormPill
33
- icon="badge-check"
34
- onClick={() => {alert('Click!')}}
35
- tabIndex={0}
36
- text="icon and a very long tag to show truncation"
37
- truncate={1}
38
- />
39
- <FormPill
40
- onClick={() => {alert('Click!')}}
41
- tabIndex={0}
42
- text="form pill with a very long tag to show truncation"
43
- truncate={1}
44
- />
45
- </Card>
46
23
  </>
47
24
  )
48
25
  }
@@ -0,0 +1 @@
1
+ For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.