@webority/ui-react 0.9.1 → 0.9.3

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.
@@ -16,7 +16,7 @@
16
16
  * @param {import('react').ReactNode} props.title
17
17
  * @param {import('react').ReactNode} [props.description]
18
18
  * @param {string} [props.checkIcon="check"]
19
- * @param {number} [props.checkSize=12]
19
+ * @param {number} [props.checkSize=18]
20
20
  * @param {string} [props.className]
21
21
  */
22
22
  export default function AppChoiceCard({ name, multiple, value, checked, onChange, icon, iconNode, // custom icon element; overrides the `icon` name when provided
package/dist/ui-react.js CHANGED
@@ -417,6 +417,7 @@ var W = {
417
417
  outline: "outline-primary",
418
418
  ghost: "ghost",
419
419
  danger: "danger",
420
+ "secondary-danger": "secondary-danger",
420
421
  "outline-danger": "outline-danger",
421
422
  light: "light",
422
423
  warning: "warning",
@@ -807,7 +808,8 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
807
808
  "remote",
808
809
  "size",
809
810
  "aria-label",
810
- "allow-custom"
811
+ "allow-custom",
812
+ "aria-invalid"
811
813
  ];
812
814
  }
813
815
  constructor() {
@@ -836,8 +838,16 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
836
838
  this.value = n;
837
839
  return;
838
840
  }
841
+ if (e === "aria-invalid") {
842
+ this._syncInvalid();
843
+ return;
844
+ }
839
845
  this._rendered && this.render();
840
846
  }
847
+ _syncInvalid() {
848
+ let e = this.querySelector(".search-select-control");
849
+ e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
850
+ }
841
851
  get value() {
842
852
  return this._value;
843
853
  }
@@ -900,7 +910,7 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
900
910
  let r = `${this.id}-listbox`;
901
911
  this._listboxId = r, this.innerHTML = `
902
912
  <div class="search-select${n}">
903
- <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Me(r)}" aria-label="${Me(this._accessibleName())}">
913
+ <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Me(r)}" aria-label="${Me(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}>
904
914
  <input class="search-select-input search-select-ac-input" placeholder="${Me(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""} />
905
915
  <span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
906
916
  <button type="button" class="search-select-clear" aria-label="Clear" hidden>${K("x")}</button>
@@ -1319,15 +1329,13 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
1319
1329
  if (!e || !t) return;
1320
1330
  let r = () => !t.hidden;
1321
1331
  this._open = () => {
1322
- if (!J(this._value) && !this._viewNavigated) {
1323
- let e = /* @__PURE__ */ new Date();
1324
- this._viewY = e.getFullYear(), this._viewM = e.getMonth();
1325
- }
1326
- let r = J(this._value), i = /* @__PURE__ */ new Date();
1327
- this._mode = "days", this._focus = r || {
1332
+ let r = /* @__PURE__ */ new Date(), i = J(this._value);
1333
+ (i || !this._viewNavigated) && (this._viewY = r.getFullYear(), this._viewM = r.getMonth()), this._mode = "days";
1334
+ let a = r.getFullYear() === this._viewY && r.getMonth() === this._viewM, o = i && i.y === this._viewY && i.m === this._viewM;
1335
+ this._focus = o ? i : {
1328
1336
  y: this._viewY,
1329
1337
  m: this._viewM,
1330
- d: i.getFullYear() === this._viewY && i.getMonth() === this._viewM ? i.getDate() : 1
1338
+ d: a ? r.getDate() : 1
1331
1339
  }, this._renderView(), t.hidden = !1, n?.classList.add("open"), this._position(e, t), e.setAttribute("aria-expanded", "true"), t.querySelector("[tabindex=\"0\"]")?.focus();
1332
1340
  }, this._close = () => {
1333
1341
  t.hidden = !0, n?.classList.remove("open"), e.setAttribute("aria-expanded", "false"), e.focus();
@@ -1684,7 +1692,8 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
1684
1692
  "icon",
1685
1693
  "size",
1686
1694
  "collapse-chips",
1687
- "aria-label"
1695
+ "aria-label",
1696
+ "aria-invalid"
1688
1697
  ];
1689
1698
  }
1690
1699
  constructor() {
@@ -1713,9 +1722,17 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
1713
1722
  formResetCallback() {
1714
1723
  this.values = (this._defaultValues || []).slice();
1715
1724
  }
1716
- attributeChangedCallback() {
1725
+ attributeChangedCallback(e) {
1726
+ if (e === "aria-invalid") {
1727
+ this._syncInvalid();
1728
+ return;
1729
+ }
1717
1730
  this._rendered && this.render();
1718
1731
  }
1732
+ _syncInvalid() {
1733
+ let e = this.querySelector(".search-select-control");
1734
+ e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
1735
+ }
1719
1736
  get values() {
1720
1737
  return this._values.slice();
1721
1738
  }
@@ -1761,7 +1778,7 @@ var Oe = Symbol("wui.trustedHtml"), q = (e) => String(e ?? "").replace(/&/g, "&a
1761
1778
  let a = `${this.id}-listbox`;
1762
1779
  this._listboxId = a, this.innerHTML = `
