playbook_ui 14.6.0 → 14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +2 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -5
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -3
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +2 -8
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -3
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -7
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +32 -26
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +22 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +39 -7
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +2 -0
- data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
- data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
- data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
- data/app/pb_kits/playbook/pb_link/link.rb +44 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -3
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -39
- data/dist/chunks/_typeahead-CGyRnRCQ.js +22 -0
- data/dist/chunks/{_weekday_stacked-C_QAqbqJ.js → _weekday_stacked-BTMWkeKM.js} +3 -3
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +3 -0
- 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/kit_base.rb +1 -21
- data/lib/playbook/version.rb +2 -2
- metadata +24 -7
- data/dist/chunks/_typeahead-BhHnXJjy.js +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ab9a27621b94e30352163a1c90f30e4cfa79ff773f1933c308c40f3345c164
|
4
|
+
data.tar.gz: 2333af54c76ad12538d3c3b59c41561d1821abc7591e8afa7eca81df1748a4f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63432e88ba76ed2231c9168dabee21ebb9573b95953667f28a9b151c8859cc9452d28467e100b7c51a73fdc0d2d20ebb13dde853d61b6aa581239b73ea0071da
|
7
|
+
data.tar.gz: a3268da60a7c6c0fca9769fa79fa0e5527c556a99f72d8787f4e39f1846057f70f0db22cb7dcefa7977b42eabadd7e68b47a092e3009aca88c9ebb6359a006ea
|
@@ -30,6 +30,7 @@
|
|
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';
|
33
34
|
@import 'pb_dropdown/dropdown';
|
34
35
|
@import 'pb_file_upload/file_upload';
|
35
36
|
@import 'pb_filter/filter';
|
@@ -54,6 +55,7 @@
|
|
54
55
|
@import 'pb_legend/legend';
|
55
56
|
@import 'pb_lightbox/lightbox';
|
56
57
|
@import 'pb_line_graph/line_graph';
|
58
|
+
@import 'pb_link/link';
|
57
59
|
@import 'pb_list/list';
|
58
60
|
@import 'pb_loading_inline/loading_inline';
|
59
61
|
@import 'pb_map/map';
|
@@ -106,7 +108,6 @@
|
|
106
108
|
@import 'pb_user_badge/user_badge';
|
107
109
|
@import 'pb_walkthrough/walkthrough';
|
108
110
|
@import 'pb_weekday_stacked/weekday_stacked';
|
109
|
-
@import 'pb_drawer/drawer';
|
110
111
|
@import 'utilities/mixins';
|
111
112
|
@import 'utilities/spacing';
|
112
113
|
@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
|
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,7 +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
110
|
|
113
111
|
const subComponentTags = (tagName: string) => {
|
114
112
|
return cardChildren.filter((c: string) => (
|
@@ -137,7 +135,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
137
135
|
{...dataProps}
|
138
136
|
{...htmlProps}
|
139
137
|
className={classnames(cardCss, globalProps(props), className)}
|
140
|
-
style={dynamicInlineProps}
|
141
138
|
>
|
142
139
|
{subComponentTags('Header')}
|
143
140
|
{
|
@@ -166,7 +163,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
166
163
|
{...dataProps}
|
167
164
|
{...htmlProps}
|
168
165
|
className={classnames(cardCss, globalProps(props), className)}
|
169
|
-
style={dynamicInlineProps}
|
170
166
|
>
|
171
167
|
{subComponentTags('Header')}
|
172
168
|
{nonHeaderChildren}
|
@@ -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
|
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"
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
@import "./scss_partials/dropdown_animation";
|
11
11
|
|
12
|
-
|
12
|
+
[class*="pb_dropdown"] {
|
13
13
|
.dropdown_wrapper {
|
14
14
|
[class*="dropdown_trigger_wrapper"] {
|
15
15
|
@include pb_body;
|
@@ -131,7 +131,7 @@
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
|
134
|
-
|
134
|
+
&[class*="separators_hidden"] {
|
135
135
|
.dropdown_wrapper {
|
136
136
|
.pb_dropdown_container {
|
137
137
|
|
@@ -142,7 +142,7 @@
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
145
|
-
|
145
|
+
&[class*="subtle"] {
|
146
146
|
.dropdown_wrapper {
|
147
147
|
.pb_dropdown_container {
|
148
148
|
|
@@ -178,7 +178,7 @@
|
|
178
178
|
}
|
179
179
|
}
|
180
180
|
|
181
|
-
|
181
|
+
&[class*="separators_hidden"] {
|
182
182
|
.dropdown_wrapper {
|
183
183
|
.pb_dropdown_container {
|
184
184
|
[class*="pb_dropdown_option"]:first-child {
|
@@ -74,10 +74,8 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
74
74
|
const htmlProps = buildHtmlProps(htmlOptions);
|
75
75
|
const separatorsClass = separators ? '' : 'separators_hidden'
|
76
76
|
const classes = classnames(
|
77
|
-
buildCss("pb_dropdown"),
|
77
|
+
buildCss("pb_dropdown", variant, separatorsClass),
|
78
78
|
globalProps(props),
|
79
|
-
variant,
|
80
|
-
separatorsClass,
|
81
79
|
className
|
82
80
|
);
|
83
81
|
|
@@ -24,7 +24,7 @@ module Playbook
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def classname
|
27
|
-
generate_classname("pb_dropdown", variant, separators_class
|
27
|
+
generate_classname("pb_dropdown", variant, separators_class)
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -38,7 +38,7 @@ module Playbook
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def separators_class
|
41
|
-
separators ?
|
41
|
+
separators ? nil : "separators_hidden"
|
42
42
|
end
|
43
43
|
|
44
44
|
def options_with_blank
|
@@ -50,7 +50,7 @@ test('generated default kit and classname', () => {
|
|
50
50
|
|
51
51
|
const kit = screen.getByTestId(testId)
|
52
52
|
expect(kit).toBeInTheDocument()
|
53
|
-
expect(kit).toHaveClass('
|
53
|
+
expect(kit).toHaveClass('pb_dropdown_default')
|
54
54
|
})
|
55
55
|
|
56
56
|
test('generated default Trigger and Container when none passed in', () => {
|
@@ -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
|
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
|
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={
|
45
|
+
style={fixedStyle}
|
52
46
|
>
|
53
47
|
{children}
|
54
48
|
</div>
|
@@ -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
|
24
|
-
|
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,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
|
|
@@ -21,6 +22,7 @@ type FormPillProps = {
|
|
21
22
|
data?: {[key: string]: string},
|
22
23
|
tabIndex?: number,
|
23
24
|
icon?: string,
|
25
|
+
truncate?: number,
|
24
26
|
closeProps?: {
|
25
27
|
onClick?: React.MouseEventHandler<HTMLSpanElement>,
|
26
28
|
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
|
@@ -43,6 +45,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
43
45
|
data = {},
|
44
46
|
tabIndex,
|
45
47
|
icon = "",
|
48
|
+
truncate,
|
46
49
|
} = props
|
47
50
|
|
48
51
|
const iconClass = icon ? "_icon" : ""
|
@@ -62,6 +65,30 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
62
65
|
const dataProps = buildDataProps(data)
|
63
66
|
const htmlProps = buildHtmlProps(htmlOptions)
|
64
67
|
|
68
|
+
const renderTitle = (content: string, className: string) => {
|
69
|
+
const titleComponent = (
|
70
|
+
<Title
|
71
|
+
className={className}
|
72
|
+
size={4}
|
73
|
+
text={content}
|
74
|
+
truncate={truncate}
|
75
|
+
/>
|
76
|
+
)
|
77
|
+
if (truncate) {
|
78
|
+
return (
|
79
|
+
<Tooltip
|
80
|
+
interaction
|
81
|
+
placement="top"
|
82
|
+
position="fixed"
|
83
|
+
text={content}
|
84
|
+
>
|
85
|
+
{titleComponent}
|
86
|
+
</Tooltip>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
return titleComponent
|
90
|
+
}
|
91
|
+
|
65
92
|
return (
|
66
93
|
<div className={css}
|
67
94
|
id={id}
|
@@ -77,12 +104,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
77
104
|
size="xxs"
|
78
105
|
status={null}
|
79
106
|
/>
|
80
|
-
|
81
|
-
className="pb_form_pill_text"
|
82
|
-
size={4}
|
83
|
-
text={name}
|
84
|
-
truncate={props.truncate}
|
85
|
-
/>
|
107
|
+
{renderTitle(name, "pb_form_pill_text")}
|
86
108
|
</>
|
87
109
|
)}
|
88
110
|
{((name && icon && !text) || (name && icon && text)) && (
|
@@ -93,12 +115,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
93
115
|
size="xxs"
|
94
116
|
status={null}
|
95
117
|
/>
|
96
|
-
|
97
|
-
className="pb_form_pill_text"
|
98
|
-
size={4}
|
99
|
-
text={name}
|
100
|
-
truncate={props.truncate}
|
101
|
-
/>
|
118
|
+
{renderTitle(name, "pb_form_pill_text")}
|
102
119
|
<Icon
|
103
120
|
className="pb_form_pill_icon"
|
104
121
|
color={color}
|
@@ -113,22 +130,10 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
113
130
|
color={color}
|
114
131
|
icon={icon}
|
115
132
|
/>
|
116
|
-
|
117
|
-
className="pb_form_pill_tag"
|
118
|
-
size={4}
|
119
|
-
text={text}
|
120
|
-
truncate={props.truncate}
|
121
|
-
/>
|
133
|
+
{renderTitle(text, "pb_form_pill_tag")}
|
122
134
|
</>
|
123
135
|
)}
|
124
|
-
{(!name && !icon && text) && (
|
125
|
-
<Title
|
126
|
-
className="pb_form_pill_tag"
|
127
|
-
size={4}
|
128
|
-
text={text}
|
129
|
-
truncate={props.truncate}
|
130
|
-
/>
|
131
|
-
)}
|
136
|
+
{(!name && !icon && text) && renderTitle(text, "pb_form_pill_tag")}
|
132
137
|
<div
|
133
138
|
className="pb_form_pill_close"
|
134
139
|
onClick={onClick}
|
@@ -143,4 +148,5 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
143
148
|
</div>
|
144
149
|
)
|
145
150
|
}
|
151
|
+
|
146
152
|
export default FormPill
|
@@ -13,7 +13,28 @@
|
|
13
13
|
id: "typeahead-form-pill",
|
14
14
|
is_multi: true,
|
15
15
|
options: names,
|
16
|
-
label: "
|
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
|
+
}) %>
|
29
|
+
<%= pb_rails("form_pill", props: {
|
30
|
+
icon: "badge-check",
|
31
|
+
text: "icon and a very long tag to show truncation",
|
32
|
+
tabindex: 0,
|
33
|
+
truncate: 1,
|
34
|
+
}) %>
|
35
|
+
<%= pb_rails("form_pill", props: {
|
36
|
+
text: "form pill with a very long tag to show truncation",
|
37
|
+
tabindex: 0,
|
38
|
+
truncate: 1,
|
39
|
+
}) %>
|
40
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import Typeahead from '
|
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="
|
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
|
}
|
@@ -1 +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
|
+
For 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.
|
@@ -1,19 +1,51 @@
|
|
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
|
-
|
4
|
+
<% element_id = "pill_#{object.name.parameterize}" %>
|
5
|
+
<div>
|
6
|
+
<%= pb_rails("title", props: {
|
7
|
+
classname: "pb_form_pill_text #{object.truncate ? "truncate_#{object.truncate}" : ""}",
|
8
|
+
id: element_id,
|
9
|
+
size: 4,
|
10
|
+
text: object.name,
|
11
|
+
}) %>
|
12
|
+
<% if object.truncate %>
|
13
|
+
<%= pb_rails("tooltip", props: {
|
14
|
+
position: "top",
|
15
|
+
tooltip_id: "tooltip-#{element_id}",
|
16
|
+
trigger_element_selector: "##{element_id}"
|
17
|
+
}) do %>
|
18
|
+
<%= object.name %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
5
22
|
<% if object.icon.present? %>
|
6
23
|
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
7
24
|
<% end %>
|
8
25
|
<% elsif object.text.present? %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
26
|
+
<% if object.icon.present? %>
|
27
|
+
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
28
|
+
<% end %>
|
29
|
+
<% element_id = "pill_#{object.text.parameterize}" %>
|
30
|
+
<div>
|
31
|
+
<%= pb_rails("title", props: {
|
32
|
+
classname: "pb_form_pill_tag #{object.truncate ? "truncate_#{object.truncate}" : ""}",
|
33
|
+
id: element_id,
|
34
|
+
size: 4,
|
35
|
+
text: object.text
|
36
|
+
}) %>
|
37
|
+
<% if object.truncate %>
|
38
|
+
<%= pb_rails("tooltip", props: {
|
39
|
+
position: "top",
|
40
|
+
tooltip_id: "tooltip-#{element_id}",
|
41
|
+
trigger_element_selector: "##{element_id}"
|
42
|
+
}) do %>
|
43
|
+
<%= object.text %>
|
44
|
+
<% end %>
|
14
45
|
<% end %>
|
46
|
+
</div>
|
15
47
|
<% end %>
|
16
48
|
<%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
|
17
49
|
<%= pb_rails("icon", props: { icon: 'times', fixed_width: true, size: object.close_icon_size }) %>
|
18
50
|
<% end %>
|
19
|
-
<% end %>
|
51
|
+
<% end %>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
@import "../tokens/line_height";
|
3
|
+
@import "../tokens/typography";
|
4
|
+
@import "../tokens/border_radius";
|
5
|
+
|
6
|
+
[class^=pb_link_kit]{
|
7
|
+
@include pb_link($primary);
|
8
|
+
&:hover {
|
9
|
+
color: $text_lt_default;
|
10
|
+
}
|
11
|
+
&:focus {
|
12
|
+
outline: none;
|
13
|
+
}
|
14
|
+
&:focus-visible {
|
15
|
+
border-radius: $border_rad_light;
|
16
|
+
outline: 1px solid $primary;
|
17
|
+
outline-offset: 2px;
|
18
|
+
}
|
19
|
+
&:visited {
|
20
|
+
color: $data_3;
|
21
|
+
}
|
22
|
+
&.dark {
|
23
|
+
@include pb_link($active_dark);
|
24
|
+
&:hover {
|
25
|
+
color: $text_dk_default;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
@each $color_name, $color_value in $pb_link_colors {
|
29
|
+
&[class*=_#{"" + $color_name}] {
|
30
|
+
@include pb_link($color_value);
|
31
|
+
|
32
|
+
&:hover {
|
33
|
+
color: map-get($pb_link_hover_colors, $color_name);
|
34
|
+
}
|
35
|
+
|
36
|
+
&:visited {
|
37
|
+
color: $data_3;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
@each $dark_color_name, $dark_color_value in $pb_dark_link_colors{
|
43
|
+
&[class*=_#{$dark_color_name}][class*=dark]{
|
44
|
+
@include pb_link($dark_color_value);
|
45
|
+
|
46
|
+
&:hover {
|
47
|
+
color: map-get($pb_dark_link_hover_colors, $dark_color_name);
|
48
|
+
}
|
49
|
+
|
50
|
+
&:visited {
|
51
|
+
color: $data_3;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
&[class*=_underline] {
|
57
|
+
text-decoration: underline;
|
58
|
+
}
|
59
|
+
|
60
|
+
&[class*=_disabled] {
|
61
|
+
pointer-events: none;
|
62
|
+
cursor: default;
|
63
|
+
color: $text_lt_lighter;
|
64
|
+
}
|
65
|
+
|
66
|
+
}
|