playbook_ui 14.6.2.pre.alpha.PLAY1551tiptapextbump4350 → 14.6.2.pre.alpha.PLAY1613darkdatetimecolors4432

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -28
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +37 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +13 -2
  7. data/app/pb_kits/playbook/pb_card/_card.tsx +11 -4
  8. data/app/pb_kits/playbook/pb_date/_date.scss +3 -0
  9. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  10. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -7
  11. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  12. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  13. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  14. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  15. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -2
  16. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +30 -26
  17. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +24 -1
  18. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
  19. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +3 -0
  20. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -0
  21. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +46 -8
  22. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  23. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +37 -0
  24. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +67 -0
  25. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +40 -0
  26. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +51 -0
  27. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +1 -0
  28. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +26 -0
  29. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +1 -0
  30. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -0
  31. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +11 -0
  32. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +59 -0
  33. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +3 -0
  34. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +20 -0
  35. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +3 -0
  36. data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +13 -0
  37. data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +5 -0
  38. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -0
  39. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +8 -0
  40. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +81 -0
  41. data/app/pb_kits/playbook/pb_timeline/_item.tsx +59 -23
  42. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -0
  43. data/app/pb_kits/playbook/pb_timeline/detail.html.erb +3 -0
  44. data/app/pb_kits/playbook/pb_timeline/detail.rb +11 -0
  45. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +43 -0
  46. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +68 -0
  47. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +2 -0
  48. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -1
  49. data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/pb_timeline/item.html.erb +17 -21
  51. data/app/pb_kits/playbook/pb_timeline/item.rb +4 -0
  52. data/app/pb_kits/playbook/pb_timeline/label.html.erb +12 -0
  53. data/app/pb_kits/playbook/pb_timeline/label.rb +13 -0
  54. data/app/pb_kits/playbook/pb_timeline/step.html.erb +14 -0
  55. data/app/pb_kits/playbook/pb_timeline/step.rb +16 -0
  56. data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +29 -0
  57. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +38 -0
  58. data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +42 -0
  59. data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +3 -0
  60. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +84 -0
  61. data/app/pb_kits/playbook/utilities/_hover.scss +46 -43
  62. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +4 -0
  63. data/app/pb_kits/playbook/utilities/globalProps.ts +44 -2
  64. data/dist/chunks/_typeahead-DhLic2Fe.js +22 -0
  65. data/dist/chunks/_weekday_stacked-Mx8TYP5I.js +45 -0
  66. data/dist/chunks/vendor.js +1 -1
  67. data/dist/menu.yml +4 -1
  68. data/dist/playbook-doc.js +1 -1
  69. data/dist/playbook-rails-react-bindings.js +1 -1
  70. data/dist/playbook-rails.js +1 -1
  71. data/dist/playbook.css +1 -1
  72. data/lib/playbook/hover.rb +4 -1
  73. data/lib/playbook/kit_base.rb +43 -5
  74. data/lib/playbook/version.rb +1 -1
  75. metadata +37 -5
  76. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
  77. data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
  78. data/dist/chunks/_weekday_stacked-BLVPFG6h.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2cc93bf2d7fe805d4a429a22e453f5b0611e6640c8c9412295200f19445acd3
4
- data.tar.gz: 11093062f7f9caa106b2c805400f779b2f8413ff21cda0ddd3a3c063662ba94e
3
+ metadata.gz: db6a77d5d0d5f2f583dec0ae055971d993b86ed35cebb3df70a3eb46c520f60e
4
+ data.tar.gz: 9f214f19a94bce463d9561600773513112947c453c8a87248c4a37740103ac47
5
5
  SHA512:
6
- metadata.gz: 3e65ac77d1e95398832bfbe710db224b7e99f1042870f6915bc75a5673300b2f78916e89dd86991b0a379a37f2de5d81477c91a057c3855e3c574ed7816ea1ef
7
- data.tar.gz: 4f88a4362e06630eb22a588539f5fb9d64b20d4e79fb57dac0443633ae4b22ed4e3516392580e52112cddaf10e56b9ffc207ec6d70d96556a8fc684c03dfe171
6
+ metadata.gz: 6d30fd7598b3c3094e108bfe2f611be040ccdc4ce8bdfdf085c6757e62b386031f890e58607e825da501479e5734974f8134fb4738a0890d1bf8caf5fb923da2
7
+ data.tar.gz: 19958248e4ee7a1a3d13efc7ba1debe4891bc58bd2ff790b33fc272a739a24789d98454b6e61b61210fafb5ceef4af94afe75f27a77122fde54b91fca6e0bd76
@@ -1,4 +1,3 @@
1
-
2
1
  @import 'pb_advanced_table/advanced_table';
