playbook_ui 14.6.2.pre.alpha.PLAY1613darkdatetimecolors4432 → 14.6.2.pre.alpha.PLAY15814348
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +28 -21
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -37
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +2 -13
- data/app/pb_kits/playbook/pb_card/_card.tsx +3 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +17 -3
- data/app/pb_kits/playbook/pb_date/_date.scss +0 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +7 -8
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -6
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +26 -30
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +1 -24
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +2 -25
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +8 -46
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +23 -59
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +0 -8
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +21 -17
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -4
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -84
- data/app/pb_kits/playbook/utilities/_hover.scss +43 -46
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +0 -5
- data/dist/chunks/_typeahead-BtdghxJo.js +22 -0
- data/dist/chunks/_weekday_stacked-D1RoR5CN.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -4
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/hover.rb +1 -4
- data/lib/playbook/kit_base.rb +15 -33
- data/lib/playbook/version.rb +1 -1
- metadata +5 -37
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +0 -3
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +0 -37
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +0 -67
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +0 -40
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +0 -51
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +0 -26
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +0 -11
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +0 -59
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +0 -20
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +0 -13
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +0 -12
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +0 -8
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +0 -81
- data/app/pb_kits/playbook/pb_timeline/detail.html.erb +0 -3
- data/app/pb_kits/playbook/pb_timeline/detail.rb +0 -11
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -43
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -68
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +0 -2
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +0 -12
- data/app/pb_kits/playbook/pb_timeline/label.rb +0 -13
- data/app/pb_kits/playbook/pb_timeline/step.html.erb +0 -14
- data/app/pb_kits/playbook/pb_timeline/step.rb +0 -16
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +0 -29
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -38
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +0 -42
- data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +0 -3
- data/dist/chunks/_typeahead-DhLic2Fe.js +0 -22
- data/dist/chunks/_weekday_stacked-Mx8TYP5I.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 014bc2684f60ff1adb9fdcdf0d8602a2ca8a0d7b47389b12af8a5a5402fa5017
|
4
|
+
data.tar.gz: 949941602000ddd6530a70c74d8cb647ea7c95537895bd7abb2abc3e09d96926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee89877910514e40e1203e7d920bdc9e778598740db0b38006d39a1441c2e1ab7c014061c533d8685038aa63ba4825f3c1fd9df504b881b13bf0314a242b1ecf
|
7
|
+
data.tar.gz: 201c7a4d5b40a73f97a1b17727d900aff6bf1e0dea35944c78c11953bfc97cff720a4f913aac7017ca19704cbdba8ebbcf6b6d584f15ec88d396ea212322fdcd
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
@import 'pb_advanced_table/advanced_table';
|
2
3
|
@import 'pb_avatar/avatar';
|
3
4
|
@import 'pb_avatar_action_button/avatar_action_button';
|
@@ -84,7 +85,6 @@
|
|
84
85
|
@import 'pb_selectable_card_icon/selectable_card_icon';
|
85
86
|
@import 'pb_selectable_icon/selectable_icon';
|
86
87
|
@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,7 +16,6 @@ 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
|
20
19
|
}
|
21
20
|
|
22
21
|
export const CustomCell = ({
|
@@ -24,7 +23,6 @@ export const CustomCell = ({
|
|
24
23
|
onRowToggleClick,
|
25
24
|
row,
|
26
25
|
value,
|
27
|
-
customRenderer,
|
28
26
|
}: CustomCellProps & GlobalProps) => {
|
29
27
|
const { setExpanded, expanded, expandedControl, inlineRowLoading } = useContext(AdvancedTableContext);
|
30
28
|
|
@@ -63,12 +61,7 @@ export const CustomCell = ({
|
|
63
61
|
</button>
|
64
62
|
) : null}
|
65
63
|
<FlexItem paddingLeft={renderButton? "none" : "xs"}>
|
66
|
-
{row.depth === 0 ? (
|
67
|
-
customRenderer ? customRenderer(row, getValue()) : getValue()
|
68
|
-
) :(
|
69
|
-
customRenderer ? customRenderer(row, value) : value
|
70
|
-
)
|
71
|
-
}
|
64
|
+
{row.depth === 0 ? getValue() : value}
|
72
65
|
</FlexItem>
|
73
66
|
</Flex>
|
74
67
|
</div>
|
@@ -90,8 +90,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
90
90
|
|
91
91
|
const columnHelper = createColumnHelper()
|
92
92
|
|
93
|
-
//Create cells for
|
94
|
-
const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element
|
93
|
+
//Create cells for first columns
|
94
|
+
const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element) => {
|
95
95
|
const columnCells = ({
|
96
96
|
row,
|
97
97
|
getValue,
|
@@ -101,16 +101,19 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
101
101
|
}) => {
|
102
102
|
const rowData = row.original
|
103
103
|
|
104
|
-
if
|
104
|
+
// Use customRenderer if provided, otherwise default rendering
|
105
|
+
if (customRenderer) {
|
106
|
+
return customRenderer(row, getValue())
|
107
|
+
}
|
108
|
+
|
105
109
|
switch (row.depth) {
|
106
110
|
case 0: {
|
107
111
|
return (
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
/>
|
112
|
+
<CustomCell
|
113
|
+
getValue={getValue}
|
114
|
+
onRowToggleClick={onRowToggleClick}
|
115
|
+
row={row}
|
116
|
+
/>
|
114
117
|
)
|
115
118
|
}
|
116
119
|
default: {
|
@@ -119,7 +122,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
119
122
|
const accessorValue = rowData[depthAccessor]
|
120
123
|
return accessorValue ? (
|
121
124
|
<CustomCell
|
122
|
-
customRenderer={customRenderer}
|
123
125
|
onRowToggleClick={onRowToggleClick}
|
124
126
|
row={row}
|
125
127
|
value={accessorValue}
|
@@ -130,13 +132,11 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
130
132
|
}
|
131
133
|
}
|
132
134
|
}
|
133
|
-
|
134
|
-
? customRenderer(row, getValue())
|
135
|
-
: getValue()
|
136
|
-
}
|
135
|
+
|
137
136
|
return columnCells
|
138
137
|
}
|
139
|
-
|
138
|
+
|
139
|
+
//Create column array in format needed by Tanstack
|
140
140
|
const columns =
|
141
141
|
columnDefinitions &&
|
142
142
|
columnDefinitions.map((column, index) => {
|
@@ -147,12 +147,19 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
147
147
|
}),
|
148
148
|
}
|
149
149
|
|
150
|
-
if
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
+
}
|
156
163
|
}
|
157
164
|
|
158
165
|
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
|
4
|
+
import { AdvancedTable } from "playbook-ui"
|
5
5
|
|
6
6
|
const MOCK_DATA = [
|
7
7
|
{
|
@@ -88,28 +88,6 @@ 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
|
-
|
113
91
|
const subRowHeaders = ["Quarter"]
|
114
92
|
|
115
93
|
const testId = "advanced_table"
|
@@ -485,17 +463,3 @@ test("responsive none prop functions as expected", () => {
|
|
485
463
|
const kit = screen.getByTestId(testId)
|
486
464
|
expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
|
487
465
|
})
|
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
|
2
|
+
import { AdvancedTable, Pill, Body, Flex, Detail, Caption } from "playbook-ui"
|
3
3
|
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
4
|
|
5
5
|
const AdvancedTableCustomCell = (props) => {
|
@@ -8,18 +8,7 @@ const AdvancedTableCustomCell = (props) => {
|
|
8
8
|
accessor: "year",
|
9
9
|
label: "Year",
|
10
10
|
cellAccessors: ["quarter", "month", "day"],
|
11
|
-
|
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
|
-
),
|
11
|
+
|
23
12
|
},
|
24
13
|
{
|
25
14
|
accessor: "newEnrollments",
|
@@ -109,8 +109,8 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
109
109
|
// coerce to array
|
110
110
|
const cardChildren = React.Children.toArray(children)
|
111
111
|
const dynamicInlineProps = globalInlineProps(props);
|
112
|
-
const { style: htmlStyle
|
113
|
-
const mergedStyles
|
112
|
+
const { style: htmlStyle, ...restHtmlProps } = htmlProps;
|
113
|
+
const mergedStyles = { ...htmlStyle, ...dynamicInlineProps };
|
114
114
|
|
115
115
|
|
116
116
|
const subComponentTags = (tagName: string) => {
|
@@ -135,6 +135,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
135
135
|
<Draggable.Item dragId={dragId}
|
136
136
|
key={dragId}
|
137
137
|
>
|
138
|
+
<h1>{htmlProps}</h1>
|
138
139
|
<Tag
|
139
140
|
{...ariaProps}
|
140
141
|
{...dataProps}
|
@@ -1,12 +1,26 @@
|
|
1
|
-
import React from
|
2
|
-
import Card from
|
1
|
+
import React from "react"
|
2
|
+
import Card from "../_card"
|
3
3
|
|
4
4
|
const CardLight = (props) => {
|
5
5
|
return (
|
6
6
|
<div>
|
7
|
-
<Card
|
7
|
+
<Card
|
8
|
+
height="100%"
|
9
|
+
htmlOptions={{
|
10
|
+
style: {
|
11
|
+
width: "100%",
|
12
|
+
backgroundColor: "blue",
|
13
|
+
},
|
14
|
+
tabIndex: 7
|
15
|
+
}}
|
16
|
+
minHeight="189px"
|
17
|
+
{...props}
|
18
|
+
>
|
19
|
+
{"HELLO WORLD!!!"}
|
20
|
+
</Card>
|
8
21
|
</div>
|
9
22
|
)
|
10
23
|
}
|
11
24
|
|
12
25
|
export default CardLight
|
26
|
+
|
@@ -47,7 +47,7 @@ interface DropdownComponent
|
|
47
47
|
Container: typeof DropdownContainer;
|
48
48
|
}
|
49
49
|
|
50
|
-
|
50
|
+
const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
51
51
|
const {
|
52
52
|
aria = {},
|
53
53
|
autocomplete = false,
|
@@ -260,7 +260,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
260
260
|
<DropdownContainer>
|
261
261
|
{optionsWithBlankSelection &&
|
262
262
|
optionsWithBlankSelection?.map((option: GenericObject) => (
|
263
|
-
<
|
263
|
+
<Dropdown.Option key={option.id}
|
264
264
|
option={option}
|
265
265
|
/>
|
266
266
|
))}
|
@@ -278,12 +278,11 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
278
278
|
</DropdownContext.Provider>
|
279
279
|
</div>
|
280
280
|
)
|
281
|
-
}
|
281
|
+
}) as DropdownComponent
|
282
282
|
|
283
|
-
Dropdown =
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
(Dropdown as DropdownComponent).Container = DropdownContainer;
|
283
|
+
Dropdown.displayName = "Dropdown";
|
284
|
+
Dropdown.Option = DropdownOption;
|
285
|
+
Dropdown.Trigger = DropdownTrigger;
|
286
|
+
Dropdown.Container = DropdownContainer;
|
288
287
|
|
289
288
|
export default Dropdown;
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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) &&
|
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: "
|
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
|
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="
|
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.
|
@@ -1,57 +1,19 @@
|
|
1
1
|
<%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
|
2
2
|
<% if object.name.present? %>
|
3
3
|
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xxs" }) %>
|
4
|
-
|
5
|
-
<div>
|
6
|
-
<%= pb_rails("title", props: {
|
7
|
-
classname: "pb_form_pill_text truncate_#{object.truncate}",
|
8
|
-
id: object.id,
|
9
|
-
size: 4,
|
10
|
-
text: object.name,
|
11
|
-
}) %>
|
12
|
-
<% if object.id.present? %>
|
13
|
-
<%= pb_rails("tooltip", props: {
|
14
|
-
position: "top",
|
15
|
-
tooltip_id: "tooltip-#{object.id}",
|
16
|
-
trigger_element_selector: "##{object.id}"
|
17
|
-
}) do %>
|
18
|
-
<%= object.name %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
</div>
|
22
|
-
<% else %>
|
23
|
-
<%= pb_rails("title", props: { classname: "pb_form_pill_text", id: object.id, size: 4, text: object.name }) %>
|
24
|
-
<% end %>
|
4
|
+
<%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
|
25
5
|
<% if object.icon.present? %>
|
26
6
|
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
27
7
|
<% end %>
|
28
8
|
<% elsif object.text.present? %>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
classname: "pb_form_pill_tag truncate_#{object.truncate}",
|
36
|
-
id: object.id,
|
37
|
-
size: 4,
|
38
|
-
text: object.text,
|
39
|
-
}) %>
|
40
|
-
<% if object.id.present? %>
|
41
|
-
<%= pb_rails("tooltip", props: {
|
42
|
-
position: "top",
|
43
|
-
tooltip_id: "tooltip-#{object.id}",
|
44
|
-
trigger_element_selector: "##{object.id}"
|
45
|
-
}) do %>
|
46
|
-
<%= object.text %>
|
47
|
-
<% end %>
|
48
|
-
<% end %>
|
49
|
-
</div>
|
50
|
-
<% else %>
|
51
|
-
<%= pb_rails("title", props: { classname: "pb_form_pill_tag", id: object.id, size: 4, text: object.text, }) %>
|
52
|
-
<% end %>
|
9
|
+
<% if object.icon.present? %>
|
10
|
+
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
11
|
+
<% end %>
|
12
|
+
<% if object.text.present? %>
|
13
|
+
<%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
|
14
|
+
<% end %>
|
53
15
|
<% end %>
|
54
16
|
<%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
|
55
17
|
<%= pb_rails("icon", props: { icon: 'times', fixed_width: true, size: object.close_icon_size }) %>
|
56
18
|
<% end %>
|
57
|
-
<% end %>
|
19
|
+
<% end %>
|