1763
1780
  <div class="search-select${i}">
1764
- <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ke(a)}" aria-label="${Ke(this._accessibleName())}"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
1781
+ <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ke(a)}" aria-label="${Ke(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
1765
1782
  ${n ? K(n, { className: "search-select-icon" }) : ""}
1766
1783
  <div class="ms-chips" data-chips></div>
1767
1784
  ${K("chevron-down", { className: "search-select-caret" })}
@@ -3488,7 +3505,8 @@ var st = class extends HTMLElement {
3488
3505
  "clearable",
3489
3506
  "icon",
3490
3507
  "prefix",
3491
- "aria-label"
3508
+ "aria-label",
3509
+ "aria-invalid"
3492
3510
  ];
3493
3511
  }
3494
3512
  _accessibleName() {
@@ -3515,8 +3533,16 @@ var st = class extends HTMLElement {
3515
3533
  this.value = n;
3516
3534
  return;
3517
3535
  }
3536
+ if (e === "aria-invalid") {
3537
+ this._syncInvalid();
3538
+ return;
3539
+ }
3518
3540
  this._rendered && this.render();
3519
3541
  }
3542
+ _syncInvalid() {
3543
+ let e = this.querySelector(".search-select-control");
3544
+ e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
3545
+ }
3520
3546
  formResetCallback() {
3521
3547
  this.value = this._defaultValue || "";
3522
3548
  }
@@ -3558,7 +3584,7 @@ var st = class extends HTMLElement {
3558
3584
  }).join("");
3559
3585
  this.innerHTML = `
3560
3586
  <div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
3561
- <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${ut(u)}" aria-label="${ut(this._accessibleName())}"${this.hasAttribute("disabled") ? " disabled" : ""}>
3587
+ <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${ut(u)}" aria-label="${ut(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}>
3562
3588
  ${a ? K(a, { className: "search-select-icon" }) : ""}
3563
3589
  ${o ? `<span class="search-select-prefix">${q(o)}</span>` : ""}
3564
3590
  <span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? Ae(l) : q(s)}</span>
@@ -3929,7 +3955,8 @@ var st = class extends HTMLElement {
3929
3955
  "max-tags",
3930
3956
  "aria-label",
3931
3957
  "separators",
3932
- "allow-duplicates"
3958
+ "allow-duplicates",
3959
+ "aria-invalid"
3933
3960
  ];
3934
3961
  }
3935
3962
  constructor() {
@@ -3961,6 +3988,10 @@ var st = class extends HTMLElement {
3961
3988
  e && (e.value = "");
3962
3989
  }
3963
3990
  attributeChangedCallback(e) {
3991
+ if (e === "aria-invalid") {
3992
+ this._syncInvalid();
3993
+ return;
3994
+ }
3964
3995
  if (this._rendered) {
3965
3996
  if (e === "separators" || e === "allow-duplicates") {
3966
3997
  this._wire();
@@ -3969,6 +4000,10 @@ var st = class extends HTMLElement {
3969
4000
  this.render();
3970
4001
  }
3971
4002
  }
4003
+ _syncInvalid() {
4004
+ let e = this.querySelector(".search-select-control");
4005
+ e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
4006
+ }
3972
4007
  get values() {
3973
4008
  return this._values.slice();
3974
4009
  }
@@ -3979,7 +4014,7 @@ var st = class extends HTMLElement {
3979
4014
  let e = this.getAttribute("size"), t = e === "sm" ? " search-select-sm" : e === "lg" ? " search-select-lg" : "";
3980
4015
  G(this, this._values.join(",")), this.innerHTML = `
