playbook_ui 14.5.0.pre.alpha.javascriptassets3939 → 14.5.0.pre.alpha.20241007playbookwebsiteaddrdbms4036
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_enhanced_element/{element_observer.js → element_observer.ts} +27 -19
- data/app/pb_kits/playbook/pb_enhanced_element/{index.js → index.ts} +22 -15
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +195 -228
- data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +5 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +105 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +106 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +149 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
- data/dist/chunks/_typeahead-CT2ByCBK.js +22 -0
- data/dist/chunks/_weekday_stacked-Bwdy1TtH.js +45 -0
- data/dist/chunks/lib-CEpcaI8y.js +29 -0
- data/dist/chunks/{pb_form_validation-8H8TD40J.js → pb_form_validation-D9zkwt2b.js} +1 -1
- data/dist/chunks/vendor.js +1 -45
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/pb_doc_helper.rb +5 -5
- data/lib/playbook/version.rb +1 -1
- metadata +17 -11
- data/dist/chunks/_typeahead-DPGG9h5l.js +0 -65
- data/dist/chunks/index-CaXZ6mCT.js +0 -1
- data/dist/chunks/index-DfoYI7sS.js +0 -1
- data/dist/chunks/lib-ByFv-sq8.js +0 -45
- data/dist/mark.js +0 -1
- data/dist/playbook-rails-friendly.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c9d08fec85ee5acbc34292a8fe9c2554c5e77a0da8e39d8aa8c901d7e911c05
|
4
|
+
data.tar.gz: 91c6c9fa38bfcd8910cabf5df1742689a327464084f5692b722f33d3576af112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0d2bfbd37af33531f7638d2f1e7e72ebe1f0bcedb5ec8f0b7df81431110a14754ed7c4d73ee19a3bb0f500e40f9e83be46ea6bf9e82d9fe186e4fca9a9818b0
|
7
|
+
data.tar.gz: c617f6acf17b65fbed0633c84baa9fbc240bc549d30633aa89b004734137a48632a47300e64b7d5660d4b71b86e05d68ae5cac13bc00f8de47e59ece1c655567
|
@@ -1,34 +1,47 @@
|
|
1
|
+
// eslint-disable-next-line
|
2
|
+
// @ts-nocheck
|
3
|
+
import PbEnhancedElement from "./index"
|
4
|
+
|
1
5
|
export default class ElementObserver {
|
2
|
-
|
6
|
+
matchDelegate: PbEnhancedElement
|
7
|
+
target: Document
|
8
|
+
_mutationObserver: MutationObserver
|
9
|
+
|
10
|
+
constructor(matchDelegate: PbEnhancedElement, target = document) {
|
3
11
|
this.matchDelegate = matchDelegate
|
4
12
|
this.target = target
|
5
13
|
}
|
6
14
|
|
7
|
-
|
15
|
+
get mutationObserver(): MutationObserver {
|
16
|
+
return this._mutationObserver =
|
17
|
+
this._mutationObserver || new MutationObserver((mutationList) => this.processMutationList(mutationList))
|
18
|
+
}
|
19
|
+
|
20
|
+
start(): void {
|
8
21
|
this.mutationObserver.observe(this.target, { attributes: true, childList: true, subtree: true })
|
9
22
|
this.catchup()
|
10
23
|
}
|
11
24
|
|
12
|
-
stop() {
|
25
|
+
stop(): void {
|
13
26
|
this.mutationObserverdisconnect()
|
14
27
|
}
|
15
28
|
|
16
|
-
catchup() {
|
17
|
-
this.handleAdditions(this.matchDelegate.matches(this.target))
|
29
|
+
catchup(): void {
|
30
|
+
this.handleAdditions(this.matchDelegate.matches(this.target as unknown as Element))
|
18
31
|
}
|
19
32
|
|
20
|
-
processMutationList(mutationList) {
|
33
|
+
processMutationList(mutationList: Array<MutationRecord>): void {
|
21
34
|
for (const mutation of mutationList) {
|
22
35
|
if (mutation.type == 'attributes') {
|
23
|
-
this.processAttributeChange(mutation.target)
|
36
|
+
this.processAttributeChange(mutation.target as Element)
|
24
37
|
} else if (mutation.type == 'childList') {
|
25
|
-
this.processRemovedNodes(Array.from(mutation.removedNodes))
|
26
|
-
this.processAddedNodes(Array.from(mutation.addedNodes))
|
38
|
+
this.processRemovedNodes(Array.from(mutation.removedNodes) as Array<Element>)
|
39
|
+
this.processAddedNodes(Array.from(mutation.addedNodes) as Array<Element>)
|
27
40
|
}
|
28
41
|
}
|
29
42
|
}
|
30
43
|
|
31
|
-
processAttributeChange(node) {
|
44
|
+
processAttributeChange(node: Element): void | Array<Element> {
|
32
45
|
if (node.nodeType !== Node.ELEMENT_NODE) return
|
33
46
|
|
34
47
|
const matches = this.matchDelegate.matches(node)
|
@@ -38,30 +51,25 @@ export default class ElementObserver {
|
|
38
51
|
this.handleAdditions(matches)
|
39
52
|
}
|
40
53
|
|
41
|
-
processRemovedNodes(nodes) {
|
54
|
+
processRemovedNodes(nodes: Array<Element>): void {
|
42
55
|
for (const node of nodes) {
|
43
56
|
if (node.nodeType !== Node.ELEMENT_NODE) continue
|
44
57
|
this.handleRemovals(this.matchDelegate.matches(node))
|
45
58
|
}
|
46
59
|
}
|
47
60
|
|
48
|
-
processAddedNodes(nodes) {
|
61
|
+
processAddedNodes(nodes: Array<Element>): void {
|
49
62
|
for (const node of nodes) {
|
50
63
|
if (node.nodeType !== Node.ELEMENT_NODE) continue
|
51
64
|
this.handleAdditions(this.matchDelegate.matches(node))
|
52
65
|
}
|
53
66
|
}
|
54
67
|
|
55
|
-
handleRemovals(elements) {
|
68
|
+
handleRemovals(elements: Array<Element>): void {
|
56
69
|
for (const element of elements) this.matchDelegate.removeMatch(element)
|
57
70
|
}
|
58
71
|
|
59
|
-
handleAdditions(elements) {
|
72
|
+
handleAdditions(elements: Array<Element>): void {
|
60
73
|
for (const element of elements) this.matchDelegate.addMatch(element)
|
61
74
|
}
|
62
|
-
|
63
|
-
get mutationObserver() {
|
64
|
-
return this._mutationObserver =
|
65
|
-
this._mutationObserver || new MutationObserver((mutationList) => this.processMutationList(mutationList))
|
66
|
-
}
|
67
75
|
}
|
@@ -1,21 +1,31 @@
|
|
1
|
-
|
1
|
+
// eslint-disable-next-line
|
2
|
+
// @ts-nocheck
|
3
|
+
import ElementObserver from './element_observer'
|
2
4
|
|
3
5
|
export default class PbEnhancedElement {
|
4
|
-
static
|
6
|
+
static _elements: Map<Element, PbEnhancedElement>
|
7
|
+
static _observer: ElementObserver
|
8
|
+
element: Element
|
9
|
+
|
10
|
+
constructor(element?: Element) {
|
11
|
+
this.element = element
|
12
|
+
}
|
13
|
+
|
14
|
+
static get elements(): Map<Element, PbEnhancedElement> {
|
5
15
|
return this._elements = (this._elements || new Map)
|
6
16
|
}
|
7
17
|
|
8
|
-
static get observer() {
|
18
|
+
static get observer(): ElementObserver {
|
9
19
|
return this._observer = (this._observer || new ElementObserver(this))
|
10
20
|
}
|
11
21
|
|
12
|
-
static get selector() {
|
22
|
+
static get selector(): string {
|
13
23
|
// eslint-disable-next-line no-console
|
14
24
|
console.warn('Define a static property for selector or redefine the matches function in a subclass.', this)
|
15
25
|
return null
|
16
26
|
}
|
17
27
|
|
18
|
-
static matches(node) {
|
28
|
+
static matches(node: Element): Array<Element> {
|
19
29
|
if (!this.selector) return []
|
20
30
|
|
21
31
|
const matches = []
|
@@ -25,7 +35,7 @@ export default class PbEnhancedElement {
|
|
25
35
|
return (matches)
|
26
36
|
}
|
27
37
|
|
28
|
-
static addMatch(element) {
|
38
|
+
static addMatch(element: Element): void {
|
29
39
|
if (element._pbEnhanced || this.elements.has(element)) return
|
30
40
|
|
31
41
|
const enhansedElement = new this(element)
|
@@ -34,7 +44,7 @@ export default class PbEnhancedElement {
|
|
34
44
|
element._pbEnhanced = enhansedElement
|
35
45
|
}
|
36
46
|
|
37
|
-
static removeMatch(element) {
|
47
|
+
static removeMatch(element: Element): void {
|
38
48
|
if (!this.elements.has(element)) return
|
39
49
|
|
40
50
|
const enhansedElement = this.elements.get(element)
|
@@ -42,22 +52,19 @@ export default class PbEnhancedElement {
|
|
42
52
|
this.elements.delete(element)
|
43
53
|
}
|
44
54
|
|
45
|
-
static start() {
|
55
|
+
static start(): void {
|
46
56
|
this.observer.start()
|
47
57
|
}
|
48
58
|
|
49
|
-
static stop() {
|
59
|
+
static stop(): void {
|
50
60
|
this.mutationObserver.stop()
|
51
61
|
}
|
52
62
|
|
53
|
-
|
54
|
-
this.element = element
|
55
|
-
}
|
56
|
-
|
57
|
-
connect() {
|
63
|
+
connect(): void {
|
58
64
|
// eslint-disable-next-line no-console
|
59
65
|
console.warn('Redefine the connect function in a subclass.', this)
|
60
66
|
}
|
61
67
|
|
62
|
-
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
69
|
+
disconnect(): void {}
|
63
70
|
}
|
@@ -47,9 +47,13 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
47
47
|
|
48
48
|
const iconClass = icon ? "_icon" : ""
|
49
49
|
const closeIconSize = size === "small" ? "xs" : "sm"
|
50
|
+
|
51
|
+
const filteredProps: FormPillProps = {...props}
|
52
|
+
delete filteredProps.truncate
|
53
|
+
|
50
54
|
const css = classnames(
|
51
55
|
`pb_form_pill_kit_${color}${iconClass}`,
|
52
|
-
globalProps(
|
56
|
+
globalProps(filteredProps),
|
53
57
|
className,
|
54
58
|
size === 'small' ? 'small' : null,
|
55
59
|
textTransform,
|
@@ -77,6 +81,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
77
81
|
className="pb_form_pill_text"
|
78
82
|
size={4}
|
79
83
|
text={name}
|
84
|
+
truncate={props.truncate}
|
80
85
|
/>
|
81
86
|
</>
|
82
87
|
)}
|
@@ -92,6 +97,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
92
97
|
className="pb_form_pill_text"
|
93
98
|
size={4}
|
94
99
|
text={name}
|
100
|
+
truncate={props.truncate}
|
95
101
|
/>
|
96
102
|
<Icon
|
97
103
|
className="pb_form_pill_icon"
|
@@ -111,6 +117,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
111
117
|
className="pb_form_pill_tag"
|
112
118
|
size={4}
|
113
119
|
text={text}
|
120
|
+
truncate={props.truncate}
|
114
121
|
/>
|
115
122
|
</>
|
116
123
|
)}
|
@@ -119,6 +126,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
119
126
|
className="pb_form_pill_tag"
|
120
127
|
size={4}
|
121
128
|
text={text}
|
129
|
+
truncate={props.truncate}
|
122
130
|
/>
|
123
131
|
)}
|
124
132
|
<div
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%
|
2
|
+
names = [
|
3
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
4
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
5
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
6
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
7
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
8
|
+
]
|
9
|
+
%>
|
10
|
+
|
11
|
+
<%= pb_rails("typeahead", props: {
|
12
|
+
html_options: { style: { maxWidth: "240px" }},
|
13
|
+
id: "typeahead-form-pill",
|
14
|
+
is_multi: true,
|
15
|
+
options: names,
|
16
|
+
label: "Names",
|
17
|
+
pills: true,
|
18
|
+
truncate: 1,
|
19
|
+
}) %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Typeahead from '../../pb_typeahead/_typeahead'
|
3
|
+
|
4
|
+
const names = [
|
5
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
6
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
7
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
8
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
9
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const FormPillTruncatedText = (props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typeahead
|
16
|
+
htmlOptions={{ style: { maxWidth: "240px" }}}
|
17
|
+
isMulti
|
18
|
+
label="Names"
|
19
|
+
options={names}
|
20
|
+
truncate={1}
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
</>
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
export default FormPillTruncatedText
|
@@ -0,0 +1 @@
|
|
1
|
+
For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
|
@@ -3,6 +3,7 @@ examples:
|
|
3
3
|
rails:
|
4
4
|
- form_pill_user: Form Pill User
|
5
5
|
- form_pill_size: Form Pill Size
|
6
|
+
- form_pill_truncated_text: Truncated Text
|
6
7
|
- form_pill_tag: Form Pill Tag
|
7
8
|
- form_pill_example: Example
|
8
9
|
- form_pill_icon: Form Pill Icon
|
@@ -11,6 +12,7 @@ examples:
|
|
11
12
|
react:
|
12
13
|
- form_pill_user: Form Pill User
|
13
14
|
- form_pill_size: Form Pill Size
|
15
|
+
- form_pill_truncated_text: Truncated Text
|
14
16
|
- form_pill_tag: Form Pill Tag
|
15
17
|
- form_pill_example: Example
|
16
18
|
- form_pill_icon: Form Pill Icon
|
@@ -4,3 +4,4 @@ export { default as FormPillTag } from './_form_pill_tag.jsx'
|
|
4
4
|
export { default as FormPillExample } from './_form_pill_example.jsx'
|
5
5
|
export { default as FormPillIcon } from './_form_pill_icon.jsx'
|
6
6
|
export { default as FormPillColors } from './_form_pill_colors.jsx'
|
7
|
+
export { default as FormPillTruncatedText } from './_form_pill_truncated_text.jsx'
|