@webority/ui-react 0.156.0 → 0.157.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.157.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Web",
|
|
@@ -9003,9 +9003,9 @@
|
|
|
9003
9003
|
},
|
|
9004
9004
|
{
|
|
9005
9005
|
"name": "label",
|
|
9006
|
-
"type": "
|
|
9006
|
+
"type": "node",
|
|
9007
9007
|
"required": false,
|
|
9008
|
-
"description": "
|
|
9008
|
+
"description": "Content of the row: text, or text with an icon. A searchable menu needs text."
|
|
9009
9009
|
},
|
|
9010
9010
|
{
|
|
9011
9011
|
"name": "shortcut",
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.157.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.157.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "7c4cf098bdf87d44680a7dbe7aa9194abb838f2f33cdeffeb730de795a4b4901",
|
|
14
|
+
"bytes": 1015137
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "f070f5515069f4e51d6183410c81d62355da1d3d10e81331dcd0fb6f344fa22b",
|
|
18
|
+
"bytes": 9846749
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import{TargetLink as i}from"../lib/TargetLink.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ee from"./warnUnknownProps.js";import te from"./withTooltip.js";import{Fragment as ne,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`,`fit`],re=e=>{e.preventDefault(),e.stopPropagation()},ie=u(function(e,t){return/* @__PURE__ */ h(`button`,{...e,ref:t,"aria-disabled":`true`})}),b=e=>e.description?/* @__PURE__ */ g(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,x=!1;function S(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!x&&(x=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function C(u){let{marker:x,props:C}=o(`AppDropdown`,u),{icon:ae,iconSize:oe,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=C;if(ee(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j)c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_),c(`AppDropdown`,`items[].tone`,e.tone,a);F||k||O||S(),c(`AppDropdown`,`toggleVariant`,E,v),c(`AppDropdown`,`menuWidth`,D,y),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[D&&y.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[W,G]=p(``),K=f(null),q=z??`Search`,se=B??`No matches.`,J=W.trim().toLowerCase(),Y=J?j.filter(e=>!e.divider&&e.header==null&&
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import{TargetLink as i}from"../lib/TargetLink.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ee from"./warnUnknownProps.js";import te from"./withTooltip.js";import{Fragment as ne,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`,`fit`],re=e=>{e.preventDefault(),e.stopPropagation()},ie=u(function(e,t){return/* @__PURE__ */ h(`button`,{...e,ref:t,"aria-disabled":`true`})}),b=e=>e.description?/* @__PURE__ */ g(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,x=!1;function S(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!x&&(x=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function C(u){let{marker:x,props:C}=o(`AppDropdown`,u),{icon:ae,iconSize:oe,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=C;if(ee(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j)if(c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_),c(`AppDropdown`,`items[].tone`,e.tone,a),R&&e.label!=null&&typeof e.label!=`string`)throw RangeError(`<AppDropdown> searchable filters rows by their text, so every item label must be a string.`);F||k||O||S(),c(`AppDropdown`,`toggleVariant`,E,v),c(`AppDropdown`,`menuWidth`,D,y),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[D&&y.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[W,G]=p(``),K=f(null),q=z??`Search`,se=B??`No matches.`,J=W.trim().toLowerCase(),Y=J?j.filter(e=>!e.divider&&e.header==null&&(typeof e.label==`string`?e.label:``).toLowerCase().includes(J)):j,ce=ae??(F?void 0:`more-horizontal`),X=I!==void 0,[le,ue]=p(!1),Z=X?!!I:le,Q=f(null);Q.current=(e,t)=>{X||ue(e),L?.(e,t)};let $=f(null);return d(()=>{if(!Z)return;let e=$.current?.getBoundingClientRect(),t=()=>{let t=$.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&Q.current?.(!1,{source:`scroll`})},n=()=>Q.current?.(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[Z]),d(()=>{R&&Z&&K.current?.focus(),Z||G(``)},[Z,R]),d(()=>{let e=K.current;if(!R||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key===`Escape`?(t.preventDefault(),t.stopPropagation(),Q.current?.(!1,{source:`keydown`,originalEvent:t}),$.current?.querySelector(`:scope > button`)?.focus()):t.key!==`Tab`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[R]),/* @__PURE__ */ g(m,{ref:$,align:A,show:Z,onToggle:(e,t)=>Q.current?.(e,t),...x,...V,children:[/* @__PURE__ */ h(m.Toggle,{as:w,icon:ce,iconSize:oe,btnClassName:H,trigger:F,title:O,"aria-label":k??(F?void 0:O)}),/* @__PURE__ */ g(m.Menu,{className:U,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:[R?/* @__PURE__ */ g(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ h(s,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:K,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:q,"aria-label":q,value:W,onChange:e=>G(e.target.value)})]}):null,P??Y.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ h(m.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ h(ne,{children:te(/* @__PURE__ */ g(m.Item,{as:ie,type:`button`,className:[e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:re,children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),e.disabledReason&&/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let a=e.to?{as:i,link:t(N,{to:e.to})}:e.href?{as:i,link:t(N,{href:e.href,external:!0})}:{as:`button`,type:`button`},o=[e.tone===`danger`&&`danger`,e.hiddenFrom&&_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ g(m.Item,{...a,onClick:e.onClick,className:o,"aria-keyshortcuts":n(e.shortcut),children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),r(e.shortcut)]},e.key)}),R&&J&&Y.length===0?/* @__PURE__ */ h(`div`,{className:`wui-dropdown-empty`,role:`status`,children:se}):null]})]})}var w=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...o},c){return/* @__PURE__ */ h(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...o,children:r??(e===void 0?null:/* @__PURE__ */ h(s,{name:e,size:t}))})});export{C as default};
|
package/dist/guidance.json
CHANGED
|
@@ -2,7 +2,7 @@ import type * as React from "react";
|
|
|
2
2
|
import { type AppLinkComponent } from "../lib/linkTarget.ts";
|
|
3
3
|
export interface AppDropdownItem {
|
|
4
4
|
key: string;
|
|
5
|
-
label?:
|
|
5
|
+
label?: React.ReactNode | undefined;
|
|
6
6
|
description?: string | undefined;
|
|
7
7
|
icon?: string | React.ReactNode | undefined;
|
|
8
8
|
image?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.157.0",
|
|
4
4
|
"description": "Webority shared React component library: App* primitives on react-bootstrap and the @webority/theme design system.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@webority/markdown-core": "0.
|
|
33
|
-
"@webority/theme": "0.
|
|
34
|
-
"@webority/ui-elements": "0.
|
|
35
|
-
"@webority/web-core": "0.
|
|
32
|
+
"@webority/markdown-core": "0.157.0",
|
|
33
|
+
"@webority/theme": "0.157.0",
|
|
34
|
+
"@webority/ui-elements": "0.157.0",
|
|
35
|
+
"@webority/web-core": "0.157.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@webority/analytics": "^0.40.0",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@vitejs/plugin-react": "^6.0.1",
|
|
53
53
|
"@vitest/coverage-v8": "5.1.0",
|
|
54
54
|
"@webority/analytics": "0.40.1",
|
|
55
|
-
"@webority/canvas-kit": "0.
|
|
56
|
-
"@webority/biome-config": "0.
|
|
57
|
-
"@webority/tokens": "0.
|
|
55
|
+
"@webority/canvas-kit": "0.157.0",
|
|
56
|
+
"@webority/biome-config": "0.157.0",
|
|
57
|
+
"@webority/tokens": "0.157.0",
|
|
58
58
|
"bootstrap": "5.3.8",
|
|
59
59
|
"jsdom": "30.1.1",
|
|
60
60
|
"react": "^19.3.1",
|