playbook_ui 14.15.0.pre.alpha.play1949lodashremoval3of36815 → 14.15.0.pre.alpha.play1952fixhorizontalnavcursorstyle6795
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_filter/Filter/CurrentFilters.tsx +4 -3
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +3 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -67
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -67
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +1 -4
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +0 -23
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -28
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -10
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +1 -149
- data/app/pb_kits/playbook/utilities/object.ts +42 -124
- data/dist/chunks/_typeahead-CVryXNui.js +22 -0
- data/dist/chunks/_weekday_stacked-BGcc0MlV.js +45 -0
- data/dist/chunks/{lib-DpO_YjaF.js → lib-Co5y3V4K.js} +3 -3
- data/dist/chunks/{pb_form_validation-C3rQtNR-.js → pb_form_validation-DMajaRt3.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/forms/builder/multi_level_select_field.rb +0 -2
- data/lib/playbook/version.rb +1 -1
- metadata +6 -12
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +0 -13
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +0 -72
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +0 -97
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +0 -71
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +0 -91
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +0 -105
- data/dist/chunks/_typeahead-DZNrDsCe.js +0 -22
- data/dist/chunks/_weekday_stacked-BwM21XCO.js +0 -45
@@ -1,7 +1,6 @@
|
|
1
1
|
/* 🛠️ Any commonly used lodash functions can be added here. 🤙 */
|
2
2
|
|
3
|
-
export const isEmpty = (obj: any) =>
|
4
|
-
[Object, Array].includes((obj || {}).constructor) && !Object.entries((obj || {})).length
|
3
|
+
export const isEmpty = (obj: any) => [Object, Array].includes((obj || {}).constructor) && !Object.entries((obj || {})).length;
|
5
4
|
|
6
5
|
export const get = <T, R = any>(obj: T, path: string, defaultValue?: R): R | any => {
|
7
6
|
const travel = (regexp: RegExp): any =>
|
@@ -25,175 +24,94 @@ export const omitBy = (obj: Record<string, any>, predicate: (value: any, key: st
|
|
25
24
|
if (obj === null || typeof obj !== 'object') return {}
|
26
25
|
return Object.keys(obj).reduce((result: Record<string, any>, key: string) => {
|
27
26
|
if (!predicate(obj[key], key)) {
|
28
|
-
result[key] = obj[key]
|
27
|
+
result[key] = obj[key];
|
29
28
|
}
|
30
|
-
return result
|
29
|
+
return result;
|
31
30
|
}, {})
|
32
31
|
}
|
33
32
|
|
34
|
-
export const omit = (
|
35
|
-
obj: Record<string, any>,
|
36
|
-
...paths: (string | string[])[]
|
37
|
-
): Record<string, any> => {
|
38
|
-
if (obj === null || typeof obj !== 'object') return {}
|
39
|
-
const keysToOmit = new Set<string>()
|
40
|
-
paths.forEach(p => {
|
41
|
-
if (Array.isArray(p)) {
|
42
|
-
p.forEach(key => keysToOmit.add(key))
|
43
|
-
} else {
|
44
|
-
keysToOmit.add(p)
|
45
|
-
}
|
46
|
-
})
|
47
|
-
const result: Record<string, any> = {}
|
48
|
-
for (const key in obj) {
|
49
|
-
if (!keysToOmit.has(key)) {
|
50
|
-
result[key] = obj[key]
|
51
|
-
}
|
52
|
-
}
|
53
|
-
return result
|
54
|
-
}
|
55
|
-
|
56
33
|
export const noop = (): void => {
|
57
34
|
// empty
|
58
|
-
}
|
59
|
-
|
60
|
-
export const cloneDeep = (value: any): any => {
|
61
|
-
if (value === null || typeof value !== 'object') {
|
62
|
-
return value
|
63
|
-
}
|
64
|
-
if (Array.isArray(value)) {
|
65
|
-
return value.map(cloneDeep)
|
66
|
-
}
|
67
|
-
if (value instanceof Date) {
|
68
|
-
return new Date(value.getTime())
|
69
|
-
}
|
70
|
-
if (value instanceof RegExp) {
|
71
|
-
return new RegExp(value.source, value.flags)
|
72
|
-
}
|
73
|
-
const clonedObj: any = {}
|
74
|
-
for (const key in value) {
|
75
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
76
|
-
clonedObj[key] = cloneDeep(value[key])
|
77
|
-
}
|
78
|
-
}
|
79
|
-
return clonedObj
|
80
|
-
}
|
35
|
+
};
|
81
36
|
|
82
37
|
export function merge(
|
83
38
|
...objects: Array<Record<string, unknown> | null | undefined>
|
84
39
|
): Record<string, unknown> {
|
85
40
|
const isPlainObject = (obj: unknown): obj is Record<string, unknown> =>
|
86
|
-
!!obj && typeof obj === 'object' && !Array.isArray(obj)
|
41
|
+
!!obj && typeof obj === 'object' && !Array.isArray(obj);
|
87
42
|
|
88
|
-
const result: Record<string, unknown> = {}
|
43
|
+
const result: Record<string, unknown> = {};
|
89
44
|
|
90
45
|
for (const obj of objects) {
|
91
|
-
if (!obj || typeof obj !== 'object') continue
|
46
|
+
if (!obj || typeof obj !== 'object') continue;
|
92
47
|
|
93
48
|
for (const key of Object.keys(obj)) {
|
94
|
-
const oldVal = result[key]
|
95
|
-
const newVal = (obj as Record<string, unknown>)[key]
|
49
|
+
const oldVal = result[key];
|
50
|
+
const newVal = (obj as Record<string, unknown>)[key];
|
96
51
|
|
97
52
|
if (Array.isArray(oldVal) && Array.isArray(newVal)) {
|
98
|
-
result[key] = newVal
|
53
|
+
result[key] = newVal;
|
99
54
|
} else if (isPlainObject(oldVal) && isPlainObject(newVal)) {
|
100
|
-
result[key] = merge(oldVal, newVal)
|
55
|
+
result[key] = merge(oldVal, newVal);
|
101
56
|
} else if (Array.isArray(oldVal) && isPlainObject(newVal)) {
|
102
|
-
result[key] = oldVal
|
57
|
+
result[key] = oldVal;
|
103
58
|
} else if (isPlainObject(oldVal) && Array.isArray(newVal)) {
|
104
|
-
result[key] = oldVal
|
59
|
+
result[key] = oldVal;
|
105
60
|
} else {
|
106
|
-
result[key] = newVal
|
61
|
+
result[key] = newVal;
|
107
62
|
}
|
108
63
|
}
|
109
64
|
}
|
110
|
-
return result
|
65
|
+
return result;
|
111
66
|
}
|
112
67
|
|
113
68
|
const createIteratee = (predicate: any) => {
|
114
69
|
if (typeof predicate === 'function') {
|
115
|
-
return predicate
|
70
|
+
return predicate;
|
116
71
|
}
|
117
72
|
if (typeof predicate === 'string') {
|
118
|
-
return (obj: any) => obj[predicate]
|
73
|
+
return (obj: any) => obj[predicate];
|
119
74
|
}
|
120
75
|
if (Array.isArray(predicate)) {
|
121
|
-
const [key, value] = predicate
|
122
|
-
return (obj: any) => obj[key] === value
|
76
|
+
const [key, value] = predicate;
|
77
|
+
return (obj: any) => obj[key] === value;
|
123
78
|
}
|
124
79
|
if (typeof predicate === 'object' && predicate !== null) {
|
125
80
|
return (obj: any) => {
|
126
81
|
for (const key in predicate) {
|
127
82
|
if (Object.prototype.hasOwnProperty.call(predicate, key)) {
|
128
|
-
if (obj[key] !== predicate[key]) return false
|
83
|
+
if (obj[key] !== predicate[key]) return false;
|
129
84
|
}
|
130
85
|
}
|
131
|
-
return true
|
132
|
-
}
|
86
|
+
return true;
|
87
|
+
};
|
133
88
|
}
|
134
|
-
return () => false
|
135
|
-
}
|
89
|
+
return () => false;
|
90
|
+
};
|
136
91
|
|
137
92
|
export const filter = <T>(array: T[], predicate: any): T[] => {
|
138
|
-
const iteratee = createIteratee(predicate)
|
139
|
-
return array.filter(iteratee)
|
140
|
-
}
|
93
|
+
const iteratee = createIteratee(predicate);
|
94
|
+
return array.filter(iteratee);
|
95
|
+
};
|
141
96
|
|
142
97
|
export const find = <T>(array: T[], predicate: any): T | undefined => {
|
143
|
-
const iteratee = createIteratee(predicate)
|
144
|
-
return array.find(iteratee)
|
145
|
-
}
|
98
|
+
const iteratee = createIteratee(predicate);
|
99
|
+
return array.find(iteratee);
|
100
|
+
};
|
146
101
|
|
147
|
-
export const partial = <F extends (...args:
|
102
|
+
export const partial = <F extends (...args: unknown[]) => unknown>(
|
148
103
|
fn: F,
|
149
|
-
...partials:
|
150
|
-
): ((...args:
|
151
|
-
const placeholder = partial.placeholder
|
152
|
-
return (...args:
|
153
|
-
let argIndex = 0
|
104
|
+
...partials: unknown[]
|
105
|
+
): ((...args: unknown[]) => ReturnType<F>) => {
|
106
|
+
const placeholder = partial.placeholder;
|
107
|
+
return (...args: unknown[]): ReturnType<F> => {
|
108
|
+
let argIndex = 0;
|
154
109
|
const finalArgs = partials.map(arg =>
|
155
110
|
arg === placeholder ? args[argIndex++] : arg
|
156
|
-
)
|
157
|
-
return fn(...(finalArgs.concat(args.slice(argIndex)) as Parameters<F>)) as ReturnType<F
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
partial.placeholder = Symbol()
|
162
|
-
export const _ = partial.placeholder
|
163
|
-
|
164
|
-
export const map = <T, U>(
|
165
|
-
collection: T[] | Record<string, T>,
|
166
|
-
iteratee?: ((value: T, index: number | string, collection: T[] | Record<string, T>) => U) | string
|
167
|
-
): U[] => {
|
168
|
-
const fn =
|
169
|
-
typeof iteratee === "function"
|
170
|
-
? iteratee
|
171
|
-
: typeof iteratee === "string"
|
172
|
-
? (item: T) => (item as any)[iteratee]
|
173
|
-
: (item: T) => item as unknown as U
|
174
|
-
|
175
|
-
if (Array.isArray(collection)) {
|
176
|
-
return collection.map((value, index) => fn(value, index, collection))
|
177
|
-
}
|
178
|
-
return Object.keys(collection).map(key => fn(collection[key], key, collection))
|
179
|
-
}
|
180
|
-
|
181
|
-
export function debounce<F extends (...args: any[]) => any>(
|
182
|
-
func: F,
|
183
|
-
wait: number,
|
184
|
-
immediate?: boolean
|
185
|
-
): (...args: Parameters<F>) => void {
|
186
|
-
let timeout: ReturnType<typeof setTimeout> | null;
|
187
|
-
return function(this: any, ...args: any[]) {
|
188
|
-
if (timeout) clearTimeout(timeout);
|
189
|
-
if (immediate && !timeout) {
|
190
|
-
func.apply(this, args);
|
191
|
-
}
|
192
|
-
timeout = setTimeout(() => {
|
193
|
-
timeout = null;
|
194
|
-
if (!immediate) {
|
195
|
-
func.apply(this, args);
|
196
|
-
}
|
197
|
-
}, wait);
|
111
|
+
);
|
112
|
+
return fn(...(finalArgs.concat(args.slice(argIndex)) as Parameters<F>)) as ReturnType<F>;
|
198
113
|
};
|
199
|
-
}
|
114
|
+
};
|
115
|
+
|
116
|
+
partial.placeholder = Symbol();
|
117
|
+
export const _ = partial.placeholder;
|