@sps-woodland/list-bar 8.0.0-rc1
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.
- package/README.md +3 -0
- package/lib/advanced-search/AdvancedSearch.css.d.ts +9 -0
- package/lib/advanced-search/AdvancedSearch.d.ts +13 -0
- package/lib/advanced-search/AdvancedSearch.examples.d.ts +2 -0
- package/lib/index.cjs.js +1047 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.es.js +1668 -0
- package/lib/list-bar/InputGroupWrapper.d.ts +3 -0
- package/lib/list-bar/ListBar.css.d.ts +38 -0
- package/lib/list-bar/ListBar.d.ts +17 -0
- package/lib/list-bar/ListBar.examples.d.ts +3 -0
- package/lib/list-bar/ListBarSearch.d.ts +5 -0
- package/lib/list-bar/ListBarSearchInfo.d.ts +3 -0
- package/lib/list-bar/ListBarSortBy.d.ts +15 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/search-results-bar/SearchResultsBar.css.d.ts +9 -0
- package/lib/search-results-bar/SearchResultsBar.d.ts +10 -0
- package/lib/search-results-bar/SearchResultsBar.examples.d.ts +2 -0
- package/lib/style.css +1 -0
- package/package.json +49 -0
- package/vite.config.js +21 -0
package/lib/index.es.js
ADDED
@@ -0,0 +1,1668 @@
|
|
1
|
+
import * as e from "react";
|
2
|
+
import { modChildren as Z, cl as x, Metadata as b, I18nContext as w, selectChildren as J, addProps as Q, PortalContext as X, contentOf as $ } from "@sps-woodland/core";
|
3
|
+
import { Button as T } from "@sps-woodland/buttons";
|
4
|
+
import { Tag as C } from "@sps-woodland/tags";
|
5
|
+
import { lockToAnimationFrames as ee, code as o } from "@spscommerce/utils";
|
6
|
+
import { SpsInputGroup as te, SpsCheckbox as ae, SpsDropdown as re, SpsForm as ne, SpsFocusedTask as se, SpsTable as oe, SpsTableHead as le, SpsTableHeader as A, SpsTableBody as ce, SpsTableRow as v, SpsTableCell as s } from "@spscommerce/ds-react";
|
7
|
+
import { sprinkles as ie } from "@sps-woodland/tokens";
|
8
|
+
function de(t, a, r) {
|
9
|
+
return a in t ? Object.defineProperty(t, a, {
|
10
|
+
value: r,
|
11
|
+
enumerable: !0,
|
12
|
+
configurable: !0,
|
13
|
+
writable: !0
|
14
|
+
}) : t[a] = r, t;
|
15
|
+
}
|
16
|
+
function _(t, a) {
|
17
|
+
var r = Object.keys(t);
|
18
|
+
if (Object.getOwnPropertySymbols) {
|
19
|
+
var n = Object.getOwnPropertySymbols(t);
|
20
|
+
a && (n = n.filter(function(c) {
|
21
|
+
return Object.getOwnPropertyDescriptor(t, c).enumerable;
|
22
|
+
})), r.push.apply(r, n);
|
23
|
+
}
|
24
|
+
return r;
|
25
|
+
}
|
26
|
+
function D(t) {
|
27
|
+
for (var a = 1; a < arguments.length; a++) {
|
28
|
+
var r = arguments[a] != null ? arguments[a] : {};
|
29
|
+
a % 2 ? _(Object(r), !0).forEach(function(n) {
|
30
|
+
de(t, n, r[n]);
|
31
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : _(Object(r)).forEach(function(n) {
|
32
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
|
33
|
+
});
|
34
|
+
}
|
35
|
+
return t;
|
36
|
+
}
|
37
|
+
var me = (t, a, r) => {
|
38
|
+
for (var n of Object.keys(t)) {
|
39
|
+
var c;
|
40
|
+
if (t[n] !== ((c = a[n]) !== null && c !== void 0 ? c : r[n]))
|
41
|
+
return !1;
|
42
|
+
}
|
43
|
+
return !0;
|
44
|
+
}, G = (t) => (a) => {
|
45
|
+
var r = t.defaultClassName, n = D(D({}, t.defaultVariants), a);
|
46
|
+
for (var c in n) {
|
47
|
+
var m, h = (m = n[c]) !== null && m !== void 0 ? m : t.defaultVariants[c];
|
48
|
+
if (h != null) {
|
49
|
+
var l = h;
|
50
|
+
typeof l == "boolean" && (l = l === !0 ? "true" : "false");
|
51
|
+
var p = t.variantClassNames[c][l];
|
52
|
+
p && (r += " " + p);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
for (var [i, u] of t.compoundVariants)
|
56
|
+
me(i, n, t.defaultVariants) && (r += " " + u);
|
57
|
+
return r;
|
58
|
+
}, ue = "_9h4p70e", he = G({ defaultClassName: "_9h4p701", variantClassNames: { pinned: { true: "_9h4p702", false: "_9h4p703" } }, defaultVariants: { pinned: !1 }, compoundVariants: [] }), pe = "_9h4p709", Se = "_9h4p70a", fe = "_9h4p707", ve = "_9h4p708", be = "_9h4p704", P = "_9h4p70b", Be = "_9h4p706", ge = "_9h4p70d", Te = "_9h4p70c", Ee = "_9h4p705", Le = "_9h4p70f";
|
59
|
+
function ye({
|
60
|
+
children: t
|
61
|
+
}) {
|
62
|
+
const a = Z(
|
63
|
+
t,
|
64
|
+
(r) => r.type === T ? [
|
65
|
+
{
|
66
|
+
className: x(r.props.className, ue)
|
67
|
+
}
|
68
|
+
] : []
|
69
|
+
);
|
70
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, a);
|
71
|
+
}
|
72
|
+
function R({
|
73
|
+
onSubmit: t,
|
74
|
+
children: a
|
75
|
+
}) {
|
76
|
+
function r(n) {
|
77
|
+
n.preventDefault(), t && t(n);
|
78
|
+
}
|
79
|
+
return /* @__PURE__ */ e.createElement("form", {
|
80
|
+
onSubmit: r,
|
81
|
+
className: Te,
|
82
|
+
noValidate: !0
|
83
|
+
}, /* @__PURE__ */ e.createElement(te, {
|
84
|
+
className: ge
|
85
|
+
}, /* @__PURE__ */ e.createElement(ye, null, a)));
|
86
|
+
}
|
87
|
+
b.set(R, {
|
88
|
+
name: "ListBarSearch",
|
89
|
+
props: {
|
90
|
+
onSubmit: { type: "FormEventHandler" }
|
91
|
+
}
|
92
|
+
});
|
93
|
+
function F({
|
94
|
+
children: t
|
95
|
+
}) {
|
96
|
+
return /* @__PURE__ */ e.createElement("div", null, t);
|
97
|
+
}
|
98
|
+
b.set(F, {
|
99
|
+
name: "ListBarSearchInfo"
|
100
|
+
});
|
101
|
+
var xe = "_1gxdcgc1", Ae = "_1gxdcgc8", Ce = "_1gxdcgc7", we = "_1gxdcgc2", Re = "_1gxdcgc5", Fe = "_1gxdcgc6", Me = "_1gxdcgc4", Ie = "_1gxdcgc0", ke = "_1gxdcgc3";
|
102
|
+
function M({
|
103
|
+
results: t,
|
104
|
+
selections: a,
|
105
|
+
zeroStateText: r,
|
106
|
+
onClear: n,
|
107
|
+
className: c,
|
108
|
+
children: m,
|
109
|
+
...h
|
110
|
+
}) {
|
111
|
+
const { t: l } = e.useContext(w), p = a ? Object.keys(a).reduce((i, u) => (a[u].length > 0 && (i[u] = a[u]), i), {}) : {};
|
112
|
+
return /* @__PURE__ */ e.createElement("div", {
|
113
|
+
className: xe,
|
114
|
+
...h
|
115
|
+
}, t != null && /* @__PURE__ */ e.createElement("div", {
|
116
|
+
className: we
|
117
|
+
}, /* @__PURE__ */ e.createElement("span", null, l("design-system:searchResultsBar.results")), /* @__PURE__ */ e.createElement(C, {
|
118
|
+
className: ke,
|
119
|
+
kind: "info"
|
120
|
+
}, /* @__PURE__ */ e.createElement("span", null, t))), /* @__PURE__ */ e.createElement("div", {
|
121
|
+
className: Me
|
122
|
+
}, Object.keys(p).length > 0 ? Object.keys(p).map((i, u) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", {
|
123
|
+
key: u,
|
124
|
+
className: Re
|
125
|
+
}, i, ":"), p[i].map((B, g) => /* @__PURE__ */ e.createElement(C, {
|
126
|
+
className: Fe,
|
127
|
+
key: g,
|
128
|
+
kind: "key"
|
129
|
+
}, /* @__PURE__ */ e.createElement("span", null, B))))) : /* @__PURE__ */ e.createElement("span", {
|
130
|
+
className: "font-italic"
|
131
|
+
}, r || l("design-system:searchResultsBar.noAdvancedSearchSelections"))), /* @__PURE__ */ e.createElement("div", {
|
132
|
+
className: Ce
|
133
|
+
}, /* @__PURE__ */ e.createElement(T, {
|
134
|
+
className: Ae,
|
135
|
+
kind: "link",
|
136
|
+
onClick: n
|
137
|
+
}, l("design-system:searchResultsBar.clearResults"))));
|
138
|
+
}
|
139
|
+
b.set(M, {
|
140
|
+
name: "Search Results Bar",
|
141
|
+
props: {
|
142
|
+
results: { type: "number | null" },
|
143
|
+
selections: { type: "{ [key: string]: string[] }" },
|
144
|
+
zeroStateText: { type: "string" },
|
145
|
+
onClear: { type: "() => void" }
|
146
|
+
}
|
147
|
+
});
|
148
|
+
function U({
|
149
|
+
advancedSearch: t,
|
150
|
+
onToggleAdvancedSearch: a,
|
151
|
+
title: r,
|
152
|
+
onToolbarPinned: n,
|
153
|
+
selectable: c,
|
154
|
+
isSelected: m,
|
155
|
+
isIndeterminate: h,
|
156
|
+
onSelectionChange: l,
|
157
|
+
pinResultsBar: p,
|
158
|
+
pinToolbar: i = !0,
|
159
|
+
children: u,
|
160
|
+
className: B,
|
161
|
+
...g
|
162
|
+
}) {
|
163
|
+
const { t: q } = e.useContext(w);
|
164
|
+
let y = null;
|
165
|
+
const [S, I] = e.useState(!1), E = e.useRef(null), f = e.useRef(null), k = ee(() => {
|
166
|
+
if (E.current && i) {
|
167
|
+
const d = E.current.getBoundingClientRect();
|
168
|
+
d && d.height > 0 && d.top <= 60 && (typeof y == "number" ? window.scrollY < y && (y = null, I(!1)) : (y = window.scrollY, I(!0), a && a(!1)));
|
169
|
+
}
|
170
|
+
});
|
171
|
+
e.useEffect(() => (window.addEventListener("scroll", k), () => {
|
172
|
+
window.removeEventListener("scroll", k);
|
173
|
+
}), []);
|
174
|
+
const L = e.useRef();
|
175
|
+
e.useLayoutEffect(() => {
|
176
|
+
if (f.current && E.current && i) {
|
177
|
+
if (S && L.current)
|
178
|
+
f.current.style.height = L.current.height, f.current.style.width = L.current.width, f.current.style.marginBottom = L.current.marginBottom;
|
179
|
+
else if (!S) {
|
180
|
+
f.current.style.height = "", f.current.style.width = "", f.current.style.marginBottom = "";
|
181
|
+
const d = window.getComputedStyle(E.current);
|
182
|
+
L.current = {
|
183
|
+
height: d.height,
|
184
|
+
width: d.width,
|
185
|
+
marginBottom: d.marginBottom
|
186
|
+
};
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}, [S]);
|
190
|
+
function H() {
|
191
|
+
a && a(!(t != null && t.isOpen));
|
192
|
+
}
|
193
|
+
function W(d) {
|
194
|
+
n && n(d);
|
195
|
+
}
|
196
|
+
e.useEffect(() => {
|
197
|
+
W(S);
|
198
|
+
}, [S]);
|
199
|
+
const [O, Y, z, [N], V] = J(u, [
|
200
|
+
{ type: R },
|
201
|
+
{ type: F },
|
202
|
+
{ type: M },
|
203
|
+
{
|
204
|
+
custom: (d) => b.isWoodlandComponent(d) && b.get(d).name === "Tabs"
|
205
|
+
}
|
206
|
+
]);
|
207
|
+
return /* @__PURE__ */ e.createElement("div", {
|
208
|
+
className: x(B),
|
209
|
+
ref: f,
|
210
|
+
...g
|
211
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
212
|
+
className: he({ pinned: S }),
|
213
|
+
ref: E,
|
214
|
+
...g
|
215
|
+
}, N ? Q(N, { context: "container" }) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", {
|
216
|
+
className: be
|
217
|
+
}, !!c && /* @__PURE__ */ e.createElement("div", {
|
218
|
+
className: Ee
|
219
|
+
}, /* @__PURE__ */ e.createElement(ae, {
|
220
|
+
checked: m,
|
221
|
+
indeterminate: h,
|
222
|
+
onChange: () => {
|
223
|
+
l == null || l(!m);
|
224
|
+
}
|
225
|
+
})), /* @__PURE__ */ e.createElement("div", {
|
226
|
+
className: Be
|
227
|
+
}, !r && O, !r && Y, O.length > 0 && t && /* @__PURE__ */ e.createElement("div", {
|
228
|
+
className: fe
|
229
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
230
|
+
className: ve
|
231
|
+
}, /* @__PURE__ */ e.createElement(T, {
|
232
|
+
kind: "link",
|
233
|
+
onClick: H
|
234
|
+
}, q("design-system:listToolbar.advancedSearchToggle"))), (t.enteredFields || 0) > 0 && /* @__PURE__ */ e.createElement(C, {
|
235
|
+
className: pe,
|
236
|
+
kind: "info"
|
237
|
+
}, /* @__PURE__ */ e.createElement("span", null, t.enteredFields))), r && /* @__PURE__ */ e.createElement("div", {
|
238
|
+
className: Se
|
239
|
+
}, r)), S ? /* @__PURE__ */ e.createElement("div", {
|
240
|
+
className: P
|
241
|
+
}, /* @__PURE__ */ e.createElement(X.Provider, {
|
242
|
+
value: { fixed: !0 }
|
243
|
+
}, V)) : /* @__PURE__ */ e.createElement("div", {
|
244
|
+
className: P
|
245
|
+
}, V)), /* @__PURE__ */ e.createElement("div", {
|
246
|
+
className: Ie
|
247
|
+
}, (!S || S && p) && z))));
|
248
|
+
}
|
249
|
+
b.set(U, {
|
250
|
+
name: "ListBar",
|
251
|
+
props: {
|
252
|
+
activeTab: { type: "Tab" },
|
253
|
+
advancedSearch: { type: "{ isOpen: boolean, enteredFields: number }" },
|
254
|
+
onToggleAdvancedSearch: { type: "(boolean) => void" },
|
255
|
+
onTabChange: { type: "(Tab) => void" },
|
256
|
+
title: { type: "string" },
|
257
|
+
onToolbarPinned: { type: "(boolean) => void" },
|
258
|
+
selectable: { type: "boolean" },
|
259
|
+
isSelected: { type: "boolean" },
|
260
|
+
isIndeterminate: { type: "boolean" },
|
261
|
+
onSelectionChange: { type: "(boolean) => void" },
|
262
|
+
pinResultsBar: { type: "boolean" },
|
263
|
+
pinToolbar: { type: "boolean", default: "true" }
|
264
|
+
}
|
265
|
+
});
|
266
|
+
function j({
|
267
|
+
options: t,
|
268
|
+
activeOption: a,
|
269
|
+
onSortChange: r,
|
270
|
+
defaultOption: n,
|
271
|
+
className: c,
|
272
|
+
...m
|
273
|
+
}) {
|
274
|
+
const h = (t || []).map((l) => [
|
275
|
+
{ label: l.label, icon: l.icon },
|
276
|
+
() => {
|
277
|
+
r && r(l);
|
278
|
+
}
|
279
|
+
]);
|
280
|
+
return /* @__PURE__ */ e.createElement(re, {
|
281
|
+
className: x(c, Le),
|
282
|
+
icon: (a == null ? void 0 : a.icon) || (n == null ? void 0 : n.icon),
|
283
|
+
label: (a == null ? void 0 : a.label) || (n == null ? void 0 : n.label),
|
284
|
+
options: h
|
285
|
+
});
|
286
|
+
}
|
287
|
+
b.set(j, {
|
288
|
+
name: "ListBarSortBy",
|
289
|
+
props: {
|
290
|
+
options: { type: "SortOption[]" },
|
291
|
+
activeOption: { type: "SortOption" },
|
292
|
+
onSortChange: { type: "(option: SortOption) => void" },
|
293
|
+
defaultOption: { type: "SortOption" }
|
294
|
+
}
|
295
|
+
});
|
296
|
+
var Oe = G({ defaultClassName: "q4fj410", variantClassNames: { open: { true: "q4fj411", false: "q4fj412" } }, defaultVariants: { open: !1 }, compoundVariants: [] }), Ne = "q4fj414", Ve = "q4fj415", _e = "q4fj413";
|
297
|
+
function K({
|
298
|
+
formArray: t,
|
299
|
+
formGroup: a,
|
300
|
+
formMeta: r,
|
301
|
+
onSubmit: n,
|
302
|
+
controlsDisabled: c,
|
303
|
+
footerLinks: m,
|
304
|
+
isOpen: h,
|
305
|
+
onClear: l,
|
306
|
+
className: p,
|
307
|
+
children: i,
|
308
|
+
...u
|
309
|
+
}) {
|
310
|
+
const { t: B } = e.useContext(w);
|
311
|
+
function g() {
|
312
|
+
l && l();
|
313
|
+
}
|
314
|
+
return /* @__PURE__ */ e.createElement("div", {
|
315
|
+
className: x(Oe({ open: h })),
|
316
|
+
...u
|
317
|
+
}, /* @__PURE__ */ e.createElement(ne, {
|
318
|
+
onSubmit: n,
|
319
|
+
formArray: t,
|
320
|
+
formGroup: a,
|
321
|
+
formMeta: r
|
322
|
+
}, /* @__PURE__ */ e.createElement("div", {
|
323
|
+
className: _e
|
324
|
+
}, i), /* @__PURE__ */ e.createElement("div", {
|
325
|
+
className: Ne
|
326
|
+
}, m && /* @__PURE__ */ e.createElement("div", {
|
327
|
+
id: "footer_links"
|
328
|
+
}, $(m)), /* @__PURE__ */ e.createElement("div", {
|
329
|
+
className: Ve
|
330
|
+
}, /* @__PURE__ */ e.createElement(T, {
|
331
|
+
kind: "default",
|
332
|
+
type: "button",
|
333
|
+
className: ie({ mr: "sm" }),
|
334
|
+
onClick: g,
|
335
|
+
disabled: c
|
336
|
+
}, B("design-system:advancedSearch.clear")), /* @__PURE__ */ e.createElement(T, {
|
337
|
+
kind: "key",
|
338
|
+
type: "submit",
|
339
|
+
disabled: c
|
340
|
+
}, B("design-system:advancedSearch.search"))))));
|
341
|
+
}
|
342
|
+
b.set(K, {
|
343
|
+
name: "Advanced Search",
|
344
|
+
props: {
|
345
|
+
formArray: { type: "SpsFormArray<any>" },
|
346
|
+
formGroup: { type: "SpsFormGroup" },
|
347
|
+
formMeta: { type: "SpsFormSetMeta<any>" },
|
348
|
+
onSubmit: { type: "React.FormEventHandler" },
|
349
|
+
controlsDisabled: { type: "boolean" },
|
350
|
+
footerLinks: { type: "React.ReactNode | (() => React.ReactNode)" },
|
351
|
+
isOpen: { type: "boolean" },
|
352
|
+
onClear: { type: "() => void" }
|
353
|
+
}
|
354
|
+
});
|
355
|
+
const De = {
|
356
|
+
components: [K],
|
357
|
+
examples: {
|
358
|
+
general: {
|
359
|
+
label: "General Usage",
|
360
|
+
description: ({ NavigateTo: t, Link: a }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, 'Advanced Search is comprised of a panel of input fields, and a text button that exposes and hides the panel. By default, the Advanced Search panel is hidden (with the exception of "Advanced Search Only" scenarios).'), /* @__PURE__ */ e.createElement("p", null, "Advanced Search works in conjunction with the", " ", /* @__PURE__ */ e.createElement(t, {
|
361
|
+
to: "list-toolbar"
|
362
|
+
}, "List Bar"), " and", " ", /* @__PURE__ */ e.createElement(t, {
|
363
|
+
to: "search-results-bar"
|
364
|
+
}, "Search Results"), " components. Refer to those pages for additional details."), /* @__PURE__ */ e.createElement("p", null, "Use the following guidelines when including Advanced Search on your page:", /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, "The Advanced Search Panel can contain any number of input fields."), /* @__PURE__ */ e.createElement("li", null, "The Advanced Search Panel can place input fields in any unique layout to best serve the needs of the search criteria, but must adhere to the rules of the", " ", /* @__PURE__ */ e.createElement(a, {
|
365
|
+
to: "/style-and-layout/grid/"
|
366
|
+
}, "SPS Grid"), " and guidelines for", " ", /* @__PURE__ */ e.createElement(t, {
|
367
|
+
to: "form"
|
368
|
+
}, "Form Layouts"), "."))))
|
369
|
+
},
|
370
|
+
basic: {
|
371
|
+
label: "Basic Usage",
|
372
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "A Basic Advanced Search consists of the List Bar with a search input and an Advanced Search text button. For more details on additional button and component options in the List Bar reference the ", /* @__PURE__ */ e.createElement(t, {
|
373
|
+
to: "list-toolbar"
|
374
|
+
}, "List Bar"), " page.")),
|
375
|
+
examples: {
|
376
|
+
basic: {
|
377
|
+
react: o`
|
378
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
379
|
+
import { Button } from "@sps-woodland/buttons";
|
380
|
+
import { grid } from "@sps-woodland/tokens";
|
381
|
+
import { SpsLabel, SpsTextInput } from "@spscommerce/ds-react";
|
382
|
+
|
383
|
+
function Component() {
|
384
|
+
const [toolbarSearchText, setToolbarSearchText] = React.useState("");
|
385
|
+
const [advSearch, patchAdvSearch] = usePatchReducer({
|
386
|
+
isOpen: false,
|
387
|
+
enteredFields: 0,
|
388
|
+
});
|
389
|
+
|
390
|
+
const initValue = {
|
391
|
+
sender: "",
|
392
|
+
receiver: "",
|
393
|
+
doctype: "",
|
394
|
+
status: "",
|
395
|
+
};
|
396
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
397
|
+
|
398
|
+
React.useEffect(() => {
|
399
|
+
// Simulate that someone has entered a search term
|
400
|
+
updateForm({
|
401
|
+
...formValue,
|
402
|
+
receiver: "Walmart"
|
403
|
+
});
|
404
|
+
patchAdvSearch({ enteredFields: 1 });
|
405
|
+
}, []);
|
406
|
+
|
407
|
+
function handleToolbarSearchChange(event) {
|
408
|
+
setToolbarSearchText(event.target.value);
|
409
|
+
}
|
410
|
+
|
411
|
+
function handleToggleAdvancedSearch(isOpen) {
|
412
|
+
patchAdvSearch({ isOpen });
|
413
|
+
}
|
414
|
+
|
415
|
+
function handleAdvancedSearchSubmit() {
|
416
|
+
patchAdvSearch({ enteredFields: diff(initValue, formValue).length });
|
417
|
+
}
|
418
|
+
|
419
|
+
function handleAdvancedSearchClear() {
|
420
|
+
updateForm(initValue);
|
421
|
+
patchAdvSearch({ enteredFields: 0 });
|
422
|
+
}
|
423
|
+
|
424
|
+
return (
|
425
|
+
<>
|
426
|
+
<ListBar
|
427
|
+
advancedSearch={advSearch}
|
428
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
429
|
+
>
|
430
|
+
<ListBarSearch>
|
431
|
+
<SpsTextInput
|
432
|
+
value={toolbarSearchText}
|
433
|
+
onChange={handleToolbarSearchChange}
|
434
|
+
disabled={advSearch.isOpen}
|
435
|
+
title="Search"
|
436
|
+
/>
|
437
|
+
<Button kind="icon" icon="search" disabled={advSearch.isOpen} data-testid="search-button" />
|
438
|
+
</ListBarSearch>
|
439
|
+
</ListBar>
|
440
|
+
<AdvancedSearch
|
441
|
+
{...advSearch}
|
442
|
+
formMeta={formMeta}
|
443
|
+
onSubmit={handleAdvancedSearchSubmit}
|
444
|
+
onClear={handleAdvancedSearchClear}
|
445
|
+
data-testid="advanced-search"
|
446
|
+
>
|
447
|
+
<div className={grid.root}>
|
448
|
+
<div className={grid[4]}>
|
449
|
+
<SpsLabel for={formMeta.fields.sender}>Sender</SpsLabel>
|
450
|
+
<SpsTextInput formMeta={formMeta.fields.sender}
|
451
|
+
value={formValue.sender}
|
452
|
+
/>
|
453
|
+
</div>
|
454
|
+
<div className={grid[4]}>
|
455
|
+
<SpsLabel for={formMeta.fields.receiver}>Receiver</SpsLabel>
|
456
|
+
<SpsTextInput formMeta={formMeta.fields.receiver}
|
457
|
+
value={formValue.receiver}
|
458
|
+
/>
|
459
|
+
</div>
|
460
|
+
<div className={grid[4]}>
|
461
|
+
<SpsLabel for={formMeta.fields.doctype}>Document Type</SpsLabel>
|
462
|
+
<SpsTextInput formMeta={formMeta.fields.doctype}
|
463
|
+
value={formValue.doctype}
|
464
|
+
/>
|
465
|
+
</div>
|
466
|
+
<div className={grid[4]}>
|
467
|
+
<SpsLabel for={formMeta.fields.status}>Status</SpsLabel>
|
468
|
+
<SpsTextInput formMeta={formMeta.fields.status}
|
469
|
+
value={formValue.status}
|
470
|
+
/>
|
471
|
+
</div>
|
472
|
+
</div>
|
473
|
+
</AdvancedSearch>
|
474
|
+
</>
|
475
|
+
)
|
476
|
+
}
|
477
|
+
`
|
478
|
+
}
|
479
|
+
}
|
480
|
+
},
|
481
|
+
footerLink: {
|
482
|
+
label: "Footer Link",
|
483
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "A Footer Link can be included in the Advanced Search footer (visible only when the menu is exposed). The Footer Link is used to link to preferences that control the Advanced Search panel display (such as customized fields and defaults).")),
|
484
|
+
examples: {
|
485
|
+
footerLink: {
|
486
|
+
react: o`
|
487
|
+
import { ListBar, ListBarSearch, AdvancedSearch } from "@sps-woodland/list-bar";
|
488
|
+
import { Button } from "@sps-woodland/buttons";
|
489
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
490
|
+
|
491
|
+
function Component(props) {
|
492
|
+
const [toolbarSearchText, setToolbarSearchText] = React.useState("");
|
493
|
+
const [advSearch, setAdvSearch] = React.useState({
|
494
|
+
isOpen: false
|
495
|
+
});
|
496
|
+
|
497
|
+
function handleToggleAdvancedSearch(isOpen) {
|
498
|
+
setAdvSearch({ isOpen });
|
499
|
+
}
|
500
|
+
|
501
|
+
function handleToolbarSearchChange(event) {
|
502
|
+
setToolbarSearchText(event.target.value);
|
503
|
+
}
|
504
|
+
|
505
|
+
return (
|
506
|
+
<>
|
507
|
+
<ListBar advancedSearch={advSearch}
|
508
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
509
|
+
>
|
510
|
+
<ListBarSearch>
|
511
|
+
<SpsTextInput value={toolbarSearchText}
|
512
|
+
onChange={handleToolbarSearchChange}
|
513
|
+
disabled={advSearch.isOpen}
|
514
|
+
title="Search"
|
515
|
+
/>
|
516
|
+
<Button kind="icon"
|
517
|
+
icon="search"
|
518
|
+
disabled={advSearch.isOpen}
|
519
|
+
/>
|
520
|
+
</ListBarSearch>
|
521
|
+
</ListBar>
|
522
|
+
<AdvancedSearch {...advSearch}
|
523
|
+
footerLinks={
|
524
|
+
<Button kind="link" icon="gear">
|
525
|
+
Advanced Search Defaults
|
526
|
+
</Button>
|
527
|
+
}
|
528
|
+
data-testid="advanced-search"
|
529
|
+
>
|
530
|
+
<br />
|
531
|
+
<br />
|
532
|
+
<br />
|
533
|
+
<br />
|
534
|
+
</AdvancedSearch>
|
535
|
+
</>
|
536
|
+
)
|
537
|
+
}
|
538
|
+
`
|
539
|
+
}
|
540
|
+
}
|
541
|
+
},
|
542
|
+
disabledButtons: {
|
543
|
+
label: "Disabling the Clear/Search Buttons",
|
544
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "The Search and Clear Fields buttons in the footer can be disabled when no input fields in the Advanced Search Panel contain values.")),
|
545
|
+
examples: {
|
546
|
+
disabledButtons: {
|
547
|
+
react: o`
|
548
|
+
import { ListBar, ListBarSearch, AdvancedSearch } from "@sps-woodland/list-bar";
|
549
|
+
import { Button } from "@sps-woodland/buttons";
|
550
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
551
|
+
|
552
|
+
function Component() {
|
553
|
+
const [toolbarSearchText, setToolbarSearchText] = React.useState("");
|
554
|
+
const [advSearch, setAdvSearch] = React.useState({
|
555
|
+
isOpen: false,
|
556
|
+
controlsDisabled: true,
|
557
|
+
});
|
558
|
+
|
559
|
+
function handleToggleAdvancedSearch(isOpen) {
|
560
|
+
setAdvSearch({ ...advSearch, isOpen });
|
561
|
+
}
|
562
|
+
|
563
|
+
function handleToolbarSearchChange(event) {
|
564
|
+
setToolbarSearchText(event.target.value);
|
565
|
+
}
|
566
|
+
|
567
|
+
return (
|
568
|
+
<>
|
569
|
+
<ListBar advancedSearch={advSearch}
|
570
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
571
|
+
>
|
572
|
+
<ListBarSearch>
|
573
|
+
<SpsTextInput value={toolbarSearchText}
|
574
|
+
onChange={handleToolbarSearchChange}
|
575
|
+
disabled={advSearch.isOpen}
|
576
|
+
title="Search"
|
577
|
+
/>
|
578
|
+
<Button kind="icon"
|
579
|
+
icon="search"
|
580
|
+
disabled={advSearch.isOpen}
|
581
|
+
/>
|
582
|
+
</ListBarSearch>
|
583
|
+
</ListBar>
|
584
|
+
<AdvancedSearch {...advSearch}>
|
585
|
+
<br />
|
586
|
+
<br />
|
587
|
+
<br />
|
588
|
+
<br />
|
589
|
+
</AdvancedSearch>
|
590
|
+
</>
|
591
|
+
)
|
592
|
+
}
|
593
|
+
`
|
594
|
+
}
|
595
|
+
}
|
596
|
+
},
|
597
|
+
advancedSearchOnly: {
|
598
|
+
label: '"Advanced Search Only" List Bar',
|
599
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "Certain scenarios may require an Advanced Search Panel to display by default (eschewing a basic search). In these scenarios a title will replace the search input in the List Bar."), /* @__PURE__ */ e.createElement("p", null, "To achieve an Advanced Search Only effect, remove the basic search input from the List Bar.")),
|
600
|
+
examples: {
|
601
|
+
withTitle: {
|
602
|
+
react: o`
|
603
|
+
import { ListBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
604
|
+
|
605
|
+
function Component() {
|
606
|
+
const [advSearch, patchAdvSearch] = usePatchReducer({
|
607
|
+
isOpen: true,
|
608
|
+
});
|
609
|
+
|
610
|
+
return (
|
611
|
+
<>
|
612
|
+
<ListBar title="Advanced Search" advancedSearch={advSearch} />
|
613
|
+
<AdvancedSearch isOpen={advSearch.isOpen} data-testid="advanced-search">
|
614
|
+
<br />
|
615
|
+
<br />
|
616
|
+
<br />
|
617
|
+
<br />
|
618
|
+
</AdvancedSearch>
|
619
|
+
</>
|
620
|
+
)
|
621
|
+
}
|
622
|
+
`
|
623
|
+
}
|
624
|
+
}
|
625
|
+
}
|
626
|
+
}
|
627
|
+
};
|
628
|
+
function Pe() {
|
629
|
+
const [t, a] = e.useState(!1);
|
630
|
+
function r() {
|
631
|
+
a(!1);
|
632
|
+
}
|
633
|
+
function n() {
|
634
|
+
a(!0);
|
635
|
+
}
|
636
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "The List Bar is divided into a number of different sections. It spans the entire width of the corresponding list."), /* @__PURE__ */ e.createElement(T, {
|
637
|
+
kind: "link",
|
638
|
+
onClick: n
|
639
|
+
}, "View Content Order Example"), /* @__PURE__ */ e.createElement(se, {
|
640
|
+
isOpen: t,
|
641
|
+
onClose: r
|
642
|
+
}, /* @__PURE__ */ e.createElement("h1", null, "Content Order"), /* @__PURE__ */ e.createElement("img", {
|
643
|
+
src: "assets/images/list-toolbar-example.svg",
|
644
|
+
alt: "A List Toolbar with labels on each section",
|
645
|
+
className: "w-100 mb-3"
|
646
|
+
}), /* @__PURE__ */ e.createElement(oe, null, /* @__PURE__ */ e.createElement(le, null, /* @__PURE__ */ e.createElement(A, {
|
647
|
+
style: { width: "80px" }
|
648
|
+
}, "Order"), /* @__PURE__ */ e.createElement(A, null, "Section"), /* @__PURE__ */ e.createElement(A, null, "Notes")), /* @__PURE__ */ e.createElement(ce, null, /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
649
|
+
className: "sps-tag sps-tag--info"
|
650
|
+
}, "1")), /* @__PURE__ */ e.createElement(s, null, "Checkbox"), /* @__PURE__ */ e.createElement(s, null, "For Content Rows and Content Tiles only.")), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
651
|
+
className: "sps-tag sps-tag--info"
|
652
|
+
}, "2")), /* @__PURE__ */ e.createElement(s, null, "Search/Filter Box"), /* @__PURE__ */ e.createElement(s, null)), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
653
|
+
className: "sps-tag sps-tag--info"
|
654
|
+
}, "3")), /* @__PURE__ */ e.createElement(s, null, "Saved Search"), /* @__PURE__ */ e.createElement(s, null)), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
655
|
+
className: "sps-tag sps-tag--info"
|
656
|
+
}, "4")), /* @__PURE__ */ e.createElement(s, null, "Advanced Search"), /* @__PURE__ */ e.createElement(s, null, "For more information, visit the Advanced Search page.")), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
657
|
+
className: "sps-tag sps-tag--info"
|
658
|
+
}, "5")), /* @__PURE__ */ e.createElement(s, null, "Column Editor"), /* @__PURE__ */ e.createElement(s, {
|
659
|
+
wrap: 500
|
660
|
+
}, "Use for Tables only. For more information, visit the Column Editor page.")), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
661
|
+
className: "sps-tag sps-tag--info"
|
662
|
+
}, "6")), /* @__PURE__ */ e.createElement(s, null, "List View Selector"), /* @__PURE__ */ e.createElement(s, null)), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
663
|
+
className: "sps-tag sps-tag--info"
|
664
|
+
}, "7")), /* @__PURE__ */ e.createElement(s, null, "Sorting"), /* @__PURE__ */ e.createElement(s, null)), /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("span", {
|
665
|
+
className: "sps-tag sps-tag--info"
|
666
|
+
}, "8")), /* @__PURE__ */ e.createElement(s, null, "Buttons"), /* @__PURE__ */ e.createElement(s, {
|
667
|
+
wrap: 500
|
668
|
+
}, "Buttons always appear in the rightmost section of the List Toolbar. For the ordering of Buttons, refer to the Button Groups section on the Buttons page."))))));
|
669
|
+
}
|
670
|
+
const Ge = {
|
671
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "The List Toolbar provides the ability to interact with elements in a list or table. It can contain elements to search, filter, sort, or perform other actions."),
|
672
|
+
components: [U, R, F, j],
|
673
|
+
examples: {
|
674
|
+
general: {
|
675
|
+
label: "General Usage",
|
676
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Use a List Toolbar:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, "When list content needs to be searched, filtered, sorted, or otherwise interacted with.")), /* @__PURE__ */ e.createElement("h5", null, "Avoid a List Toolbar:"), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement("li", null, "When no list is present."), /* @__PURE__ */ e.createElement("li", null, "When there will always be a small number of elements in the list, or the list does not require searching, filtering, or other actions.")))
|
677
|
+
},
|
678
|
+
contentOrder: {
|
679
|
+
label: "Content Order",
|
680
|
+
description: /* @__PURE__ */ e.createElement(Pe, null)
|
681
|
+
},
|
682
|
+
checkbox: {
|
683
|
+
label: "Checkbox",
|
684
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "Use a Checkbox in the List Bar when items in a", " ", /* @__PURE__ */ e.createElement(t, {
|
685
|
+
to: "content-row"
|
686
|
+
}, "Content Row"), " or", " ", /* @__PURE__ */ e.createElement(t, {
|
687
|
+
to: "content-tile"
|
688
|
+
}, "Content Tile"), " are selectable. The Checkbox selects all items in the list, and will cause the Action Bar to appear. Do not use this with a Table, as Tables have a built-in checkbox in the header row."),
|
689
|
+
examples: {
|
690
|
+
basic: {
|
691
|
+
react: o`
|
692
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
693
|
+
|
694
|
+
function Component() {
|
695
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
696
|
+
searchText: "",
|
697
|
+
});
|
698
|
+
|
699
|
+
function handleSearch(event) {
|
700
|
+
console.log(event, formValue.searchText)
|
701
|
+
}
|
702
|
+
|
703
|
+
const [selectedColors, setSelectedColors] = React.useState([]);
|
704
|
+
colors = ['Red', 'Blue', 'Green']
|
705
|
+
|
706
|
+
const isIndeterminate = selectedColors.length > 0 && selectedColors.length < colors.length
|
707
|
+
const isSelected = selectedColors.length > 0
|
708
|
+
|
709
|
+
return (
|
710
|
+
<>
|
711
|
+
<ListBar
|
712
|
+
selectable
|
713
|
+
isIndeterminate={isIndeterminate}
|
714
|
+
isSelected={isSelected}
|
715
|
+
onSelectionChange={() => {
|
716
|
+
if (isIndeterminate || isSelected) {
|
717
|
+
setSelectedColors([])
|
718
|
+
} else {
|
719
|
+
etSelectedColors(colors);
|
720
|
+
}
|
721
|
+
}}
|
722
|
+
data-testid="list-bar"
|
723
|
+
>
|
724
|
+
<ListBarSearch onSubmit={handleSearch}>
|
725
|
+
<SpsTextInput
|
726
|
+
value={formValue.searchText}
|
727
|
+
formMeta={formMeta.fields.searchText}
|
728
|
+
icon={SpsIcon.FILTER}
|
729
|
+
placeholder="Filter fields"
|
730
|
+
/>
|
731
|
+
</ListBarSearch>
|
732
|
+
</ListBar>
|
733
|
+
{colors.map((color) => (
|
734
|
+
<SpsCheckbox
|
735
|
+
checked={selectedColors.includes(color)}
|
736
|
+
inline
|
737
|
+
label={color}
|
738
|
+
onChange={() => {
|
739
|
+
if (selectedColors.includes(color)) {
|
740
|
+
setSelectedColors(selectedColors.filter((c) => c !== color))
|
741
|
+
} else {
|
742
|
+
setSelectedColors([...selectedColors, color])
|
743
|
+
}
|
744
|
+
}
|
745
|
+
}
|
746
|
+
/>
|
747
|
+
))}
|
748
|
+
</>
|
749
|
+
)
|
750
|
+
}
|
751
|
+
`
|
752
|
+
}
|
753
|
+
}
|
754
|
+
},
|
755
|
+
searchAndFilter: {
|
756
|
+
label: "Search + Filter Inputs",
|
757
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "Use Search and Filter inputs to make it easier to quickly find list items."),
|
758
|
+
examples: {
|
759
|
+
search: {
|
760
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Search"), /* @__PURE__ */ e.createElement("p", null, "Use Search to find list item(s) starting from an empty list.")),
|
761
|
+
react: o`
|
762
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
763
|
+
import { Button } from "@sps-woodland/buttons";
|
764
|
+
|
765
|
+
function Component() {
|
766
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
767
|
+
searchText: "",
|
768
|
+
});
|
769
|
+
|
770
|
+
function handleSearch(event) {
|
771
|
+
console.log(event, formValue.searchText)
|
772
|
+
}
|
773
|
+
|
774
|
+
return (
|
775
|
+
<ListBar>
|
776
|
+
<ListBarSearch onSubmit={handleSearch}>
|
777
|
+
<SpsTextInput
|
778
|
+
value={formValue.searchText}
|
779
|
+
formMeta={formMeta.fields.searchText}
|
780
|
+
placeholder="Search fields"
|
781
|
+
/>
|
782
|
+
<Button kind="icon" icon="search" type="submit" />
|
783
|
+
</ListBarSearch>
|
784
|
+
</ListBar>
|
785
|
+
)
|
786
|
+
}
|
787
|
+
`
|
788
|
+
},
|
789
|
+
searchAndSelect: {
|
790
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Search + Select"), /* @__PURE__ */ e.createElement("p", null, "Use Select to search for list item(s) in a particular category.")),
|
791
|
+
react: o`
|
792
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
793
|
+
import { Button } from "@sps-woodland/buttons";
|
794
|
+
import { SpsSelect, SpsTextInput } from "@spscommerce/ds-react";
|
795
|
+
|
796
|
+
function Component() {
|
797
|
+
const filterKeys = ["Document Type", "Sender Name", "Receiver Name"];
|
798
|
+
|
799
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
800
|
+
searchText: "",
|
801
|
+
filterOption: filterKeys[0],
|
802
|
+
});
|
803
|
+
|
804
|
+
function handleSearch(event) {
|
805
|
+
console.log(event, formValue.searchText)
|
806
|
+
}
|
807
|
+
|
808
|
+
return (
|
809
|
+
<ListBar>
|
810
|
+
<ListBarSearch onSubmit={handleSearch}>
|
811
|
+
<SpsSelect
|
812
|
+
options={filterKeys}
|
813
|
+
formMeta={formMeta.fields.filterOption}
|
814
|
+
value={formValue.filterOption}
|
815
|
+
notClearable
|
816
|
+
/>
|
817
|
+
<SpsTextInput
|
818
|
+
value={formValue.searchText}
|
819
|
+
formMeta={formMeta.fields.searchText}
|
820
|
+
placeholder="Search fields"
|
821
|
+
/>
|
822
|
+
<Button kind="icon" icon="search" type="submit" />
|
823
|
+
</ListBarSearch>
|
824
|
+
</ListBar>
|
825
|
+
)
|
826
|
+
}
|
827
|
+
`
|
828
|
+
},
|
829
|
+
filter: {
|
830
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Filter"), /* @__PURE__ */ e.createElement("p", null, "Use Filter to find list item(s) starting from a populated list.")),
|
831
|
+
react: o`
|
832
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
833
|
+
import { Button } from "@sps-woodland/buttons";
|
834
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
835
|
+
|
836
|
+
function Component() {
|
837
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
838
|
+
searchText: "",
|
839
|
+
});
|
840
|
+
|
841
|
+
function handleSearch(event) {
|
842
|
+
console.log(event, formValue.searchText)
|
843
|
+
}
|
844
|
+
|
845
|
+
return (
|
846
|
+
<ListBar>
|
847
|
+
<ListBarSearch onSubmit={handleSearch}>
|
848
|
+
<SpsTextInput
|
849
|
+
value={formValue.searchText}
|
850
|
+
formMeta={formMeta.fields.searchText}
|
851
|
+
icon={SpsIcon.FILTER}
|
852
|
+
placeholder="Filter fields"
|
853
|
+
/>
|
854
|
+
</ListBarSearch>
|
855
|
+
</ListBar>
|
856
|
+
)
|
857
|
+
}
|
858
|
+
`
|
859
|
+
},
|
860
|
+
filterAndSelect: {
|
861
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Filter + Select"), /* @__PURE__ */ e.createElement("p", null, "Use Select to filter list item(s) in a particular category.")),
|
862
|
+
react: o`
|
863
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
864
|
+
import { Button } from "@sps-woodland/buttons";
|
865
|
+
import { SpsSelect, SpsTextInput } from "@spscommerce/ds-react";
|
866
|
+
|
867
|
+
function Component() {
|
868
|
+
const filterKeys = ["Document Type", "Sender Name", "Receiver Name"];
|
869
|
+
|
870
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
871
|
+
searchText: "",
|
872
|
+
filterOption: filterKeys[0],
|
873
|
+
});
|
874
|
+
|
875
|
+
function handleSearch(event) {
|
876
|
+
console.log(event, formValue.searchText)
|
877
|
+
}
|
878
|
+
|
879
|
+
return (
|
880
|
+
<ListBar>
|
881
|
+
<ListBarSearch onSubmit={handleSearch}>
|
882
|
+
<SpsSelect
|
883
|
+
options={filterKeys}
|
884
|
+
formMeta={formMeta.fields.filterOption}
|
885
|
+
value={formValue.filterOption}
|
886
|
+
notClearable
|
887
|
+
/>
|
888
|
+
<SpsTextInput
|
889
|
+
value={formValue.searchText}
|
890
|
+
formMeta={formMeta.fields.searchText}
|
891
|
+
icon={SpsIcon.FILTER}
|
892
|
+
placeholder="Filter fields"
|
893
|
+
/>
|
894
|
+
</ListBarSearch>
|
895
|
+
</ListBar>
|
896
|
+
)
|
897
|
+
}
|
898
|
+
`
|
899
|
+
},
|
900
|
+
searchInfo: {
|
901
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h5", null, "Search Info"), /* @__PURE__ */ e.createElement("p", null, "Use SpsListToolbarSearchInfo component to add additional information about your search.")),
|
902
|
+
react: o`
|
903
|
+
import { ListBar, ListBarSearch, ListBarSearchInfo } from "@sps-woodland/list-bar";
|
904
|
+
import { Icon } from "@sps-woodland/core";
|
905
|
+
import { SpsSelect, SpsTextInput } from "@spscommerce/ds-react";
|
906
|
+
|
907
|
+
function Component() {
|
908
|
+
const filterKeys = ["Key Item ID", "Document Type", "Sender Name", "Receiver Name"];
|
909
|
+
|
910
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
911
|
+
searchText: "",
|
912
|
+
filterOption: filterKeys[0],
|
913
|
+
});
|
914
|
+
|
915
|
+
function handleSearch(event) {
|
916
|
+
console.log(event, formValue.searchText)
|
917
|
+
}
|
918
|
+
|
919
|
+
return (
|
920
|
+
<ListBar>
|
921
|
+
<ListBarSearch onSubmit={handleSearch}>
|
922
|
+
<SpsSelect
|
923
|
+
options={filterKeys}
|
924
|
+
formMeta={formMeta.fields.filterOption}
|
925
|
+
value={formValue.filterOption}
|
926
|
+
notClearable
|
927
|
+
/>
|
928
|
+
<SpsTextInput
|
929
|
+
value={formValue.searchText}
|
930
|
+
formMeta={formMeta.fields.searchText}
|
931
|
+
icon={SpsIcon.FILTER}
|
932
|
+
placeholder="Filter fields"
|
933
|
+
/>
|
934
|
+
</ListBarSearch>
|
935
|
+
<ListBarSearchInfo>
|
936
|
+
<div style={{ display: 'flex', alignItems: 'center'}}>
|
937
|
+
<span style={{ marginRight: 5 }} >
|
938
|
+
Key Item ID = Vendor Part Number
|
939
|
+
</span>
|
940
|
+
<Icon icon="info-circle" className="blue200"/>
|
941
|
+
</div>
|
942
|
+
</ListBarSearchInfo>
|
943
|
+
</ListBar>
|
944
|
+
)
|
945
|
+
}
|
946
|
+
`
|
947
|
+
}
|
948
|
+
}
|
949
|
+
},
|
950
|
+
advancedSearch: {
|
951
|
+
label: "Advanced Search",
|
952
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "Include the Advanced Search feature when more complex options are required to narrow down search results. For more information, visit the", " ", /* @__PURE__ */ e.createElement(t, {
|
953
|
+
to: "advanced-search"
|
954
|
+
}, "Advanced Search"), " page."),
|
955
|
+
examples: {
|
956
|
+
advancedSearch: {
|
957
|
+
react: o`
|
958
|
+
import { ListBar, ListBarSearch, AdvancedSearch } from "@sps-woodland/list-bar";
|
959
|
+
import { Button } from "@sps-woodland/buttons";
|
960
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
961
|
+
|
962
|
+
function Component() {
|
963
|
+
const [advSearch, setAdvSearch] = React.useState({
|
964
|
+
isOpen: false,
|
965
|
+
controlsDisabled: true,
|
966
|
+
});
|
967
|
+
|
968
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
969
|
+
searchText: "",
|
970
|
+
});
|
971
|
+
|
972
|
+
function handleToggleAdvancedSearch(isOpen) {
|
973
|
+
setAdvSearch({ isOpen });
|
974
|
+
}
|
975
|
+
|
976
|
+
return (
|
977
|
+
<>
|
978
|
+
<ListBar
|
979
|
+
advancedSearch={advSearch}
|
980
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
981
|
+
>
|
982
|
+
<ListBarSearch>
|
983
|
+
<SpsTextInput
|
984
|
+
value={formValue.searchText}
|
985
|
+
formMeta={formMeta.fields.searchText}
|
986
|
+
placeholder="Search fields"
|
987
|
+
/>
|
988
|
+
<Button kind="icon" icon="search" />
|
989
|
+
</ListBarSearch>
|
990
|
+
</ListBar>
|
991
|
+
<AdvancedSearch {...advSearch}>
|
992
|
+
<i>insert form here</i>
|
993
|
+
</AdvancedSearch>
|
994
|
+
</>
|
995
|
+
)
|
996
|
+
}
|
997
|
+
`
|
998
|
+
},
|
999
|
+
withResultsBar: {
|
1000
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "You can include ", /* @__PURE__ */ e.createElement(t, {
|
1001
|
+
to: "search-results-bar"
|
1002
|
+
}, "Search Results Bar"), "."),
|
1003
|
+
react: o`
|
1004
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
1005
|
+
import { Button } from "@sps-woodland/buttons";
|
1006
|
+
import { SpsTextInput, SpsLabel, SpsMultiselect } from "@spscommerce/ds-react";
|
1007
|
+
|
1008
|
+
function Component() {
|
1009
|
+
const senderOptions = ["Aktie Sports", "FGL Sports","Modells Sporting Goods", "Perry Sport", "Sportman Warhouse Australia"];
|
1010
|
+
const receiverOptions = ["FGL Sports", "Foot Asylum", "Hervis", "Lovell Rugby", "Aktie Sports"];
|
1011
|
+
const doctypeOptions = [".doc", ".txt", ".pdf"];
|
1012
|
+
const statusOptions = ["pending", "done"];
|
1013
|
+
|
1014
|
+
const [advSearch, setAdvSearch] = React.useState({
|
1015
|
+
isOpen: false
|
1016
|
+
});
|
1017
|
+
|
1018
|
+
const [showSearchBar, setShowSearchBar] = React.useState(true);
|
1019
|
+
|
1020
|
+
const [selections, setSelections] = React.useState();
|
1021
|
+
const [results, setResults] = React.useState(0);
|
1022
|
+
|
1023
|
+
const initValue = {
|
1024
|
+
searchText: "",
|
1025
|
+
sender: [],
|
1026
|
+
receiver: [],
|
1027
|
+
doctype: [],
|
1028
|
+
status: [],
|
1029
|
+
};
|
1030
|
+
|
1031
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
1032
|
+
|
1033
|
+
function handleToggleAdvancedSearch(isOpen) {
|
1034
|
+
setAdvSearch({ isOpen });
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
function handleAdvancedSearchSubmit() {
|
1038
|
+
console.log("submit");
|
1039
|
+
setShowSearchBar(true);
|
1040
|
+
setSelections(omit(formValue, "searchText"));
|
1041
|
+
setResults(Math.floor(Math.random() * 100));
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
function handleAdvancedSearchClear() {
|
1045
|
+
updateForm(initValue);
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
return (
|
1049
|
+
<>
|
1050
|
+
<ListBar advancedSearch={advSearch}
|
1051
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
1052
|
+
>
|
1053
|
+
<ListBarSearch>
|
1054
|
+
<SpsTextInput
|
1055
|
+
value={formValue.searchText}
|
1056
|
+
formMeta={formMeta.fields.searchText}
|
1057
|
+
placeholder="Search fields"
|
1058
|
+
/>
|
1059
|
+
<Button kind="icon" icon="search" />
|
1060
|
+
</ListBarSearch>
|
1061
|
+
<Button className={sprinkles({ mr: "sm" })} kind="icon" icon="download-cloud" />
|
1062
|
+
<Button className={sprinkles({ mr: "sm" })}>Button</Button>
|
1063
|
+
<Button kind="key">Button</Button>
|
1064
|
+
{showSearchBar && (
|
1065
|
+
<SearchResultsBar
|
1066
|
+
results={results}
|
1067
|
+
selections={selections}
|
1068
|
+
onClear={() => setShowSearchBar(false)}
|
1069
|
+
/>
|
1070
|
+
)}
|
1071
|
+
</ListBar>
|
1072
|
+
<AdvancedSearch {...advSearch}
|
1073
|
+
formMeta={formMeta}
|
1074
|
+
onSubmit={handleAdvancedSearchSubmit}
|
1075
|
+
onClear={handleAdvancedSearchClear}
|
1076
|
+
>
|
1077
|
+
<div className="sfg-row">
|
1078
|
+
<div className="sfg-col-4">
|
1079
|
+
<SpsLabel for={formMeta.fields.sender}>Sender</SpsLabel>
|
1080
|
+
<SpsMultiSelect
|
1081
|
+
formMeta={formMeta.fields.sender}
|
1082
|
+
value={formValue.sender}
|
1083
|
+
options={senderOptions}
|
1084
|
+
/>
|
1085
|
+
</div>
|
1086
|
+
<div className="sfg-col-4">
|
1087
|
+
<SpsLabel for={formMeta.fields.receiver}>Receiver</SpsLabel>
|
1088
|
+
<SpsMultiSelect
|
1089
|
+
formMeta={formMeta.fields.receiver}
|
1090
|
+
value={formValue.receiver}
|
1091
|
+
options={receiverOptions}
|
1092
|
+
/>
|
1093
|
+
</div>
|
1094
|
+
<div className="sfg-col-4">
|
1095
|
+
<SpsLabel for={formMeta.fields.doctype}>Document Type</SpsLabel>
|
1096
|
+
<SpsMultiSelect
|
1097
|
+
formMeta={formMeta.fields.doctype}
|
1098
|
+
value={formValue.doctype}
|
1099
|
+
options={doctypeOptions}
|
1100
|
+
/>
|
1101
|
+
</div>
|
1102
|
+
<div className="sfg-col-4">
|
1103
|
+
<SpsLabel for={formMeta.fields.status}>Status</SpsLabel>
|
1104
|
+
<SpsMultiSelect
|
1105
|
+
formMeta={formMeta.fields.status}
|
1106
|
+
value={formValue.status}
|
1107
|
+
options={statusOptions}
|
1108
|
+
/>
|
1109
|
+
</div>
|
1110
|
+
</div>
|
1111
|
+
</AdvancedSearch>
|
1112
|
+
</>
|
1113
|
+
)
|
1114
|
+
}
|
1115
|
+
`
|
1116
|
+
},
|
1117
|
+
pinnedResultsBar: {
|
1118
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "You can pin the Results Bar by passing pinResultsBar prop to SpsListToolbar."),
|
1119
|
+
react: o`
|
1120
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
1121
|
+
import { Button } from "@sps-woodland/buttons";
|
1122
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
1123
|
+
|
1124
|
+
function Component() {
|
1125
|
+
const [advSearch, setAdvSearch] = React.useState({
|
1126
|
+
isOpen: false
|
1127
|
+
});
|
1128
|
+
|
1129
|
+
const [showSearchBar, setShowSearchBar] = React.useState(true);
|
1130
|
+
|
1131
|
+
const [results, setResults] = React.useState(0);
|
1132
|
+
|
1133
|
+
const initValue = {
|
1134
|
+
searchText: "",
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
1138
|
+
|
1139
|
+
function handleToggleAdvancedSearch(isOpen) {
|
1140
|
+
setAdvSearch({ isOpen });
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
function handleAdvancedSearchSubmit() {
|
1144
|
+
setShowSearchBar(true);
|
1145
|
+
setResults(Math.floor(Math.random() * 100));
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
function handleAdvancedSearchClear() {
|
1149
|
+
updateForm(initValue);
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
return (
|
1153
|
+
<>
|
1154
|
+
<ListBar advancedSearch={advSearch}
|
1155
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
1156
|
+
pinResultsBar
|
1157
|
+
>
|
1158
|
+
<ListBarSearch>
|
1159
|
+
<SpsTextInput
|
1160
|
+
value={formValue.searchText}
|
1161
|
+
formMeta={formMeta.fields.searchText}
|
1162
|
+
placeholder="Search fields"
|
1163
|
+
/>
|
1164
|
+
<Button kind="icon" icon="search" />
|
1165
|
+
</ListBarSearch>
|
1166
|
+
<Button className={sprinkles({ mr: "sm" })} kind="icon" icon="download-cloud" />
|
1167
|
+
<Button className={sprinkles({ mr: "sm" })}>Button</Button>
|
1168
|
+
<Button kind="key">Button</Button>
|
1169
|
+
{showSearchBar && (
|
1170
|
+
<SearchResultsBar
|
1171
|
+
results={results}
|
1172
|
+
onClear={() => setShowSearchBar(false)}
|
1173
|
+
/>
|
1174
|
+
)}
|
1175
|
+
</ListBar>
|
1176
|
+
<AdvancedSearch {...advSearch}
|
1177
|
+
onSubmit={handleAdvancedSearchSubmit}
|
1178
|
+
>
|
1179
|
+
<i>insert form here</i>
|
1180
|
+
</AdvancedSearch>
|
1181
|
+
</>
|
1182
|
+
)
|
1183
|
+
}
|
1184
|
+
`
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
},
|
1188
|
+
columnEditor: {
|
1189
|
+
label: "Column Editor",
|
1190
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "Use a Column Editor when tables require the ability to show or hide specific columns based on the user's preferences. The Column Editor should only be used for", " ", /* @__PURE__ */ e.createElement(t, {
|
1191
|
+
to: "tables"
|
1192
|
+
}, "Tables"), ", and not any other type of list view. For more information, visit the ", /* @__PURE__ */ e.createElement(t, {
|
1193
|
+
to: "column-chooser"
|
1194
|
+
}, "Column Editor"), " page."),
|
1195
|
+
examples: {
|
1196
|
+
columnEditor: {
|
1197
|
+
react: o`
|
1198
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
1199
|
+
import { Button } from "@sps-woodland/buttons";
|
1200
|
+
|
1201
|
+
function Component() {
|
1202
|
+
const unselectedCols = [
|
1203
|
+
{ name: "Title" },
|
1204
|
+
];
|
1205
|
+
const selectedCols = [
|
1206
|
+
{ name: "Documents" },
|
1207
|
+
{ name: "Price" },
|
1208
|
+
]
|
1209
|
+
|
1210
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
1211
|
+
searchText: "",
|
1212
|
+
});
|
1213
|
+
|
1214
|
+
function handleSearch(event) {
|
1215
|
+
console.log(event, formValue.searchText)
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
return (
|
1219
|
+
<ListBar>
|
1220
|
+
<ListBarSearch onSubmit={handleSearch}>
|
1221
|
+
<SpsTextInput
|
1222
|
+
value={formValue.searchText}
|
1223
|
+
formMeta={formMeta.fields.searchText}
|
1224
|
+
placeholder="Search fields"
|
1225
|
+
/>
|
1226
|
+
<Button kind="icon" icon="search" type="submit" />
|
1227
|
+
</ListBarSearch>
|
1228
|
+
<SpsColumnChooser
|
1229
|
+
unselectedColumns={unselectedCols}
|
1230
|
+
selectedColumns={selectedCols}
|
1231
|
+
onApplyChanges={(selectedColumns) => {console.log(selectedColumns)}}
|
1232
|
+
/>
|
1233
|
+
</ListBar>
|
1234
|
+
)
|
1235
|
+
}
|
1236
|
+
`
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
},
|
1240
|
+
buttons: {
|
1241
|
+
label: "Buttons",
|
1242
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "Use Buttons only for actions that do not affect existing list items, such as exporting the list or creating a new list item. For actions that are taken on list items, such as changing a status of a list item, refer to the", " ", /* @__PURE__ */ e.createElement(t, {
|
1243
|
+
to: "list-action-bar"
|
1244
|
+
}, "List Action Bar"), "."),
|
1245
|
+
examples: {
|
1246
|
+
buttons: {
|
1247
|
+
react: o`
|
1248
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
1249
|
+
import { Button } from "@sps-woodland/buttons";
|
1250
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
1251
|
+
|
1252
|
+
function Component() {
|
1253
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
1254
|
+
searchText: "",
|
1255
|
+
});
|
1256
|
+
|
1257
|
+
function handleSearch(event) {
|
1258
|
+
console.log(event, formValue.searchText)
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
return (
|
1262
|
+
<ListBar>
|
1263
|
+
<ListBarSearch onSubmit={handleSearch}>
|
1264
|
+
<SpsTextInput
|
1265
|
+
value={formValue.searchText}
|
1266
|
+
formMeta={formMeta.fields.searchText}
|
1267
|
+
placeholder="Search fields"
|
1268
|
+
/>
|
1269
|
+
<Button kind="icon" icon="search" type="submit" />
|
1270
|
+
</ListBarSearch>
|
1271
|
+
<Button className={sprinkles({ mr: "sm" })} kind="link">Text Button</Button>
|
1272
|
+
<Button className={sprinkles({ mr: "sm" })} kind="icon" icon="download-cloud" />
|
1273
|
+
<Button className={sprinkles({ mr: "sm" })}>Button</Button>
|
1274
|
+
<Button kind="key">Button</Button>
|
1275
|
+
</ListBar>
|
1276
|
+
)
|
1277
|
+
}
|
1278
|
+
`
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
},
|
1282
|
+
tabs: {
|
1283
|
+
label: "Tabs",
|
1284
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "When tabs are included, they appear above the List Toolbar. Tab rules are outlined on the ", /* @__PURE__ */ e.createElement(t, {
|
1285
|
+
to: "cards"
|
1286
|
+
}, "Cards"), " page."), /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement("code", null, "<Item>"), " comes from the ", /* @__PURE__ */ e.createElement("code", null, "@react-stately/collections"), "package, which is a peer dependency of our React components.")),
|
1287
|
+
examples: {
|
1288
|
+
tabs: {
|
1289
|
+
react: o`
|
1290
|
+
import { ListBar, ListBarSearch } from "@sps-woodland/list-bar";
|
1291
|
+
import { Button } from "@sps-woodland/buttons";
|
1292
|
+
import { SpsSelect, SpsTextInput } from "@spscommerce/ds-react";
|
1293
|
+
import { Item } from "@react-stately/collections";
|
1294
|
+
|
1295
|
+
function Component() {
|
1296
|
+
const filterKeys = ["Document Type", "Sender Name", "Receiver Name"];
|
1297
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
1298
|
+
searchText: "",
|
1299
|
+
})
|
1300
|
+
|
1301
|
+
function handleTabChange(tab) {
|
1302
|
+
console.log(tab);
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
return (
|
1306
|
+
<ListBar
|
1307
|
+
onTabChange={handleTabChange}
|
1308
|
+
>
|
1309
|
+
<Tabs>
|
1310
|
+
<Item key="tab1" title="Tab 1">
|
1311
|
+
<ListBarSearch>
|
1312
|
+
<SpsTextInput formMeta={formMeta.fields.searchText} value={formValue.searchText} placeholder="Search fields" />
|
1313
|
+
<Button kind="icon" icon="search" type="submit" />
|
1314
|
+
</ListBarSearch>
|
1315
|
+
</Item>
|
1316
|
+
<Item key="tab2" title="Tab 2">
|
1317
|
+
<ListBarSearch>
|
1318
|
+
<SpsSelect
|
1319
|
+
options={filterKeys}
|
1320
|
+
notClearable
|
1321
|
+
/>
|
1322
|
+
<SpsTextInput
|
1323
|
+
value={formValue.searchText}
|
1324
|
+
formMeta={formMeta.fields.searchText}
|
1325
|
+
icon={SpsIcon.FILTER}
|
1326
|
+
placeholder="Filter fields"
|
1327
|
+
/>
|
1328
|
+
</ListBarSearch>
|
1329
|
+
</Item>
|
1330
|
+
</Tabs>
|
1331
|
+
</ListBar>
|
1332
|
+
)
|
1333
|
+
}
|
1334
|
+
`
|
1335
|
+
}
|
1336
|
+
}
|
1337
|
+
},
|
1338
|
+
title: {
|
1339
|
+
label: "Title",
|
1340
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement("p", null, "Use Titles when there is no Search or Filter input required for the list items, such as when the only search options are in an Advanced Search panel. For more information, visit the ", /* @__PURE__ */ e.createElement(t, {
|
1341
|
+
to: "advanced-search"
|
1342
|
+
}, "Advanced Search"), " page."),
|
1343
|
+
examples: {
|
1344
|
+
title: {
|
1345
|
+
react: o`
|
1346
|
+
import { ListBar } from "@sps-woodland/list-bar";
|
1347
|
+
import { Button } from "@sps-woodland/buttons";
|
1348
|
+
|
1349
|
+
function Component() {
|
1350
|
+
return (
|
1351
|
+
<ListBar title="Good List Title">
|
1352
|
+
<Button>Button</Button>
|
1353
|
+
</ListBar>
|
1354
|
+
)
|
1355
|
+
}
|
1356
|
+
`
|
1357
|
+
}
|
1358
|
+
}
|
1359
|
+
},
|
1360
|
+
sortBy: {
|
1361
|
+
label: "Sort By",
|
1362
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "Use Sort By component to sort list of rows. It looks like SpsDropdown but with sorting interface."),
|
1363
|
+
examples: {
|
1364
|
+
basic: {
|
1365
|
+
react: o`
|
1366
|
+
import { ListBar, ListBarSortBy } from "@sps-woodland/list-bar";
|
1367
|
+
import { Button } from "@sps-woodland/buttons";
|
1368
|
+
import { VerticalRule } from "@sps-woodland/core";
|
1369
|
+
|
1370
|
+
function Component() {
|
1371
|
+
const [activeOption, setActiveOption] = React.useState(null);
|
1372
|
+
const defaultOption = {
|
1373
|
+
label: "Default",
|
1374
|
+
key: "default",
|
1375
|
+
direction: SortDirection.ASCENDING,
|
1376
|
+
icon: SpsIcon.SORT_ALPHA_ASC,
|
1377
|
+
}
|
1378
|
+
const options = [
|
1379
|
+
defaultOption,
|
1380
|
+
{
|
1381
|
+
label: "Company Name: A-Z",
|
1382
|
+
key: "name",
|
1383
|
+
direction: SortDirection.ASCENDING,
|
1384
|
+
icon: SpsIcon.SORT_ALPHA_ASC,
|
1385
|
+
},
|
1386
|
+
{
|
1387
|
+
label: "Company Name: Z-A",
|
1388
|
+
key: "name",
|
1389
|
+
direction: SortDirection.DESCENDING,
|
1390
|
+
icon: SpsIcon.SORT_ALPHA_DESC,
|
1391
|
+
},
|
1392
|
+
{
|
1393
|
+
label: 'Created Date: Oldest to Newest',
|
1394
|
+
key: 'created',
|
1395
|
+
direction: SortDirection.ASCENDING,
|
1396
|
+
icon: SpsIcon.SORT_NUM_ASC,
|
1397
|
+
},
|
1398
|
+
{
|
1399
|
+
label: 'Created Date: Newest to Oldest',
|
1400
|
+
key: 'created',
|
1401
|
+
direction: SortDirection.DESCENDING,
|
1402
|
+
icon: SpsIcon.SORT_NUM_DESC,
|
1403
|
+
}
|
1404
|
+
]
|
1405
|
+
|
1406
|
+
return (
|
1407
|
+
<ListBar title="List of sortable rows">
|
1408
|
+
<Button kind="icon" icon="download-cloud" />
|
1409
|
+
<VerticalRule />
|
1410
|
+
<ListBarSortBy
|
1411
|
+
options={options}
|
1412
|
+
activeOption={activeOption}
|
1413
|
+
defaultOption={defaultOption}
|
1414
|
+
onSortChange={(option) => setActiveOption(option)}
|
1415
|
+
/>
|
1416
|
+
<VerticalRule />
|
1417
|
+
<Button kind="confirm">Create New</Button>
|
1418
|
+
</ListBar>
|
1419
|
+
)
|
1420
|
+
}
|
1421
|
+
`
|
1422
|
+
}
|
1423
|
+
}
|
1424
|
+
}
|
1425
|
+
}
|
1426
|
+
}, Ue = {
|
1427
|
+
components: [M],
|
1428
|
+
examples: {
|
1429
|
+
basic: {
|
1430
|
+
label: "Basic",
|
1431
|
+
description: ({ NavigateTo: t }) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "The SearchResultsBar should be used with List Bar and Advanced Search."), /* @__PURE__ */ e.createElement("p", null, "For more examples go to the Advanced Search section on the", " ", /* @__PURE__ */ e.createElement(t, {
|
1432
|
+
to: "list-bar"
|
1433
|
+
}, "List Bar"), " page.")),
|
1434
|
+
examples: {
|
1435
|
+
basic: {
|
1436
|
+
react: o`
|
1437
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
1438
|
+
import { Button } from "@sps-woodland/buttons";
|
1439
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
1440
|
+
|
1441
|
+
function Component() {
|
1442
|
+
const [advSearch, setAdvSearch] = React.useState({
|
1443
|
+
isOpen: false
|
1444
|
+
});
|
1445
|
+
|
1446
|
+
const [showSearchBar, setShowSearchBar] = React.useState(true);
|
1447
|
+
|
1448
|
+
const [results, setResults] = React.useState(10);
|
1449
|
+
|
1450
|
+
const initialSelections = {
|
1451
|
+
sender: ["Aktie Sports","Modells Sporting Goods", "Perry Sport"],
|
1452
|
+
receiver: ["FGL Sports", "Foot Asylum", "Hervis", "Lovell Rugby"],
|
1453
|
+
};
|
1454
|
+
|
1455
|
+
const [selections, setSelections] = React.useState(initialSelections);
|
1456
|
+
|
1457
|
+
const initValue = {
|
1458
|
+
searchText: "",
|
1459
|
+
};
|
1460
|
+
|
1461
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
1462
|
+
|
1463
|
+
function handleToggleAdvancedSearch(isOpen) {
|
1464
|
+
setAdvSearch({ isOpen });
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
function handleAdvancedSearchSubmit() {
|
1468
|
+
console.log("submit");
|
1469
|
+
setResults(10);
|
1470
|
+
setSelections(initialSelections);
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
function handleClear() {
|
1474
|
+
setResults(0);
|
1475
|
+
setSelections({});
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
return (
|
1479
|
+
<>
|
1480
|
+
<ListBar
|
1481
|
+
advancedSearch={advSearch}
|
1482
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
1483
|
+
>
|
1484
|
+
<ListBarSearch>
|
1485
|
+
<SpsTextInput
|
1486
|
+
value={formValue.searchText}
|
1487
|
+
formMeta={formMeta.fields.searchText}
|
1488
|
+
placeholder="Search fields"
|
1489
|
+
/>
|
1490
|
+
<Button kind="icon" icon="search" />
|
1491
|
+
</ListBarSearch>
|
1492
|
+
<SearchResultsBar
|
1493
|
+
results={results}
|
1494
|
+
onClear={handleClear}
|
1495
|
+
selections={selections}
|
1496
|
+
/>
|
1497
|
+
</ListBar>
|
1498
|
+
<AdvancedSearch {...advSearch} onSubmit={handleAdvancedSearchSubmit}>
|
1499
|
+
<i>insert form here</i>
|
1500
|
+
</AdvancedSearch>
|
1501
|
+
</>
|
1502
|
+
)
|
1503
|
+
}
|
1504
|
+
`
|
1505
|
+
},
|
1506
|
+
situational: {
|
1507
|
+
description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h4", null, "Unknown Results Count"), /* @__PURE__ */ e.createElement("p", null, "In cases where the exact count of results is not able to be determined, Results section won't be displayed.")),
|
1508
|
+
react: o`
|
1509
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
1510
|
+
import { Button } from "@sps-woodland/buttons";
|
1511
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
1512
|
+
|
1513
|
+
function Component() {
|
1514
|
+
const [advSearch, setAdvSearch] = React.useState({
|
1515
|
+
isOpen: false
|
1516
|
+
});
|
1517
|
+
|
1518
|
+
const [showSearchBar, setShowSearchBar] = React.useState(true);
|
1519
|
+
|
1520
|
+
const initialSelections = {
|
1521
|
+
sender: ["Aktie Sports","Modells Sporting Goods", "Perry Sport"],
|
1522
|
+
receiver: ["FGL Sports", "Foot Asylum", "Hervis", "Lovell Rugby"],
|
1523
|
+
};
|
1524
|
+
|
1525
|
+
const [selections, setSelections] = React.useState(initialSelections);
|
1526
|
+
|
1527
|
+
const initValue = {
|
1528
|
+
searchText: "",
|
1529
|
+
};
|
1530
|
+
|
1531
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
1532
|
+
|
1533
|
+
function handleToggleAdvancedSearch(isOpen) {
|
1534
|
+
setAdvSearch({ isOpen });
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
function handleAdvancedSearchSubmit() {
|
1538
|
+
console.log("submit");
|
1539
|
+
setSelections(initialSelections);
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
function handleClear() {
|
1543
|
+
setSelections({});
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
return (
|
1547
|
+
<>
|
1548
|
+
<ListBar
|
1549
|
+
advancedSearch={advSearch}
|
1550
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
1551
|
+
>
|
1552
|
+
<ListBarSearch>
|
1553
|
+
<SpsTextInput
|
1554
|
+
value={formValue.searchText}
|
1555
|
+
formMeta={formMeta.fields.searchText}
|
1556
|
+
placeholder="Search fields"
|
1557
|
+
/>
|
1558
|
+
<Button kind="icon" icon="search" />
|
1559
|
+
</ListBarSearch>
|
1560
|
+
<SearchResultsBar
|
1561
|
+
onClear={handleClear}
|
1562
|
+
selections={selections}
|
1563
|
+
/>
|
1564
|
+
</ListBar>
|
1565
|
+
<AdvancedSearch {...advSearch} onSubmit={handleAdvancedSearchSubmit}>
|
1566
|
+
<i>insert form here</i>
|
1567
|
+
</AdvancedSearch>
|
1568
|
+
</>
|
1569
|
+
)
|
1570
|
+
}
|
1571
|
+
`
|
1572
|
+
}
|
1573
|
+
}
|
1574
|
+
},
|
1575
|
+
customText: {
|
1576
|
+
label: "Custom Text",
|
1577
|
+
description: () => /* @__PURE__ */ e.createElement("p", null, "You can pass in custom text to be displayed when there are no selections."),
|
1578
|
+
examples: {
|
1579
|
+
customText: {
|
1580
|
+
react: o`
|
1581
|
+
import { ListBar, ListBarSearch, SearchResultsBar, AdvancedSearch } from "@sps-woodland/list-bar";
|
1582
|
+
import { Button } from "@sps-woodland/buttons";
|
1583
|
+
import { SpsTextInput } from "@spscommerce/ds-react";
|
1584
|
+
|
1585
|
+
function Component() {
|
1586
|
+
const [advSearch, setAdvSearch] = React.useState({
|
1587
|
+
isOpen: false
|
1588
|
+
});
|
1589
|
+
|
1590
|
+
const [showSearchBar, setShowSearchBar] = React.useState(true);
|
1591
|
+
|
1592
|
+
const [results, setResults] = React.useState(0);
|
1593
|
+
|
1594
|
+
const initialSelections = {
|
1595
|
+
sender: ["Aktie Sports","Modells Sporting Goods", "Perry Sport"],
|
1596
|
+
receiver: ["FGL Sports", "Foot Asylum", "Hervis", "Lovell Rugby"],
|
1597
|
+
};
|
1598
|
+
|
1599
|
+
const [selections, setSelections] = React.useState({});
|
1600
|
+
|
1601
|
+
const initValue = {
|
1602
|
+
searchText: "",
|
1603
|
+
};
|
1604
|
+
|
1605
|
+
const { formValue, formMeta, updateForm } = useSpsForm(initValue);
|
1606
|
+
|
1607
|
+
function handleToggleAdvancedSearch(isOpen) {
|
1608
|
+
setAdvSearch({ isOpen });
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
function handleAdvancedSearchSubmit() {
|
1612
|
+
console.log("submit");
|
1613
|
+
setResults(10);
|
1614
|
+
setSelections(initialSelections);
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
function handleClear() {
|
1618
|
+
setResults(0);
|
1619
|
+
setSelections({});
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
return (
|
1623
|
+
<>
|
1624
|
+
<ListBar
|
1625
|
+
advancedSearch={advSearch}
|
1626
|
+
onToggleAdvancedSearch={handleToggleAdvancedSearch}
|
1627
|
+
>
|
1628
|
+
<ListBarSearch>
|
1629
|
+
<SpsTextInput
|
1630
|
+
value={formValue.searchText}
|
1631
|
+
formMeta={formMeta.fields.searchText}
|
1632
|
+
placeholder="Search fields"
|
1633
|
+
/>
|
1634
|
+
<Button kind="icon" icon="search" />
|
1635
|
+
</ListBarSearch>
|
1636
|
+
<SearchResultsBar
|
1637
|
+
results={results}
|
1638
|
+
onClear={handleClear}
|
1639
|
+
selections={selections}
|
1640
|
+
zeroStateText="There are no selections here"
|
1641
|
+
/>
|
1642
|
+
</ListBar>
|
1643
|
+
<AdvancedSearch {...advSearch} onSubmit={handleAdvancedSearchSubmit}>
|
1644
|
+
<i>insert form here</i>
|
1645
|
+
</AdvancedSearch>
|
1646
|
+
</>
|
1647
|
+
)
|
1648
|
+
}
|
1649
|
+
`
|
1650
|
+
}
|
1651
|
+
}
|
1652
|
+
}
|
1653
|
+
}
|
1654
|
+
}, ze = {
|
1655
|
+
"Advanced Search": De,
|
1656
|
+
"List Bar": Ge,
|
1657
|
+
"Search Results Bar": Ue
|
1658
|
+
};
|
1659
|
+
export {
|
1660
|
+
K as AdvancedSearch,
|
1661
|
+
ye as InputGroupWrapper,
|
1662
|
+
U as ListBar,
|
1663
|
+
R as ListBarSearch,
|
1664
|
+
F as ListBarSearchInfo,
|
1665
|
+
j as ListBarSortBy,
|
1666
|
+
ze as MANIFEST,
|
1667
|
+
M as SearchResultsBar
|
1668
|
+
};
|