3981
4016
  <div class="search-select${t}">
3982
- <div class="input search-select-control search-select-multi"${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
4017
+ <div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
3983
4018
  <input type="text" class="ms-input" data-input aria-label="${gt(this._accessibleName())}" placeholder="${gt(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
3984
4019
  <div class="ms-chips" data-chips></div>
3985
4020
  </div>
@@ -4224,31 +4259,31 @@ var st = class extends HTMLElement {
4224
4259
  }
4225
4260
  _wire() {
4226
4261
  this._teardown();
4227
- let e = this.querySelector(".timepicker-trigger"), t = this.querySelector(".timepicker-pop");
4262
+ let e = this.querySelector(".timepicker-trigger"), t = this.querySelector(".timepicker-pop"), n = this.querySelector(".timepicker");
4228
4263
  if (!e || !t) return;
4229
- let n = () => !t.hidden;
4264
+ let r = () => !t.hidden;
4230
4265
  this._open = () => {
4231
- this._focus = null, this._renderOptions(), t.hidden = !1, e.setAttribute("aria-expanded", "true"), this._position(e, t);
4232
- let n = t.querySelector(".is-selected");
4233
- n ? this._focus = [...t.querySelectorAll(".timepicker-option")].indexOf(n) : this._focus = 0, this._renderOptions(), t.querySelector("[tabindex=\"0\"]")?.focus();
4266
+ this._focus = null, this._renderOptions(), t.hidden = !1, n?.classList.add("open"), e.setAttribute("aria-expanded", "true"), this._position(e, t);
4267
+ let r = t.querySelector(".is-selected");
4268
+ r ? this._focus = [...t.querySelectorAll(".timepicker-option")].indexOf(r) : this._focus = 0, this._renderOptions(), t.querySelector("[tabindex=\"0\"]")?.focus();
4234
4269
  }, this._close = () => {
4235
- t.hidden = !0, e.setAttribute("aria-expanded", "false"), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", e.focus();
4236
- }, e.addEventListener("click", () => n() ? this._close() : this._open()), e.addEventListener("keydown", (e) => {
4237
- (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), n() || this._open());
4270
+ t.hidden = !0, n?.classList.remove("open"), e.setAttribute("aria-expanded", "false"), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", e.focus();
4271
+ }, e.addEventListener("click", () => r() ? this._close() : this._open()), e.addEventListener("keydown", (e) => {
4272
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), r() || this._open());
4238
4273
  }), t.addEventListener("click", (e) => {
4239
4274
  this._popClick = !0;
4240
4275
  let t = e.target.closest(".timepicker-option");
4241
4276
  t && !t.disabled && (this.value = t.dataset.hm, this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
4242
4277
  }), this._onKeyBound = (e) => {
4243
- n() && this._onKey(e);
4278
+ r() && this._onKey(e);
4244
4279
  }, t.addEventListener("keydown", this._onKeyBound), this._bindGlobal = () => {
4245
4280
  this._teardown(), this._onDocClick = (e) => {
4246
4281
  let t = this._popClick;
4247
- this._popClick = !1, n() && !t && !this.contains(e.target) && this._close();
4282
+ this._popClick = !1, r() && !t && !this.contains(e.target) && this._close();
4248
4283
  }, document.addEventListener("click", this._onDocClick), this._onDocKey = (e) => {
4249
- n() && e.key === "Escape" && this._close();
4284
+ r() && e.key === "Escape" && this._close();
4250
4285
  }, document.addEventListener("keydown", this._onDocKey), Ce(this, () => {
4251
- n() && this._position(e, t);
4286
+ r() && this._position(e, t);
4252
4287
  });
4253
4288
  }, this._bindGlobal(), this._syncFormValue();
4254
4289
  }