3
2
  @import 'pb_avatar/avatar';
4
3
  @import 'pb_avatar_action_button/avatar_action_button';
@@ -85,6 +84,7 @@
85
84
  @import 'pb_selectable_card_icon/selectable_card_icon';
86
85
  @import 'pb_selectable_icon/selectable_icon';
87
86
  @import 'pb_selectable_list/selectable_list';
87
+ @import 'pb_skeleton_loading/skeleton_loading';
88
88
  @import 'pb_source/source';
89
89
  @import 'pb_star_rating/star_rating';
90
90
  @import 'pb_stat_change/stat_change';
@@ -16,6 +16,7 @@ interface CustomCellProps {
16
16
  onRowToggleClick?: (arg: Row<GenericObject>) => void
17
17
  row: Row<GenericObject>
18
18
  value?: string
19
+ customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
19
20
  }
20
21
 
21
22
  export const CustomCell = ({
@@ -23,6 +24,7 @@ export const CustomCell = ({
23
24
  onRowToggleClick,
24
25
  row,
25
26
  value,
27
+ customRenderer,
26
28
  }: CustomCellProps & GlobalProps) => {
27
29
  const { setExpanded, expanded, expandedControl, inlineRowLoading } = useContext(AdvancedTableContext);
28
30
 
@@ -61,7 +63,12 @@ export const CustomCell = ({
61
63
  </button>
62
64
  ) : null}
63
65
  <FlexItem paddingLeft={renderButton? "none" : "xs"}>
64
- {row.depth === 0 ? getValue() : value}
66
+ {row.depth === 0 ? (
67
+ customRenderer ? customRenderer(row, getValue()) : getValue()
68
+ ) :(
69
+ customRenderer ? customRenderer(row, value) : value
70
+ )
71
+ }
65
72
  </FlexItem>
66
73
  </Flex>
67
74
  </div>
@@ -90,8 +90,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
90
90
 
91
91
  const columnHelper = createColumnHelper()
92
92
 
93
- //Create cells for first columns
94
- const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element) => {
93
+ //Create cells for columns, with customization for first column
94
+ const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element, index?: number) => {
95
95
  const columnCells = ({
96
96
  row,
97
97
  getValue,
@@ -101,19 +101,16 @@ const AdvancedTable = (props: AdvancedTableProps) => {
101
101
  }) => {
102
102
  const rowData = row.original
103
103
 
104
- // Use customRenderer if provided, otherwise default rendering
105
- if (customRenderer) {
106
- return customRenderer(row, getValue())
107
- }
108
-
104
+ if (index === 0) {
109
105
  switch (row.depth) {
110
106
  case 0: {
111
107
  return (
112
- <CustomCell
113
- getValue={getValue}
114
- onRowToggleClick={onRowToggleClick}
115
- row={row}
116
- />
108
+ <CustomCell
109
+ customRenderer={customRenderer}
110
+ getValue={getValue}
111
+ onRowToggleClick={onRowToggleClick}
112
+ row={row}
113
+ />
117
114
  )
118
115
  }
119
116
  default: {
@@ -122,6 +119,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
122
119
  const accessorValue = rowData[depthAccessor]
123
120
  return accessorValue ? (
124
121
  <CustomCell
122
+ customRenderer={customRenderer}
125
123
  onRowToggleClick={onRowToggleClick}
126
124
  row={row}
127
125
  value={accessorValue}
@@ -132,11 +130,13 @@ const AdvancedTable = (props: AdvancedTableProps) => {
132
130
  }
133
131
  }
134
132
  }
135
-
133
+ return customRenderer
134
+ ? customRenderer(row, getValue())
135
+ : getValue()
136
+ }
136
137
  return columnCells
137
138
  }
138
-
139
- //Create column array in format needed by Tanstack
139
+ //Create column array in format needed by Tanstack
140
140
  const columns =
141
141
  columnDefinitions &&
142
142
  columnDefinitions.map((column, index) => {
@@ -147,19 +147,12 @@ const AdvancedTable = (props: AdvancedTableProps) => {
147
147
  }),
148
148
  }
149
149
 
150
- // Use the custom renderer if provided, EXCEPT for the first column
151
- if (index !== 0) {
152
- if (column.cellAccessors || column.customRenderer) {
153
- columnStructure.cell = createCellFunction(
154
- column.cellAccessors,
155
- column.customRenderer
156
- )
157
- }
158
- } else {
159
- // For the first column, apply createCellFunction without customRenderer
160
- if (column.cellAccessors) {
161
- columnStructure.cell = createCellFunction(column.cellAccessors)
162
- }
150
+ if (column.cellAccessors || column.customRenderer) {
151
+ columnStructure.cell = createCellFunction(
152
+ column.cellAccessors,
153
+ column.customRenderer,
154
+ index
155
+ )
163
156
  }
164
157
 
165
158
  return columnStructure
@@ -1,7 +1,7 @@
1
1
  import React, {useState} from "react"
2
2
  import { render, screen, waitFor } from "../utilities/test-utils"
3
3
 
4
- import { AdvancedTable } from "playbook-ui"
4
+ import { AdvancedTable, Pill } from "playbook-ui"
5
5
 
6
6
  const MOCK_DATA = [
7
7
  {
@@ -88,6 +88,28 @@ const columnDefinitions = [
88
88
  },
89
89
  ]
90
90
 
91
+ const columnDefinitionsCustomRenderer = [
92
+ {
93
+ accessor: "year",
94
+ label: "Year",
95
+ cellAccessors: ["quarter", "month", "day"],
96
+ },
97
+ {
98
+ accessor: "newEnrollments",
99
+ label: "New Enrollments",
100
+ customRenderer: (row, value) => (
101
+ <Pill text={value}
102
+ variant="success"
103
+ />
104
+ ),
105
+ },
106
+ {
107
+ accessor: "scheduledMeetings",
108
+ label: "Scheduled Meetings",
109
+ },
110
+ ]
111
+
112
+
91
113
  const subRowHeaders = ["Quarter"]
92
114
 
93
115
  const testId = "advanced_table"
@@ -463,3 +485,17 @@ test("responsive none prop functions as expected", () => {
463
485
  const kit = screen.getByTestId(testId)
464
486
  expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
465
487
  })
488
+
489
+ test("customRenderer prop functions as expected", () => {
490
+ render(
491
+ <AdvancedTable
492
+ columnDefinitions={columnDefinitionsCustomRenderer}
493
+ data={{ testid: testId }}
494
+ tableData={MOCK_DATA}
495
+ />
496
+ )
497
+
498
+ const kit = screen.getByTestId(testId)
499
+ const pill = kit.querySelector(".pb_pill_kit_success_lowercase")
500
+ expect(pill).toBeInTheDocument()
501
+ })
@@ -1,5 +1,5 @@
1
1
  import React from "react"
2
- import { AdvancedTable, Pill, Body, Flex, Detail, Caption } from "playbook-ui"
2
+ import { AdvancedTable, Pill, Body, Flex, Detail, Caption, Badge, Title } from "playbook-ui"
3
3
  import MOCK_DATA from "./advanced_table_mock_data.json"
4
4
 
5
5
  const AdvancedTableCustomCell = (props) => {
@@ -8,7 +8,18 @@ const AdvancedTableCustomCell = (props) => {
8
8
  accessor: "year",
9
9
  label: "Year",
10
10
  cellAccessors: ["quarter", "month", "day"],
11
-
11
+ customRenderer: (row, value) => (
12
+ <Flex>
13
+ <Title size={4}
14
+ text={value}
15
+ />
16
+ <Badge dark
17
+ marginLeft="xxs"
18
+ text={row.original.newEnrollments > 20 ? "High" : "Low"}
19
+ variant="neutral"
20
+ />
21
+ </Flex>
22
+ ),
12
23
  },
13
24
  {
14
25
  accessor: "newEnrollments",
@@ -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 } from '../utilities/globalProps'
8
+ import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
9
9
  import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
10
10
 
11
11
  import Icon from '../pb_icon/_icon'
@@ -49,6 +49,7 @@ type CardBodyProps = {
49
49
  padding?: string,
50
50
  } & GlobalProps
51
51
 
52
+
52
53
  // Header component
53
54
  const Header = (props: CardHeaderProps) => {
54
55
  const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
@@ -107,6 +108,10 @@ const Card = (props: CardPropTypes): React.ReactElement => {
107
108
 
108
109
  // coerce to array
109
110
  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
+
110
115
 
111
116
  const subComponentTags = (tagName: string) => {
112
117
  return cardChildren.filter((c: string) => (
@@ -122,7 +127,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
122
127
 
123
128
  const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
124
129
  const Tag = tagOptions.includes(tag) ? tag : 'div'
125
-
130
+
126
131
  return (
127
132
  <>
128
133
  {
@@ -133,8 +138,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
133
138
  <Tag
134
139
  {...ariaProps}
135
140
  {...dataProps}
136
- {...htmlProps}
137
141
  className={classnames(cardCss, globalProps(props), className)}
142
+ {...restHtmlProps}
143
+ style={mergedStyles}
138
144
  >
139
145
  {subComponentTags('Header')}
140
146
  {
@@ -161,8 +167,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
161
167
  <Tag
162
168
  {...ariaProps}
163
169
  {...dataProps}
164
- {...htmlProps}
165
170
  className={classnames(cardCss, globalProps(props), className)}
171
+ {...restHtmlProps}
172
+ style={mergedStyles}
166
173
  >
167
174
  {subComponentTags('Header')}
168
175
  {nonHeaderChildren}
@@ -28,5 +28,8 @@
28
28
  [class^=pb_title_kit] {
29
29
  color: $text_dk_default !important;
30
30
  }
31
+ [class^=pb_body_kit], [class^=pb_caption_kit] {
32
+ color: $text_dk_light !important;
33
+ }
31
34
  }
32
35
  }
@@ -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 } from "../utilities/globalProps";
9
+ import { globalProps, globalInlineProps } from "../utilities/globalProps";
10
10
 
11
11
  import Body from "../pb_body/_body";
12
12
  import Button from "../pb_button/_button";
@@ -91,6 +91,8 @@ const Dialog = (props: DialogProps): React.ReactElement => {
91
91
  beforeClose: "pb_dialog_overlay_before_close",
92
92
  };
93
93
 
94
+ const dynamicInlineProps = globalInlineProps(props);
95
+
94
96
  const classes = classnames(
95
97
  buildCss("pb_dialog_wrapper"),
96
98
  globalProps(props),
@@ -184,6 +186,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
184
186
  overlayClassName={overlayClassNames}
185
187
  portalClassName={portalClassName}
186
188
  shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
189
+ style={{ content: dynamicInlineProps }}
187
190
  >
188
191
  <>
189
192
  {title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
@@ -192,6 +195,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
192
195
  <Dialog.Body
193
196
  className="dialog_status_text_align"
194
197
  padding="md"
198
+
195
199
  >
196
200
  <Flex align="center"
197
201
  orientation="column"
@@ -47,7 +47,7 @@ interface DropdownComponent
47
47
  Container: typeof DropdownContainer;
48
48
  }
49
49
 
50
- const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
50
+ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
51
51
  const {
52
52
  aria = {},
53
53
  autocomplete = false,
@@ -260,7 +260,7 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
260
260
  <DropdownContainer>
261
261
  {optionsWithBlankSelection &&
262
262
  optionsWithBlankSelection?.map((option: GenericObject) => (
263
- <Dropdown.Option key={option.id}
263
+ <DropdownOption key={option.id}
264
264
  option={option}
265
265
  />
266
266
  ))}
@@ -278,11 +278,12 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
278
278
  </DropdownContext.Provider>
279
279
  </div>
280
280
  )
281
- }) as DropdownComponent
281
+ }
282
282
 
283
- Dropdown.displayName = "Dropdown";
284
- Dropdown.Option = DropdownOption;
285
- Dropdown.Trigger = DropdownTrigger;
286
- Dropdown.Container = DropdownContainer;
283
+ Dropdown = forwardRef(Dropdown) as unknown as DropdownComponent;
284
+ (Dropdown as DropdownComponent).displayName = "Dropdown";
285
+ (Dropdown as DropdownComponent).Option = DropdownOption;
286
+ (Dropdown as DropdownComponent).Trigger = DropdownTrigger;
287
+ (Dropdown as DropdownComponent).Container = DropdownContainer;
287
288
 
288
289
  export default Dropdown;
@@ -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 } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
5
5
  import { GenericObject, Sizes } from '../types'
6
6
 
7
7
  type FlexProps = {
@@ -61,6 +61,7 @@ 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)
64
65
 
65
66
 
66
67
  return (
@@ -83,6 +84,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
83
84
  globalProps(props),
84
85
  className
85
86
  )}
87
+ style={dynamicInlineProps}
86
88
  {...dataProps}
87
89
  {...htmlProps}
88
90
  >
@@ -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 } from '../utilities/globalProps'
4
+ import { globalProps, GlobalProps, globalInlineProps} from '../utilities/globalProps'
5
5
  type FlexItemPropTypes = {
6
6
  children: React.ReactNode[] | React.ReactNode,
7
7
  fixedSize?: string,
@@ -35,14 +35,20 @@ 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
+ }
38
43
 
39
44
  const htmlProps = buildHtmlProps(htmlOptions)
40
45
 
46
+
41
47
  return (
42
48
  <div
43
49
  {...htmlProps}
44
50
  className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass, displayFlexClass), orderClass, alignSelfClass, globalProps(props), className)}
45
- style={fixedStyle}
51
+ style={combinedStyles}
46
52
  >
47
53
  {children}
48
54
  </div>
@@ -1,8 +1,5 @@
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 %>
1
+ <%= pb_content_tag(:div,
2
+ style: object.inline_styles
3
+ ) do %>
7
4
  <%= content.presence %>
8
5
  <% end %>
@@ -20,8 +20,13 @@ 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 style_value
24
- "flex-basis: #{fixed_size};" if fixed_size.present?
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(" ")
25
30
  end
26
31
 
27
32
  private
@@ -142,7 +142,9 @@ $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 {
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 {
146
148
  padding-left: 0;
147
149
  }
148
150
  }
@@ -169,7 +171,9 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
169
171
  }
170
172
  .pb_form_pill_icon {
171
173
  padding-right: $space_xxs;
172
- + .pb_form_pill_text, + .pb_form_pill_tag {
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 {
173
177
  padding-left: 0;
174
178
  }
175
179
  }
@@ -3,6 +3,7 @@ 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'
6
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
7
8
  import { buildDataProps, buildHtmlProps } from '../utilities/props'
8
9
 
@@ -62,6 +63,30 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
62
63
  const dataProps = buildDataProps(data)
63
64
  const htmlProps = buildHtmlProps(htmlOptions)
64
65
 
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
+
65
90
  return (
66
91
  <div className={css}
67
92
  id={id}
@@ -77,12 +102,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
77
102
  size="xxs"
78
103
  status={null}
79
104
  />
80
- <Title
81
- className="pb_form_pill_text"
82
- size={4}
83
- text={name}
84
- truncate={props.truncate}
85
- />
105
+ {renderTitle(name, "pb_form_pill_text")}
86
106
  </>
87
107
  )}
88
108
  {((name && icon && !text) || (name && icon && text)) && (
@@ -93,12 +113,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
93
113
  size="xxs"
94
114
  status={null}
95
115
  />
96
- <Title
97
- className="pb_form_pill_text"
98
- size={4}
99
- text={name}
100
- truncate={props.truncate}
101
- />
116
+ {renderTitle(name, "pb_form_pill_text")}
102
117
  <Icon
103
118
  className="pb_form_pill_icon"
104
119
  color={color}
@@ -113,22 +128,10 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
113
128
  color={color}
114
129
  icon={icon}
115
130
  />
116
- <Title
117
- className="pb_form_pill_tag"
118
- size={4}
119
- text={text}
120
- truncate={props.truncate}
121
- />
131
+ {renderTitle(text, "pb_form_pill_tag")}
122
132
  </>
123
133
  )}
124
- {(!name && !icon && text) && (
125
- <Title
126
- className="pb_form_pill_tag"
127
- size={4}
128
- text={text}
129
- truncate={props.truncate}
130
- />
131
- )}
134
+ {(!name && !icon && text) && renderTitle(text, "pb_form_pill_tag")}
132
135
  <div
133
136
  className="pb_form_pill_close"
134
137
  onClick={onClick}
@@ -143,4 +146,5 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
143
146
  </div>
144
147
  )
145
148
  }
149
+
146
150
  export default FormPill
@@ -13,7 +13,30 @@
13
13
  id: "typeahead-form-pill",
14
14
  is_multi: true,
15
15
  options: names,
16
- label: "Names",
16
+ label: "Truncation Within Typeahead",
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 Typeahead from '../../pb_typeahead/_typeahead'
2
+ import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
3
3
 
4
4
  const names = [
5
5
  { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
@@ -15,11 +15,34 @@ const FormPillTruncatedText = (props) => {
15
15
  <Typeahead
16
16
  htmlOptions={{ style: { maxWidth: "240px" }}}
17
17
  isMulti
18
- label="Names"
18
+ label="Truncation Within Typeahead"
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>
23
46
  </>
24
47
  )
25
48
  }
@@ -0,0 +1,3 @@
1
+ For Form 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.
2
+
3
+ __NOTE__: For Rails Form Pills (not ones embedded within a React-rendered Typeahead or MultiLevelSelect), a unique `id` is required to enable the Tooltip functionality displaying the text or tag section of the Form Pill.
@@ -0,0 +1 @@
1
+ For Form Pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.