playbook_ui 16.2.0.pre.alpha.advancedtablecascadingcollapsereact14676 → 16.2.0.pre.alpha.faiconbuttonfix14520
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/Components/CustomCell.tsx +4 -17
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +9 -21
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +1 -25
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -74
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_collapsible/index.js +4 -16
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_dialog/index.js +5 -45
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +13 -68
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +3 -19
- data/app/pb_kits/playbook/pb_enhanced_element/element_observer.ts +1 -1
- data/app/pb_kits/playbook/pb_enhanced_element/index.ts +1 -2
- data/app/pb_kits/playbook/pb_icon/icon.rb +19 -168
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +0 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +1 -101
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +1 -172
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +15 -178
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +0 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +0 -2
- data/app/pb_kits/playbook/pb_select/_select.tsx +0 -2
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +1 -1
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +0 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +0 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +2 -2
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +21 -43
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_textarea/docs/index.js +8 -9
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +4 -4
- data/app/pb_kits/playbook/pb_textarea/textarea.rb +2 -6
- data/app/pb_kits/playbook/pb_textarea/textarea.test.js +1 -134
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +0 -6
- data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_tooltip/index.js +15 -60
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -1
- data/dist/chunks/{_pb_line_graph-BGY7jEks.js → _pb_line_graph-BSLb5VXP.js} +1 -1
- data/dist/chunks/{_typeahead-QhswHQnq.js → _typeahead-DXIBDeMj.js} +1 -1
- data/dist/chunks/{globalProps-CK2YuA9O.js → globalProps-DyTB8IdV.js} +1 -1
- data/dist/chunks/{lib-DspaUdlc.js → lib-9wz3x5jl.js} +1 -1
- data/dist/chunks/vendor.js +5 -5
- data/dist/menu.yml +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/checkbox_field.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -12
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md +0 -1
- data/app/pb_kits/playbook/pb_kit_registry/index.ts +0 -180
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_reset_key.jsx +0 -100
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_reset_key.md +0 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.jsx +0 -68
|
@@ -17,7 +17,7 @@ module Playbook
|
|
|
17
17
|
input = super(name, options, checked_value, unchecked_value)
|
|
18
18
|
|
|
19
19
|
if props[:label]
|
|
20
|
-
@template.pb_rails("caption", props: {
|
|
20
|
+
@template.pb_rails("caption", props: { text: label_text, margin_bottom: "xs" }) +
|
|
21
21
|
@template.pb_rails("checkbox", props: props) do
|
|
22
22
|
input
|
|
23
23
|
end
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playbook_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.2.0.pre.alpha.
|
|
4
|
+
version: 16.2.0.pre.alpha.faiconbuttonfix14520
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Power UX
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-02-
|
|
12
|
+
date: 2026-02-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: actionpack
|
|
@@ -283,8 +283,6 @@ files:
|
|
|
283
283
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.md
|
|
284
284
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb
|
|
285
285
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md
|
|
286
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx
|
|
287
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md
|
|
288
286
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx
|
|
289
287
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md
|
|
290
288
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb
|
|
@@ -1880,7 +1878,6 @@ files:
|
|
|
1880
1878
|
- app/pb_kits/playbook/pb_image/image.test.js
|
|
1881
1879
|
- app/pb_kits/playbook/pb_kit/dateTime.ts
|
|
1882
1880
|
- app/pb_kits/playbook/pb_kit/pb_date_time.rb
|
|
1883
|
-
- app/pb_kits/playbook/pb_kit_registry/index.ts
|
|
1884
1881
|
- app/pb_kits/playbook/pb_label_pill/_label_pill.scss
|
|
1885
1882
|
- app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
|
|
1886
1883
|
- app/pb_kits/playbook/pb_label_pill/docs/_description.md
|
|
@@ -2137,8 +2134,6 @@ files:
|
|
|
2137
2134
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md
|
|
2138
2135
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx
|
|
2139
2136
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.md
|
|
2140
|
-
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_reset_key.jsx
|
|
2141
|
-
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_reset_key.md
|
|
2142
2137
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.html.erb
|
|
2143
2138
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.jsx
|
|
2144
2139
|
- app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.md
|
|
@@ -3358,7 +3353,6 @@ files:
|
|
|
3358
3353
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_inline.html.erb
|
|
3359
3354
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_inline.jsx
|
|
3360
3355
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.html.erb
|
|
3361
|
-
- app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.jsx
|
|
3362
3356
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_input_options.md
|
|
3363
3357
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md
|
|
3364
3358
|
- app/pb_kits/playbook/pb_textarea/docs/_textarea_required_indicator.html.erb
|
|
@@ -3924,12 +3918,12 @@ files:
|
|
|
3924
3918
|
- app/pb_kits/playbook/utilities/test/globalProps/zIndex.test.js
|
|
3925
3919
|
- app/pb_kits/playbook/utilities/text.ts
|
|
3926
3920
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
|
3927
|
-
- dist/chunks/_pb_line_graph-
|
|
3928
|
-
- dist/chunks/_typeahead-
|
|
3921
|
+
- dist/chunks/_pb_line_graph-BSLb5VXP.js
|
|
3922
|
+
- dist/chunks/_typeahead-DXIBDeMj.js
|
|
3929
3923
|
- dist/chunks/componentRegistry-DzmmLR2x.js
|
|
3930
|
-
- dist/chunks/globalProps-
|
|
3924
|
+
- dist/chunks/globalProps-DyTB8IdV.js
|
|
3931
3925
|
- dist/chunks/lazysizes-B7xYodB-.js
|
|
3932
|
-
- dist/chunks/lib-
|
|
3926
|
+
- dist/chunks/lib-9wz3x5jl.js
|
|
3933
3927
|
- dist/chunks/vendor.js
|
|
3934
3928
|
- dist/menu.yml
|
|
3935
3929
|
- dist/playbook-rails-react-bindings.js
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
-
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
4
|
-
|
|
5
|
-
const AdvancedTableCascadeCollapse = (props) => {
|
|
6
|
-
const columnDefinitions = [
|
|
7
|
-
{
|
|
8
|
-
accessor: "year",
|
|
9
|
-
label: "Year",
|
|
10
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
accessor: "newEnrollments",
|
|
14
|
-
label: "New Enrollments",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
accessor: "scheduledMeetings",
|
|
18
|
-
label: "Scheduled Meetings",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
accessor: "attendanceRate",
|
|
22
|
-
label: "Attendance Rate",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
accessor: "completedClasses",
|
|
26
|
-
label: "Completed Classes",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
accessor: "classCompletionRate",
|
|
30
|
-
label: "Class Completion Rate",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
accessor: "graduatedStudents",
|
|
34
|
-
label: "Graduated Students",
|
|
35
|
-
},
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div>
|
|
40
|
-
<AdvancedTable
|
|
41
|
-
cascadeCollapse
|
|
42
|
-
columnDefinitions={columnDefinitions}
|
|
43
|
-
tableData={MOCK_DATA}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default AdvancedTableCascadeCollapse
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
`cascadeCollapse` is an optional prop that is set to 'false' by default. If set to 'true', collapsing any parent row itself or by using the toggle exapansion buttons in any header or subheader row also collapses all descendants and clears their expansion state. Re-expanding then shows only direct children until the user expands deeper levels again.
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import PbEnhancedElement from "../pb_enhanced_element";
|
|
4
|
-
|
|
5
|
-
type KitClass = typeof PbEnhancedElement;
|
|
6
|
-
|
|
7
|
-
class PbKitRegistry {
|
|
8
|
-
private static instance: PbKitRegistry;
|
|
9
|
-
|
|
10
|
-
// array to avoid overwriting if multiple kits share a selector
|
|
11
|
-
private kits: Map<string, KitClass[]> = new Map();
|
|
12
|
-
|
|
13
|
-
private mutationObserver: MutationObserver | null = null;
|
|
14
|
-
private initialized = false;
|
|
15
|
-
|
|
16
|
-
// rAF batching to reduce jank during heavy DOM churn
|
|
17
|
-
private queued = false;
|
|
18
|
-
private pendingMutations: MutationRecord[] = [];
|
|
19
|
-
|
|
20
|
-
static getInstance(): PbKitRegistry {
|
|
21
|
-
if (!PbKitRegistry.instance) {
|
|
22
|
-
PbKitRegistry.instance = new PbKitRegistry();
|
|
23
|
-
}
|
|
24
|
-
return PbKitRegistry.instance;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
register(kit: KitClass): void {
|
|
28
|
-
const selector = kit.selector;
|
|
29
|
-
if (!selector) {
|
|
30
|
-
console.warn("[PbKitRegistry] Kit missing selector:", kit.name);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const list = this.kits.get(selector) || [];
|
|
35
|
-
list.push(kit);
|
|
36
|
-
this.kits.set(selector, list);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
start(): void {
|
|
40
|
-
if (this.initialized) return;
|
|
41
|
-
this.initialized = true;
|
|
42
|
-
|
|
43
|
-
const target = document.documentElement || document;
|
|
44
|
-
|
|
45
|
-
// Single MutationObserver for ALL kits
|
|
46
|
-
// attributes OFF
|
|
47
|
-
this.mutationObserver = new MutationObserver((muts) => this.onMutations(muts));
|
|
48
|
-
|
|
49
|
-
this.mutationObserver.observe(target, {
|
|
50
|
-
childList: true,
|
|
51
|
-
subtree: true,
|
|
52
|
-
// attributes: false by omission
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// Initial scan of document
|
|
56
|
-
this.scan(document);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
stop(): void {
|
|
60
|
-
if (!this.initialized) return;
|
|
61
|
-
|
|
62
|
-
this.mutationObserver?.disconnect();
|
|
63
|
-
this.mutationObserver = null;
|
|
64
|
-
|
|
65
|
-
// Disconnect all kit instances safely (snapshot keys first)
|
|
66
|
-
this.kits.forEach((kitsForSelector) => {
|
|
67
|
-
kitsForSelector.forEach((kit) => {
|
|
68
|
-
if (!kit.elements) return;
|
|
69
|
-
const els = Array.from(kit.elements.keys());
|
|
70
|
-
els.forEach((el) => kit.removeMatch(el));
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
this.pendingMutations = [];
|
|
75
|
-
this.queued = false;
|
|
76
|
-
this.initialized = false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ---- Mutation batching ----
|
|
80
|
-
|
|
81
|
-
private onMutations(muts: MutationRecord[]): void {
|
|
82
|
-
this.pendingMutations.push(...muts);
|
|
83
|
-
|
|
84
|
-
if (this.queued) return;
|
|
85
|
-
this.queued = true;
|
|
86
|
-
|
|
87
|
-
requestAnimationFrame(() => {
|
|
88
|
-
this.queued = false;
|
|
89
|
-
const batch = this.pendingMutations;
|
|
90
|
-
this.pendingMutations = [];
|
|
91
|
-
this.processMutations(batch);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private processMutations(mutations: MutationRecord[]): void {
|
|
96
|
-
// We only care about added nodes here.
|
|
97
|
-
// Removals handled by cleanupDisconnected() (no selector queries on removed subtrees)
|
|
98
|
-
const addedRoots: Element[] = [];
|
|
99
|
-
|
|
100
|
-
for (const mutation of mutations) {
|
|
101
|
-
if (mutation.type !== "childList") continue;
|
|
102
|
-
|
|
103
|
-
mutation.addedNodes.forEach((node) => {
|
|
104
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
105
|
-
addedRoots.push(node as Element);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Enhance anything newly inserted
|
|
111
|
-
if (addedRoots.length) {
|
|
112
|
-
for (const root of addedRoots) {
|
|
113
|
-
this.scan(root);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Handle removals cheaply: only look at already-enhanced elements
|
|
118
|
-
this.cleanupDisconnected();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// ---- Scanning / enhancing ----
|
|
122
|
-
|
|
123
|
-
private scan(root: ParentNode): void {
|
|
124
|
-
// For each selector, query within root once and attach all kits registered to it
|
|
125
|
-
this.kits.forEach((kitsForSelector, selector) => {
|
|
126
|
-
let matches: NodeListOf<Element>;
|
|
127
|
-
try {
|
|
128
|
-
// querySelectorAll doesn’t include root itself, so we handle that below too
|
|
129
|
-
matches = (root as any).querySelectorAll
|
|
130
|
-
? (root as any).querySelectorAll(selector)
|
|
131
|
-
: document.querySelectorAll(selector);
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.debug(`[PbKitRegistry] Invalid selector "${selector}"`, error);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (matches && matches.length) {
|
|
138
|
-
matches.forEach((el) => {
|
|
139
|
-
kitsForSelector.forEach((kit) => kit.addMatch(el));
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Include root itself if it matches
|
|
144
|
-
if ((root as any).matches?.(selector)) {
|
|
145
|
-
kitsForSelector.forEach((kit) => kit.addMatch(root as any));
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// No selector queries on removals
|
|
151
|
-
// We just remove instances whose elements are no longer in the DOM
|
|
152
|
-
private cleanupDisconnected(): void {
|
|
153
|
-
this.kits.forEach((kitsForSelector) => {
|
|
154
|
-
kitsForSelector.forEach((kit) => {
|
|
155
|
-
if (!kit.elements) return;
|
|
156
|
-
|
|
157
|
-
// Snapshot keys to avoid mutate-while-iterating
|
|
158
|
-
const els = Array.from(kit.elements.keys());
|
|
159
|
-
for (const el of els) {
|
|
160
|
-
if (!el.isConnected) {
|
|
161
|
-
kit.removeMatch(el);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Debug helpers
|
|
169
|
-
getRegisteredSelectors(): string[] {
|
|
170
|
-
return Array.from(this.kits.keys());
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Optional: manually rescan a subtree (useful if some page toggles data-* after insertion)
|
|
174
|
-
rescan(root: ParentNode = document): void {
|
|
175
|
-
if (!this.initialized) return;
|
|
176
|
-
this.scan(root);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export default PbKitRegistry.getInstance();
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_reset_key.jsx
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import MultiLevelSelect from "../_multi_level_select";
|
|
3
|
-
import { Button } from "playbook-ui";
|
|
4
|
-
|
|
5
|
-
const treeData = [
|
|
6
|
-
{
|
|
7
|
-
label: "Power Home Remodeling",
|
|
8
|
-
value: "powerHomeRemodeling",
|
|
9
|
-
id: "100",
|
|
10
|
-
expanded: true,
|
|
11
|
-
children: [
|
|
12
|
-
{
|
|
13
|
-
label: "People",
|
|
14
|
-
value: "people",
|
|
15
|
-
id: "101",
|
|
16
|
-
expanded: true,
|
|
17
|
-
children: [
|
|
18
|
-
{
|
|
19
|
-
label: "Talent Acquisition",
|
|
20
|
-
value: "talentAcquisition",
|
|
21
|
-
id: "102",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "Business Affairs",
|
|
25
|
-
value: "businessAffairs",
|
|
26
|
-
id: "103",
|
|
27
|
-
children: [
|
|
28
|
-
{
|
|
29
|
-
label: "Initiatives",
|
|
30
|
-
value: "initiatives",
|
|
31
|
-
id: "104",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: "Learning & Development",
|
|
35
|
-
value: "learningAndDevelopment",
|
|
36
|
-
id: "105",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: "People Experience",
|
|
42
|
-
value: "peopleExperience",
|
|
43
|
-
id: "106",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: "Contact Center",
|
|
49
|
-
value: "contactCenter",
|
|
50
|
-
id: "107",
|
|
51
|
-
children: [
|
|
52
|
-
{
|
|
53
|
-
label: "Appointment Management",
|
|
54
|
-
value: "appointmentManagement",
|
|
55
|
-
id: "108",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "Customer Service",
|
|
59
|
-
value: "customerService",
|
|
60
|
-
id: "109",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: "Energy",
|
|
64
|
-
value: "energy",
|
|
65
|
-
id: "110",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const MultiLevelSelectReactResetKey = (props) => {
|
|
74
|
-
const [resetKey, setResetKey] = useState(0);
|
|
75
|
-
|
|
76
|
-
const handleReset = () => {
|
|
77
|
-
setResetKey((k) => k + 1);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<>
|
|
82
|
-
<MultiLevelSelect
|
|
83
|
-
{...props}
|
|
84
|
-
id="multi-level-select-reset-example"
|
|
85
|
-
key={`multi-level-select-reset-${resetKey}`}
|
|
86
|
-
name="my_array"
|
|
87
|
-
returnAllSelected
|
|
88
|
-
treeData={treeData}
|
|
89
|
-
/>
|
|
90
|
-
<Button
|
|
91
|
-
id="multilevelselect-reset-button"
|
|
92
|
-
marginTop="lg"
|
|
93
|
-
onClick={handleReset}
|
|
94
|
-
text="Reset"
|
|
95
|
-
/>
|
|
96
|
-
</>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default MultiLevelSelectReactResetKey;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
When a parent resets a Multi Level Select (e.g., “Default” or “Clear”), the kit needs a `key` that changes with the selection because React uses the `key` to determine component identity and whether to preserve internal state. If the `key` doesn’t change, React reuses the existing instance and may keep showing the old selection instead of resetting to the new one.
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react"
|
|
2
|
-
|
|
3
|
-
import Textarea from "../_textarea"
|
|
4
|
-
|
|
5
|
-
const TextareaInputOptions = (props) => {
|
|
6
|
-
const [value1, setValue1] = useState("")
|
|
7
|
-
const [value2, setValue2] = useState("")
|
|
8
|
-
const [value3, setValue3] = useState("")
|
|
9
|
-
const [value4, setValue4] = useState("")
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div>
|
|
13
|
-
<Textarea
|
|
14
|
-
id="container-id"
|
|
15
|
-
label="ID on Container"
|
|
16
|
-
name="comment"
|
|
17
|
-
onChange={(e) => setValue1(e.target.value)}
|
|
18
|
-
rows={4}
|
|
19
|
-
value={value1}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
|
|
23
|
-
<br />
|
|
24
|
-
|
|
25
|
-
<Textarea
|
|
26
|
-
inputOptions={{ id: "textarea-id" }}
|
|
27
|
-
label="ID on Textarea via inputOptions"
|
|
28
|
-
name="comment"
|
|
29
|
-
onChange={(e) => setValue2(e.target.value)}
|
|
30
|
-
rows={4}
|
|
31
|
-
value={value2}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
|
-
<br />
|
|
36
|
-
|
|
37
|
-
<Textarea
|
|
38
|
-
id="container-id-2"
|
|
39
|
-
inputOptions={{ id: "textarea-id-2" }}
|
|
40
|
-
label="Both Container and Textarea IDs"
|
|
41
|
-
name="comment"
|
|
42
|
-
onChange={(e) => setValue3(e.target.value)}
|
|
43
|
-
rows={4}
|
|
44
|
-
value={value3}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
<br />
|
|
49
|
-
|
|
50
|
-
<Textarea
|
|
51
|
-
inputOptions={{
|
|
52
|
-
"aria-label": "Enter description",
|
|
53
|
-
"aria-describedby": "help-text",
|
|
54
|
-
data: { controller: "textarea", action: "focus->handleFocus" },
|
|
55
|
-
id: "description-textarea"
|
|
56
|
-
}}
|
|
57
|
-
label="Data and ARIA Attributes"
|
|
58
|
-
name="description"
|
|
59
|
-
onChange={(e) => setValue4(e.target.value)}
|
|
60
|
-
rows={4}
|
|
61
|
-
value={value4}
|
|
62
|
-
{...props}
|
|
63
|
-
/>
|
|
64
|
-
</div>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default TextareaInputOptions
|