@@ -4357,7 +4392,7 @@ var st = class extends HTMLElement {
4357
4392
  }
4358
4393
  _footerHtml(e) {
4359
4394
  let t = this._active, n = e.length - 1, r = this.hasAttribute("disabled") ? " disabled" : "", i = e[t]?.hasAttribute("optional") || this.hasAttribute("skippable"), a = this.getAttribute("back-label") || "Back", o = this.getAttribute("next-label") || "Next", s = this.getAttribute("skip-label") || "Skip", c = this.getAttribute("finish-label") || "Finish";
4360
- return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${wt(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${wt(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${wt(o)}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${wt(c)}</button>`}</span>`;
4395
+ return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${K("arrow-left", { className: "me-2" })}${wt(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${wt(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${wt(o)}${K("arrow-right", { className: "ms-2" })}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${wt(c)}</button>`}</span>`;
4361
4396
  }
4362
4397
  _wire() {
4363
4398
  this._teardown(), this._onHeaderClick = (e) => {
@@ -5200,7 +5235,7 @@ function mn({ label: e, children: t, tone: n = "neutral", variant: r = "soft", s
5200
5235
  }
5201
5236
  //#endregion
5202
5237
  //#region src/components/AppChoiceCard.jsx
5203
- function hn({ name: e, multiple: t = !1, value: n, checked: r, onChange: i, icon: a, iconNode: o, iconSize: s = 18, image: c, imageAlt: l = "", children: u, title: d, description: h, checkIcon: g = "check", checkSize: _ = 12, className: v = "", ...y }) {
5238
+ function hn({ name: e, multiple: t = !1, value: n, checked: r, onChange: i, icon: a, iconNode: o, iconSize: s = 18, image: c, imageAlt: l = "", children: u, title: d, description: h, checkIcon: g = "check", checkSize: _ = 18, className: v = "", ...y }) {
5204
5239
  return N("AppChoiceCard", y), /* @__PURE__ */ m("label", {
5205
5240
  className: `struct-card${c ? " struct-card-img-card" : ""}${r ? " checked" : ""}${v ? ` ${v}` : ""}`,
5206
5241
  ...y,
@@ -6034,7 +6069,10 @@ function zn({ columns: e, rows: n, rowKey: r = (e) => e.id, sort: i, onSort: a,
6034
6069
  }) : /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
6035
6070
  colSpan: j,
6036
6071
  className: "wui-table-empty",
6037
- children: L
6072
+ children: typeof L == "string" ? /* @__PURE__ */ p("div", {
6073
+ className: "tbl-empty-plain",
6074
+ children: L
6075
+ }) : L
6038
6076
  }) }) })]
6039
6077
  })
6040
6078
  }), _ && !o && _.total > 0 && /* @__PURE__ */ p(In, {
@@ -6887,6 +6925,7 @@ function pr({ value: e, fallback: t, name: n, onPick: r, onRemove: i, loading: a
6887
6925
  ...k,
6888
6926
  children: /* @__PURE__ */ m("span", {
6889
6927
  className: "set-uploader-ring",
6928
+ "data-overlay-label": g,
6890
6929
  children: [ne ? /* @__PURE__ */ p("img", {
6891
6930
  className: "set-uploader-img",
6892
6931
  src: ne,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
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/theme": "0.9.1",
32
- "@webority/ui-elements": "0.9.1"
31
+ "@webority/theme": "0.9.3",
32
+ "@webority/ui-elements": "0.9.3"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "bootstrap": "5.3.3",