playbook_ui 14.22.0.pre.alpha.PLAY2303optB8977 → 14.22.0.pre.alpha.PLAY22578709
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_advanced_table/docs/example.yml +6 -7
- data/app/pb_kits/playbook/pb_badge/_badge.scss +6 -5
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +15 -33
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +72 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +6 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +15 -33
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +22 -52
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +16 -12
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +15 -31
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +16 -39
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +38 -86
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +15 -32
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +22 -72
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +15 -31
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +16 -37
- data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +1 -36
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +26 -71
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +16 -29
- data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors_rails.md → _circle_chart_colors.md} +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +16 -28
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +2 -4
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +15 -23
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +51 -81
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +75 -103
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +6 -3
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +13 -19
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +17 -30
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +20 -34
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +20 -29
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +20 -28
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +17 -27
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +36 -59
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -9
- data/dist/chunks/{_typeahead-B1tu_vWi.js → _typeahead-BZsshVoi.js} +3 -3
- data/dist/chunks/{_weekday_stacked-CKk0dR5s.js → _weekday_stacked-DO4S-plL.js} +1 -1
- data/dist/chunks/{lib-DYpq0k8j.js → lib-Carqm8Ip.js} +1 -1
- data/dist/chunks/{pb_form_validation-BUOKwfvW.js → pb_form_validation-DqRmTS8m.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +8 -68
- data/dist/playbook-doc.js +2 -2
- 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 +16 -19
- data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +0 -106
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate_react.md +0 -4
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +0 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate_react.md +0 -4
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +0 -14
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +0 -1
- data/dist/chunks/_circle_chart-BZmlhBs2.js +0 -1
- /data/app/pb_kits/playbook/pb_body/docs/{_body_truncate_rails.md → _body_truncate.md} +0 -0
- /data/app/pb_kits/playbook/pb_title/docs/{_title_truncate_rails.md → _title_truncate.md} +0 -0
- /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open_react.md → _tooltip_click_open.md} +0 -0
@@ -68,7 +68,7 @@ const containOnlyNumbers = (value: string) => {
|
|
68
68
|
return /^[()+\-\ .\d]*$/g.test(value)
|
69
69
|
}
|
70
70
|
|
71
|
-
const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.
|
71
|
+
const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefObject<unknown>) => {
|
72
72
|
const {
|
73
73
|
aria = {},
|
74
74
|
className,
|
@@ -106,16 +106,15 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
106
106
|
className
|
107
107
|
)
|
108
108
|
|
109
|
-
const inputRef = useRef<HTMLInputElement
|
109
|
+
const inputRef = useRef<HTMLInputElement>()
|
110
110
|
const itiRef = useRef<any>(null);
|
111
111
|
const [inputValue, setInputValue] = useState(value)
|
112
112
|
const [error, setError] = useState(props.error)
|
113
113
|
const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
|
114
114
|
const [selectedData, setSelectedData] = useState()
|
115
|
-
const [hasTyped, setHasTyped] = useState(false)
|
116
115
|
|
117
116
|
useEffect(() => {
|
118
|
-
if (
|
117
|
+
if (error?.length > 0) {
|
119
118
|
onValidate(false)
|
120
119
|
} else {
|
121
120
|
onValidate(true)
|
@@ -132,7 +131,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
132
131
|
clearField() {
|
133
132
|
setInputValue("")
|
134
133
|
setError("")
|
135
|
-
setHasTyped(false)
|
136
134
|
},
|
137
135
|
inputNode() {
|
138
136
|
return inputRef.current
|
@@ -203,8 +201,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
203
201
|
}
|
204
202
|
|
205
203
|
const validateErrors = () => {
|
206
|
-
if (!hasTyped && !error) return
|
207
|
-
|
208
204
|
if (itiRef.current) isValid(itiRef.current.isValidNumber())
|
209
205
|
if (validateOnlyNumbers(itiRef.current)) return
|
210
206
|
if (validateTooLongNumber(itiRef.current)) return
|
@@ -218,7 +214,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
218
214
|
}
|
219
215
|
|
220
216
|
const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
221
|
-
if (!hasTyped) setHasTyped(true)
|
222
217
|
setInputValue(evt.target.value)
|
223
218
|
let phoneNumberData
|
224
219
|
if (formatAsYouType) {
|
@@ -264,17 +259,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
264
259
|
|
265
260
|
itiRef.current = telInputInit;
|
266
261
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
262
|
+
inputRef.current.addEventListener("countrychange", (evt: Event) => {
|
263
|
+
const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
|
264
|
+
setSelectedData(phoneNumberData)
|
265
|
+
onChange(phoneNumberData)
|
266
|
+
validateErrors()
|
267
|
+
})
|
268
|
+
|
269
|
+
inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
|
270
|
+
inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
|
274
271
|
|
275
|
-
inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
|
276
|
-
inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
|
277
|
-
}
|
278
272
|
if (formatAsYouType) {
|
279
273
|
inputRef.current?.addEventListener("input", (evt) => {
|
280
274
|
handleOnChange(evt as unknown as React.ChangeEvent<HTMLInputElement>);
|
@@ -309,16 +303,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
309
303
|
{...htmlProps}
|
310
304
|
>
|
311
305
|
<TextInput
|
312
|
-
ref={
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
} else {
|
317
|
-
(ref as React.MutableRefObject<HTMLInputElement | null>).current = inputNode
|
318
|
-
}
|
306
|
+
ref={
|
307
|
+
inputNode => {
|
308
|
+
ref ? ref.current = inputNode : null
|
309
|
+
inputRef.current = inputNode
|
319
310
|
}
|
320
|
-
|
321
|
-
}}
|
311
|
+
}
|
322
312
|
{...textInputProps}
|
323
313
|
/>
|
324
314
|
</div>
|
@@ -20,7 +20,7 @@ const TitleTruncate = (props) => {
|
|
20
20
|
marginBottom="md"
|
21
21
|
size={4}
|
22
22
|
text={lorem}
|
23
|
-
truncate=
|
23
|
+
truncate="1"
|
24
24
|
{...props}
|
25
25
|
/>
|
26
26
|
|
@@ -32,7 +32,7 @@ const TitleTruncate = (props) => {
|
|
32
32
|
marginBottom="md"
|
33
33
|
size={4}
|
34
34
|
text={lorem}
|
35
|
-
truncate=
|
35
|
+
truncate="2"
|
36
36
|
{...props}
|
37
37
|
/>
|
38
38
|
|
@@ -43,7 +43,7 @@ const TitleTruncate = (props) => {
|
|
43
43
|
<Title
|
44
44
|
size={4}
|
45
45
|
text={lorem}
|
46
|
-
truncate=
|
46
|
+
truncate="3"
|
47
47
|
{...props}
|
48
48
|
/>
|
49
49
|
</Flex>
|
@@ -19,75 +19,60 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
this.triggerElements.forEach((trigger) => {
|
22
|
-
const method = this.
|
22
|
+
const method = this.triggerMethod
|
23
23
|
const interactionEnabled = this.tooltipInteraction
|
24
24
|
|
25
25
|
if (method === 'click') {
|
26
|
-
trigger.addEventListener('click', (
|
27
|
-
|
28
|
-
e.preventDefault()
|
29
|
-
if (this.isTooltipVisible()) {
|
30
|
-
this.hideTooltip()
|
31
|
-
} else {
|
32
|
-
this.showTooltip(trigger)
|
33
|
-
}
|
34
|
-
} else {
|
35
|
-
this.showTooltip(trigger)
|
36
|
-
}
|
26
|
+
trigger.addEventListener('click', () => {
|
27
|
+
this.showTooltip(trigger)
|
37
28
|
})
|
38
29
|
} else {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
this.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
})
|
30
|
+
trigger.addEventListener('mouseenter', () => {
|
31
|
+
clearSafeZoneListener(this)
|
32
|
+
clearTimeout(this.mouseleaveTimeout)
|
33
|
+
this.currentTrigger = trigger
|
34
|
+
const delayOpen = this.delayOpen ? parseInt(this.delayOpen) : TOOLTIP_TIMEOUT
|
35
|
+
this.mouseenterTimeout = setTimeout(() => {
|
36
|
+
this.showTooltip(trigger)
|
37
|
+
if (interactionEnabled) {
|
38
|
+
this.checkCloseTooltip(trigger)
|
39
|
+
}
|
40
|
+
}, delayOpen)
|
41
|
+
})
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if (interactionEnabled) {
|
59
|
-
this.attachSafeZoneListener()
|
60
|
-
} else {
|
61
|
-
this.hideTooltip()
|
62
|
-
}
|
63
|
-
}, delayClose)
|
64
|
-
} else {
|
43
|
+
trigger.addEventListener('mouseleave', () => {
|
44
|
+
clearTimeout(this.mouseenterTimeout)
|
45
|
+
if (this.delayClose) {
|
46
|
+
const delayClose = parseInt(this.delayClose)
|
47
|
+
this.mouseleaveTimeout = setTimeout(() => {
|
65
48
|
if (interactionEnabled) {
|
66
49
|
this.attachSafeZoneListener()
|
67
50
|
} else {
|
68
51
|
this.hideTooltip()
|
69
52
|
}
|
53
|
+
}, delayClose)
|
54
|
+
} else {
|
55
|
+
if (interactionEnabled) {
|
56
|
+
this.attachSafeZoneListener()
|
57
|
+
} else {
|
58
|
+
this.hideTooltip()
|
70
59
|
}
|
71
|
-
}
|
60
|
+
}
|
61
|
+
})
|
72
62
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
63
|
+
if (interactionEnabled) {
|
64
|
+
this.tooltip.addEventListener('mouseenter', () => {
|
65
|
+
clearSafeZoneListener(this)
|
66
|
+
})
|
77
67
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
68
|
+
this.tooltip.addEventListener('mouseleave', () => {
|
69
|
+
this.attachSafeZoneListener()
|
70
|
+
})
|
82
71
|
}
|
83
72
|
}
|
84
73
|
})
|
85
74
|
}
|
86
75
|
|
87
|
-
isTooltipVisible() {
|
88
|
-
return this.tooltip && this.tooltip.classList.contains('show')
|
89
|
-
}
|
90
|
-
|
91
76
|
attachSafeZoneListener() {
|
92
77
|
clearSafeZoneListener(this)
|
93
78
|
this.safeZoneHandler = (e) => {
|
@@ -160,7 +145,7 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
160
145
|
|
161
146
|
this.tooltip.classList.add('show')
|
162
147
|
|
163
|
-
if (this.
|
148
|
+
if (this.triggerMethod === 'click') {
|
164
149
|
clearTimeout(this.autoHideTimeout)
|
165
150
|
this.autoHideTimeout = setTimeout(() => {
|
166
151
|
this.hideTooltip()
|
@@ -239,14 +224,6 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
239
224
|
return this.element.dataset.pbTooltipTriggerMethod || 'hover'
|
240
225
|
}
|
241
226
|
|
242
|
-
get useClickToOpen() {
|
243
|
-
return this.element.dataset.pbTooltipUseClickToOpen === 'true'
|
244
|
-
}
|
245
|
-
|
246
|
-
get effectiveTriggerMethod() {
|
247
|
-
return this.useClickToOpen ? 'click' : this.triggerMethod
|
248
|
-
}
|
249
|
-
|
250
227
|
get tooltipInteraction() {
|
251
228
|
return this.element.dataset.pbTooltipInteraction === 'true'
|
252
229
|
}
|
@@ -21,8 +21,6 @@ module Playbook
|
|
21
21
|
prop :trigger_method, type: Playbook::Props::Enum,
|
22
22
|
values: %w[hover click],
|
23
23
|
default: "hover"
|
24
|
-
prop :use_click_to_open, type: Playbook::Props::Boolean,
|
25
|
-
default: false
|
26
24
|
prop :width
|
27
25
|
|
28
26
|
def classname
|
@@ -48,10 +46,6 @@ module Playbook
|
|
48
46
|
out
|
49
47
|
end
|
50
48
|
|
51
|
-
def effective_trigger_method
|
52
|
-
use_click_to_open ? "click" : (trigger_method || "hover")
|
53
|
-
end
|
54
|
-
|
55
49
|
def data
|
56
50
|
data = Hash(values[:data]).merge(
|
57
51
|
pb_tooltip_kit: true,
|
@@ -60,9 +54,8 @@ module Playbook
|
|
60
54
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
61
55
|
pb_tooltip_tooltip_id: tooltip_id,
|
62
56
|
pb_tooltip_show_tooltip: true,
|
63
|
-
pb_tooltip_trigger_method:
|
64
|
-
pb_tooltip_interaction: interaction
|
65
|
-
pb_tooltip_use_click_to_open: use_click_to_open
|
57
|
+
pb_tooltip_trigger_method: trigger_method,
|
58
|
+
pb_tooltip_interaction: interaction
|
66
59
|
)
|
67
60
|
data = data.merge(pb_tooltip_delay_open: delay_open) if delay_open
|
68
61
|
data = data.merge(pb_tooltip_delay_close: delay_close) if delay_close
|