playbook_ui 14.14.0.pre.alpha.play1852reacthookformsupportradio6318 → 14.14.0.pre.alpha.play1922tooltipfloatingui6361
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/pb_currency/_currency.tsx +46 -31
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +15 -8
- data/app/pb_kits/playbook/pb_currency/currency.rb +17 -2
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +22 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx +34 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +74 -85
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_radio/radio.test.js +0 -16
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +26 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +282 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +10 -2
- data/dist/chunks/{_typeahead-8okiJBmN.js → _typeahead-BGTMEmj7.js} +2 -2
- data/dist/chunks/_weekday_stacked-De2TduOp.js +45 -0
- data/dist/chunks/{lib-D3us1bGD.js → lib-Fr78pbpF.js} +1 -1
- data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-CN51bfsD.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/version.rb +1 -1
- metadata +14 -8
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +0 -60
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +0 -1
- data/dist/chunks/_weekday_stacked-DrKLZrfR.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: 502cec589e04f1dadf9f1031362601dc45cd275a31e6adbe7740fff375ea51ad
|
4
|
+
data.tar.gz: d6503c736579de2429555d24c9d7deaa184c0be62a7d7ec7c3cfffbccb44da4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e19a779db35a93ad46589bb48a6341a5829843b81567e82f0f2a6cee8cdd7d9d9a2f9a7ae16105f51e70505db96747217d8306f12bcf49dcf8942179a5e157c0
|
7
|
+
data.tar.gz: 422d4862023de1ccd5c0a154dbe4cd57757c289072626fa35e57706050468b61b2e8935a816b59dc4f64218a9958b8272b482eca3ef3b88d5f42233b79e4aeb3
|
@@ -21,6 +21,7 @@ type CurrencyProps = {
|
|
21
21
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
22
22
|
id?: string,
|
23
23
|
label?: string,
|
24
|
+
nullDisplay?: string,
|
24
25
|
size?: 'sm' | 'md' | 'lg',
|
25
26
|
symbol?: string,
|
26
27
|
variant?: 'default' | 'light' | 'bold',
|
@@ -49,6 +50,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
49
50
|
unit,
|
50
51
|
className,
|
51
52
|
label = '',
|
53
|
+
nullDisplay = '',
|
52
54
|
size = 'sm',
|
53
55
|
symbol = '$',
|
54
56
|
variant = 'default',
|
@@ -118,44 +120,57 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
118
120
|
id={id}
|
119
121
|
>
|
120
122
|
<Caption dark={dark}>{label}</Caption>
|
121
|
-
|
122
123
|
<div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
|
123
124
|
{unstyled ? (
|
124
|
-
|
125
|
-
<div>{
|
126
|
-
|
127
|
-
|
128
|
-
{
|
129
|
-
{
|
130
|
-
|
131
|
-
|
125
|
+
nullDisplay && !amount ? (
|
126
|
+
<div>{nullDisplay}</div>
|
127
|
+
) : (
|
128
|
+
<>
|
129
|
+
<div>{handleNegative}{symbol}</div>
|
130
|
+
<div>{getAmount}</div>
|
131
|
+
<div>
|
132
|
+
{getAbbreviation}
|
133
|
+
{unit ? unit : getDecimalValue}
|
134
|
+
</div>
|
135
|
+
</>
|
136
|
+
)
|
132
137
|
) : (
|
133
|
-
|
134
|
-
<Body
|
135
|
-
className="dollar_sign"
|
136
|
-
color="light"
|
137
|
-
dark={dark}
|
138
|
-
>
|
139
|
-
{handleNegative}{symbol}
|
140
|
-
</Body>
|
141
|
-
|
138
|
+
nullDisplay && !amount ? (
|
142
139
|
<Title
|
143
140
|
className="pb_currency_value"
|
144
141
|
dark={dark}
|
145
142
|
size={sizes[size]}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
143
|
+
>
|
144
|
+
{nullDisplay}
|
145
|
+
</Title>
|
146
|
+
) : (
|
147
|
+
<>
|
148
|
+
<Body
|
149
|
+
className="dollar_sign"
|
150
|
+
color="light"
|
151
|
+
dark={dark}
|
152
|
+
>
|
153
|
+
{handleNegative}{symbol}
|
154
|
+
</Body>
|
155
|
+
|
156
|
+
<Title
|
157
|
+
className="pb_currency_value"
|
158
|
+
dark={dark}
|
159
|
+
size={sizes[size]}
|
160
|
+
>
|
161
|
+
{getAmount}
|
162
|
+
</Title>
|
163
|
+
|
164
|
+
<Body
|
165
|
+
className="unit"
|
166
|
+
color="light"
|
167
|
+
dark={dark}
|
168
|
+
>
|
169
|
+
{getAbbreviation}
|
170
|
+
{unit ? unit : getDecimalValue}
|
171
|
+
</Body>
|
172
|
+
</>
|
173
|
+
)
|
159
174
|
)}
|
160
175
|
</div>
|
161
176
|
</div>
|
@@ -1,17 +1,24 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
2
|
<%= pb_rails("caption", props: object.caption_props) %>
|
3
|
-
|
4
3
|
<div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
|
5
4
|
<% if object.unstyled %>
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
<% if object.null_display && object.amount.blank? %>
|
6
|
+
<div><%= object.null_display %></div>
|
7
|
+
<% else %>
|
8
|
+
<div><%= object.negative_sign %><%= object.symbol %></div>
|
9
|
+
<div><%= object.title_props[:text] %></div>
|
10
|
+
<div><%= object.body_props[:text] %></div>
|
11
|
+
<% end %>
|
9
12
|
<% else %>
|
10
|
-
|
11
|
-
<%=
|
13
|
+
<% if object.null_display && object.amount.blank? %>
|
14
|
+
<%= pb_rails("title", props: object.title_props) %>
|
15
|
+
<% else %>
|
16
|
+
<%= pb_rails("body", props: object.currency_wrapper_props) do %>
|
17
|
+
<%= object.negative_sign %><%= object.symbol %>
|
18
|
+
<% end %>
|
19
|
+
<%= pb_rails("title", props: object.title_props) %>
|
20
|
+
<%= pb_rails("body", props: object.body_props) %>
|
12
21
|
<% end %>
|
13
|
-
<%= pb_rails("title", props: object.title_props) %>
|
14
|
-
<%= pb_rails("body", props: object.body_props) %>
|
15
22
|
<% end %>
|
16
23
|
</div>
|
17
24
|
<% end %>
|
@@ -46,6 +46,9 @@ module Playbook
|
|
46
46
|
prop :comma_separator, type: Playbook::Props::Boolean,
|
47
47
|
default: false
|
48
48
|
|
49
|
+
prop :null_display, type: Playbook::Props::String,
|
50
|
+
required: false
|
51
|
+
|
49
52
|
def classname
|
50
53
|
generate_classname("pb_currency_kit", align, size, dark_class)
|
51
54
|
end
|
@@ -65,10 +68,20 @@ module Playbook
|
|
65
68
|
}
|
66
69
|
end
|
67
70
|
|
71
|
+
def title_text
|
72
|
+
if null_display
|
73
|
+
null_display
|
74
|
+
elsif swap_negative
|
75
|
+
absolute_amount(abbr_or_format_amount)
|
76
|
+
else
|
77
|
+
abbr_or_format_amount
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
68
81
|
def title_props
|
69
82
|
{
|
70
83
|
size: size_value,
|
71
|
-
text:
|
84
|
+
text: title_text,
|
72
85
|
classname: "pb_currency_value",
|
73
86
|
dark: dark,
|
74
87
|
}
|
@@ -145,8 +158,10 @@ module Playbook
|
|
145
158
|
1
|
146
159
|
when "md"
|
147
160
|
3
|
148
|
-
|
161
|
+
when "sm"
|
149
162
|
4
|
163
|
+
else
|
164
|
+
3
|
150
165
|
end
|
151
166
|
end
|
152
167
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= pb_rails("currency", props: {
|
2
|
+
amount: "",
|
3
|
+
label: "Nil",
|
4
|
+
margin_bottom: "md",
|
5
|
+
null_display: "--",
|
6
|
+
size: "sm"
|
7
|
+
}) %>
|
8
|
+
|
9
|
+
<%= pb_rails("currency", props: {
|
10
|
+
amount: "",
|
11
|
+
label: "Nil",
|
12
|
+
margin_bottom: "md",
|
13
|
+
null_display: "$0.00",
|
14
|
+
size: "sm"
|
15
|
+
}) %>
|
16
|
+
|
17
|
+
<%= pb_rails("currency", props: {
|
18
|
+
amount: "",
|
19
|
+
label: "Nil",
|
20
|
+
null_display: " ",
|
21
|
+
size: "sm"
|
22
|
+
}) %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Currency } from 'playbook-ui'
|
3
|
+
|
4
|
+
const CurrencyNullDisplay = (props) => {
|
5
|
+
return (
|
6
|
+
<>
|
7
|
+
<Currency
|
8
|
+
amount=""
|
9
|
+
label="Null"
|
10
|
+
marginBottom="md"
|
11
|
+
nullDisplay="--"
|
12
|
+
{...props}
|
13
|
+
/>
|
14
|
+
|
15
|
+
<Currency
|
16
|
+
amount=""
|
17
|
+
label="Null"
|
18
|
+
marginBottom="md"
|
19
|
+
nullDisplay="$0.00"
|
20
|
+
{...props}
|
21
|
+
/>
|
22
|
+
|
23
|
+
<Currency
|
24
|
+
amount=""
|
25
|
+
label="Null"
|
26
|
+
marginBottom="md"
|
27
|
+
nullDisplay=" "
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
</>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
|
34
|
+
export default CurrencyNullDisplay
|
@@ -0,0 +1 @@
|
|
1
|
+
To customize how the `amount` field appears when it is empty, use the `null_display` prop and set it to the desired value you want to display.
|
@@ -0,0 +1 @@
|
|
1
|
+
To customize how the `amount` field appears when it is empty, use the `nullDisplay` prop and set it to the desired value you want to display.
|
@@ -10,6 +10,7 @@ examples:
|
|
10
10
|
- currency_unstyled: Unstyled
|
11
11
|
- currency_comma_separator: Comma Separator
|
12
12
|
- currency_negative: Negative
|
13
|
+
- currency_null_display: Null Display
|
13
14
|
|
14
15
|
react:
|
15
16
|
- currency_variants: Variants
|
@@ -21,6 +22,7 @@ examples:
|
|
21
22
|
- currency_unstyled: Unstyled
|
22
23
|
- currency_comma_separator: Comma Separator
|
23
24
|
- currency_negative: Negative
|
25
|
+
- currency_null_display: Null Display
|
24
26
|
|
25
27
|
swift:
|
26
28
|
- currency_size_swift: Size
|
@@ -6,4 +6,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
8
|
export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
|
9
|
-
export { default as CurrencyNegative } from './_currency_negative.jsx'
|
9
|
+
export { default as CurrencyNegative } from './_currency_negative.jsx'
|
10
|
+
export { default as CurrencyNullDisplay } from './_currency_null_display.jsx'
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
/*eslint-disable react/no-multi-comp */
|
2
|
+
|
3
|
+
import React, { forwardRef, useRef } from 'react'
|
2
4
|
import Body from '../pb_body/_body'
|
3
5
|
import Flex from '../pb_flex/_flex'
|
4
6
|
import classnames from 'classnames'
|
@@ -8,7 +10,7 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
8
10
|
type RadioProps = {
|
9
11
|
aria?: { [key: string]: string },
|
10
12
|
alignment?: string,
|
11
|
-
checked?: boolean,
|
13
|
+
checked?: boolean,
|
12
14
|
children?: React.ReactChild[] | React.ReactChild,
|
13
15
|
customChildren?: boolean,
|
14
16
|
className?: string,
|
@@ -22,10 +24,10 @@ type RadioProps = {
|
|
22
24
|
name?: string,
|
23
25
|
value?: string,
|
24
26
|
text?: string,
|
25
|
-
onChange
|
27
|
+
onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
|
26
28
|
} & GlobalProps
|
27
29
|
|
28
|
-
const Radio =
|
30
|
+
const Radio = ({
|
29
31
|
aria = {},
|
30
32
|
alignment,
|
31
33
|
children,
|
@@ -41,123 +43,110 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(({
|
|
41
43
|
name = 'radio_name',
|
42
44
|
text = 'Radio Text',
|
43
45
|
value = 'radio_text',
|
44
|
-
checked,
|
45
46
|
onChange = () => { void 0 },
|
46
47
|
...props
|
47
|
-
}, ref) => {
|
48
|
-
const
|
49
|
-
const setRefs = (el: HTMLInputElement) => {
|
50
|
-
internalRef.current = el
|
51
|
-
if (typeof ref === 'function') {
|
52
|
-
ref(el)
|
53
|
-
} else if (ref) {
|
54
|
-
(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
const ariaProps = buildAriaProps(aria)
|
59
|
-
const dataProps = buildDataProps(data)
|
60
|
-
const htmlProps = buildHtmlProps(htmlOptions)
|
48
|
+
}: RadioProps, ref: any) => {
|
49
|
+
const radioRef = useRef(null);
|
61
50
|
|
51
|
+
const ariaProps = buildAriaProps(aria);
|
52
|
+
const dataProps = buildDataProps(data);
|
53
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
62
54
|
const classes = classnames(
|
63
55
|
buildCss('pb_radio_kit', alignment),
|
64
56
|
dark ? 'dark' : null,
|
65
57
|
error ? 'error' : null,
|
66
58
|
globalProps(props),
|
67
59
|
className
|
68
|
-
)
|
60
|
+
);
|
69
61
|
|
70
62
|
const classesCustom = classnames(
|
71
63
|
dark ? 'dark' : null,
|
72
64
|
error ? 'error' : null,
|
73
65
|
globalProps(props),
|
74
66
|
className
|
75
|
-
)
|
76
|
-
|
77
|
-
const checkedProps = checked !== undefined ? { checked } : {}
|
67
|
+
);
|
78
68
|
|
79
|
-
const displayRadio = (
|
80
|
-
if (children && customChildren
|
81
|
-
return children
|
69
|
+
const displayRadio = (props: RadioProps & any) => {
|
70
|
+
if (children && customChildren == false)
|
71
|
+
return (children)
|
82
72
|
else
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
73
|
+
return (
|
74
|
+
<input
|
75
|
+
disabled={disabled}
|
76
|
+
id={id}
|
77
|
+
name={name}
|
78
|
+
onChange={onChange}
|
79
|
+
ref={ref}
|
80
|
+
text={text}
|
81
|
+
type="radio"
|
82
|
+
value={value}
|
83
|
+
{...props}
|
84
|
+
/>
|
85
|
+
)}
|
97
86
|
|
98
87
|
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
99
88
|
if (event) {
|
100
|
-
const target = event.target as HTMLElement
|
89
|
+
const target = event.target as HTMLElement;
|
101
90
|
if (
|
102
91
|
target.id === 'pb-radio-children-wrapper' ||
|
103
92
|
target.closest('#pb-radio-children-wrapper')
|
104
93
|
) {
|
105
|
-
|
94
|
+
radioRef.current?.click();
|
106
95
|
}
|
107
96
|
}
|
108
|
-
}
|
97
|
+
};
|
109
98
|
|
110
|
-
return
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
99
|
+
return (
|
100
|
+
customChildren ? (
|
101
|
+
<Flex
|
102
|
+
{...ariaProps}
|
103
|
+
{...dataProps}
|
104
|
+
{...htmlProps}
|
105
|
+
align='center'
|
106
|
+
className={classesCustom}
|
107
|
+
cursor='pointer'
|
108
|
+
htmlFor={id}
|
109
|
+
htmlOptions={{
|
110
|
+
onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
111
|
+
handleContainerClick(event);
|
112
|
+
}) as unknown as () => void
|
113
|
+
}}
|
114
|
+
id="radio-container"
|
115
|
+
>
|
116
|
+
<label className={buildCss('pb_radio_kit', alignment)}>
|
127
117
|
<input
|
128
|
-
{...checkedProps}
|
129
118
|
disabled={disabled}
|
130
119
|
id={id}
|
131
120
|
name={name}
|
132
121
|
onChange={onChange}
|
133
|
-
ref={
|
122
|
+
ref={radioRef}
|
134
123
|
type="radio"
|
135
124
|
value={value}
|
136
125
|
{...props}
|
137
126
|
/>
|
127
|
+
<span className="pb_radio_button" />
|
128
|
+
</label>
|
129
|
+
<div id="pb-radio-children-wrapper"> {children} </div>
|
130
|
+
</Flex>
|
131
|
+
) : (
|
132
|
+
<label
|
133
|
+
{...ariaProps}
|
134
|
+
{...dataProps}
|
135
|
+
{...htmlProps}
|
136
|
+
className={classes}
|
137
|
+
htmlFor={id}
|
138
|
+
>
|
139
|
+
<>{displayRadio(props)}</>
|
138
140
|
<span className="pb_radio_button" />
|
141
|
+
<Body
|
142
|
+
dark={dark}
|
143
|
+
status={error ? 'negative' : null}
|
144
|
+
text={label}
|
145
|
+
variant={null}
|
146
|
+
/>
|
139
147
|
</label>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
<label
|
144
|
-
{...ariaProps}
|
145
|
-
{...dataProps}
|
146
|
-
{...htmlProps}
|
147
|
-
className={classes}
|
148
|
-
htmlFor={id}
|
149
|
-
>
|
150
|
-
{displayRadio(props)}
|
151
|
-
<span className="pb_radio_button" />
|
152
|
-
<Body
|
153
|
-
dark={dark}
|
154
|
-
status={error ? 'negative' : null}
|
155
|
-
text={label}
|
156
|
-
variant={null}
|
157
|
-
/>
|
158
|
-
</label>
|
159
|
-
)
|
160
|
-
})
|
148
|
+
)
|
149
|
+
);
|
150
|
+
};
|
161
151
|
|
162
|
-
|
163
|
-
export default Radio
|
152
|
+
export default forwardRef(Radio);
|
@@ -16,7 +16,6 @@ examples:
|
|
16
16
|
- radio_alignment: Alignment
|
17
17
|
- radio_disabled: Disabled
|
18
18
|
- radio_custom_children: Custom Children
|
19
|
-
- radio_react_hook: React Hook Form
|
20
19
|
|
21
20
|
swift:
|
22
21
|
- radio_default_swift: Default
|
@@ -27,4 +26,4 @@ examples:
|
|
27
26
|
- radio_spacing_swift: Spacing
|
28
27
|
- radio_padding_swift: Padding
|
29
28
|
- radio_subtitle_swift: Subtitle
|
30
|
-
- radio_props_swift: ""
|
29
|
+
- radio_props_swift: ""
|
@@ -4,4 +4,3 @@ export { default as RadioError } from './_radio_error.jsx'
|
|
4
4
|
export { default as RadioAlignment } from './_radio_alignment.jsx'
|
5
5
|
export { default as RadioDisabled } from './_radio_disabled.jsx'
|
6
6
|
export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
|
7
|
-
export { default as RadioReactHook } from './_radio_react_hook.jsx'
|
@@ -86,19 +86,3 @@ test('has disabled attribute', () => {
|
|
86
86
|
expect(input).toHaveAttribute('disabled')
|
87
87
|
})
|
88
88
|
|
89
|
-
|
90
|
-
test('has ref in the input element', () => {
|
91
|
-
const ref = React.createRef()
|
92
|
-
render(
|
93
|
-
<Radio
|
94
|
-
data={{ testid: testId }}
|
95
|
-
name="Radio-name"
|
96
|
-
ref={ref}
|
97
|
-
text="Radio"
|
98
|
-
value="radio value"
|
99
|
-
/>
|
100
|
-
)
|
101
|
-
|
102
|
-
expect(ref.current).not.toBeNull()
|
103
|
-
expect(ref.current?.tagName).toBe('INPUT')
|
104
|
-
})
|
@@ -141,7 +141,6 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
141
141
|
|
142
142
|
&[data-popper-placement="right"] {
|
143
143
|
box-shadow: -8px 0 28px 0 $tooltip_shadow;
|
144
|
-
margin: 0 0 0 $space_sm;
|
145
144
|
.arrow {
|
146
145
|
left: -18px;
|
147
146
|
right: auto;
|
@@ -156,7 +155,6 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
156
155
|
|
157
156
|
&[data-popper-placement="bottom"] {
|
158
157
|
box-shadow: 0 -12px 28px 0 $tooltip_shadow;
|
159
|
-
margin: $space_sm 0 0 0;
|
160
158
|
.arrow {
|
161
159
|
top: -18px;
|
162
160
|
margin-bottom: 0;
|
@@ -169,7 +167,6 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
169
167
|
|
170
168
|
&[data-popper-placement="left"] {
|
171
169
|
box-shadow: 8px 0 28px 0 $tooltip_shadow;
|
172
|
-
margin: 0 $space_sm 0 0;
|
173
170
|
.arrow {
|
174
171
|
margin-bottom: 0;
|
175
172
|
right: -18px;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= pb_rails("flex", props: { orientation: "row", gap: "md" }) do %>
|
2
|
+
<%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
|
3
|
+
<%= pb_rails("button", props: {classname: "tooltip-delay", text: "1s delay"}) %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
|
7
|
+
<%= pb_rails("button", props: {classname: "tooltip-open-delay", text: "Open only"}) %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
|
11
|
+
<%= pb_rails("button", props: {classname: "tooltip-close-delay", text: "Close only"}) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= pb_rails("tooltip", props: {
|
15
|
+
trigger_element_selector: ".tooltip-delay",
|
16
|
+
tooltip_id: "delay-tooltip",
|
17
|
+
position: 'top',
|
18
|
+
delay_open: 1000,
|
19
|
+
delay_close: 1000
|
20
|
+
}) do %>
|
21
|
+
1s open/close delay
|
22
|
+
<% end %>
|
23
|
+
<%= pb_rails("tooltip", props: {
|
24
|
+
trigger_element_selector: ".tooltip-open-delay",
|
25
|
+
tooltip_id: "open-tooltip",
|
26
|
+
position: 'top',
|
27
|
+
delay_open: 1000
|
28
|
+
}) do %>
|
29
|
+
1s open delay
|
30
|
+
<% end %>
|
31
|
+
<%= pb_rails("tooltip", props: {
|
32
|
+
trigger_element_selector: ".tooltip-close-delay",
|
33
|
+
tooltip_id: "close-tooltip",
|
34
|
+
position: 'top',
|
35
|
+
delay_close: 1000
|
36
|
+
}) do %>
|
37
|
+
1s close delay
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<%= pb_rails("flex", props: { gap: "md", wrap: true }) do %>
|
2
|
+
<%= pb_rails("flex/flex_item") do %>
|
3
|
+
<%= pb_rails("button", props: { text: "With Interaction", id: "tooltip-interaction"}) %>
|
4
|
+
|
5
|
+
<%= pb_rails("tooltip", props: {
|
6
|
+
trigger_element_selector: "#tooltip-interaction",
|
7
|
+
tooltip_id: "tooltip-with-interaction",
|
8
|
+
position: 'top',
|
9
|
+
interaction: true
|
10
|
+
}) do %>
|
11
|
+
You can copy me
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= pb_rails("flex/flex_item") do %>
|
16
|
+
<%= pb_rails("button", props: { text: "No Interaction", id: "tooltip-no-interaction"}) %>
|
17
|
+
|
18
|
+
<%= pb_rails("tooltip", props: {
|
19
|
+
trigger_element_selector: "#tooltip-no-interaction",
|
20
|
+
tooltip_id: "tooltip-without-interaction",
|
21
|
+
position: 'top',
|
22
|
+
}) do %>
|
23
|
+
I'm just a regular tooltip
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
@@ -2,8 +2,10 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- tooltip_default: Default
|
5
|
+
- tooltip_interaction: Content Interaction
|
5
6
|
- tooltip_selectors: Using Common Selectors
|
6
7
|
- tooltip_with_icon_circle: Icon Circle Tooltip
|
8
|
+
- tooltip_delay_rails: Delay
|
7
9
|
- tooltip_show_tooltip: Show Tooltip
|
8
10
|
|
9
11
|
react:
|