playbook_ui 14.16.0 → 14.17.0.pre.rc.1
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/_advanced_table.scss +34 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +86 -84
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -3
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -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.tsx +2 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- 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 +149 -1
- data/app/pb_kits/playbook/utilities/object.ts +124 -42
- data/dist/chunks/_typeahead-Djo6qCne.js +22 -0
- data/dist/chunks/_weekday_stacked-DIIHW0OV.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DMajaRt3.js → pb_form_validation-BvNy9Bd6.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 +2 -2
- metadata +17 -10
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-BuTZG1Jn.js +0 -22
- data/dist/chunks/_weekday_stacked-oT22q75-.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Co5y3V4K.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
/* 🛠️ Any commonly used lodash functions can be added here. 🤙 */
|
2
2
|
|
3
|
-
export const isEmpty = (obj: any) =>
|
3
|
+
export const isEmpty = (obj: any) =>
|
4
|
+
[Object, Array].includes((obj || {}).constructor) && !Object.entries((obj || {})).length
|
4
5
|
|
5
6
|
export const get = <T, R = any>(obj: T, path: string, defaultValue?: R): R | any => {
|
6
7
|
const travel = (regexp: RegExp): any =>
|
@@ -24,94 +25,175 @@ export const omitBy = (obj: Record<string, any>, predicate: (value: any, key: st
|
|
24
25
|
if (obj === null || typeof obj !== 'object') return {}
|
25
26
|
return Object.keys(obj).reduce((result: Record<string, any>, key: string) => {
|
26
27
|
if (!predicate(obj[key], key)) {
|
27
|
-
result[key] = obj[key]
|
28
|
+
result[key] = obj[key]
|
28
29
|
}
|
29
|
-
return result
|
30
|
+
return result
|
30
31
|
}, {})
|
31
32
|
}
|
32
33
|
|
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
|
+
|
33
56
|
export const noop = (): void => {
|
34
57
|
// empty
|
35
|
-
}
|
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
|
+
}
|
36
81
|
|
37
82
|
export function merge(
|
38
83
|
...objects: Array<Record<string, unknown> | null | undefined>
|
39
84
|
): Record<string, unknown> {
|
40
85
|
const isPlainObject = (obj: unknown): obj is Record<string, unknown> =>
|
41
|
-
!!obj && typeof obj === 'object' && !Array.isArray(obj)
|
86
|
+
!!obj && typeof obj === 'object' && !Array.isArray(obj)
|
42
87
|
|
43
|
-
const result: Record<string, unknown> = {}
|
88
|
+
const result: Record<string, unknown> = {}
|
44
89
|
|
45
90
|
for (const obj of objects) {
|
46
|
-
if (!obj || typeof obj !== 'object') continue
|
91
|
+
if (!obj || typeof obj !== 'object') continue
|
47
92
|
|
48
93
|
for (const key of Object.keys(obj)) {
|
49
|
-
const oldVal = result[key]
|
50
|
-
const newVal = (obj as Record<string, unknown>)[key]
|
94
|
+
const oldVal = result[key]
|
95
|
+
const newVal = (obj as Record<string, unknown>)[key]
|
51
96
|
|
52
97
|
if (Array.isArray(oldVal) && Array.isArray(newVal)) {
|
53
|
-
result[key] = newVal
|
98
|
+
result[key] = newVal
|
54
99
|
} else if (isPlainObject(oldVal) && isPlainObject(newVal)) {
|
55
|
-
result[key] = merge(oldVal, newVal)
|
100
|
+
result[key] = merge(oldVal, newVal)
|
56
101
|
} else if (Array.isArray(oldVal) && isPlainObject(newVal)) {
|
57
|
-
result[key] = oldVal
|
102
|
+
result[key] = oldVal
|
58
103
|
} else if (isPlainObject(oldVal) && Array.isArray(newVal)) {
|
59
|
-
result[key] = oldVal
|
104
|
+
result[key] = oldVal
|
60
105
|
} else {
|
61
|
-
result[key] = newVal
|
106
|
+
result[key] = newVal
|
62
107
|
}
|
63
108
|
}
|
64
109
|
}
|
65
|
-
return result
|
110
|
+
return result
|
66
111
|
}
|
67
112
|
|
68
113
|
const createIteratee = (predicate: any) => {
|
69
114
|
if (typeof predicate === 'function') {
|
70
|
-
return predicate
|
115
|
+
return predicate
|
71
116
|
}
|
72
117
|
if (typeof predicate === 'string') {
|
73
|
-
return (obj: any) => obj[predicate]
|
118
|
+
return (obj: any) => obj[predicate]
|
74
119
|
}
|
75
120
|
if (Array.isArray(predicate)) {
|
76
|
-
const [key, value] = predicate
|
77
|
-
return (obj: any) => obj[key] === value
|
121
|
+
const [key, value] = predicate
|
122
|
+
return (obj: any) => obj[key] === value
|
78
123
|
}
|
79
124
|
if (typeof predicate === 'object' && predicate !== null) {
|
80
125
|
return (obj: any) => {
|
81
126
|
for (const key in predicate) {
|
82
127
|
if (Object.prototype.hasOwnProperty.call(predicate, key)) {
|
83
|
-
if (obj[key] !== predicate[key]) return false
|
128
|
+
if (obj[key] !== predicate[key]) return false
|
84
129
|
}
|
85
130
|
}
|
86
|
-
return true
|
87
|
-
}
|
131
|
+
return true
|
132
|
+
}
|
88
133
|
}
|
89
|
-
return () => false
|
90
|
-
}
|
134
|
+
return () => false
|
135
|
+
}
|
91
136
|
|
92
137
|
export const filter = <T>(array: T[], predicate: any): T[] => {
|
93
|
-
const iteratee = createIteratee(predicate)
|
94
|
-
return array.filter(iteratee)
|
95
|
-
}
|
138
|
+
const iteratee = createIteratee(predicate)
|
139
|
+
return array.filter(iteratee)
|
140
|
+
}
|
96
141
|
|
97
142
|
export const find = <T>(array: T[], predicate: any): T | undefined => {
|
98
|
-
const iteratee = createIteratee(predicate)
|
99
|
-
return array.find(iteratee)
|
100
|
-
}
|
143
|
+
const iteratee = createIteratee(predicate)
|
144
|
+
return array.find(iteratee)
|
145
|
+
}
|
101
146
|
|
102
|
-
export const partial = <F extends (...args:
|
147
|
+
export const partial = <F extends (...args: any[]) => any>(
|
103
148
|
fn: F,
|
104
|
-
...partials:
|
105
|
-
): ((...args:
|
106
|
-
const placeholder = partial.placeholder
|
107
|
-
return (...args:
|
108
|
-
let argIndex = 0
|
149
|
+
...partials: any[]
|
150
|
+
): ((...args: any[]) => ReturnType<F>) => {
|
151
|
+
const placeholder = partial.placeholder
|
152
|
+
return (...args: any[]): ReturnType<F> => {
|
153
|
+
let argIndex = 0
|
109
154
|
const finalArgs = partials.map(arg =>
|
110
155
|
arg === placeholder ? args[argIndex++] : arg
|
111
|
-
)
|
112
|
-
return fn(...(finalArgs.concat(args.slice(argIndex)) as Parameters<F>)) as ReturnType<F
|
113
|
-
}
|
114
|
-
}
|
156
|
+
)
|
157
|
+
return fn(...(finalArgs.concat(args.slice(argIndex)) as Parameters<F>)) as ReturnType<F>
|
158
|
+
}
|
159
|
+
}
|
115
160
|
|
116
|
-
partial.placeholder = Symbol()
|
117
|
-
export const _ = partial.placeholder
|
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);
|
198
|
+
};
|
199
|
+
}
|