@webority/ui-react 0.10.1 → 0.11.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.
|
@@ -3,13 +3,32 @@ import "@webority/ui-elements";
|
|
|
3
3
|
* Multi-value select over the shared `<wui-multiselect>` element. The control shows each
|
|
4
4
|
* chosen value as a removable `.chip`; the dropdown is a searchable checklist.
|
|
5
5
|
*
|
|
6
|
+
* Options may be rich rows: `description` is a secondary line under the label (also matched
|
|
7
|
+
* by the search), `avatar` an image URL and `initials` the face shown without (or under) it,
|
|
8
|
+
* and `disabled` keeps a row visible but unselectable with `disabledHint` beside it
|
|
9
|
+
* (e.g. "Already added").
|
|
10
|
+
*
|
|
11
|
+
* `allowCustom` turns the control into free entry: an inline text input after the chips
|
|
12
|
+
* filters the list, and Enter / comma / blur / a pasted list commit whatever was typed as its
|
|
13
|
+
* own chip (value = label = the text). Typed text is checked against `customPattern` then
|
|
14
|
+
* `validateCustom`; a refusal keeps the text and shows the message under the control. Chips are
|
|
15
|
+
* de-duplicated ignoring case. The in-menu search box is not shown in this mode.
|
|
16
|
+
*
|
|
6
17
|
* @param {object} props
|
|
7
18
|
* @param {string[]} [props.values] Selected option values.
|
|
8
19
|
* @param {(values: string[]) => void} [props.onChange]
|
|
9
|
-
* @param {{value: string, label: string}[]} [props.options]
|
|
20
|
+
* @param {{value: string, label: string, description?: string, avatar?: string, initials?: string, disabled?: boolean, disabledHint?: string}[]} [props.options]
|
|
10
21
|
* @param {string} [props.placeholder]
|
|
11
22
|
* @param {string} [props.searchPlaceholder] Placeholder for the in-menu search box.
|
|
12
|
-
* @param {boolean} [props.searchable=true]
|
|
23
|
+
* @param {boolean} [props.searchable=true] Ignored under `allowCustom`, whose inline input is the search.
|
|
24
|
+
* @param {boolean} [props.allowCustom=false] Accept typed entries that are not options.
|
|
25
|
+
* @param {(value: string) => boolean | string} [props.validateCustom] Checks a typed entry:
|
|
26
|
+
* `true` accepts, a string refuses with that message, anything else refuses with
|
|
27
|
+
* `customInvalidMessage`. Runs after `customPattern`.
|
|
28
|
+
* @param {string} [props.customPattern] Regular expression a typed entry must match in full
|
|
29
|
+
* (anchored like the HTML `pattern` attribute).
|
|
30
|
+
* @param {string} [props.customInvalidMessage] Message for a refused typed entry
|
|
31
|
+
* (default "Enter a valid value.").
|
|
13
32
|
* @param {boolean} [props.disabled]
|
|
14
33
|
* @param {string} [props.icon] Leading glyph inside the control (a Bootstrap Icons name).
|
|
15
34
|
* @param {'sm'|'lg'} [props.size] Control size around the default.
|
package/dist/ui-react.js
CHANGED
|
@@ -3580,60 +3580,66 @@ function wn({ value: e = 0, min: t = 0, max: n = 100, tone: r = "info", optimum:
|
|
|
3580
3580
|
}
|
|
3581
3581
|
//#endregion
|
|
3582
3582
|
//#region src/components/AppMultiSelect.jsx
|
|
3583
|
-
var Tn = i(function({ values: e, onChange: t, options: n, placeholder: r = "Select…", searchPlaceholder: i = "Search…", searchable: a = !0, disabled: c = !1, icon: l, size: u, collapseChips: d = !1,
|
|
3584
|
-
U("AppMultiSelect",
|
|
3585
|
-
let
|
|
3586
|
-
ref:
|
|
3583
|
+
var Tn = i(function({ values: e, onChange: t, options: n, placeholder: r = "Select…", searchPlaceholder: i = "Search…", searchable: a = !0, disabled: c = !1, icon: l, size: u, collapseChips: d = !1, allowCustom: f = !1, validateCustom: p, customPattern: m, customInvalidMessage: h, name: g, id: _, label: v, error: y, hint: b, required: x = !1, help: S, helpLabel: C = "More information", fieldClassName: w = "", ...T }, O) {
|
|
3584
|
+
U("AppMultiSelect", T);
|
|
3585
|
+
let k = s(), A = _ || k, { setRef: j, innerRef: M } = Q({
|
|
3586
|
+
ref: O,
|
|
3587
3587
|
value: e,
|
|
3588
3588
|
onChange: t,
|
|
3589
3589
|
readValue: Ge,
|
|
3590
3590
|
writeValue: Ke
|
|
3591
3591
|
});
|
|
3592
3592
|
return o(() => {
|
|
3593
|
-
let e =
|
|
3593
|
+
let e = M.current;
|
|
3594
3594
|
if (!e) return;
|
|
3595
3595
|
let t = n || [];
|
|
3596
3596
|
We(t, e.options) || (e.options = t);
|
|
3597
|
-
}, [n,
|
|
3598
|
-
|
|
3597
|
+
}, [n, M]), o(() => {
|
|
3598
|
+
let e = M.current;
|
|
3599
|
+
e && (e.validateCustom = p ?? null);
|
|
3600
|
+
}, [p, M]), /* @__PURE__ */ D("div", {
|
|
3601
|
+
className: `field${w ? ` ${w}` : ""}`,
|
|
3599
3602
|
children: [
|
|
3600
|
-
|
|
3603
|
+
v && /* @__PURE__ */ D("label", {
|
|
3601
3604
|
className: "label",
|
|
3602
|
-
htmlFor:
|
|
3605
|
+
htmlFor: A,
|
|
3603
3606
|
children: [
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
label:
|
|
3608
|
-
children:
|
|
3607
|
+
v,
|
|
3608
|
+
x && /* @__PURE__ */ E(Z, {}),
|
|
3609
|
+
S && /* @__PURE__ */ E(Be, {
|
|
3610
|
+
label: C,
|
|
3611
|
+
children: S
|
|
3609
3612
|
})
|
|
3610
3613
|
]
|
|
3611
3614
|
}),
|
|
3612
3615
|
/* @__PURE__ */ E("wui-multiselect", {
|
|
3613
|
-
"aria-label": typeof
|
|
3614
|
-
"aria-describedby":
|
|
3615
|
-
"aria-invalid":
|
|
3616
|
-
id:
|
|
3617
|
-
ref:
|
|
3618
|
-
name:
|
|
3616
|
+
"aria-label": typeof v == "string" ? v : void 0,
|
|
3617
|
+
"aria-describedby": y ? `${A}-error` : b ? `${A}-hint` : void 0,
|
|
3618
|
+
"aria-invalid": y ? "true" : void 0,
|
|
3619
|
+
id: A,
|
|
3620
|
+
ref: j,
|
|
3621
|
+
name: g,
|
|
3619
3622
|
placeholder: r,
|
|
3620
3623
|
"search-placeholder": i,
|
|
3621
3624
|
icon: l || void 0,
|
|
3622
3625
|
size: u || void 0,
|
|
3623
3626
|
"collapse-chips": d ? "" : void 0,
|
|
3627
|
+
"allow-custom": f ? "" : void 0,
|
|
3628
|
+
"custom-pattern": m || void 0,
|
|
3629
|
+
"custom-invalid-message": h || void 0,
|
|
3624
3630
|
searchable: a ? "" : void 0,
|
|
3625
3631
|
disabled: c ? "" : void 0,
|
|
3626
|
-
required:
|
|
3627
|
-
...
|
|
3632
|
+
required: x ? "" : void 0,
|
|
3633
|
+
...T
|
|
3628
3634
|
}),
|
|
3629
|
-
|
|
3635
|
+
y ? /* @__PURE__ */ E("div", {
|
|
3630
3636
|
className: "field-error",
|
|
3631
|
-
id: `${
|
|
3632
|
-
children:
|
|
3633
|
-
}) :
|
|
3637
|
+
id: `${A}-error`,
|
|
3638
|
+
children: y
|
|
3639
|
+
}) : b ? /* @__PURE__ */ E("div", {
|
|
3634
3640
|
className: "field-hint",
|
|
3635
|
-
id: `${
|
|
3636
|
-
children:
|
|
3641
|
+
id: `${A}-hint`,
|
|
3642
|
+
children: b
|
|
3637
3643
|
}) : null
|
|
3638
3644
|
]
|
|
3639
3645
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@webority/
|
|
32
|
-
"@webority/
|
|
31
|
+
"@webority/theme": "0.11.0",
|
|
32
|
+
"@webority/ui-elements": "0.11.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"bootstrap": "5.3.3",
|