@spscommerce/ds-react 6.3.0 → 6.4.0
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/lib/index.cjs.js +603 -504
- package/lib/index.es.js +360 -232
- package/package.json +11 -11
package/lib/index.es.js
CHANGED
|
@@ -30282,212 +30282,375 @@ Object.assign(SpsMultiSelect, {
|
|
|
30282
30282
|
displayName: "SpsMultiSelect"
|
|
30283
30283
|
});
|
|
30284
30284
|
const SpsMultiSelectExamples = {
|
|
30285
|
-
|
|
30286
|
-
label: "
|
|
30287
|
-
description: "
|
|
30285
|
+
general: {
|
|
30286
|
+
label: "General Usage",
|
|
30287
|
+
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h5", null, "Use a Mulit-Select"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, "When a list of predetermined values can be provided and the input allows multiple entries.")), /* @__PURE__ */ React.createElement("h5", null, "Do Not Use a Multi-Select:"), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", {
|
|
30288
|
+
className: "mb-2"
|
|
30289
|
+
}, "When there are only two possible options. Consider", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30290
|
+
to: "checkbox"
|
|
30291
|
+
}, "Checkboxes"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30292
|
+
to: "radio-buttons"
|
|
30293
|
+
}, "Radio Buttons"), " instead."), /* @__PURE__ */ React.createElement("li", null, "When it is ideal to display all available options without requiring a click. Consider", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30294
|
+
to: "checkbox"
|
|
30295
|
+
}, "Checkboxes"), " or", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30296
|
+
to: "radio-buttons"
|
|
30297
|
+
}, "Radio Buttons"), " instead.")), /* @__PURE__ */ React.createElement("h5", null, "Using Multi-Selects in a Form"), /* @__PURE__ */ React.createElement("p", null, "Reference the ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30298
|
+
to: "form"
|
|
30299
|
+
}, "Forms"), " page for guidelines for placing", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
30300
|
+
to: "text-inputs"
|
|
30301
|
+
}, "Inputs"), " in Form Layouts."))
|
|
30302
|
+
},
|
|
30303
|
+
basicMuliSelect: {
|
|
30304
|
+
label: "Basic Multi-Selects",
|
|
30305
|
+
description: "Basic Multi-Selects include a label and dropdown menu including a list of options. The user is allowed to make a single selection.",
|
|
30288
30306
|
examples: {
|
|
30289
|
-
|
|
30307
|
+
basic: {
|
|
30290
30308
|
react: code`
|
|
30291
|
-
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
|
|
30299
|
-
|
|
30300
|
-
|
|
30301
|
-
|
|
30302
|
-
|
|
30303
|
-
|
|
30304
|
-
|
|
30305
|
-
|
|
30306
|
-
|
|
30307
|
-
|
|
30308
|
-
`
|
|
30309
|
+
function Component() {
|
|
30310
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"])
|
|
30311
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30312
|
+
things: [opts[0]]
|
|
30313
|
+
})
|
|
30314
|
+
|
|
30315
|
+
return <>
|
|
30316
|
+
<SpsLabel for={formMeta.fields.things}>Company Names</SpsLabel>
|
|
30317
|
+
<SpsMultiSelect
|
|
30318
|
+
options={opts}
|
|
30319
|
+
formMeta={formMeta.fields.things}
|
|
30320
|
+
value={formValue.things}
|
|
30321
|
+
/>
|
|
30322
|
+
<br />
|
|
30323
|
+
{JSON.stringify(formValue)}
|
|
30324
|
+
</>
|
|
30325
|
+
}`
|
|
30309
30326
|
},
|
|
30310
|
-
|
|
30327
|
+
customizablePlaceholderText: {
|
|
30328
|
+
description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Customizable Placeholder Text"), /* @__PURE__ */ React.createElement("p", null, "Placeholder text can be customized to specifically reference the content in the dropdown menu.")),
|
|
30311
30329
|
react: code`
|
|
30312
|
-
|
|
30313
|
-
|
|
30314
|
-
|
|
30315
|
-
|
|
30316
|
-
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30326
|
-
|
|
30327
|
-
|
|
30328
|
-
|
|
30329
|
-
|
|
30330
|
+
function Component() {
|
|
30331
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"])
|
|
30332
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30333
|
+
things: []
|
|
30334
|
+
})
|
|
30335
|
+
|
|
30336
|
+
return <>
|
|
30337
|
+
<SpsLabel for={formMeta.fields.things}>Company Names</SpsLabel>
|
|
30338
|
+
<SpsMultiSelect
|
|
30339
|
+
placeholder= "Select companies..."
|
|
30340
|
+
options={opts}
|
|
30341
|
+
formMeta={formMeta.fields.things}
|
|
30342
|
+
value={formValue.things}
|
|
30343
|
+
/>
|
|
30344
|
+
<br />
|
|
30345
|
+
{JSON.stringify(formValue)}
|
|
30346
|
+
</>
|
|
30347
|
+
}`
|
|
30330
30348
|
},
|
|
30331
|
-
|
|
30349
|
+
zeroStateNoAvailableOptions: {
|
|
30350
|
+
description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Zero State / No Available Options"), /* @__PURE__ */ React.createElement("p", null, "If no options are available in the dropdown menu, a zero state message appears. This option is most commonly used with the Select with Filter option.")),
|
|
30332
30351
|
react: code`
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
|
|
30338
|
-
|
|
30339
|
-
|
|
30340
|
-
|
|
30341
|
-
|
|
30342
|
-
|
|
30343
|
-
|
|
30344
|
-
|
|
30345
|
-
|
|
30346
|
-
|
|
30347
|
-
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30352
|
+
function Component() {
|
|
30353
|
+
const [opts] = React.useState([])
|
|
30354
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30355
|
+
things: []
|
|
30356
|
+
})
|
|
30357
|
+
|
|
30358
|
+
return <>
|
|
30359
|
+
<SpsLabel for={formMeta.fields.things}>Company Names</SpsLabel>
|
|
30360
|
+
<SpsMultiSelect
|
|
30361
|
+
zeroState="No options available"
|
|
30362
|
+
options={opts}
|
|
30363
|
+
formMeta={formMeta.fields.things}
|
|
30364
|
+
value={formValue.things}
|
|
30365
|
+
/>
|
|
30366
|
+
<br />
|
|
30367
|
+
{JSON.stringify(formValue)}
|
|
30368
|
+
</>
|
|
30369
|
+
}`
|
|
30370
|
+
}
|
|
30371
|
+
}
|
|
30372
|
+
},
|
|
30373
|
+
promise: {
|
|
30374
|
+
label: "Asynchronous Data Source",
|
|
30375
|
+
description: "If the list of options must be sourced asynchronously, the options prop can take a function that returns a Promise.",
|
|
30376
|
+
examples: {
|
|
30377
|
+
returnAPromise: {
|
|
30378
|
+
react: code`function Component() {
|
|
30379
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30380
|
+
things: []
|
|
30381
|
+
})
|
|
30382
|
+
function colorSearch(search) {
|
|
30383
|
+
return new Promise((resolve, reject) => {
|
|
30384
|
+
const result = ["foo", "bar", "baz", "orp"]
|
|
30385
|
+
.filter(s => new RegExp(search, "i").test(s));
|
|
30386
|
+
resolve(result);
|
|
30387
|
+
});
|
|
30388
|
+
}
|
|
30389
|
+
|
|
30390
|
+
return <>
|
|
30391
|
+
<SpsLabel for={formMeta.fields.things}>Things</SpsLabel>
|
|
30392
|
+
<SpsMultiSelect
|
|
30393
|
+
options={colorSearch}
|
|
30394
|
+
formMeta={formMeta.fields.things}
|
|
30395
|
+
value={formValue.things}
|
|
30396
|
+
/>
|
|
30397
|
+
<br />
|
|
30398
|
+
{JSON.stringify(formValue)}
|
|
30399
|
+
</>
|
|
30400
|
+
}`
|
|
30401
|
+
}
|
|
30402
|
+
}
|
|
30403
|
+
},
|
|
30404
|
+
objectOptions: {
|
|
30405
|
+
label: "Object Options",
|
|
30406
|
+
description: "The values in the select menu can be modified to provide more detail to the user or the system, when necssary.",
|
|
30407
|
+
examples: {
|
|
30408
|
+
basic: {
|
|
30367
30409
|
react: code`
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30410
|
+
function Component() {
|
|
30411
|
+
const [opts] = React.useState([
|
|
30412
|
+
{ id: 1, name: "Target" },
|
|
30413
|
+
{ id: 2, name: "Cabela's" },
|
|
30414
|
+
{ id: 3, name: "Best Buy" },
|
|
30415
|
+
])
|
|
30416
|
+
const [foo, setFoo] = React.useState([])
|
|
30417
|
+
function handleChange(event) {
|
|
30418
|
+
setFoo(event.target.value)
|
|
30419
|
+
}
|
|
30420
|
+
return (
|
|
30421
|
+
<>
|
|
30422
|
+
<SpsMultiSelect
|
|
30423
|
+
options={opts}
|
|
30424
|
+
textKey="name"
|
|
30425
|
+
value={foo}
|
|
30426
|
+
onChange={handleChange}
|
|
30427
|
+
/>
|
|
30428
|
+
<br />
|
|
30429
|
+
{JSON.stringify(foo)}
|
|
30430
|
+
</>
|
|
30431
|
+
)
|
|
30432
|
+
}`
|
|
30387
30433
|
},
|
|
30388
|
-
|
|
30434
|
+
extendedDetails: {
|
|
30435
|
+
description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Extended Details"), /* @__PURE__ */ React.createElement("p", null, "Extended details can be displayed in the dropdown menu. Only the primary detail is displayed as the selection.")),
|
|
30389
30436
|
react: code`
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30404
|
-
|
|
30405
|
-
|
|
30406
|
-
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30437
|
+
function Component() {
|
|
30438
|
+
const [opts] = React.useState([
|
|
30439
|
+
{ id: 1, name: "Target", description: "blah", disabled: true },
|
|
30440
|
+
{ id: 2, name: "Cabela's", description: "test", disabled: true },
|
|
30441
|
+
{ id: 3, name: "Best Buy", description: "2" },
|
|
30442
|
+
])
|
|
30443
|
+
const [foo, setFoo] = React.useState([])
|
|
30444
|
+
function handleChange(event) {
|
|
30445
|
+
setFoo(event.target.value)
|
|
30446
|
+
}
|
|
30447
|
+
return (
|
|
30448
|
+
<>
|
|
30449
|
+
<SpsMultiSelect
|
|
30450
|
+
options={opts}
|
|
30451
|
+
textKey="name"
|
|
30452
|
+
captionKey="description"
|
|
30453
|
+
value={foo}
|
|
30454
|
+
onChange={handleChange}
|
|
30455
|
+
/>
|
|
30456
|
+
<br />
|
|
30457
|
+
{JSON.stringify(foo)}
|
|
30458
|
+
</>
|
|
30459
|
+
)
|
|
30460
|
+
}`
|
|
30414
30461
|
},
|
|
30415
|
-
|
|
30462
|
+
disabledOption: {
|
|
30463
|
+
description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", null, "Disabled Options"), /* @__PURE__ */ React.createElement("p", null, "When options in the dropdown list are unavailable (as a result of having been selected or for any other reason) they should adopt a disabled style.")),
|
|
30416
30464
|
react: code`
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
{JSON.stringify(foo)}
|
|
30437
|
-
</>
|
|
30438
|
-
)
|
|
30439
|
-
}
|
|
30440
|
-
`
|
|
30465
|
+
function Component() {
|
|
30466
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"])
|
|
30467
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30468
|
+
things: [ opts[0] ]
|
|
30469
|
+
})
|
|
30470
|
+
|
|
30471
|
+
return <>
|
|
30472
|
+
<SpsLabel for={formMeta.fields.things}>Company Names</SpsLabel>
|
|
30473
|
+
<SpsMultiSelect
|
|
30474
|
+
options={opts}
|
|
30475
|
+
formMeta={formMeta.fields.things}
|
|
30476
|
+
value={formValue.things}
|
|
30477
|
+
disableSelected
|
|
30478
|
+
/>
|
|
30479
|
+
<br />
|
|
30480
|
+
{JSON.stringify(formValue)}
|
|
30481
|
+
</>
|
|
30482
|
+
}
|
|
30483
|
+
`
|
|
30441
30484
|
}
|
|
30442
30485
|
}
|
|
30443
30486
|
},
|
|
30444
|
-
|
|
30445
|
-
label: "Search
|
|
30446
|
-
description: "
|
|
30487
|
+
getSearchText: {
|
|
30488
|
+
label: "Get Search Text",
|
|
30489
|
+
description: "The text that the user has entered into the input can be accessed via passing a handler to onSearchChange. This is typically used in combination with the action option to enable a user to add a value they don't find in the list.",
|
|
30447
30490
|
examples: {
|
|
30448
|
-
|
|
30449
|
-
react: code`
|
|
30450
|
-
|
|
30451
|
-
|
|
30452
|
-
|
|
30453
|
-
|
|
30491
|
+
basic: {
|
|
30492
|
+
react: code`function Component() {
|
|
30493
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"]);
|
|
30494
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30495
|
+
tags: [opts[0]],
|
|
30496
|
+
});
|
|
30497
|
+
|
|
30498
|
+
const [searchText, setSearchText] = React.useState("");
|
|
30499
|
+
|
|
30500
|
+
React.useEffect(() => {
|
|
30501
|
+
updateAction({
|
|
30502
|
+
label: searchText ? \`Create a New Tag "\${searchText}"\` : "Create a New Tag",
|
|
30454
30503
|
});
|
|
30455
|
-
|
|
30456
|
-
|
|
30457
|
-
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30462
|
-
|
|
30463
|
-
|
|
30464
|
-
|
|
30465
|
-
|
|
30466
|
-
|
|
30467
|
-
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30504
|
+
}, [searchText, opts]);
|
|
30505
|
+
|
|
30506
|
+
const handleSearchChange = (searchTextValue) => {
|
|
30507
|
+
setSearchText(searchTextValue)
|
|
30508
|
+
}
|
|
30509
|
+
|
|
30510
|
+
const [action, updateAction] = useSpsAction(
|
|
30511
|
+
{
|
|
30512
|
+
label: "Create a New Tag",
|
|
30513
|
+
icon: SpsIcon.PLUS_SIGN,
|
|
30514
|
+
},
|
|
30515
|
+
() => console.log("New Tag has been created")
|
|
30516
|
+
);
|
|
30517
|
+
|
|
30518
|
+
return (
|
|
30519
|
+
<>
|
|
30520
|
+
<SpsLabel for={formMeta.fields.tags}>Tags</SpsLabel>
|
|
30521
|
+
<SpsMultiSelect
|
|
30522
|
+
disableSelected
|
|
30523
|
+
icon={SpsIcon.FILTER}
|
|
30524
|
+
options={opts}
|
|
30525
|
+
action={action}
|
|
30526
|
+
formMeta={formMeta.fields.tags}
|
|
30527
|
+
value={formValue.tags}
|
|
30528
|
+
onSearchChange={handleSearchChange}
|
|
30529
|
+
/>
|
|
30530
|
+
</>
|
|
30531
|
+
);
|
|
30532
|
+
}`
|
|
30533
|
+
}
|
|
30534
|
+
}
|
|
30535
|
+
},
|
|
30536
|
+
createANewValue: {
|
|
30537
|
+
label: "Create a New Value",
|
|
30538
|
+
description: "This feature allows users to add, and select, a new value that doesn't exist in the current dropdown menu options.",
|
|
30539
|
+
examples: {
|
|
30540
|
+
basic: {
|
|
30541
|
+
react: code`function Component() {
|
|
30542
|
+
const [opts, setOpts] = React.useState(["foo", "bar", "baz", "orp"]);
|
|
30543
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30544
|
+
tags: [opts[0]],
|
|
30545
|
+
});
|
|
30546
|
+
|
|
30547
|
+
const [searchText, setSearchText] = React.useState("");
|
|
30548
|
+
|
|
30549
|
+
React.useEffect(() => {
|
|
30550
|
+
updateAction({
|
|
30551
|
+
label: searchText
|
|
30552
|
+
? \`Create a New Tag "\${searchText}"\`
|
|
30553
|
+
: "Create a New Tag",
|
|
30554
|
+
disabled: searchText === ""
|
|
30555
|
+
});
|
|
30556
|
+
}, [searchText, opts]);
|
|
30557
|
+
|
|
30558
|
+
const handleSearchChange = (searchTextValue) => {
|
|
30559
|
+
setSearchText(searchTextValue);
|
|
30560
|
+
};
|
|
30561
|
+
|
|
30562
|
+
const [action, updateAction] = useSpsAction(
|
|
30563
|
+
{
|
|
30564
|
+
label: "Create a New Tag",
|
|
30565
|
+
icon: SpsIcon.PLUS_SIGN,
|
|
30566
|
+
},
|
|
30567
|
+
() => {
|
|
30568
|
+
setOpts([...opts, searchText]);
|
|
30569
|
+
updateForm({ ...formValue, tags: [...formValue.tags, searchText] });
|
|
30570
|
+
handleSearchChange("");
|
|
30571
|
+
}
|
|
30572
|
+
);
|
|
30573
|
+
|
|
30574
|
+
return (
|
|
30575
|
+
<>
|
|
30576
|
+
<SpsLabel for={formMeta.fields.tags}>Tags</SpsLabel>
|
|
30577
|
+
<SpsMultiSelect
|
|
30578
|
+
disableSelected
|
|
30579
|
+
icon={SpsIcon.FILTER}
|
|
30580
|
+
options={opts}
|
|
30581
|
+
action={action}
|
|
30582
|
+
formMeta={formMeta.fields.tags}
|
|
30583
|
+
value={formValue.tags}
|
|
30584
|
+
onSearchChange={handleSearchChange}
|
|
30585
|
+
clearSearchOnBlur
|
|
30586
|
+
/>
|
|
30587
|
+
</>
|
|
30588
|
+
);
|
|
30589
|
+
}`
|
|
30590
|
+
}
|
|
30591
|
+
}
|
|
30592
|
+
},
|
|
30593
|
+
selectedValuesAlternate: {
|
|
30594
|
+
label: "Selected Values Alternate",
|
|
30595
|
+
description: () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "Use this option when it is ideal for the selected values to appear as tags outside of the input field. Opt for this option when adding or removing values from a large list of selections that would create a cumbersome field."), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("i", null, "Note: The placement of the selected values can appear belcow the input field or elsewhere in the UI if necessary."))),
|
|
30596
|
+
examples: {
|
|
30597
|
+
basic: {
|
|
30598
|
+
react: code`function Component() {
|
|
30599
|
+
const [foo, setFoo] = React.useState(["orp"])
|
|
30600
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"])
|
|
30601
|
+
function handleChange(event) {
|
|
30602
|
+
setFoo(event.target.value)
|
|
30603
|
+
}
|
|
30604
|
+
function removeByIndex(i) {
|
|
30605
|
+
foo.splice(i, 1)
|
|
30606
|
+
setFoo([...foo])
|
|
30607
|
+
}
|
|
30608
|
+
return (
|
|
30609
|
+
<>
|
|
30479
30610
|
<SpsMultiSelect
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
|
|
30484
|
-
formMeta={formMeta.fields.tags}
|
|
30485
|
-
value={formValue.tags}
|
|
30486
|
-
onSearchChange={handleSearchChange}
|
|
30611
|
+
hideSelected
|
|
30612
|
+
options={opts}
|
|
30613
|
+
value={foo}
|
|
30614
|
+
onChange={handleChange}
|
|
30487
30615
|
/>
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
|
|
30616
|
+
<br />
|
|
30617
|
+
{foo.map((opt, i) => (
|
|
30618
|
+
<SpsClickableTag
|
|
30619
|
+
className="mt-1 ml-1"
|
|
30620
|
+
key={i}
|
|
30621
|
+
onRemove={() => removeByIndex(i)}
|
|
30622
|
+
>
|
|
30623
|
+
{opt}
|
|
30624
|
+
</SpsClickableTag>
|
|
30625
|
+
))}
|
|
30626
|
+
</>
|
|
30627
|
+
)
|
|
30628
|
+
}`
|
|
30629
|
+
}
|
|
30630
|
+
}
|
|
30631
|
+
},
|
|
30632
|
+
disabledState: {
|
|
30633
|
+
label: "Disabled State",
|
|
30634
|
+
description: "In the disabled state, select inputs display the current selection or placeholder text, but cannot be interacted with.",
|
|
30635
|
+
examples: {
|
|
30636
|
+
basic: {
|
|
30637
|
+
react: code`function Component() {
|
|
30638
|
+
const [opts] = React.useState(["foo", "bar", "baz", "orp"])
|
|
30639
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
30640
|
+
things: [ opts[0] ]
|
|
30641
|
+
})
|
|
30642
|
+
|
|
30643
|
+
return <>
|
|
30644
|
+
<SpsLabel for={formMeta.fields.things}>Company Name</SpsLabel>
|
|
30645
|
+
<SpsMultiSelect disabled
|
|
30646
|
+
options={opts}
|
|
30647
|
+
formMeta={formMeta.fields.things}
|
|
30648
|
+
value={formValue.things}
|
|
30649
|
+
/>
|
|
30650
|
+
<br />
|
|
30651
|
+
{JSON.stringify(formValue)}
|
|
30652
|
+
</>
|
|
30653
|
+
}`
|
|
30491
30654
|
}
|
|
30492
30655
|
}
|
|
30493
30656
|
}
|
|
@@ -37390,13 +37553,7 @@ const MANIFEST = {
|
|
|
37390
37553
|
},
|
|
37391
37554
|
Cards: {
|
|
37392
37555
|
description: () => /* @__PURE__ */ React.createElement("p", null, "Cards are used to group similar or related content together in a single container. They can be combined with additional elements such as Headers, Footers, or Tabs."),
|
|
37393
|
-
components: [
|
|
37394
|
-
SpsCardV2,
|
|
37395
|
-
SpsCardV2Footer,
|
|
37396
|
-
SpsCardV2Header,
|
|
37397
|
-
SpsCardV2Title,
|
|
37398
|
-
SpsTabsV2
|
|
37399
|
-
],
|
|
37556
|
+
components: [SpsCardV2, SpsCardV2Footer, SpsCardV2Header, SpsCardV2Title, SpsTabsV2],
|
|
37400
37557
|
examples: SpsCardExamples
|
|
37401
37558
|
},
|
|
37402
37559
|
Checkbox: {
|
|
@@ -37427,12 +37584,7 @@ const MANIFEST = {
|
|
|
37427
37584
|
examples: SpsContentRowExamples
|
|
37428
37585
|
},
|
|
37429
37586
|
"Content Tiles": {
|
|
37430
|
-
components: [
|
|
37431
|
-
SpsTile,
|
|
37432
|
-
SpsTileList,
|
|
37433
|
-
SpsSortingHeader,
|
|
37434
|
-
SpsSortingHeaderCell
|
|
37435
|
-
],
|
|
37587
|
+
components: [SpsTile, SpsTileList, SpsSortingHeader, SpsSortingHeaderCell],
|
|
37436
37588
|
examples: SpsTileListExamples
|
|
37437
37589
|
},
|
|
37438
37590
|
"Filter Tiles": {
|
|
@@ -37452,11 +37604,7 @@ const MANIFEST = {
|
|
|
37452
37604
|
examples: SpsDatetimeExamples
|
|
37453
37605
|
},
|
|
37454
37606
|
"Description Lists": {
|
|
37455
|
-
components: [
|
|
37456
|
-
SpsDescriptionList,
|
|
37457
|
-
SpsDescriptionListDefinition,
|
|
37458
|
-
SpsDescriptionListTerm
|
|
37459
|
-
],
|
|
37607
|
+
components: [SpsDescriptionList, SpsDescriptionListDefinition, SpsDescriptionListTerm],
|
|
37460
37608
|
examples: SpsDescriptionListExamples
|
|
37461
37609
|
},
|
|
37462
37610
|
Dropdown: {
|
|
@@ -37464,7 +37612,7 @@ const MANIFEST = {
|
|
|
37464
37612
|
examples: SpsDropdownExamples
|
|
37465
37613
|
},
|
|
37466
37614
|
"Feedback Blocks": {
|
|
37467
|
-
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "Feedback Blocks show static informational messages on a page. They should not dynamically appear or disappear. For feedback that responds to a user action, Use a ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
37615
|
+
description: ({ NavigateTo }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "Feedback Blocks show static informational messages on a page. They should not dynamically appear or disappear. For feedback that responds to a user action, Use a", " ", /* @__PURE__ */ React.createElement(NavigateTo, {
|
|
37468
37616
|
to: "growler"
|
|
37469
37617
|
}, "Growler"), " instead."), /* @__PURE__ */ React.createElement("h5", null, "Variants"), /* @__PURE__ */ React.createElement("p", null, "Variants are generally tied to a specific color and an accompanying icon."), /* @__PURE__ */ React.createElement(SpsMicroBlock, {
|
|
37470
37618
|
kind: FeedbackBlockKind.ERROR,
|
|
@@ -37490,12 +37638,7 @@ const MANIFEST = {
|
|
|
37490
37638
|
examples: SpsFieldsetExamples
|
|
37491
37639
|
},
|
|
37492
37640
|
"Filter Panel": {
|
|
37493
|
-
components: [
|
|
37494
|
-
SpsFilterPanel,
|
|
37495
|
-
SpsFilterPanelSection,
|
|
37496
|
-
SpsFilterPanelCap,
|
|
37497
|
-
SpsFilterPanelFilterBox
|
|
37498
|
-
],
|
|
37641
|
+
components: [SpsFilterPanel, SpsFilterPanelSection, SpsFilterPanelCap, SpsFilterPanelFilterBox],
|
|
37499
37642
|
examples: SpsFilterPanelExamples
|
|
37500
37643
|
},
|
|
37501
37644
|
"Focused Task": {
|
|
@@ -37552,6 +37695,7 @@ const MANIFEST = {
|
|
|
37552
37695
|
examples: SpsModalExamples
|
|
37553
37696
|
},
|
|
37554
37697
|
"Multi Select": {
|
|
37698
|
+
description: () => /* @__PURE__ */ React.createElement("p", null, "Multi-Selects consist of a Label and a dropdown menu from which a user selects one or more values from a list of pre-defined options."),
|
|
37555
37699
|
components: [SpsMultiSelect],
|
|
37556
37700
|
examples: SpsMultiSelectExamples
|
|
37557
37701
|
},
|
|
@@ -37611,11 +37755,7 @@ const MANIFEST = {
|
|
|
37611
37755
|
examples: SpsSlackLinkExamples
|
|
37612
37756
|
},
|
|
37613
37757
|
"Summary List Row": {
|
|
37614
|
-
components: [
|
|
37615
|
-
SpsSummaryListRow,
|
|
37616
|
-
SpsSummaryListColumn,
|
|
37617
|
-
SpsSummaryListExpansion
|
|
37618
|
-
],
|
|
37758
|
+
components: [SpsSummaryListRow, SpsSummaryListColumn, SpsSummaryListExpansion],
|
|
37619
37759
|
examples: SpsSummaryListExamples
|
|
37620
37760
|
},
|
|
37621
37761
|
Tables: {
|
|
@@ -37628,14 +37768,7 @@ const MANIFEST = {
|
|
|
37628
37768
|
}, "Content Tiles"), ") are one of three options for displaying a list of records on a page."), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("div", {
|
|
37629
37769
|
className: "sps-body-14"
|
|
37630
37770
|
}, "Tables are the ideal solution for displaying tabular data, especially when the listed records contain a considerable amount of data points. While tables are primarily used to display an extensive list of records, often in a paginated format, they can also be used to display smaller sets of tabular data in any context.")),
|
|
37631
|
-
components: [
|
|
37632
|
-
SpsTable,
|
|
37633
|
-
SpsTableBody,
|
|
37634
|
-
SpsTableCell,
|
|
37635
|
-
SpsTableHead,
|
|
37636
|
-
SpsTableHeader,
|
|
37637
|
-
SpsTableRow
|
|
37638
|
-
],
|
|
37771
|
+
components: [SpsTable, SpsTableBody, SpsTableCell, SpsTableHead, SpsTableHeader, SpsTableRow],
|
|
37639
37772
|
examples: SpsTableExamples
|
|
37640
37773
|
},
|
|
37641
37774
|
Tags: {
|
|
@@ -37669,12 +37802,7 @@ const MANIFEST = {
|
|
|
37669
37802
|
examples: SpsWizardExamples
|
|
37670
37803
|
},
|
|
37671
37804
|
Workflow: {
|
|
37672
|
-
components: [
|
|
37673
|
-
SpsWorkflow,
|
|
37674
|
-
SpsWorkflowDocument,
|
|
37675
|
-
SpsWorkflowDocumentStatus,
|
|
37676
|
-
SpsWorkflowStep
|
|
37677
|
-
],
|
|
37805
|
+
components: [SpsWorkflow, SpsWorkflowDocument, SpsWorkflowDocumentStatus, SpsWorkflowStep],
|
|
37678
37806
|
examples: SpsWorkflowExamples
|
|
37679
37807
|
},
|
|
37680
37808
|
"Zero States": {
|