playbook_ui 14.14.0.pre.alpha.play1853typeaheadreacthookform6461 → 14.14.0.pre.alpha.play1868dependencyremovallodash6286
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_card/_card.tsx +2 -1
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +31 -46
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +8 -15
- data/app/pb_kits/playbook/pb_currency/currency.rb +2 -17
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +8 -32
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -20
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -20
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +1 -49
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +4 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +0 -13
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +3 -5
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +1 -16
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +0 -12
- data/app/pb_kits/playbook/pb_select/select.rb +0 -8
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -10
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -4
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +6 -17
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/app/pb_kits/playbook/utilities/object.ts +82 -1
- data/dist/chunks/_typeahead-CHxdYnAw.js +36 -0
- data/dist/chunks/_weekday_stacked-D2tZHCNS.js +45 -0
- data/dist/chunks/{lib-Fr78pbpF.js → lib-CrrD678a.js} +2 -2
- data/dist/chunks/{pb_form_validation-CN51bfsD.js → pb_form_validation-BbWhQeoO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- 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 +6 -32
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +0 -22
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx +0 -34
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +0 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +0 -8
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +0 -33
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +0 -24
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +0 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +0 -49
- data/app/pb_kits/playbook/pb_drawer/index.js +0 -257
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +0 -37
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/index.js +0 -61
- data/app/pb_kits/playbook/pb_select/index.js +0 -38
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +0 -39
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +0 -26
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +0 -66
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +0 -1
- data/dist/chunks/_typeahead-CFU6u471.js +0 -36
- data/dist/chunks/_weekday_stacked-B0sOSO9C.js +0 -45
@@ -141,6 +141,7 @@ $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;
|
144
145
|
.arrow {
|
145
146
|
left: -18px;
|
146
147
|
right: auto;
|
@@ -155,6 +156,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
155
156
|
|
156
157
|
&[data-popper-placement="bottom"] {
|
157
158
|
box-shadow: 0 -12px 28px 0 $tooltip_shadow;
|
159
|
+
margin: $space_sm 0 0 0;
|
158
160
|
.arrow {
|
159
161
|
top: -18px;
|
160
162
|
margin-bottom: 0;
|
@@ -167,6 +169,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
167
169
|
|
168
170
|
&[data-popper-placement="left"] {
|
169
171
|
box-shadow: 8px 0 28px 0 $tooltip_shadow;
|
172
|
+
margin: 0 $space_sm 0 0;
|
170
173
|
.arrow {
|
171
174
|
margin-bottom: 0;
|
172
175
|
right: -18px;
|
@@ -2,10 +2,8 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- tooltip_default: Default
|
5
|
-
- tooltip_interaction: Content Interaction
|
6
5
|
- tooltip_selectors: Using Common Selectors
|
7
6
|
- tooltip_with_icon_circle: Icon Circle Tooltip
|
8
|
-
- tooltip_delay_rails: Delay
|
9
7
|
- tooltip_show_tooltip: Show Tooltip
|
10
8
|
|
11
9
|
react:
|
@@ -11,7 +11,7 @@ const TOOLTIP_TIMEOUT = 250
|
|
11
11
|
|
12
12
|
export default class PbTooltip extends PbEnhancedElement {
|
13
13
|
static get selector() {
|
14
|
-
return '[data-pb-tooltip-kit
|
14
|
+
return '[data-pb-tooltip-kit]'
|
15
15
|
}
|
16
16
|
|
17
17
|
connect() {
|
@@ -7,10 +7,6 @@ module Playbook
|
|
7
7
|
prop :trigger_element_selector
|
8
8
|
prop :trigger_element_id, deprecated: true
|
9
9
|
prop :tooltip_id
|
10
|
-
prop :interaction, type: Playbook::Props::Boolean,
|
11
|
-
default: false
|
12
|
-
prop :delay_open
|
13
|
-
prop :delay_close
|
14
10
|
prop :dark, type: Playbook::Props::Boolean,
|
15
11
|
default: false
|
16
12
|
prop :trigger_method, type: Playbook::Props::Enum,
|
@@ -22,19 +18,15 @@ module Playbook
|
|
22
18
|
end
|
23
19
|
|
24
20
|
def data
|
25
|
-
|
21
|
+
Hash(values[:data]).merge(
|
26
22
|
pb_tooltip_kit: true,
|
27
23
|
pb_tooltip_position: position,
|
28
24
|
pb_tooltip_trigger_element_selector: trigger_element_selector,
|
29
25
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
30
26
|
pb_tooltip_tooltip_id: tooltip_id,
|
31
27
|
pb_tooltip_show_tooltip: true,
|
32
|
-
pb_tooltip_trigger_method: trigger_method
|
33
|
-
pb_tooltip_interaction: interaction
|
28
|
+
pb_tooltip_trigger_method: trigger_method
|
34
29
|
)
|
35
|
-
data = data.merge(pb_tooltip_delay_open: delay_open) if delay_open
|
36
|
-
data = data.merge(pb_tooltip_delay_close: delay_close) if delay_close
|
37
|
-
data
|
38
30
|
end
|
39
31
|
|
40
32
|
private
|
@@ -10,7 +10,8 @@ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
|
10
10
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
11
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
12
|
import treemap from 'highcharts/modules/treemap'
|
13
|
-
import { merge
|
13
|
+
import { merge} from '../utilities/object'
|
14
|
+
|
14
15
|
|
15
16
|
type TreemapChartProps = {
|
16
17
|
chartData: {
|
@@ -53,7 +54,7 @@ const TreemapChart = ({
|
|
53
54
|
type = "treemap",
|
54
55
|
...props
|
55
56
|
}: TreemapChartProps): React.ReactElement => {
|
56
|
-
|
57
|
+
|
57
58
|
const ariaProps = buildAriaProps(aria)
|
58
59
|
const dataProps = buildDataProps(data)
|
59
60
|
const htmlProps = buildHtmlProps(htmlOptions)
|
@@ -62,9 +63,9 @@ const TreemapChart = ({
|
|
62
63
|
dark
|
63
64
|
? Highcharts.setOptions(highchartsDarkTheme)
|
64
65
|
: Highcharts.setOptions(highchartsTheme);
|
65
|
-
};
|
66
|
+
};
|
66
67
|
treemap(Highcharts)
|
67
|
-
setupTheme();
|
68
|
+
setupTheme();
|
68
69
|
|
69
70
|
const staticOptions = {
|
70
71
|
title: {
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
import Select from 'react-select'
|
3
3
|
import AsyncSelect from 'react-select/async'
|
4
4
|
import CreateableSelect from 'react-select/creatable'
|
5
5
|
import AsyncCreateableSelect from 'react-select/async-creatable'
|
6
|
-
import { get, isString, uniqueId } from '
|
6
|
+
import { get, isString, uniqueId } from '../utilities/object'
|
7
|
+
|
7
8
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
8
9
|
import classnames from 'classnames'
|
9
10
|
|
@@ -47,7 +48,6 @@ type TypeaheadProps = {
|
|
47
48
|
name?: string,
|
48
49
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
50
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
50
|
-
onChange?: any,
|
51
51
|
} & GlobalProps
|
52
52
|
|
53
53
|
export type SelectValueType = {
|
@@ -67,7 +67,8 @@ type TagOnChangeValues = {
|
|
67
67
|
* @constant {React.ReactComponent} Typeahead
|
68
68
|
* @param {TypeaheadProps} props - props as described at https://react-select.com/props
|
69
69
|
*/
|
70
|
-
|
70
|
+
|
71
|
+
const Typeahead = ({
|
71
72
|
async,
|
72
73
|
className,
|
73
74
|
components = {},
|
@@ -78,11 +79,9 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
78
79
|
getOptionValue,
|
79
80
|
htmlOptions = {},
|
80
81
|
id,
|
81
|
-
name,
|
82
82
|
loadOptions = noop,
|
83
83
|
marginBottom = "sm",
|
84
84
|
pillColor,
|
85
|
-
onChange,
|
86
85
|
...props
|
87
86
|
}: TypeaheadProps) => {
|
88
87
|
const selectProps = {
|
@@ -124,15 +123,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
124
123
|
)
|
125
124
|
|
126
125
|
const handleOnChange = (_data: SelectValueType, { action, option, removedValue }: TagOnChangeValues) => {
|
127
|
-
if (onChange) {
|
128
|
-
const isReactHookForm = onChange.toString().includes("target")
|
129
|
-
if (isReactHookForm) {
|
130
|
-
onChange({ target: { name, value: _data } })
|
131
|
-
} else {
|
132
|
-
onChange(_data)
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
126
|
if (action === 'select-option') {
|
137
127
|
if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
|
138
128
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
|
@@ -176,11 +166,10 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
176
166
|
/>
|
177
167
|
</div>
|
178
168
|
)
|
179
|
-
}
|
169
|
+
}
|
180
170
|
|
181
171
|
Object.keys(kitComponents).forEach((k) => {
|
182
172
|
(Typeahead as GenericObject)[k] = (kitComponents as {[key: string]: unknown})[k]
|
183
173
|
})
|
184
174
|
|
185
|
-
Typeahead.displayName = 'Typeahead'
|
186
175
|
export default Typeahead
|
@@ -49,7 +49,7 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
49
49
|
* @summary - for doc example purposes only
|
50
50
|
*/
|
51
51
|
const handleOnMultiValueClick = (value) => {
|
52
|
-
alert(`You
|
52
|
+
alert(`You removed the user: "${value.label}"`)
|
53
53
|
}
|
54
54
|
|
55
55
|
return (
|
@@ -56,7 +56,7 @@ const TypeaheadWithPillsAsyncUsers = (props) => {
|
|
56
56
|
* @summary - for doc example purposes only
|
57
57
|
*/
|
58
58
|
const handleOnMultiValueClick = (value) => {
|
59
|
-
alert(`You
|
59
|
+
alert(`You removed the user: "${value.label}"`)
|
60
60
|
}
|
61
61
|
|
62
62
|
return (
|
@@ -13,4 +13,3 @@ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_lis
|
|
13
13
|
export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
|
14
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
15
15
|
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|
16
|
-
export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
@@ -1,3 +1,84 @@
|
|
1
1
|
/* 🛠️ Any commonly used lodash functions can be added here. 🤙 */
|
2
2
|
|
3
|
-
export const isEmpty = (obj:
|
3
|
+
export const isEmpty = (obj: any) => [Object, Array].includes((obj || {}).constructor) && !Object.entries((obj || {})).length;
|
4
|
+
|
5
|
+
export const get = <T, R = any>(obj: T, path: string, defaultValue?: R): R | any => {
|
6
|
+
const travel = (regexp: RegExp): any =>
|
7
|
+
String.prototype.split
|
8
|
+
.call(path, regexp)
|
9
|
+
.filter(Boolean)
|
10
|
+
.reduce((res: any, key: string) => (res !== null && res !== undefined ? res[key] : res), obj)
|
11
|
+
const result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/)
|
12
|
+
return result === undefined || result === obj ? defaultValue : result
|
13
|
+
}
|
14
|
+
|
15
|
+
export const map = <T, U>(
|
16
|
+
collection: T[] | Record<string, T> | null | undefined,
|
17
|
+
iteratee: (value: any, key: string, collection: T[] | Record<string, T>) => U
|
18
|
+
): U[] => {
|
19
|
+
if (!collection) return []
|
20
|
+
const coerce = (val: any) => {
|
21
|
+
if (val === true) return val
|
22
|
+
if (
|
23
|
+
typeof val === "number" ||
|
24
|
+
typeof val === "string" ||
|
25
|
+
typeof val === "boolean" ||
|
26
|
+
val === null
|
27
|
+
)
|
28
|
+
return String(val)
|
29
|
+
return val
|
30
|
+
}
|
31
|
+
return Array.isArray(collection)
|
32
|
+
? collection.map((v, i) => iteratee(coerce(v), String(i), collection))
|
33
|
+
: Object.keys(collection).map(key => iteratee(coerce(collection[key]), key, collection))
|
34
|
+
}
|
35
|
+
|
36
|
+
export const isString = (str: unknown): str is string =>
|
37
|
+
str != null && typeof (str as any).valueOf() === "string"
|
38
|
+
|
39
|
+
export const omitBy = <T extends Record<string, any>>(
|
40
|
+
obj: T,
|
41
|
+
predicate: (value: T[keyof T], key: string) => boolean
|
42
|
+
): Partial<T> => {
|
43
|
+
if (obj === null || typeof obj !== 'object') return {} as Partial<T>
|
44
|
+
return Object.keys(obj).reduce((result, key) => {
|
45
|
+
const typedKey = key as keyof T
|
46
|
+
if (!predicate(obj[typedKey], key)) {
|
47
|
+
result[typedKey] = obj[typedKey]
|
48
|
+
}
|
49
|
+
return result
|
50
|
+
}, {} as Partial<T>)
|
51
|
+
}
|
52
|
+
|
53
|
+
export const uniqueId: (prefix?: string) => string = (() => {
|
54
|
+
let counter = 0
|
55
|
+
return (prefix = '') => `${prefix}${++counter}`
|
56
|
+
})()
|
57
|
+
|
58
|
+
type PlainObject = { [key: string]: any }
|
59
|
+
|
60
|
+
const isObject = (item: any): item is PlainObject =>
|
61
|
+
item !== null && typeof item === 'object'
|
62
|
+
|
63
|
+
export const merge = <T extends PlainObject>(
|
64
|
+
target: T,
|
65
|
+
...sources: PlainObject[]
|
66
|
+
): T => {
|
67
|
+
if (!sources.length) return target
|
68
|
+
const source = sources.shift()!
|
69
|
+
if (isObject(target) && isObject(source)) {
|
70
|
+
Object.keys(source).forEach((key: string) => {
|
71
|
+
const typedKey = key as keyof T
|
72
|
+
const srcValue = source[key]
|
73
|
+
if (isObject(srcValue)) {
|
74
|
+
if (!target[typedKey]) {
|
75
|
+
target[typedKey] = (Array.isArray(srcValue) ? [] : {}) as unknown as T[typeof typedKey]
|
76
|
+
}
|
77
|
+
merge(target[typedKey], srcValue)
|
78
|
+
} else {
|
79
|
+
target[typedKey] = srcValue
|
80
|
+
}
|
81
|
+
})
|
82
|
+
}
|
83
|
+
return merge(target, ...sources)
|
84
|
+
}
|