@webority/ui-react 0.110.2 → 0.110.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.
@@ -67714,10 +67714,10 @@ var CKe = ["end", "start"], wKe = [
67714
67714
  "xl"
67715
67715
  ], TKe = [50, 90], EKe = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Number.isFinite(e) && e >= 10 && e <= 100);
67716
67716
  function DKe(e) {
67717
- let { marker: r, props: i } = H("AppDrawer", e), { open: a = !1, onClose: o, title: s, titleIcon: c, header: l, subtitle: u, ariaLabel: d, side: f = "end", size: p = "md", width: h, maxWidth: g, snapPoints: _ = TKe, defaultSnap: v = 0, sheet: y = !0, onSnapChange: b, onOpened: C, onClosed: w, dismissible: T = !0, closeLabel: E = "Close", staticBackdrop: D = !1, confirmDiscard: O, dirty: k = !1, bodyClassName: A = "", footer: j, className: M = "", style: N, children: P, ...F } = i;
67718
- U("AppDrawer", F), V("AppDrawer", "side", f, CKe), V("AppDrawer", "size", p, wKe), V("AppDrawer", "snapPoints", EKe(_) ? void 0 : JSON.stringify(_), ["an array of numbers from 10 to 100"]);
67719
- let I = x(null), L = x(null), R = x(null), [z, B] = S(!1);
67720
- L.current = {
67717
+ let { marker: r, props: i } = H("AppDrawer", e), { open: a = !1, onClose: o, title: s, titleIcon: c, header: l, subtitle: u, ariaLabel: d, side: f = "end", size: p = "md", width: h, maxWidth: g, snapPoints: _ = TKe, defaultSnap: v = 0, sheet: y = !0, onSnapChange: b, onOpened: C, onClosed: w, dismissible: T = !0, closeLabel: E = "Close", staticBackdrop: D = !1, confirmDiscard: O, dirty: k = !1, headerClassName: A = "", bodyClassName: j = "", footer: M, className: N = "", style: P, children: F, ...I } = i;
67718
+ U("AppDrawer", I), V("AppDrawer", "side", f, CKe), V("AppDrawer", "size", p, wKe), V("AppDrawer", "snapPoints", EKe(_) ? void 0 : JSON.stringify(_), ["an array of numbers from 10 to 100"]);
67719
+ let L = x(null), R = x(null), z = x(null), [B, ee] = S(!1);
67720
+ R.current = {
67721
67721
  onClose: o,
67722
67722
  onSnapChange: b,
67723
67723
  onOpened: C,
@@ -67725,26 +67725,26 @@ function DKe(e) {
67725
67725
  confirmDiscard: O,
67726
67726
  dirty: k
67727
67727
  }, m(() => {
67728
- a || B(!1);
67728
+ a || ee(!1);
67729
67729
  }, [a]), m(() => {
67730
- z && R.current?.focus();
67731
- }, [z]), m(() => {
67732
- let e = I.current;
67730
+ B && z.current?.focus();
67731
+ }, [B]), m(() => {
67732
+ let e = L.current;
67733
67733
  if (!e) return;
67734
67734
  let t = (t) => {
67735
67735
  if (t.target === e) {
67736
- if (t.preventDefault(), L.current.confirmDiscard && L.current.dirty) {
67737
- B(!0);
67736
+ if (t.preventDefault(), R.current.confirmDiscard && R.current.dirty) {
67737
+ ee(!0);
67738
67738
  return;
67739
67739
  }
67740
- L.current.onClose?.();
67740
+ R.current.onClose?.();
67741
67741
  }
67742
67742
  }, n = (t) => {
67743
- t.target === e && L.current.onSnapChange?.(t.detail.index, t.detail.percent);
67743
+ t.target === e && R.current.onSnapChange?.(t.detail.index, t.detail.percent);
67744
67744
  }, r = (t) => {
67745
- t.target === e && L.current.onOpened?.();
67745
+ t.target === e && R.current.onOpened?.();
67746
67746
  }, i = (t) => {
67747
- t.target === e && L.current.onClosed?.();
67747
+ t.target === e && R.current.onClosed?.();
67748
67748
  }, a = (n) => {
67749
67749
  n.target.closest?.("[data-wui-dismiss]") && t({
67750
67750
  target: e,
@@ -67755,27 +67755,27 @@ function DKe(e) {
67755
67755
  e.removeEventListener("wui-drawer-close", t), e.removeEventListener("wui-drawer-snap", n), e.removeEventListener("wui-drawer-opened", r), e.removeEventListener("wui-drawer-closed", i), e.removeEventListener("click", a);
67756
67756
  };
67757
67757
  }, []);
67758
- let ee = () => {
67759
- B(!1), I.current?.dispatchEvent(new CustomEvent("wui:drawer:discard", { bubbles: !0 })), L.current.onClose?.();
67760
- }, te = EKe(_) ? _ : TKe, ne = {
67758
+ let te = () => {
67759
+ ee(!1), L.current?.dispatchEvent(new CustomEvent("wui:drawer:discard", { bubbles: !0 })), R.current.onClose?.();
67760
+ }, ne = EKe(_) ? _ : TKe, re = {
67761
67761
  ...h && { "--wui-drawer-width": h },
67762
67762
  ...g && { "--wui-drawer-max-width": g },
67763
- ...N
67763
+ ...P
67764
67764
  };
67765
67765
  return n("wui-drawer", {
67766
- ref: I,
67766
+ ref: L,
67767
67767
  ...r,
67768
- ...F,
67769
- class: ["wui-drawer", M].filter(Boolean).join(" "),
67768
+ ...I,
67769
+ class: ["wui-drawer", N].filter(Boolean).join(" "),
67770
67770
  side: f,
67771
67771
  size: p,
67772
- "snap-points": te.join(","),
67772
+ "snap-points": ne.join(","),
67773
67773
  "default-snap": String(v),
67774
67774
  static: D ? "" : void 0,
67775
67775
  "no-sheet": y ? void 0 : "",
67776
67776
  "confirm-discard": O || void 0,
67777
67777
  open: a ? "" : void 0,
67778
- style: ne,
67778
+ style: re,
67779
67779
  children: [t("div", {
67780
67780
  className: "wui-drawer-backdrop",
67781
67781
  "data-wui-drawer-backdrop": "",
@@ -67799,7 +67799,7 @@ function DKe(e) {
67799
67799
  })
67800
67800
  }),
67801
67801
  l === void 0 ? n("div", {
67802
- className: "wui-drawer-header",
67802
+ className: ["wui-drawer-header", A].filter(Boolean).join(" "),
67803
67803
  "data-wui-drawer-grip": y ? "" : void 0,
67804
67804
  children: [n("div", {
67805
67805
  className: "wui-drawer-headtext",
@@ -67836,17 +67836,17 @@ function DKe(e) {
67836
67836
  })]
67837
67837
  }) : l,
67838
67838
  t("div", {
67839
- className: ["wui-drawer-body", A].filter(Boolean).join(" "),
67840
- children: P
67839
+ className: ["wui-drawer-body", j].filter(Boolean).join(" "),
67840
+ children: F
67841
67841
  }),
67842
- (j || z) && n("div", {
67843
- className: z ? "wui-drawer-footer wui-drawer-discarding" : "wui-drawer-footer",
67844
- children: [z && t(FHe, {
67842
+ (M || B) && n("div", {
67843
+ className: B ? "wui-drawer-footer wui-drawer-discarding" : "wui-drawer-footer",
67844
+ children: [B && t(FHe, {
67845
67845
  text: O,
67846
- confirmRef: R,
67847
- onDiscard: ee,
67848
- onKeep: () => B(!1)
67849
- }), j]
67846
+ confirmRef: z,
67847
+ onDiscard: te,
67848
+ onKeep: () => ee(!1)
67849
+ }), M]
67850
67850
  })
67851
67851
  ]
67852
67852
  })]
@@ -126832,14 +126832,14 @@ function Emt(e) {
126832
126832
  let B = C > 0 ? {
126833
126833
  ...R,
126834
126834
  "--wui-nav-item-height": `${C}px`
126835
- } : R, [ee, te] = S(() => k && g === void 0 && typeof document < "u" ? dmt(A) ?? !1 : !1), [ne, re] = S(!1), [ie, ae] = S(!1), [oe, se] = S(!1), ce = x(null), le = g ?? ee, ue = () => {
126836
- let e = !le;
126835
+ } : R, [ee, te] = S(() => k && g === void 0 && typeof document < "u" ? dmt(A) ?? !1 : !1), [ne, re] = S(!1), [ie, ae] = S(!1), [oe, se] = S(!1), ce = x(null), le = x(null), ue = x(null), de = g ?? ee, fe = () => {
126836
+ let e = !de;
126837
126837
  g === void 0 && te(e), k && fmt(e, A), _?.(e);
126838
- }, de = a.some((e) => e.collapsible), [fe, pe] = S(() => de && typeof document < "u" ? pmt(j) : /* @__PURE__ */ new Set()), me = (e) => {
126839
- let t = new Set(fe);
126840
- t.has(e) ? t.delete(e) : t.add(e), pe(t), mmt(t, j);
126841
- }, he = y(() => Dmt(a, O), [a, O]), ge = v ? null : Mmt(he);
126842
- return m(() => {
126838
+ }, pe = a.some((e) => e.collapsible), [me, he] = S(() => pe && typeof document < "u" ? pmt(j) : /* @__PURE__ */ new Set()), ge = (e) => {
126839
+ let t = new Set(me);
126840
+ t.has(e) ? t.delete(e) : t.add(e), he(t), mmt(t, j);
126841
+ }, _e = y(() => Dmt(a, O), [a, O]), ve = v ? null : Mmt(_e);
126842
+ m(() => {
126843
126843
  let e = () => ae(window.scrollY > 4);
126844
126844
  return e(), window.addEventListener("scroll", e, { passive: !0 }), () => window.removeEventListener("scroll", e);
126845
126845
  }, []), m(() => {
@@ -126856,22 +126856,34 @@ function Emt(e) {
126856
126856
  if (t(), typeof ResizeObserver > "u") return;
126857
126857
  let n = new ResizeObserver(t);
126858
126858
  return n.observe(e), () => n.disconnect();
126859
- }, [he]), m(() => {
126859
+ }, [_e]);
126860
+ let ye = !!f;
126861
+ return m(() => {
126862
+ let e = ue.current, t = le.current;
126863
+ if (!ye || !e || !t) return;
126864
+ let n = () => t.style.setProperty("--app-footer-h", `${e.offsetHeight}px`);
126865
+ n();
126866
+ let r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
126867
+ return r?.observe(e), () => {
126868
+ r?.disconnect(), t.style.removeProperty("--app-footer-h");
126869
+ };
126870
+ }, [ye]), m(() => {
126860
126871
  if (!ne) return;
126861
126872
  let e = (e) => {
126862
126873
  e.key === "Escape" && re(!1);
126863
126874
  };
126864
126875
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
126865
126876
  }, [ne]), n("div", {
126877
+ ref: le,
126866
126878
  className: [
126867
126879
  "app-shell",
126868
- le ? "collapsed" : "",
126880
+ de ? "collapsed" : "",
126869
126881
  v ? "no-sidebar" : "",
126870
126882
  ne ? "mobile-open" : "",
126871
126883
  L
126872
126884
  ].filter(Boolean).join(" "),
126873
126885
  "data-density": b === "compact" ? "compact" : void 0,
126874
- "data-wui-folded-cookie": de ? j : void 0,
126886
+ "data-wui-folded-cookie": pe ? j : void 0,
126875
126887
  style: B,
126876
126888
  ...r,
126877
126889
  ...z,
@@ -126901,7 +126913,7 @@ function Emt(e) {
126901
126913
  "aria-label": E,
126902
126914
  ref: ce,
126903
126915
  tabIndex: oe ? 0 : void 0,
126904
- children: he.map((e, r) => {
126916
+ children: _e.map((e, r) => {
126905
126917
  let i = e.items.map((e) => e.header == null ? t(Pmt, {
126906
126918
  item: e,
126907
126919
  linkComponent: D,
@@ -126925,7 +126937,7 @@ function Emt(e) {
126925
126937
  })
126926
126938
  ]
126927
126939
  }, e.key ?? e.label ?? `group-${r}`);
126928
- let a = !fe.has(e.key) || !!x9(e.items), o = `wui-nav-group-${e.key}`;
126940
+ let a = !me.has(e.key) || !!x9(e.items), o = `wui-nav-group-${e.key}`;
126929
126941
  return n("div", {
126930
126942
  className: `app-nav-group wui-nav-group-collapsible${a ? "" : " wui-nav-group-folded"}`,
126931
126943
  "data-wui-nav-group": e.key,
@@ -126934,7 +126946,7 @@ function Emt(e) {
126934
126946
  className: "app-nav-group-label wui-nav-group-toggle",
126935
126947
  "aria-expanded": a,
126936
126948
  "aria-controls": o,
126937
- onClick: () => me(e.key),
126949
+ onClick: () => ge(e.key),
126938
126950
  children: [t("span", {
126939
126951
  className: "wui-nav-group-text",
126940
126952
  children: e.label
@@ -126963,9 +126975,9 @@ function Emt(e) {
126963
126975
  !v && t("button", {
126964
126976
  type: "button",
126965
126977
  className: "app-sidebar-toggle",
126966
- onClick: ue,
126967
- "aria-label": le ? "Expand navigation" : "Collapse navigation",
126968
- "aria-expanded": !le,
126978
+ onClick: fe,
126979
+ "aria-label": de ? "Expand navigation" : "Collapse navigation",
126980
+ "aria-expanded": !de,
126969
126981
  children: t(W, {
126970
126982
  name: "chevrons-left",
126971
126983
  size: 20
@@ -127015,6 +127027,7 @@ function Emt(e) {
127015
127027
  }),
127016
127028
  f && t("footer", {
127017
127029
  className: "app-footer",
127030
+ ref: ue,
127018
127031
  children: f
127019
127032
  })
127020
127033
  ]
@@ -127023,16 +127036,16 @@ function Emt(e) {
127023
127036
  className: "wui-shell-launcher",
127024
127037
  children: p
127025
127038
  }),
127026
- ge && n("nav", {
127039
+ ve && n("nav", {
127027
127040
  className: "wui-tabbar",
127028
127041
  "aria-label": M,
127029
- children: [ge.tabs.map((e) => t(Nmt, {
127042
+ children: [ve.tabs.map((e) => t(Nmt, {
127030
127043
  tab: e,
127031
127044
  linkComponent: D,
127032
127045
  iconVariant: w
127033
- }, e.key ?? e.href)), ge.hasMore && n("button", {
127046
+ }, e.key ?? e.href)), ve.hasMore && n("button", {
127034
127047
  type: "button",
127035
- className: `wui-tabbar-item${ge.moreActive ? " active" : ""}`,
127048
+ className: `wui-tabbar-item${ve.moreActive ? " active" : ""}`,
127036
127049
  onClick: () => re(!0),
127037
127050
  children: [t("span", {
127038
127051
  className: "wui-tabbar-icon",
@@ -133203,7 +133216,7 @@ var Evt = u(function({ compact: r, tenant: i, "aria-label": a, className: o, ...
133203
133216
  kind: "WeborityWeb",
133204
133217
  library: {
133205
133218
  name: "@webority/ui-react",
133206
- version: "0.110.2"
133219
+ version: "0.110.3"
133207
133220
  },
133208
133221
  rendererProtocolVersion: 13,
133209
133222
  platform: "Web",
@@ -140125,6 +140138,13 @@ var Evt = u(function({ compact: r, tenant: i, "aria-label": a, className: o, ...
140125
140138
  required: !1,
140126
140139
  description: "A custom header that replaces the default one (title, subtitle and close button)."
140127
140140
  },
140141
+ {
140142
+ name: "headerClassName",
140143
+ type: "string",
140144
+ required: !1,
140145
+ description: "Classes on the default header, so a product can style it without restyling the library class. Ignored when header replaces it.",
140146
+ default: ""
140147
+ },
140128
140148
  {
140129
140149
  name: "maxWidth",
140130
140150
  type: "string",
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityWeb",
3
3
  "library": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.110.2"
5
+ "version": "0.110.3"
6
6
  },
7
7
  "rendererProtocolVersion": 13,
8
8
  "platform": "Web",
@@ -7622,6 +7622,13 @@
7622
7622
  "required": false,
7623
7623
  "description": "A custom header that replaces the default one (title, subtitle and close button)."
7624
7624
  },
7625
+ {
7626
+ "name": "headerClassName",
7627
+ "type": "string",
7628
+ "required": false,
7629
+ "description": "Classes on the default header, so a product can style it without restyling the library class. Ignored when header replaces it.",
7630
+ "default": ""
7631
+ },
7625
7632
  {
7626
7633
  "name": "maxWidth",
7627
7634
  "type": "string",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.110.2",
3
+ "version": "0.110.3",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 13,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.110.2"
9
+ "version": "0.110.3"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "d96a59620dfea078c6a095c5e9fe2649ee198c252f7f8afa4f84e61c09f4040f",
14
- "bytes": 856654
13
+ "sha256": "918a0f8c365b21ba31532e0320db794c8880fca26828cd5694340f645260642a",
14
+ "bytes": 856948
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "6d9aadc59f0c6852059c71d0db1db0c771df10da8f4ad403bf5ba95ccf7e95a5",
18
- "bytes": 10900270
17
+ "sha256": "94a298141c52bd973a0e9287dfbe1a2cfbd0502a418dc8d7628a1df5c3357d06",
18
+ "bytes": 10901000
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/DiscardPrompt.js";import{useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var u=[`end`,`start`],d=[`sm`,`md`,`lg`,`xl`],f=[50,90],p=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function m(m){let{marker:h,props:g}=e(`AppDrawer`,m),{open:_=!1,onClose:v,title:y,titleIcon:b,header:x,subtitle:S,ariaLabel:C,side:w=`end`,size:T=`md`,width:E,maxWidth:D,snapPoints:O=f,defaultSnap:k=0,sheet:A=!0,onSnapChange:j,onOpened:M,onClosed:N,dismissible:P=!0,closeLabel:F=`Close`,staticBackdrop:I=!1,confirmDiscard:L,dirty:R=!1,bodyClassName:z=``,footer:B,className:V=``,style:H,children:U,...W}=g;n(`AppDrawer`,W),t(`AppDrawer`,`side`,w,u),t(`AppDrawer`,`size`,T,d),t(`AppDrawer`,`snapPoints`,p(O)?void 0:JSON.stringify(O),[`an array of numbers from 10 to 100`]);let G=o(null),K=o(null),q=o(null),[J,Y]=s(!1);K.current={onClose:v,onSnapChange:j,onOpened:M,onClosed:N,confirmDiscard:L,dirty:R},a(()=>{_||Y(!1)},[_]),a(()=>{J&&q.current?.focus()},[J]),a(()=>{let e=G.current;if(!e)return;let t=t=>{if(t.target===e){if(t.preventDefault(),K.current.confirmDiscard&&K.current.dirty){Y(!0);return}K.current.onClose?.()}},n=t=>{t.target===e&&K.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=t=>{t.target===e&&K.current.onOpened?.()},i=t=>{t.target===e&&K.current.onClosed?.()},a=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let X=()=>{Y(!1),G.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),K.current.onClose?.()},Z=p(O)?O:f,Q={...E&&{"--wui-drawer-width":E},...D&&{"--wui-drawer-max-width":D},...H};return l(`wui-drawer`,{ref:G,...h,...W,class:[`wui-drawer`,V].filter(Boolean).join(` `),side:w,size:T,"snap-points":Z.join(`,`),"default-snap":String(k),static:I?``:void 0,"no-sheet":A?void 0:``,"confirm-discard":L||void 0,open:_?``:void 0,style:Q,children:[c(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),l(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":C||y||void 0,tabIndex:-1,children:[A&&c(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:c(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Sheet height`})}),x===void 0?l(`div`,{className:`wui-drawer-header`,"data-wui-drawer-grip":A?``:void 0,children:[l(`div`,{className:`wui-drawer-headtext`,children:[y&&l(`div`,{className:`wui-drawer-title`,children:[b&&c(`span`,{className:`wui-drawer-title-ic`,children:c(r,{name:b,size:18})}),y]}),S&&c(`div`,{className:`wui-drawer-subtitle`,children:S})]}),P&&c(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":F,children:c(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:c(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):x,c(`div`,{className:[`wui-drawer-body`,z].filter(Boolean).join(` `),children:U}),(B||J)&&l(`div`,{className:J?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[J&&c(i,{text:L,confirmRef:q,onDiscard:X,onKeep:()=>Y(!1)}),B]})]})]})}export{m as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/DiscardPrompt.js";import{useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var u=[`end`,`start`],d=[`sm`,`md`,`lg`,`xl`],f=[50,90],p=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function m(m){let{marker:h,props:g}=e(`AppDrawer`,m),{open:_=!1,onClose:v,title:y,titleIcon:b,header:x,subtitle:S,ariaLabel:C,side:w=`end`,size:T=`md`,width:E,maxWidth:D,snapPoints:O=f,defaultSnap:k=0,sheet:A=!0,onSnapChange:j,onOpened:M,onClosed:N,dismissible:P=!0,closeLabel:F=`Close`,staticBackdrop:I=!1,confirmDiscard:L,dirty:R=!1,headerClassName:z=``,bodyClassName:B=``,footer:V,className:H=``,style:U,children:W,...G}=g;n(`AppDrawer`,G),t(`AppDrawer`,`side`,w,u),t(`AppDrawer`,`size`,T,d),t(`AppDrawer`,`snapPoints`,p(O)?void 0:JSON.stringify(O),[`an array of numbers from 10 to 100`]);let K=o(null),q=o(null),J=o(null),[Y,X]=s(!1);q.current={onClose:v,onSnapChange:j,onOpened:M,onClosed:N,confirmDiscard:L,dirty:R},a(()=>{_||X(!1)},[_]),a(()=>{Y&&J.current?.focus()},[Y]),a(()=>{let e=K.current;if(!e)return;let t=t=>{if(t.target===e){if(t.preventDefault(),q.current.confirmDiscard&&q.current.dirty){X(!0);return}q.current.onClose?.()}},n=t=>{t.target===e&&q.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=t=>{t.target===e&&q.current.onOpened?.()},i=t=>{t.target===e&&q.current.onClosed?.()},a=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let Z=()=>{X(!1),K.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),q.current.onClose?.()},Q=p(O)?O:f,$={...E&&{"--wui-drawer-width":E},...D&&{"--wui-drawer-max-width":D},...U};return l(`wui-drawer`,{ref:K,...h,...G,class:[`wui-drawer`,H].filter(Boolean).join(` `),side:w,size:T,"snap-points":Q.join(`,`),"default-snap":String(k),static:I?``:void 0,"no-sheet":A?void 0:``,"confirm-discard":L||void 0,open:_?``:void 0,style:$,children:[c(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),l(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":C||y||void 0,tabIndex:-1,children:[A&&c(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:c(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Sheet height`})}),x===void 0?l(`div`,{className:[`wui-drawer-header`,z].filter(Boolean).join(` `),"data-wui-drawer-grip":A?``:void 0,children:[l(`div`,{className:`wui-drawer-headtext`,children:[y&&l(`div`,{className:`wui-drawer-title`,children:[b&&c(`span`,{className:`wui-drawer-title-ic`,children:c(r,{name:b,size:18})}),y]}),S&&c(`div`,{className:`wui-drawer-subtitle`,children:S})]}),P&&c(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":F,children:c(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:c(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):x,c(`div`,{className:[`wui-drawer-body`,B].filter(Boolean).join(` `),children:W}),(V||Y)&&l(`div`,{className:Y?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Y&&c(i,{text:L,confirmRef:J,onDiscard:Z,onKeep:()=>X(!1)}),V]})]})]})}export{m as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"./AppAvatar.js";import{navMatchScore as o}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as s,readNavFolded as c,readShellCollapsed as l,writeNavFolded as u,writeShellCollapsed as d}from"../lib/shellCookie.js";import{initScrollEdges as f}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";var x=99,S=4,C=5,w=/^[a-z0-9-]+$/,T=[`prefix`,`exact`],E=[`comfortable`,`compact`],D=[`default`,`primary`],O=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],k=new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),A=e=>e>x?`${x}+`:String(e),j=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),M=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:j.format(new Date)<=e};function ee(t){let{marker:a,props:o}=e(`AppShell`,t),{groups:m=[],brand:v,sidebarStart:x,sidebarStartCompact:S,sidebarFooter:C,topbarStart:w,topbarEnd:T,footer:k,launcher:A,children:j,collapsed:M,onCollapsedChange:ee,noSidebar:N=!1,density:P=`comfortable`,itemHeight:F,iconVariant:I,topbarTone:L=`default`,navLabel:B=`Main navigation`,linkComponent:V,currentPath:H,rememberCollapsed:U=!1,collapsedCookie:W=`wui-shell-collapsed`,foldedCookie:G=s,tabBarLabel:se=`Quick navigation`,moreLabel:ce=`More`,userMenu:K,notifications:q,search:le,className:ue=``,style:de,...fe}=o;r(`AppShell`,fe),n(`AppShell`,`density`,P,E),n(`AppShell`,`topbarTone`,L,D),n(`AppShell`,`iconVariant`,I,O);let pe=F>0?{...de,"--wui-nav-item-height":`${F}px`}:de,[me,he]=_(()=>U&&M===void 0&&typeof document<`u`?l(W)??!1:!1),[J,Y]=_(!1),[ge,_e]=_(!1),[ve,ye]=_(!1),X=g(null),Z=M??me,be=()=>{let e=!Z;M===void 0&&he(e),U&&d(e,W),ee?.(e)},xe=m.some(e=>e.collapsible),[Se,Ce]=_(()=>xe&&typeof document<`u`?c(G):new Set),we=e=>{let t=new Set(Se);t.has(e)?t.delete(e):t.add(e),Ce(t),u(t,G)},Q=h(()=>te(m,H),[m,H]),$=N?null:ne(Q);return p(()=>{let e=()=>_e(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),p(()=>{f()},[]),p(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),p(()=>{let e=X.current;if(!e)return;let t=()=>ye(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]),p(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]),b(`div`,{className:[`app-shell`,Z?`collapsed`:``,N?`no-sidebar`:``,J?`mobile-open`:``,ue].filter(Boolean).join(` `),"data-density":P===`compact`?`compact`:void 0,"data-wui-folded-cookie":xe?G:void 0,style:pe,...a,...fe,children:[y(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),b(`aside`,{className:`app-sidebar`,children:[v&&y(`div`,{className:`app-sidebar-brand`,children:v}),x&&y(`div`,{className:`app-sidebar-start`,children:x}),S&&y(`div`,{className:`app-sidebar-start-compact`,children:S}),y(`nav`,{className:`app-sidebar-scroll`,"aria-label":B,ref:X,tabIndex:ve?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?y(z,{item:e,linkComponent:V,onNavigate:()=>Y(!1),iconVariant:I},e.key??e.href??e.label):y(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return b(`div`,{className:`app-nav-group`,children:[e.label&&y(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!Se.has(e.key)||!!R(e.items),a=`wui-nav-group-${e.key}`;return b(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[b(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":a,onClick:()=>we(e.key),children:[y(`span`,{className:`wui-nav-group-text`,children:e.label}),y(`span`,{className:`wui-nav-group-caret`,children:y(i,{name:`chevron-down`,size:16})})]}),b(`div`,{className:`wui-nav-group-body`,id:a,children:[n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),C&&y(`div`,{className:`app-sidebar-foot`,children:C}),!N&&y(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:be,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:y(i,{name:`chevrons-left`,size:20})})]}),b(`div`,{className:`app-main`,children:[b(`header`,{className:`app-topbar${ge?` scrolled`:``}`,"data-tone":L===`primary`?`primary`:void 0,children:[b(`div`,{className:`app-topbar-start`,children:[y(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":`Open navigation`,"aria-expanded":J,children:y(i,{name:`menu`,size:18})}),w,le&&y(oe,{config:le})]}),b(`div`,{className:`app-topbar-end`,children:[T,q&&y(ae,{config:q}),K&&y(ie,{config:K,linkComponent:V})]})]}),y(`main`,{className:`app-content`,id:`main-content`,children:j}),k&&y(`footer`,{className:`app-footer`,children:k})]}),A&&y(`div`,{className:`wui-shell-launcher`,children:A}),$&&b(`nav`,{className:`wui-tabbar`,"aria-label":se,children:[$.tabs.map(e=>y(re,{tab:e,linkComponent:V,iconVariant:I},e.key??e.href)),$.hasMore&&b(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[y(`span`,{className:`wui-tabbar-icon`,children:y(i,{name:`more`,size:24})}),y(`span`,{className:`wui-tabbar-label`,children:ce})]})]}),y(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":`Close navigation`,tabIndex:J?0:-1})]})}function te(e,t){for(let t of e)t.collapsible&&L(t);let i=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:i(e.children)}:{...e}).filter(e=>P(e)?t:(e.children?.length??0)>0||!!e.href),a=e.map(e=>({...e,items:F(i(e.items,!0))})).filter(e=>e.items.some(e=>!P(e))),s=[],c=e=>{for(let t of e)P(t)||(s.push(t),t.children&&c(t.children))};for(let e of a)c(e.items);for(let e of s)r(`AppShell items`,N(e)),n(`AppShell`,`match`,e.match,T),n(`AppShell`,`iconVariant`,e.iconVariant,O);let l=null;if(t!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let n of s){if(n.active!=null||n.children?.length&&!n.href)continue;let r=o(t,n.href,{exact:n.match===`exact`,also:n.matchAlso});if(r<0)continue;let i=n.match===`exact`&&o(t,n.href,{exact:!0})>=0?1/0:r;i>e&&(e=i,l=n)}}for(let e of s)e.active=e.active??e===l;return a}function N(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!k.has(e)))}var P=e=>e.header!=null;function F(e){return e.filter((t,n)=>{if(!P(t))return!0;let r=e.findIndex((e,t)=>t>n&&P(e));return e.slice(n+1,r<0?void 0:r).length>0})}var I=new Set;function L(e){if(e.key!=null&&w.test(e.key))return;let n=e.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${e.key}" must use lower-case letters, digits and hyphens.`,r=!0;try{r=process.env.NODE_ENV!==`production`}catch{r=!0}!r||I.has(n)||(I.add(n),t(n))}function ne(e){let t=[],n=e=>{for(let r of e)P(r)||(r.children?.length?n(r.children):t.push(r))};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?S:C;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function re({tab:e,linkComponent:t,iconVariant:n}){let r=`wui-tabbar-item${e.active?` active`:``}`,a=b(v,{children:[e.icon&&y(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),y(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&y(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return t?y(t,{className:r,to:e.href,"aria-current":o,children:a}):y(`a`,{className:r,href:e.href,"aria-current":o,children:a})}function R(e){for(let t of e){if(t.active)return t;let e=t.children?.length?R(t.children):void 0;if(e)return e}}function z({item:e,linkComponent:t,onNavigate:n,depth:r=0,iconVariant:a}){let o=r>0,s=r>1?` wui-nav-depth-${Math.min(r,6)}`:``,c=Array.isArray(e.children)&&e.children.length>0,l=c?R(e.children):void 0,u=!!l,d=l?l.key??l.href??l.label:null,[f,m]=_(u);p(()=>{d!=null&&m(!0)},[d]);let h=typeof e.label==`string`?e.label:void 0,g=!o&&e.icon&&y(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&y(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=M(e.newUntil)&&y(`span`,{className:`wui-nav-new`,children:`New`}),C=b(v,{children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&y(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?y(i,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(c){let c=y(`div`,{className:`app-nav-sub${f?` expanded`:``}`,inert:!f,"aria-hidden":!f||void 0,children:y(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>y(z,{item:e,linkComponent:t,onNavigate:n,depth:r+1,iconVariant:a},e.key??e.href))})});if(e.href){let r=t?y(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":w,onClick:n,children:C}):y(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":w,onClick:n,children:C});return b(v,{children:[b(`div`,{className:`app-nav-item has-children wui-nav-split${o?` app-nav-subitem`:``}${u||e.active?` active`:``}${s}`,"data-label":h,children:[r,y(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":f,"aria-label":`Show or hide ${h??``} pages`,onClick:()=>m(e=>!e),children:y(i,{name:`chevron-right`,size:16})})]}),c]})}return b(v,{children:[b(`button`,{type:`button`,className:`app-nav-item${o?` app-nav-subitem`:``} has-children${u?` active`:``}${s}`,"aria-expanded":f,"data-label":h,onClick:()=>m(e=>!e),children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,y(`span`,{className:`app-nav-caret`,children:y(i,{name:`chevron-right`,size:16})})]}),c]})}let T=`app-nav-item${o?` app-nav-subitem`:``}${e.active?` active`:``}${s}`;return t?y(t,{className:T,to:e.href,"aria-current":w,"data-label":h,onClick:n,children:C}):y(`a`,{className:T,href:e.href,"aria-current":w,"data-label":h,onClick:n,children:C})}function B(){let[e,t]=_(!1),n=g(null);return p(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function ie({config:e,linkComponent:t}){let n=m(),{open:r,setOpen:o,ref:s}=B(),{name:c,role:l,roles:u=[],photo:d,profileHref:f,profileLabel:p=`My profile`,onLogout:h,logoutAction:g,logoutLabel:_=`Sign out`,items:x=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let S=u.map(e=>(e??``).trim()).filter(Boolean),C=()=>o(!1),w=(e,n,r,i)=>t?y(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):y(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),T=b(v,{children:[y(i,{name:`log-out`,size:18}),_]});return b(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[b(`button`,{type:`button`,id:n,className:`wui-usermenu-trigger`,"aria-expanded":r,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[y(a,{name:c,src:d,tone:`auto`}),b(`span`,{className:`wui-usermenu-text`,children:[y(`span`,{className:`wui-usermenu-name`,children:c}),l&&y(`span`,{className:`wui-usermenu-role`,children:l})]}),y(i,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${r?` show`:``}`,"aria-labelledby":n,"data-bs-popper":r?`static`:void 0,children:[b(`div`,{className:`wui-usermenu-head`,children:[y(a,{name:c,src:d,size:`lg`,tone:`auto`}),b(`div`,{className:`wui-usermenu-who`,children:[y(`div`,{className:`wui-usermenu-name`,children:c}),l&&y(`div`,{className:`wui-usermenu-role`,children:l}),S.length>0&&b(`div`,{className:`wui-usermenu-roles`,children:[y(`span`,{className:`wui-usermenu-roles-label`,children:S.length===1?`Role:`:`Roles:`}),` ${S.join(`, `)}`]})]})]}),f&&w(f,b(v,{children:[y(i,{name:`user`,size:18}),p]}),void 0,C),x.map(e=>{if(e.divider)return y(`hr`,{className:`dropdown-divider`},e.key);let t=b(v,{children:[e.icon&&y(i,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),C()};return e.href?w(e.href,t,e.key,n):y(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),g?y(`form`,{method:`post`,action:g,className:`wui-usermenu-logout`,children:y(`button`,{type:`submit`,className:`dropdown-item danger`,children:T})}):h&&y(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{C(),h()},children:T})]})]})}function ae({config:e}){let t=m(),{open:n,setOpen:r,ref:a}=B(),{unread:o=0,items:s,loading:c=!1,onOpen:l,onMarkAllRead:u,viewAllHref:d,label:f=`Notifications`,emptyText:h=`You are all caught up.`}=e,[x,S]=_(``),C=g(o);p(()=>{C.current!==o&&(C.current=o,S(o===0?`No unread notifications`:`${A(o)} unread notifications`))},[o]);let w=null;return s?.length?w=y(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let n=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,r=b(v,{children:[y(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&y(`span`,{className:`wui-bell-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-bell-body`,children:[!e.read&&y(`span`,{className:`visually-hidden`,children:`Unread: `}),y(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&y(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?y(`a`,{className:n,href:e.href,"data-id":e.id,children:r},e.id??t):y(`div`,{className:n,"data-id":e.id,children:r},e.id??t)})}):c?w=y(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(w=y(`div`,{className:`wui-bell-state`,children:h})),b(`div`,{className:`dropdown wui-bell`,ref:a,children:[b(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":n,"aria-label":o===0?f:`${f}, ${A(o)} unread`,onClick:()=>{let e=!n;r(e),e&&l?.()},children:[y(i,{name:`notification`,size:20}),y(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:A(o)})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${n?` show`:``}`,"aria-labelledby":t,"data-bs-popper":n?`static`:void 0,children:[b(`div`,{className:`wui-bell-head`,children:[y(`span`,{className:`wui-bell-title`,children:f}),u&&y(`button`,{type:`button`,className:`wui-bell-markall`,onClick:u,children:`Mark all read`})]}),y(`div`,{className:`wui-bell-list`,"aria-busy":c||void 0,children:w}),d&&y(`a`,{className:`wui-bell-foot`,href:d,children:`View all`})]})]})}var V=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function oe({config:e}){let t=m(),{value:n=``,onChange:r,results:a=null,loading:o=!1,onSelect:s,onSubmit:c,placeholder:l=`Search`}=e,[u,d]=_(!1),[f,v]=_(!1),[x,S]=_({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=g(null),E=g(null),D=g([]),O=h(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!f,A=O.length;p(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||V(e.target)||(e.preventDefault(),d(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(v(!0),d(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let j=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):c&&n.trim()!==``&&(e.preventDefault(),c(n.trim())):e.key===`Escape`&&(k?(e.preventDefault(),v(!0)):u&&(e.preventDefault(),d(!1)))},M=-1;return D.current=[],b(`div`,{className:`wui-topsearch${u?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[y(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":l,"aria-expanded":u,"aria-controls":`${t}-panel`,onClick:()=>{let e=!u;d(e),e&&E.current?.focus()},children:y(i,{name:`search`,size:20})}),b(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[b(`div`,{className:`search-wrap`,children:[y(i,{name:`search`,size:18,className:`search-icon`}),y(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:l,"aria-label":l,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:n,onChange:e=>{v(!1),r?.(e.target.value)},onKeyDown:j})]}),y(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&b(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&b(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,n,`”`]}),a.filter(e=>e.hits?.length).map((e,n)=>b(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&y(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{M+=1;let n=M;return b(`a`,{className:`wui-topsearch-hit${n===C?` is-active`:``}`,role:`option`,"aria-selected":n===C,id:`${t}-opt-${n}`,href:e.href,ref:e=>{D.current[n]=e},onClick:t=>s?.(e,t),children:[e.icon&&y(`span`,{className:`wui-topsearch-hit-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-topsearch-hit-text`,children:[y(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&y(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${n}`)})]},e.label??n))]})})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{ee as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"./AppAvatar.js";import{navMatchScore as o}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as s,readNavFolded as c,readShellCollapsed as l,writeNavFolded as u,writeShellCollapsed as d}from"../lib/shellCookie.js";import{initScrollEdges as f}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";var x=99,S=4,C=5,w=/^[a-z0-9-]+$/,T=[`prefix`,`exact`],E=[`comfortable`,`compact`],D=[`default`,`primary`],O=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],k=new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),A=e=>e>x?`${x}+`:String(e),j=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),M=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:j.format(new Date)<=e};function ee(t){let{marker:a,props:o}=e(`AppShell`,t),{groups:m=[],brand:v,sidebarStart:x,sidebarStartCompact:S,sidebarFooter:C,topbarStart:w,topbarEnd:T,footer:k,launcher:A,children:j,collapsed:M,onCollapsedChange:ee,noSidebar:N=!1,density:P=`comfortable`,itemHeight:F,iconVariant:I,topbarTone:L=`default`,navLabel:z=`Main navigation`,linkComponent:B,currentPath:ce,rememberCollapsed:V=!1,collapsedCookie:H=`wui-shell-collapsed`,foldedCookie:U=s,tabBarLabel:le=`Quick navigation`,moreLabel:ue=`More`,userMenu:W,notifications:G,search:K,className:de=``,style:fe,...q}=o;r(`AppShell`,q),n(`AppShell`,`density`,P,E),n(`AppShell`,`topbarTone`,L,D),n(`AppShell`,`iconVariant`,I,O);let pe=F>0?{...fe,"--wui-nav-item-height":`${F}px`}:fe,[me,he]=_(()=>V&&M===void 0&&typeof document<`u`?l(H)??!1:!1),[J,Y]=_(!1),[ge,_e]=_(!1),[ve,ye]=_(!1),X=g(null),be=g(null),xe=g(null),Z=M??me,Se=()=>{let e=!Z;M===void 0&&he(e),V&&d(e,H),ee?.(e)},Ce=m.some(e=>e.collapsible),[we,Te]=_(()=>Ce&&typeof document<`u`?c(U):new Set),Ee=e=>{let t=new Set(we);t.has(e)?t.delete(e):t.add(e),Te(t),u(t,U)},Q=h(()=>te(m,ce),[m,ce]),$=N?null:ne(Q);p(()=>{let e=()=>_e(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),p(()=>{f()},[]),p(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),p(()=>{let e=X.current;if(!e)return;let t=()=>ye(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]);let De=!!k;return p(()=>{let e=xe.current,t=be.current;if(!De||!e||!t)return;let n=()=>t.style.setProperty(`--app-footer-h`,`${e.offsetHeight}px`);n();let r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return r?.observe(e),()=>{r?.disconnect(),t.style.removeProperty(`--app-footer-h`)}},[De]),p(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]),b(`div`,{ref:be,className:[`app-shell`,Z?`collapsed`:``,N?`no-sidebar`:``,J?`mobile-open`:``,de].filter(Boolean).join(` `),"data-density":P===`compact`?`compact`:void 0,"data-wui-folded-cookie":Ce?U:void 0,style:pe,...a,...q,children:[y(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),b(`aside`,{className:`app-sidebar`,children:[v&&y(`div`,{className:`app-sidebar-brand`,children:v}),x&&y(`div`,{className:`app-sidebar-start`,children:x}),S&&y(`div`,{className:`app-sidebar-start-compact`,children:S}),y(`nav`,{className:`app-sidebar-scroll`,"aria-label":z,ref:X,tabIndex:ve?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?y(ie,{item:e,linkComponent:B,onNavigate:()=>Y(!1),iconVariant:I},e.key??e.href??e.label):y(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return b(`div`,{className:`app-nav-group`,children:[e.label&&y(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!we.has(e.key)||!!R(e.items),a=`wui-nav-group-${e.key}`;return b(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[b(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":a,onClick:()=>Ee(e.key),children:[y(`span`,{className:`wui-nav-group-text`,children:e.label}),y(`span`,{className:`wui-nav-group-caret`,children:y(i,{name:`chevron-down`,size:16})})]}),b(`div`,{className:`wui-nav-group-body`,id:a,children:[n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),C&&y(`div`,{className:`app-sidebar-foot`,children:C}),!N&&y(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:Se,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:y(i,{name:`chevrons-left`,size:20})})]}),b(`div`,{className:`app-main`,children:[b(`header`,{className:`app-topbar${ge?` scrolled`:``}`,"data-tone":L===`primary`?`primary`:void 0,children:[b(`div`,{className:`app-topbar-start`,children:[y(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":`Open navigation`,"aria-expanded":J,children:y(i,{name:`menu`,size:18})}),w,K&&y(se,{config:K})]}),b(`div`,{className:`app-topbar-end`,children:[T,G&&y(oe,{config:G}),W&&y(ae,{config:W,linkComponent:B})]})]}),y(`main`,{className:`app-content`,id:`main-content`,children:j}),k&&y(`footer`,{className:`app-footer`,ref:xe,children:k})]}),A&&y(`div`,{className:`wui-shell-launcher`,children:A}),$&&b(`nav`,{className:`wui-tabbar`,"aria-label":le,children:[$.tabs.map(e=>y(re,{tab:e,linkComponent:B,iconVariant:I},e.key??e.href)),$.hasMore&&b(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[y(`span`,{className:`wui-tabbar-icon`,children:y(i,{name:`more`,size:24})}),y(`span`,{className:`wui-tabbar-label`,children:ue})]})]}),y(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":`Close navigation`,tabIndex:J?0:-1})]})}function te(e,t){for(let t of e)t.collapsible&&L(t);let i=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:i(e.children)}:{...e}).filter(e=>P(e)?t:(e.children?.length??0)>0||!!e.href),a=e.map(e=>({...e,items:F(i(e.items,!0))})).filter(e=>e.items.some(e=>!P(e))),s=[],c=e=>{for(let t of e)P(t)||(s.push(t),t.children&&c(t.children))};for(let e of a)c(e.items);for(let e of s)r(`AppShell items`,N(e)),n(`AppShell`,`match`,e.match,T),n(`AppShell`,`iconVariant`,e.iconVariant,O);let l=null;if(t!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let n of s){if(n.active!=null||n.children?.length&&!n.href)continue;let r=o(t,n.href,{exact:n.match===`exact`,also:n.matchAlso});if(r<0)continue;let i=n.match===`exact`&&o(t,n.href,{exact:!0})>=0?1/0:r;i>e&&(e=i,l=n)}}for(let e of s)e.active=e.active??e===l;return a}function N(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!k.has(e)))}var P=e=>e.header!=null;function F(e){return e.filter((t,n)=>{if(!P(t))return!0;let r=e.findIndex((e,t)=>t>n&&P(e));return e.slice(n+1,r<0?void 0:r).length>0})}var I=new Set;function L(e){if(e.key!=null&&w.test(e.key))return;let n=e.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${e.key}" must use lower-case letters, digits and hyphens.`,r=!0;try{r=process.env.NODE_ENV!==`production`}catch{r=!0}!r||I.has(n)||(I.add(n),t(n))}function ne(e){let t=[],n=e=>{for(let r of e)P(r)||(r.children?.length?n(r.children):t.push(r))};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?S:C;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function re({tab:e,linkComponent:t,iconVariant:n}){let r=`wui-tabbar-item${e.active?` active`:``}`,a=b(v,{children:[e.icon&&y(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),y(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&y(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return t?y(t,{className:r,to:e.href,"aria-current":o,children:a}):y(`a`,{className:r,href:e.href,"aria-current":o,children:a})}function R(e){for(let t of e){if(t.active)return t;let e=t.children?.length?R(t.children):void 0;if(e)return e}}function ie({item:e,linkComponent:t,onNavigate:n,depth:r=0,iconVariant:a}){let o=r>0,s=r>1?` wui-nav-depth-${Math.min(r,6)}`:``,c=Array.isArray(e.children)&&e.children.length>0,l=c?R(e.children):void 0,u=!!l,d=l?l.key??l.href??l.label:null,[f,m]=_(u);p(()=>{d!=null&&m(!0)},[d]);let h=typeof e.label==`string`?e.label:void 0,g=!o&&e.icon&&y(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&y(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=M(e.newUntil)&&y(`span`,{className:`wui-nav-new`,children:`New`}),C=b(v,{children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&y(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?y(i,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(c){let c=y(`div`,{className:`app-nav-sub${f?` expanded`:``}`,inert:!f,"aria-hidden":!f||void 0,children:y(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>y(ie,{item:e,linkComponent:t,onNavigate:n,depth:r+1,iconVariant:a},e.key??e.href))})});if(e.href){let r=t?y(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":w,onClick:n,children:C}):y(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":w,onClick:n,children:C});return b(v,{children:[b(`div`,{className:`app-nav-item has-children wui-nav-split${o?` app-nav-subitem`:``}${u||e.active?` active`:``}${s}`,"data-label":h,children:[r,y(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":f,"aria-label":`Show or hide ${h??``} pages`,onClick:()=>m(e=>!e),children:y(i,{name:`chevron-right`,size:16})})]}),c]})}return b(v,{children:[b(`button`,{type:`button`,className:`app-nav-item${o?` app-nav-subitem`:``} has-children${u?` active`:``}${s}`,"aria-expanded":f,"data-label":h,onClick:()=>m(e=>!e),children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,y(`span`,{className:`app-nav-caret`,children:y(i,{name:`chevron-right`,size:16})})]}),c]})}let T=`app-nav-item${o?` app-nav-subitem`:``}${e.active?` active`:``}${s}`;return t?y(t,{className:T,to:e.href,"aria-current":w,"data-label":h,onClick:n,children:C}):y(`a`,{className:T,href:e.href,"aria-current":w,"data-label":h,onClick:n,children:C})}function z(){let[e,t]=_(!1),n=g(null);return p(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function ae({config:e,linkComponent:t}){let n=m(),{open:r,setOpen:o,ref:s}=z(),{name:c,role:l,roles:u=[],photo:d,profileHref:f,profileLabel:p=`My profile`,onLogout:h,logoutAction:g,logoutLabel:_=`Sign out`,items:x=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let S=u.map(e=>(e??``).trim()).filter(Boolean),C=()=>o(!1),w=(e,n,r,i)=>t?y(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):y(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),T=b(v,{children:[y(i,{name:`log-out`,size:18}),_]});return b(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[b(`button`,{type:`button`,id:n,className:`wui-usermenu-trigger`,"aria-expanded":r,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[y(a,{name:c,src:d,tone:`auto`}),b(`span`,{className:`wui-usermenu-text`,children:[y(`span`,{className:`wui-usermenu-name`,children:c}),l&&y(`span`,{className:`wui-usermenu-role`,children:l})]}),y(i,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${r?` show`:``}`,"aria-labelledby":n,"data-bs-popper":r?`static`:void 0,children:[b(`div`,{className:`wui-usermenu-head`,children:[y(a,{name:c,src:d,size:`lg`,tone:`auto`}),b(`div`,{className:`wui-usermenu-who`,children:[y(`div`,{className:`wui-usermenu-name`,children:c}),l&&y(`div`,{className:`wui-usermenu-role`,children:l}),S.length>0&&b(`div`,{className:`wui-usermenu-roles`,children:[y(`span`,{className:`wui-usermenu-roles-label`,children:S.length===1?`Role:`:`Roles:`}),` ${S.join(`, `)}`]})]})]}),f&&w(f,b(v,{children:[y(i,{name:`user`,size:18}),p]}),void 0,C),x.map(e=>{if(e.divider)return y(`hr`,{className:`dropdown-divider`},e.key);let t=b(v,{children:[e.icon&&y(i,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),C()};return e.href?w(e.href,t,e.key,n):y(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),g?y(`form`,{method:`post`,action:g,className:`wui-usermenu-logout`,children:y(`button`,{type:`submit`,className:`dropdown-item danger`,children:T})}):h&&y(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{C(),h()},children:T})]})]})}function oe({config:e}){let t=m(),{open:n,setOpen:r,ref:a}=z(),{unread:o=0,items:s,loading:c=!1,onOpen:l,onMarkAllRead:u,viewAllHref:d,label:f=`Notifications`,emptyText:h=`You are all caught up.`}=e,[x,S]=_(``),C=g(o);p(()=>{C.current!==o&&(C.current=o,S(o===0?`No unread notifications`:`${A(o)} unread notifications`))},[o]);let w=null;return s?.length?w=y(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let n=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,r=b(v,{children:[y(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&y(`span`,{className:`wui-bell-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-bell-body`,children:[!e.read&&y(`span`,{className:`visually-hidden`,children:`Unread: `}),y(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&y(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?y(`a`,{className:n,href:e.href,"data-id":e.id,children:r},e.id??t):y(`div`,{className:n,"data-id":e.id,children:r},e.id??t)})}):c?w=y(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(w=y(`div`,{className:`wui-bell-state`,children:h})),b(`div`,{className:`dropdown wui-bell`,ref:a,children:[b(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":n,"aria-label":o===0?f:`${f}, ${A(o)} unread`,onClick:()=>{let e=!n;r(e),e&&l?.()},children:[y(i,{name:`notification`,size:20}),y(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:A(o)})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${n?` show`:``}`,"aria-labelledby":t,"data-bs-popper":n?`static`:void 0,children:[b(`div`,{className:`wui-bell-head`,children:[y(`span`,{className:`wui-bell-title`,children:f}),u&&y(`button`,{type:`button`,className:`wui-bell-markall`,onClick:u,children:`Mark all read`})]}),y(`div`,{className:`wui-bell-list`,"aria-busy":c||void 0,children:w}),d&&y(`a`,{className:`wui-bell-foot`,href:d,children:`View all`})]})]})}var B=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function se({config:e}){let t=m(),{value:n=``,onChange:r,results:a=null,loading:o=!1,onSelect:s,onSubmit:c,placeholder:l=`Search`}=e,[u,d]=_(!1),[f,v]=_(!1),[x,S]=_({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=g(null),E=g(null),D=g([]),O=h(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!f,A=O.length;p(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||B(e.target)||(e.preventDefault(),d(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(v(!0),d(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let j=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):c&&n.trim()!==``&&(e.preventDefault(),c(n.trim())):e.key===`Escape`&&(k?(e.preventDefault(),v(!0)):u&&(e.preventDefault(),d(!1)))},M=-1;return D.current=[],b(`div`,{className:`wui-topsearch${u?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[y(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":l,"aria-expanded":u,"aria-controls":`${t}-panel`,onClick:()=>{let e=!u;d(e),e&&E.current?.focus()},children:y(i,{name:`search`,size:20})}),b(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[b(`div`,{className:`search-wrap`,children:[y(i,{name:`search`,size:18,className:`search-icon`}),y(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:l,"aria-label":l,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:n,onChange:e=>{v(!1),r?.(e.target.value)},onKeyDown:j})]}),y(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&b(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&b(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,n,`”`]}),a.filter(e=>e.hits?.length).map((e,n)=>b(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&y(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{M+=1;let n=M;return b(`a`,{className:`wui-topsearch-hit${n===C?` is-active`:``}`,role:`option`,"aria-selected":n===C,id:`${t}-opt-${n}`,href:e.href,ref:e=>{D.current[n]=e},onClick:t=>s?.(e,t),children:[e.icon&&y(`span`,{className:`wui-topsearch-hit-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-topsearch-hit-text`,children:[y(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&y(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${n}`)})]},e.label??n))]})})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{ee as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-guidance/1",
3
3
  "package": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.110.2"
5
+ "version": "0.110.3"
6
6
  },
7
7
  "components": [
8
8
  {
@@ -35,6 +35,7 @@ import "@webority/ui-elements/elements/drawer";
35
35
  * @param {boolean} [props.dirty]
36
36
  * @param {import('react').ReactNode} [props.footer]
37
37
  * @param {string} [props.className]
38
+ * @param {string} [props.headerClassName] Classes on the default header; ignored when `header` replaces it.
38
39
  * @param {string} [props.bodyClassName]
39
40
  * @param {import('react').CSSProperties} [props.style]
40
41
  * @param {import('react').ReactNode} props.children
@@ -117,6 +118,11 @@ export default function AppDrawer(props: {
117
118
  * @default ""
118
119
  */
119
120
  className?: string;
121
+ /**
122
+ * Classes on the default header, so a product can style it without restyling the library class. Ignored when header replaces it.
123
+ * @default ""
124
+ */
125
+ headerClassName?: string;
120
126
  /**
121
127
  * Classes on the scrolling body, such as p-0 to drop its padding.
122
128
  * @default ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.110.2",
3
+ "version": "0.110.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",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "@webority/theme": "0.110.2",
33
- "@webority/ui-elements": "0.110.2"
32
+ "@webority/ui-elements": "0.110.3",
33
+ "@webority/theme": "0.110.3"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@webority/analytics": "^0.28.0",
@@ -56,8 +56,8 @@
56
56
  "typescript": "^7.0.2",
57
57
  "vite": "^8.0.12",
58
58
  "vitest": "5.0.1",
59
- "@webority/canvas-kit": "0.110.2",
60
- "@webority/tokens": "0.110.2"
59
+ "@webority/canvas-kit": "0.110.3",
60
+ "@webority/tokens": "0.110.3"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "vite build && tsc -p tsconfig.json && node ../../scripts/inject-meta-docs.mjs && node ../canvas-kit/dist/cli.js build --config canvas-kit.json --out dist/canvas-kit && node ../canvas-kit/dist/cli.js guidance --config canvas-kit.json --out dist/guidance.json && node ../../scripts/sync-rcl-assets.mjs analytics",