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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_enhanced_element/{element_observer.js → element_observer.ts} +27 -19
  3. data/app/pb_kits/playbook/pb_enhanced_element/{index.js → index.ts} +22 -15
  4. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
  5. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
  6. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
  7. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
  8. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +195 -228
  11. data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +5 -0
  12. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
  13. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +105 -0
  14. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +1 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +106 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +1 -0
  17. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -0
  18. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
  19. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +149 -0
  20. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
  21. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
  22. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
  23. data/dist/chunks/_typeahead-CT2ByCBK.js +22 -0
  24. data/dist/chunks/_weekday_stacked-Bwdy1TtH.js +45 -0
  25. data/dist/chunks/lib-CEpcaI8y.js +29 -0
  26. data/dist/chunks/{pb_form_validation-8H8TD40J.js → pb_form_validation-D9zkwt2b.js} +1 -1
  27. data/dist/chunks/vendor.js +1 -45
  28. data/dist/playbook-doc.js +1 -1
  29. data/dist/playbook-rails-react-bindings.js +1 -1
  30. data/dist/playbook-rails.js +1 -1
  31. data/lib/playbook/pb_doc_helper.rb +5 -5
  32. data/lib/playbook/version.rb +1 -1
  33. metadata +17 -11
  34. data/dist/chunks/_typeahead-DPGG9h5l.js +0 -65
  35. data/dist/chunks/index-CaXZ6mCT.js +0 -1
  36. data/dist/chunks/index-DfoYI7sS.js +0 -1
  37. data/dist/chunks/lib-ByFv-sq8.js +0 -45
  38. data/dist/mark.js +0 -1
  39. data/dist/playbook-rails-friendly.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2ca4e8e8c3df9cdee7d02f68c3a611611053345876eb602efcdb91a16b4b076
4
- data.tar.gz: fb337ad2f116c3f991969c8e59c06ba697828ae5af32cde1c01cb49bf06b6ee6
3
+ metadata.gz: 1c9d08fec85ee5acbc34292a8fe9c2554c5e77a0da8e39d8aa8c901d7e911c05
4
+ data.tar.gz: 91c6c9fa38bfcd8910cabf5df1742689a327464084f5692b722f33d3576af112
5
5
  SHA512:
6
- metadata.gz: c833f8f4d32140a79a374f9d2b2b642fff7341defb6fc781122288238ba851c62281797eb4307ad9859c3a5004fd756c37e25dea8aa73434ac0dc6952b345fe9
7
- data.tar.gz: 468fdf29ec022656bedceb21a0f7e165aee5de1d469ebd541e09a0587a642f91dbee263fe8c7932b5cd06fa9cac6f73efd4852edeab71757d93f1ffd561638f2
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
- constructor(matchDelegate, target = document) {
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
- start() {
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
- import ElementObserver from './element_observer.js'
1
+ // eslint-disable-next-line
2
+ // @ts-nocheck
3
+ import ElementObserver from './element_observer'
2
4
 
3
5
  export default class PbEnhancedElement {
4
- static get elements() {
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
- constructor(element) {
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
- disconnect() { }
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(props),
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'