@webority/ui-react 0.6.5 → 0.6.6
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/dist/types/components/AppInput.d.ts +6 -0
- package/dist/ui-react.js +115 -92
- package/package.json +3 -3
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
* @param {string} [props.leftIcon] Icon name
|
|
21
21
|
* @param {string} [props.rightIcon] Icon name
|
|
22
22
|
* @param {() => void} [props.onRightIconClick]
|
|
23
|
+
* @param {string} [props.rightIconLabel] Accessible name for the right-icon button. Defaults to
|
|
24
|
+
* the icon name, which is a poor label but not an absent one.
|
|
23
25
|
* @param {string} [props.unit]
|
|
24
26
|
* @param {string} [props.id]
|
|
25
27
|
* @param {string} [props.name]
|
|
@@ -29,6 +31,10 @@
|
|
|
29
31
|
* @param {boolean} [props.clearable=false] Show an ✕ button while the field has a value.
|
|
30
32
|
* @param {boolean} [props.showCount=false] Show a live `count / maxLength` under the field.
|
|
31
33
|
* @param {number} [props.maxLength] Character cap; the count turns red as it is approached.
|
|
34
|
+
* @param {import('react').ReactNode} [props.prefix] A bordered box before the input (e.g. ₹, https://).
|
|
35
|
+
* @param {import('react').ReactNode} [props.suffix] A bordered box after the input (e.g. .00, .com).
|
|
36
|
+
* @param {boolean} [props.floatingLabel=false] Label sits inside as a placeholder, then slides up
|
|
37
|
+
* on focus/fill. Opt-in variant; standalone only (no icon/unit/prefix in the same field).
|
|
32
38
|
* @param {import('react').Ref<HTMLInputElement>} [ref]
|
|
33
39
|
*/
|
|
34
40
|
declare const AppInput: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
package/dist/ui-react.js
CHANGED
|
@@ -180,6 +180,7 @@ function k({ icon: e, label: n, danger: r = !1, disabled: i = !1, size: a = 20,
|
|
|
180
180
|
title: n,
|
|
181
181
|
disabled: p ? i : void 0,
|
|
182
182
|
"aria-disabled": !p && i ? "true" : void 0,
|
|
183
|
+
role: !p && i ? "link" : void 0,
|
|
183
184
|
onClick: o,
|
|
184
185
|
...u,
|
|
185
186
|
children: /* @__PURE__ */ t(O, {
|
|
@@ -258,7 +259,7 @@ var M = {
|
|
|
258
259
|
delete: "<rect width=\"174\" height=\"174\" rx=\"87\" fill=\"var(--wui-danger-5)\"/>\n<rect x=\"24\" y=\"24\" width=\"126\" height=\"126\" rx=\"63\" stroke=\"var(--wui-danger-20)\" stroke-width=\"16\"/>\n<g clip-path=\"url(#wui_delete_clip0)\">\n<rect x=\"32\" y=\"32\" width=\"110\" height=\"110\" rx=\"55\" fill=\"var(--wui-danger)\"/>\n<path d=\"M114.529 67.5672L163.249 116.287L116.354 163.183L67.6336 114.463L100.999 81.0975L64.999 77.5L58.999 69.5L114.529 67.5672Z\" fill=\"var(--wui-danger-active)\"/>\n<path d=\"M103.5 79L100.5 105.5L76 113L69.5 83.5L103.5 79Z\" fill=\"var(--wui-danger)\"/>\n<g clip-path=\"url(#wui_delete_clip1)\">\n<path d=\"M113.652 66.9993C108.895 66.5266 104.139 66.1721 99.3522 65.9061V65.8766L98.7022 62.0357C98.259 59.3175 97.609 55.2402 90.6954 55.2402H82.9545C76.0704 55.2402 75.4204 59.1402 74.9477 62.0061L74.3272 65.788C71.5795 65.9652 68.8318 66.1425 66.084 66.4084L60.0568 66.9993C58.8159 67.1175 57.9295 68.2107 58.0477 69.4221C58.1659 70.6334 59.2295 71.5198 60.4704 71.4016L66.4977 70.8107C81.9795 69.2743 97.5795 69.8652 113.239 71.4311C113.327 71.4311 113.386 71.4311 113.475 71.4311C114.598 71.4311 115.573 70.5743 115.691 69.4221C115.779 68.2107 114.893 67.1175 113.652 66.9993Z\" fill=\"white\"/>\n<path d=\"M108.216 75.5971C107.507 74.8585 106.532 74.4448 105.527 74.4448H68.1816C67.177 74.4448 66.1725 74.8585 65.4929 75.5971C64.8134 76.3357 64.4293 77.3403 64.4884 78.3744L66.3202 108.688C66.6452 113.179 67.0588 118.793 77.3702 118.793H96.3384C106.65 118.793 107.063 113.208 107.388 108.688L109.22 78.4039C109.279 77.3403 108.895 76.3357 108.216 75.5971ZM91.7588 103.99H81.9202C80.7088 103.99 79.7043 102.986 79.7043 101.774C79.7043 100.563 80.7088 99.5585 81.9202 99.5585H91.7588C92.9702 99.5585 93.9747 100.563 93.9747 101.774C93.9747 102.986 92.9702 103.99 91.7588 103.99ZM94.2406 92.1721H79.4679C78.2566 92.1721 77.252 91.1676 77.252 89.9562C77.252 88.7448 78.2566 87.7403 79.4679 87.7403H94.2406C95.452 87.7403 96.4566 88.7448 96.4566 89.9562C96.4566 91.1676 95.452 92.1721 94.2406 92.1721Z\" fill=\"white\"/>\n</g>\n</g>\n<defs><clipPath id=\"wui_delete_clip0\"><rect x=\"32\" y=\"32\" width=\"110\" height=\"110\" rx=\"55\" fill=\"white\"/></clipPath><clipPath id=\"wui_delete_clip1\"><rect width=\"65\" height=\"65\" fill=\"white\" transform=\"translate(54.3535 54.502)\"/></clipPath></defs>"
|
|
259
260
|
};
|
|
260
261
|
Object.keys(M);
|
|
261
|
-
var
|
|
262
|
+
var N = class extends HTMLElement {
|
|
262
263
|
static get observedAttributes() {
|
|
263
264
|
return ["tone", "size"];
|
|
264
265
|
}
|
|
@@ -272,14 +273,14 @@ var ee = class extends HTMLElement {
|
|
|
272
273
|
let e = this.getAttribute("tone"), t = this.getAttribute("size") || "72", n = M[e] || M.info;
|
|
273
274
|
this.innerHTML = `<svg width="${t}" height="${t}" viewBox="0 0 174 174" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${n}</svg>`;
|
|
274
275
|
}
|
|
275
|
-
},
|
|
276
|
+
}, ee = "data-wui-mirror";
|
|
276
277
|
function P(e, t) {
|
|
277
|
-
let n = e.getAttribute("name"), r = e.querySelector(`:scope > input[${
|
|
278
|
+
let n = e.getAttribute("name"), r = e.querySelector(`:scope > input[${ee}]`);
|
|
278
279
|
if (!n) {
|
|
279
280
|
r?.remove();
|
|
280
281
|
return;
|
|
281
282
|
}
|
|
282
|
-
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute(
|
|
283
|
+
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute(ee, ""), e.appendChild(r)), r.name = n, r.value = t == null ? "" : String(t);
|
|
283
284
|
for (let t of e.attributes) t.name.startsWith("data-val") && r.setAttribute(t.name, t.value);
|
|
284
285
|
r.disabled = e.hasAttribute("disabled");
|
|
285
286
|
}
|
|
@@ -673,7 +674,7 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
673
674
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
674
675
|
if (!t) return;
|
|
675
676
|
let r = (e || "").trim().toLowerCase(), i = this._readOptions();
|
|
676
|
-
r && (i = i.filter((e) =>
|
|
677
|
+
r && (i = i.filter((e) => G(e.label).toLowerCase().includes(r))), t.innerHTML = i.map((e) => {
|
|
677
678
|
let t = this._values.includes(String(e.value));
|
|
678
679
|
return `<button type="button" role="option" class="search-select-option${t ? " selected" : ""}" data-value="${W(e.value)}" aria-selected="${t}"><span class="ms-check"><i class="bi bi-check" aria-hidden="true"></i></span><span class="ms-opt-label">${L(e)}</span></button>`;
|
|
679
680
|
}).join(""), n && (n.hidden = i.length > 0), this._active = -1;
|
|
@@ -738,7 +739,7 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
738
739
|
disconnectedCallback() {
|
|
739
740
|
this._onDocClick && document.removeEventListener("click", this._onDocClick);
|
|
740
741
|
}
|
|
741
|
-
}, W = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"),
|
|
742
|
+
}, W = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), G = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), oe = [
|
|
742
743
|
[
|
|
743
744
|
"AF",
|
|
744
745
|
"Afghanistan",
|
|
@@ -1964,11 +1965,11 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1964
1965
|
"Zimbabwe",
|
|
1965
1966
|
"263"
|
|
1966
1967
|
]
|
|
1967
|
-
],
|
|
1968
|
+
], K = (e) => (oe.find((t) => t[0] === e) || [
|
|
1968
1969
|
"",
|
|
1969
1970
|
"",
|
|
1970
1971
|
""
|
|
1971
|
-
])[2],
|
|
1972
|
+
])[2], q = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, se = class extends HTMLElement {
|
|
1972
1973
|
static get observedAttributes() {
|
|
1973
1974
|
return [
|
|
1974
1975
|
"value",
|
|
@@ -1987,7 +1988,7 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1987
1988
|
this._rendered && (e === "country" && (this._country = n || "IN"), this.render());
|
|
1988
1989
|
}
|
|
1989
1990
|
get value() {
|
|
1990
|
-
return `+${
|
|
1991
|
+
return `+${K(this._country)}${this._national}`;
|
|
1991
1992
|
}
|
|
1992
1993
|
set value(e) {
|
|
1993
1994
|
this._national = String(e ?? "").replace(/[^0-9]/g, ""), this._commit();
|
|
@@ -1998,21 +1999,21 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1998
1999
|
render() {
|
|
1999
2000
|
let e = this.getAttribute("placeholder") || "Enter phone number";
|
|
2000
2001
|
this._country = this.getAttribute("country") || this._country;
|
|
2001
|
-
let t =
|
|
2002
|
+
let t = oe.map(([e, t, n]) => `<button type="button" role="option" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}"><span class="${q(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join("");
|
|
2002
2003
|
this.innerHTML = `
|
|
2003
2004
|
<div class="phone-input-wrap">
|
|
2004
2005
|
<div class="phone-country-adornment">
|
|
2005
2006
|
<button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
2006
|
-
<span class="${
|
|
2007
|
+
<span class="${q(this._country)}" data-flag aria-hidden="true"></span>
|
|
2007
2008
|
<i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
|
|
2008
|
-
<span class="phone-dial" data-dial>+${
|
|
2009
|
+
<span class="phone-dial" data-dial>+${K(this._country)}</span>
|
|
2009
2010
|
</button>
|
|
2010
2011
|
<div class="country-dropdown-menu" role="listbox" hidden>
|
|
2011
2012
|
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon"><i class="bi bi-search" aria-hidden="true"></i></span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" /></div>
|
|
2012
2013
|
<div class="country-list-scroll">${t}<div class="country-empty" hidden>No countries found</div></div>
|
|
2013
2014
|
</div>
|
|
2014
2015
|
</div>
|
|
2015
|
-
<input type="tel" class="input" placeholder="${
|
|
2016
|
+
<input type="tel" class="input" placeholder="${ce(e)}" value="${ce(this._national)}"${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
2016
2017
|
</div>`, this._rendered = !0, P(this, this.value), this._wire();
|
|
2017
2018
|
}
|
|
2018
2019
|
_wire() {
|
|
@@ -2037,7 +2038,7 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2037
2038
|
}
|
|
2038
2039
|
i && (i.hidden = n > 0);
|
|
2039
2040
|
}, p = (e) => {
|
|
2040
|
-
this._country = e, this.setAttribute("country", e), o && (o.className =
|
|
2041
|
+
this._country = e, this.setAttribute("country", e), o && (o.className = q(e)), s && (s.textContent = `+${K(e)}`);
|
|
2041
2042
|
for (let t of r.querySelectorAll(".country-dropdown-item")) t.classList.toggle("selected", t.dataset.iso === e);
|
|
2042
2043
|
d(), this._commit();
|
|
2043
2044
|
};
|
|
@@ -2053,7 +2054,7 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2053
2054
|
disconnectedCallback() {
|
|
2054
2055
|
this._reposition && (window.removeEventListener("scroll", this._reposition, !0), window.removeEventListener("resize", this._reposition)), this._onDocClick && document.removeEventListener("click", this._onDocClick);
|
|
2055
2056
|
}
|
|
2056
|
-
},
|
|
2057
|
+
}, ce = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), le = class extends HTMLElement {
|
|
2057
2058
|
static get observedAttributes() {
|
|
2058
2059
|
return [
|
|
2059
2060
|
"value",
|
|
@@ -2108,16 +2109,16 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2108
2109
|
i && (this._value = String(i.value)), P(this, this._value);
|
|
2109
2110
|
let a = e.map((e) => {
|
|
2110
2111
|
let t = String(e.value) === String(this._value);
|
|
2111
|
-
return `<button type="button" role="option" class="search-select-option${t ? " selected" : ""}" data-value="${
|
|
2112
|
+
return `<button type="button" role="option" class="search-select-option${t ? " selected" : ""}" data-value="${J(e.value)}" aria-selected="${t}">${L(e)}</button>`;
|
|
2112
2113
|
}).join("");
|
|
2113
2114
|
this.innerHTML = `
|
|
2114
2115
|
<div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}">
|
|
2115
|
-
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-label="${
|
|
2116
|
+
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-label="${J(this._accessibleName())}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
2116
2117
|
<span class="${i ? "" : "search-select-placeholder"}" data-label>${i ? L(i) : I(n)}</span>
|
|
2117
2118
|
<i class="bi bi-chevron-down search-select-caret" aria-hidden="true"></i>
|
|
2118
2119
|
</button>
|
|
2119
2120
|
<div class="search-select-menu search-select-menu-fixed" role="listbox" tabindex="-1" hidden>
|
|
2120
|
-
${t ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${
|
|
2121
|
+
${t ? `<div class="search-select-search"><i class="bi bi-search" aria-hidden="true"></i><input class="search-select-input" placeholder="${J(r)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden><i class="bi bi-x" aria-hidden="true"></i></button></div>` : ""}
|
|
2121
2122
|
<div class="search-select-options">${a}<div class="search-select-empty" hidden>No matches</div></div>
|
|
2122
2123
|
</div>
|
|
2123
2124
|
</div>`, this._rendered = !0, P(this, this._value), this._wire();
|
|
@@ -2200,14 +2201,14 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2200
2201
|
disconnectedCallback() {
|
|
2201
2202
|
this._onDocClick && document.removeEventListener("click", this._onDocClick);
|
|
2202
2203
|
}
|
|
2203
|
-
},
|
|
2204
|
+
}, J = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), ue = "image/png,image/jpeg,image/webp", de = {
|
|
2204
2205
|
"image/png": [".png"],
|
|
2205
2206
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
2206
2207
|
"image/webp": [".webp"],
|
|
2207
2208
|
"image/gif": [".gif"],
|
|
2208
2209
|
"image/svg+xml": [".svg"],
|
|
2209
2210
|
"application/pdf": [".pdf"]
|
|
2210
|
-
},
|
|
2211
|
+
}, fe = {
|
|
2211
2212
|
"image/png": "PNG",
|
|
2212
2213
|
"image/jpeg": "JPG",
|
|
2213
2214
|
"image/webp": "WEBP",
|
|
@@ -2221,31 +2222,31 @@ var F = Symbol("wui.trustedHtml"), I = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2221
2222
|
".gif": "GIF",
|
|
2222
2223
|
".svg": "SVG",
|
|
2223
2224
|
".pdf": "PDF"
|
|
2224
|
-
},
|
|
2225
|
-
function
|
|
2225
|
+
}, pe = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
2226
|
+
function me(e) {
|
|
2226
2227
|
let t = [];
|
|
2227
|
-
for (let n of
|
|
2228
|
-
let e =
|
|
2228
|
+
for (let n of pe(e)) {
|
|
2229
|
+
let e = fe[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
2229
2230
|
t.includes(e) || t.push(e);
|
|
2230
2231
|
}
|
|
2231
2232
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
2232
2233
|
}
|
|
2233
|
-
function
|
|
2234
|
-
let n =
|
|
2234
|
+
function he(e, t) {
|
|
2235
|
+
let n = pe(t);
|
|
2235
2236
|
if (!n.length) return !0;
|
|
2236
2237
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
2237
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
2238
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (de[e] || []).some((e) => i.endsWith(e)));
|
|
2238
2239
|
}
|
|
2239
|
-
function
|
|
2240
|
+
function ge(e, t = {}) {
|
|
2240
2241
|
if (!e) return null;
|
|
2241
|
-
let n = t.accept === void 0 ?
|
|
2242
|
-
return
|
|
2242
|
+
let n = t.accept === void 0 ? ue : t.accept, r = t.maxSizeMb || 5;
|
|
2243
|
+
return he(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${me(n)} file.`;
|
|
2243
2244
|
}
|
|
2244
2245
|
var Y = (e, t) => {
|
|
2245
2246
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
2246
2247
|
};
|
|
2247
2248
|
function _e() {
|
|
2248
|
-
Y("wui-select",
|
|
2249
|
+
Y("wui-select", le), Y("wui-phone", se), Y("wui-datepicker", ie), Y("wui-autocomplete", te), Y("wui-multiselect", ae), Y("wui-status-icon", N);
|
|
2249
2250
|
}
|
|
2250
2251
|
_e();
|
|
2251
2252
|
//#endregion
|
|
@@ -2713,83 +2714,105 @@ function Q({ label: e, children: r, ...i }) {
|
|
|
2713
2714
|
}
|
|
2714
2715
|
//#endregion
|
|
2715
2716
|
//#region src/components/AppInput.jsx
|
|
2716
|
-
var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, helpLabel: s = "More information", type: u = "text", size: d = "md", leftIcon: f, rightIcon: p, onRightIconClick: h,
|
|
2717
|
-
T("AppInput",
|
|
2718
|
-
let [
|
|
2719
|
-
|
|
2720
|
-
},
|
|
2721
|
-
|
|
2722
|
-
},
|
|
2717
|
+
var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, helpLabel: s = "More information", type: u = "text", size: d = "md", leftIcon: f, rightIcon: p, onRightIconClick: h, rightIconLabel: g, unit: _, id: v, name: y, className: b = "", fieldClassName: x = "", disabled: S = !1, clearable: C = !1, showCount: w = !1, maxLength: E, prefix: D, suffix: k, floatingLabel: A = !1, ...j }, M) {
|
|
2718
|
+
T("AppInput", j);
|
|
2719
|
+
let [N, ee] = l(!1), P = v || y, F = u === "password", I = F && N ? "text" : u, L = c(null), te = (e) => {
|
|
2720
|
+
L.current = e, typeof M == "function" ? M(e) : M && (M.current = e);
|
|
2721
|
+
}, R = String(j.value ?? j.defaultValue ?? ""), [z, B] = l(() => !!R), [ne, V] = l(() => R.length), re = C && !S, H = C || w, U = (e) => {
|
|
2722
|
+
B(!!e.target.value), V(e.target.value.length), j.onInput?.(e);
|
|
2723
|
+
}, ie = re ? /* @__PURE__ */ t("button", {
|
|
2723
2724
|
type: "button",
|
|
2724
2725
|
className: "input-clear",
|
|
2725
2726
|
onClick: () => {
|
|
2726
|
-
let e =
|
|
2727
|
+
let e = L.current;
|
|
2727
2728
|
if (!e) return;
|
|
2728
2729
|
let t = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
2729
|
-
t ? t.call(e, "") : e.value = "", e.dispatchEvent(new Event("input", { bubbles: !0 })),
|
|
2730
|
+
t ? t.call(e, "") : e.value = "", e.dispatchEvent(new Event("input", { bubbles: !0 })), B(!1), e.focus();
|
|
2730
2731
|
},
|
|
2731
2732
|
"aria-label": "Clear",
|
|
2732
2733
|
tabIndex: -1,
|
|
2733
|
-
hidden: !
|
|
2734
|
+
hidden: !z,
|
|
2734
2735
|
children: /* @__PURE__ */ t(O, {
|
|
2735
2736
|
name: "x",
|
|
2736
2737
|
size: 16
|
|
2737
2738
|
})
|
|
2738
|
-
}) : null,
|
|
2739
|
+
}) : null, ae = [
|
|
2739
2740
|
"input",
|
|
2740
2741
|
d === "sm" ? "input-sm" : "",
|
|
2741
2742
|
d === "lg" ? "input-lg" : "",
|
|
2742
2743
|
i ? "error" : "",
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
].filter(Boolean).join(" "),
|
|
2748
|
-
id:
|
|
2749
|
-
name:
|
|
2750
|
-
type:
|
|
2751
|
-
className:
|
|
2752
|
-
disabled:
|
|
2744
|
+
F ? "pw" : "",
|
|
2745
|
+
_ ? "num-input" : "",
|
|
2746
|
+
C ? "has-clear" : "",
|
|
2747
|
+
b
|
|
2748
|
+
].filter(Boolean).join(" "), W = /* @__PURE__ */ t(m.Control, {
|
|
2749
|
+
id: P,
|
|
2750
|
+
name: y,
|
|
2751
|
+
type: I,
|
|
2752
|
+
className: ae,
|
|
2753
|
+
disabled: S,
|
|
2753
2754
|
required: r,
|
|
2754
2755
|
"aria-invalid": i ? "true" : "false",
|
|
2755
|
-
maxLength:
|
|
2756
|
-
...
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2756
|
+
maxLength: E,
|
|
2757
|
+
...j,
|
|
2758
|
+
placeholder: A ? " " : j.placeholder,
|
|
2759
|
+
ref: te,
|
|
2760
|
+
onInput: H ? U : j.onInput
|
|
2761
|
+
}), G;
|
|
2762
|
+
return G = A && e ? /* @__PURE__ */ n("div", {
|
|
2763
|
+
className: "field-float",
|
|
2764
|
+
children: [W, /* @__PURE__ */ n("label", {
|
|
2765
|
+
className: "float-label",
|
|
2766
|
+
htmlFor: P,
|
|
2767
|
+
children: [e, r && /* @__PURE__ */ t(X, {})]
|
|
2768
|
+
})]
|
|
2769
|
+
}) : D || k ? /* @__PURE__ */ n("div", {
|
|
2770
|
+
className: "input-affixed",
|
|
2771
|
+
children: [
|
|
2772
|
+
D != null && /* @__PURE__ */ t("span", {
|
|
2773
|
+
className: "affix affix-pre",
|
|
2774
|
+
children: D
|
|
2775
|
+
}),
|
|
2776
|
+
W,
|
|
2777
|
+
k != null && /* @__PURE__ */ t("span", {
|
|
2778
|
+
className: "affix affix-suf",
|
|
2779
|
+
children: k
|
|
2780
|
+
})
|
|
2781
|
+
]
|
|
2782
|
+
}) : _ ? /* @__PURE__ */ n("div", {
|
|
2761
2783
|
className: "input-with-unit",
|
|
2762
|
-
children: [
|
|
2784
|
+
children: [W, /* @__PURE__ */ t("span", {
|
|
2763
2785
|
className: "unit",
|
|
2764
|
-
children:
|
|
2786
|
+
children: _
|
|
2765
2787
|
})]
|
|
2766
|
-
}) :
|
|
2788
|
+
}) : F ? /* @__PURE__ */ n("div", {
|
|
2767
2789
|
className: "input-wrap",
|
|
2768
|
-
children: [
|
|
2790
|
+
children: [W, /* @__PURE__ */ t("button", {
|
|
2769
2791
|
type: "button",
|
|
2770
2792
|
className: "pw-toggle",
|
|
2771
|
-
onClick: () =>
|
|
2772
|
-
"aria-label":
|
|
2793
|
+
onClick: () => ee((e) => !e),
|
|
2794
|
+
"aria-label": N ? "Hide password" : "Show password",
|
|
2773
2795
|
tabIndex: -1,
|
|
2774
2796
|
children: /* @__PURE__ */ t(O, {
|
|
2775
|
-
name:
|
|
2797
|
+
name: N ? "eye-off" : "eye",
|
|
2776
2798
|
size: 18
|
|
2777
2799
|
})
|
|
2778
2800
|
})]
|
|
2779
2801
|
}) : p ? /* @__PURE__ */ n("div", {
|
|
2780
2802
|
className: "input-wrap",
|
|
2781
|
-
children: [
|
|
2803
|
+
children: [W, /* @__PURE__ */ t("button", {
|
|
2782
2804
|
type: "button",
|
|
2783
2805
|
className: "pw-toggle",
|
|
2784
2806
|
onClick: h,
|
|
2785
2807
|
disabled: !h,
|
|
2786
2808
|
tabIndex: -1,
|
|
2809
|
+
"aria-label": g || p,
|
|
2787
2810
|
children: /* @__PURE__ */ t(O, {
|
|
2788
2811
|
name: p,
|
|
2789
2812
|
size: 18
|
|
2790
2813
|
})
|
|
2791
2814
|
})]
|
|
2792
|
-
}) :
|
|
2815
|
+
}) : C ? /* @__PURE__ */ n("div", {
|
|
2793
2816
|
className: f ? "input-icon" : "input-wrap",
|
|
2794
2817
|
children: [
|
|
2795
2818
|
f && /* @__PURE__ */ t("span", {
|
|
@@ -2799,8 +2822,8 @@ var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, he
|
|
|
2799
2822
|
size: 16
|
|
2800
2823
|
})
|
|
2801
2824
|
}),
|
|
2802
|
-
|
|
2803
|
-
|
|
2825
|
+
W,
|
|
2826
|
+
ie
|
|
2804
2827
|
]
|
|
2805
2828
|
}) : f ? /* @__PURE__ */ n("div", {
|
|
2806
2829
|
className: "input-icon",
|
|
@@ -2810,13 +2833,13 @@ var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, he
|
|
|
2810
2833
|
name: f,
|
|
2811
2834
|
size: 16
|
|
2812
2835
|
})
|
|
2813
|
-
}),
|
|
2814
|
-
}) :
|
|
2815
|
-
className: `field${
|
|
2836
|
+
}), W]
|
|
2837
|
+
}) : W, /* @__PURE__ */ n(m.Group, {
|
|
2838
|
+
className: `field${x ? ` ${x}` : ""}`,
|
|
2816
2839
|
children: [
|
|
2817
|
-
e && /* @__PURE__ */ n(m.Label, {
|
|
2840
|
+
e && !A && /* @__PURE__ */ n(m.Label, {
|
|
2818
2841
|
className: "label",
|
|
2819
|
-
htmlFor:
|
|
2842
|
+
htmlFor: P,
|
|
2820
2843
|
children: [
|
|
2821
2844
|
e,
|
|
2822
2845
|
r && /* @__PURE__ */ t(X, {}),
|
|
@@ -2826,7 +2849,7 @@ var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, he
|
|
|
2826
2849
|
})
|
|
2827
2850
|
]
|
|
2828
2851
|
}),
|
|
2829
|
-
|
|
2852
|
+
G,
|
|
2830
2853
|
i ? /* @__PURE__ */ t("div", {
|
|
2831
2854
|
className: "field-error",
|
|
2832
2855
|
children: i
|
|
@@ -2834,9 +2857,9 @@ var Me = r(function({ label: e, required: r = !1, error: i, hint: a, help: o, he
|
|
|
2834
2857
|
className: "field-hint",
|
|
2835
2858
|
children: a
|
|
2836
2859
|
}) : null,
|
|
2837
|
-
|
|
2838
|
-
className: `field-count${
|
|
2839
|
-
children: [
|
|
2860
|
+
w && /* @__PURE__ */ n("div", {
|
|
2861
|
+
className: `field-count${E && ne >= E ? " at-limit" : ""}`,
|
|
2862
|
+
children: [ne, E ? ` / ${E}` : ""]
|
|
2840
2863
|
})
|
|
2841
2864
|
]
|
|
2842
2865
|
});
|
|
@@ -3159,18 +3182,18 @@ function Ke({ columns: r, rows: i, rowKey: a = (e) => e.id, sort: o, onSort: s,
|
|
|
3159
3182
|
"aria-label": "Select all rows"
|
|
3160
3183
|
})
|
|
3161
3184
|
}),
|
|
3162
|
-
r.map((e) => {
|
|
3163
|
-
let
|
|
3185
|
+
r.map((e, r) => {
|
|
3186
|
+
let i = !!(e.sortable && s), a = o && o.key === e.key;
|
|
3164
3187
|
return /* @__PURE__ */ n("th", {
|
|
3165
|
-
className: (
|
|
3188
|
+
className: (i ? "sortable " : "") + (r === 0 ? "lx-name-cell " : "") + We(e.align),
|
|
3166
3189
|
style: e.width ? { width: e.width } : void 0,
|
|
3167
|
-
tabIndex:
|
|
3168
|
-
"aria-sort":
|
|
3169
|
-
onClick:
|
|
3170
|
-
onKeyDown:
|
|
3190
|
+
tabIndex: i ? 0 : void 0,
|
|
3191
|
+
"aria-sort": a ? o.dir === "asc" ? "ascending" : "descending" : i ? "none" : void 0,
|
|
3192
|
+
onClick: i ? () => s(e.key) : void 0,
|
|
3193
|
+
onKeyDown: i ? (t) => {
|
|
3171
3194
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), s(e.key));
|
|
3172
3195
|
} : void 0,
|
|
3173
|
-
children: [e.label,
|
|
3196
|
+
children: [e.label, i && /* @__PURE__ */ t("span", {
|
|
3174
3197
|
className: "sort-icon",
|
|
3175
3198
|
children: /* @__PURE__ */ t(O, {
|
|
3176
3199
|
name: "chevrons-up-down",
|
|
@@ -3207,8 +3230,8 @@ function Ke({ columns: r, rows: i, rowKey: a = (e) => e.id, sort: o, onSort: s,
|
|
|
3207
3230
|
"aria-label": "Select row"
|
|
3208
3231
|
})
|
|
3209
3232
|
}),
|
|
3210
|
-
r.map((n) => /* @__PURE__ */ t("td", {
|
|
3211
|
-
className: We(n.align) + (n.cellClassName ? ` ${n.cellClassName}` : ""),
|
|
3233
|
+
r.map((n, r) => /* @__PURE__ */ t("td", {
|
|
3234
|
+
className: (r === 0 ? "lx-name-cell " : "") + We(n.align) + (n.cellClassName ? ` ${n.cellClassName}` : ""),
|
|
3212
3235
|
children: n.render ? n.render(e) : Ge(e[n.key])
|
|
3213
3236
|
}, n.key)),
|
|
3214
3237
|
p && /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", {
|
|
@@ -3375,7 +3398,7 @@ function Xe({ icon: e, iconSize: r = 24, size: i = "md", title: a, text: o, acti
|
|
|
3375
3398
|
}
|
|
3376
3399
|
//#endregion
|
|
3377
3400
|
//#region src/components/AppFileAttachment.jsx
|
|
3378
|
-
function Ze({ label: r = "Attachment", value: i, name: s, onChange: c, accept: u =
|
|
3401
|
+
function Ze({ label: r = "Attachment", value: i, name: s, onChange: c, accept: u = ue, maxSizeMb: d = 5, optional: f = !1, error: p, id: m, ...h }) {
|
|
3379
3402
|
T("AppFileAttachment", h);
|
|
3380
3403
|
let g = o(), _ = m || s || g, [v, y] = l(null), [b, x] = l("");
|
|
3381
3404
|
a(() => {
|
|
@@ -3388,7 +3411,7 @@ function Ze({ label: r = "Attachment", value: i, name: s, onChange: c, accept: u
|
|
|
3388
3411
|
function S(e) {
|
|
3389
3412
|
let t = e.target.files?.[0];
|
|
3390
3413
|
if (e.target.value = "", !t) return;
|
|
3391
|
-
let n =
|
|
3414
|
+
let n = ge(t, {
|
|
3392
3415
|
accept: u,
|
|
3393
3416
|
maxSizeMb: d
|
|
3394
3417
|
});
|
|
@@ -3513,7 +3536,7 @@ function tt({ label: e, value: r, name: i, onPick: s, accept: u = ".jpg,.jpeg,.p
|
|
|
3513
3536
|
g(null);
|
|
3514
3537
|
}, [r]);
|
|
3515
3538
|
let S = r?.url || h, C = (e) => {
|
|
3516
|
-
let t =
|
|
3539
|
+
let t = ge(e, {
|
|
3517
3540
|
accept: u,
|
|
3518
3541
|
maxSizeMb: d
|
|
3519
3542
|
});
|
|
@@ -3740,7 +3763,7 @@ function it({ value: r, fallback: i, name: a, onPick: o, loading: s = !1, accept
|
|
|
3740
3763
|
onChange: (e) => {
|
|
3741
3764
|
let t = e.target.files?.[0];
|
|
3742
3765
|
if (e.target.value = "", !t) return;
|
|
3743
|
-
let n =
|
|
3766
|
+
let n = ge(t, {
|
|
3744
3767
|
accept: l,
|
|
3745
3768
|
maxSizeMb: u
|
|
3746
3769
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
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",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-toastify": "^11.1.0",
|
|
32
|
-
"@webority/theme": "^0.6.
|
|
33
|
-
"@webority/ui-elements": "^0.6.
|
|
32
|
+
"@webority/theme": "^0.6.6",
|
|
33
|
+
"@webority/ui-elements": "^0.6.6"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"bootstrap": "5.3.3",
|