wimui 0.30.0 → 0.31.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.
Files changed (35) hide show
  1. package/README.ja.md +10 -9
  2. package/README.md +9 -6
  3. package/dist/components/_internal/StatusContent.cjs +1 -1
  4. package/dist/components/_internal/StatusContent.d.ts +9 -2
  5. package/dist/components/_internal/StatusContent.js +4 -2
  6. package/dist/components/_internal/status-content.module.cjs +1 -1
  7. package/dist/components/_internal/status-content.module.js +11 -9
  8. package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
  9. package/dist/components/data-display/Carousel/Carousel.d.ts +6 -0
  10. package/dist/components/data-display/Carousel/Carousel.js +92 -92
  11. package/dist/components/data-display/Carousel/carousel.module.cjs +1 -1
  12. package/dist/components/data-display/Carousel/carousel.module.js +14 -13
  13. package/dist/components/data-display/EmptyState/EmptyState.cjs +1 -1
  14. package/dist/components/data-display/EmptyState/EmptyState.d.ts +7 -1
  15. package/dist/components/data-display/EmptyState/EmptyState.js +4 -3
  16. package/dist/components/data-display/Marquee/Marquee.cjs +1 -1
  17. package/dist/components/data-display/Marquee/Marquee.d.ts +4 -1
  18. package/dist/components/data-display/Marquee/Marquee.js +4 -2
  19. package/dist/components/data-display/Marquee/marquee.module.cjs +1 -1
  20. package/dist/components/data-display/Marquee/marquee.module.js +1 -1
  21. package/dist/components/data-display/Stats/Stats.cjs +1 -1
  22. package/dist/components/data-display/Stats/Stats.d.ts +14 -3
  23. package/dist/components/data-display/Stats/Stats.js +12 -6
  24. package/dist/components/data-display/Stats/stats.module.cjs +1 -1
  25. package/dist/components/data-display/Stats/stats.module.js +4 -4
  26. package/dist/components/form/RichTextEditor/commands.d.ts +1 -1
  27. package/dist/components/overlay/Dropdown/Dropdown.cjs +1 -1
  28. package/dist/components/overlay/Dropdown/Dropdown.d.ts +14 -0
  29. package/dist/components/overlay/Dropdown/Dropdown.js +99 -93
  30. package/dist/llms-full.txt +15 -3
  31. package/dist/llms.txt +2 -2
  32. package/dist/styles.css +2 -2
  33. package/dist/wimui.umd.css +1 -1
  34. package/dist/wimui.umd.js +5 -5
  35. package/package.json +30 -11
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../icon/arrow-down.cjs"),n=require("../../../icon/arrow-right.cjs"),r=require("../../../icon/arrow-up.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../Card/Card.cjs"),o=require("./stats.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u={up:r.default,down:t.default,neutral:n.default},d=({variant:e=`outline`,className:t,children:n,...r})=>(0,l.jsx)(a.Card,{variant:e,className:(0,c.default)(`wim-stats`,o.default.root,t),padding:`none`,...r,children:(0,l.jsx)(`div`,{className:o.default.inner,children:n})}),f=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.label,e),...n,children:t}),p=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.value,e),...n,children:t}),m=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.description,e),...n,children:t}),h=({direction:e=`up`,className:t,children:n,...r})=>(0,l.jsxs)(`div`,{className:(0,c.default)(o.default.trend,o.default[e],t),...r,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:(0,l.jsx)(i.Icon,{component:u[e],size:`sm`})}),(0,l.jsx)(`span`,{children:n})]});d.displayName=`Stats`,f.displayName=`Stats.Label`,p.displayName=`Stats.Value`,m.displayName=`Stats.Description`,h.displayName=`Stats.Trend`,d.Label=f,d.Value=p,d.Description=m,d.Trend=h,exports.Stats=d,exports.default=d,exports.StatsDescription=m,exports.StatsLabel=f,exports.StatsTrend=h,exports.StatsValue=p;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../icon/arrow-down.cjs"),n=require("../../../icon/arrow-right.cjs"),r=require("../../../icon/arrow-up.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../Card/Card.cjs"),o=require("./stats.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u={up:r.default,down:t.default,neutral:n.default},d=({variant:e=`outline`,className:t,children:n,...r})=>(0,l.jsx)(a.Card,{variant:e,className:(0,c.default)(`wim-stats`,o.default.root,t),padding:`none`,...r,children:(0,l.jsx)(`div`,{className:o.default.inner,children:n})}),f=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.label,e),...n,children:t}),p=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.value,e),...n,children:t}),m=({className:e,children:t,...n})=>(0,l.jsx)(`div`,{className:(0,c.default)(o.default.description,e),...n,children:t}),h={up:`success`,down:`danger`,neutral:`neutral`},g=({direction:e=`up`,intent:t=h[e],className:n,children:r,...a})=>(0,l.jsxs)(`div`,{className:(0,c.default)(o.default.trend,o.default[t],n),"data-direction":e,"data-intent":t,...a,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:(0,l.jsx)(i.Icon,{component:u[e],size:`sm`})}),(0,l.jsx)(`span`,{children:r})]});d.displayName=`Stats`,f.displayName=`Stats.Label`,p.displayName=`Stats.Value`,m.displayName=`Stats.Description`,g.displayName=`Stats.Trend`,d.Label=f,d.Value=p,d.Description=m,d.Trend=g,exports.Stats=d,exports.default=d,exports.StatsDescription=m,exports.StatsLabel=f,exports.StatsTrend=g,exports.StatsValue=p;
@@ -23,7 +23,7 @@ export declare const Stats: {
23
23
  displayName: string;
24
24
  };
25
25
  Trend: {
26
- ({ direction, className, children, ...props }: StatsTrendProps): React.JSX.Element;
26
+ ({ direction, intent, className, children, ...props }: StatsTrendProps): React.JSX.Element;
27
27
  displayName: string;
28
28
  };
29
29
  };
@@ -40,11 +40,22 @@ export declare const StatsDescription: {
40
40
  displayName: string;
41
41
  };
42
42
  export type StatsTrendProps = React.ComponentPropsWithoutRef<"div"> & {
43
- /** Trend direction, which controls the icon and color */
43
+ /**
44
+ * Trend direction, which controls the arrow icon. When `intent` is not given it
45
+ * also sets the color (`up` = success, `down` = danger, `neutral` = neutral).
46
+ * @default "up"
47
+ */
44
48
  direction?: "up" | "down" | "neutral";
49
+ /**
50
+ * Whether the change is good or bad, which controls the color independently of
51
+ * the arrow. Set it for metrics where a rise is bad news, such as costs or error
52
+ * rates: `direction="up" intent="danger"`. Defaults to the color implied by
53
+ * `direction`.
54
+ */
55
+ intent?: "success" | "danger" | "neutral";
45
56
  };
46
57
  export declare const StatsTrend: {
47
- ({ direction, className, children, ...props }: StatsTrendProps): React.JSX.Element;
58
+ ({ direction, intent, className, children, ...props }: StatsTrendProps): React.JSX.Element;
48
59
  displayName: string;
49
60
  };
50
61
  export default Stats;
@@ -34,17 +34,23 @@ var l = {
34
34
  className: o(a.description, e),
35
35
  ...n,
36
36
  children: t
37
- }), m = ({ direction: e = "up", className: t, children: n, ...i }) => /* @__PURE__ */ c("div", {
38
- className: o(a.trend, a[e], t),
39
- ...i,
37
+ }), m = {
38
+ up: "success",
39
+ down: "danger",
40
+ neutral: "neutral"
41
+ }, h = ({ direction: e = "up", intent: t = m[e], className: n, children: i, ...u }) => /* @__PURE__ */ c("div", {
42
+ className: o(a.trend, a[t], n),
43
+ "data-direction": e,
44
+ "data-intent": t,
45
+ ...u,
40
46
  children: [/* @__PURE__ */ s("span", {
41
47
  "aria-hidden": "true",
42
48
  children: /* @__PURE__ */ s(r, {
43
49
  component: l[e],
44
50
  size: "sm"
45
51
  })
46
- }), /* @__PURE__ */ s("span", { children: n })]
52
+ }), /* @__PURE__ */ s("span", { children: i })]
47
53
  });
48
- u.displayName = "Stats", d.displayName = "Stats.Label", f.displayName = "Stats.Value", p.displayName = "Stats.Description", m.displayName = "Stats.Trend", u.Label = d, u.Value = f, u.Description = p, u.Trend = m;
54
+ u.displayName = "Stats", d.displayName = "Stats.Label", f.displayName = "Stats.Value", p.displayName = "Stats.Description", h.displayName = "Stats.Trend", u.Label = d, u.Value = f, u.Description = p, u.Trend = h;
49
55
  //#endregion
50
- export { u as Stats, u as default, p as StatsDescription, d as StatsLabel, m as StatsTrend, f as StatsValue };
56
+ export { u as Stats, u as default, p as StatsDescription, d as StatsLabel, h as StatsTrend, f as StatsValue };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_1ky8j_3`,t=`_inner_1ky8j_6`,n=`_label_1ky8j_12`,r=`_value_1ky8j_18`,i=`_description_1ky8j_24`,a=`_trend_1ky8j_29`,o=`_up_1ky8j_49`,s=`_down_1ky8j_53`,c=`_neutral_1ky8j_57`,l={root:e,inner:t,label:n,value:r,description:i,trend:a,up:o,down:s,neutral:c};exports.default=l,exports.description=i,exports.down=s,exports.inner=t,exports.label=n,exports.neutral=c,exports.root=e,exports.trend=a,exports.up=o,exports.value=r;
2
+ var e=`_root_l22hh_3`,t=`_inner_l22hh_6`,n=`_label_l22hh_12`,r=`_value_l22hh_18`,i=`_description_l22hh_24`,a=`_trend_l22hh_29`,o=`_success_l22hh_50`,s=`_danger_l22hh_54`,c=`_neutral_l22hh_58`,l={root:e,inner:t,label:n,value:r,description:i,trend:a,success:o,danger:s,neutral:c};exports.danger=s,exports.default=l,exports.description=i,exports.inner=t,exports.label=n,exports.neutral=c,exports.root=e,exports.success=o,exports.trend=a,exports.value=r;
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  //#region src/components/data-display/Stats/stats.module.scss
3
- var e = "_root_1ky8j_3", t = "_inner_1ky8j_6", n = "_label_1ky8j_12", r = "_value_1ky8j_18", i = "_description_1ky8j_24", a = "_trend_1ky8j_29", o = "_up_1ky8j_49", s = "_down_1ky8j_53", c = "_neutral_1ky8j_57", l = {
3
+ var e = "_root_l22hh_3", t = "_inner_l22hh_6", n = "_label_l22hh_12", r = "_value_l22hh_18", i = "_description_l22hh_24", a = "_trend_l22hh_29", o = "_success_l22hh_50", s = "_danger_l22hh_54", c = "_neutral_l22hh_58", l = {
4
4
  root: e,
5
5
  inner: t,
6
6
  label: n,
7
7
  value: r,
8
8
  description: i,
9
9
  trend: a,
10
- up: o,
11
- down: s,
10
+ success: o,
11
+ danger: s,
12
12
  neutral: c
13
13
  };
14
14
  //#endregion
15
- export { l as default, i as description, s as down, t as inner, n as label, c as neutral, e as root, a as trend, o as up, r as value };
15
+ export { s as danger, l as default, i as description, t as inner, n as label, c as neutral, e as root, o as success, a as trend, r as value };
@@ -2,7 +2,7 @@
2
2
  * RichTextEditor のコマンド層(純 DOM、React 非依存)。
3
3
  *
4
4
  * 旧実装は非推奨の document.execCommand / queryCommandState に依存していた
5
- * (IMPROVEMENTS.md T15)。ここでは Selection / Range API で同等のコマンドを
5
+ * (docs/history/improvements-ledger.md の T15)。ここでは Selection / Range API で同等のコマンドを
6
6
  * 実装する。部分選択時の書式分割は Range.extractContents() の仕様
7
7
  * (partial containment chain を複製してフラグメント側に書式ラッパーを残す)
8
8
  * を利用する。
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../layout/Transition/Transition.cjs"),r=require("../../_internal/BaseListItem/BaseListItem.cjs"),i=require("../../_internal/mergeRefs.cjs"),a=require("./dropdown.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("@floating-ui/react");var u=o.default.createContext({isOpen:!1,toggle:()=>{},close:()=>{},menuId:``,triggerId:``,focusedIndex:-1,setFocusedIndex:()=>{},registerItem:()=>0,containerRef:{current:null},setReference:()=>{},setFloating:()=>{},floatingStyles:{},floatingRef:{current:null},setAlign:()=>{}}),d=(0,o.forwardRef)(({children:e,className:n,asChild:r=!1,...d},f)=>{let[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(-1),_=(0,o.useRef)(null),v=(0,o.useRef)(0),[y,b]=(0,o.useState)(`left`),{refs:x,floatingStyles:S}=(0,l.useFloating)({open:p,placement:y===`right`?`bottom-end`:`bottom-start`,whileElementsMounted:l.autoUpdate,middleware:[(0,l.offset)(4),(0,l.flip)(),(0,l.shift)({padding:8})]}),C=i.mergeRefs(_,f);(0,o.useEffect)(()=>{v.current=0});let w=()=>{let e=v.current;return v.current+=1,e},T=(0,o.useId)(),E=`wim-dropdown-menu-${T}`,D=`wim-dropdown-trigger-${T}`,O=()=>{let e=!p;m(e),g(e?0:-1)},k=()=>{m(!1),g(-1)};(0,o.useEffect)(()=>{let e=e=>{let t=e.target,n=x.floating.current?.contains(t)??!1;_.current&&!_.current.contains(t)&&!n&&k()},t=e=>{e.key===`Escape`&&k()};return p&&(document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t)),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[p,x.floating]);let A=e=>{if(!p)return;let t=Array.from((x.floating.current??_.current)?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)||[]);switch(e.key){case`ArrowDown`:e.preventDefault(),g(e=>e<t.length-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),g(e=>e>0?e-1:t.length-1);break;case`Home`:e.preventDefault(),g(0);break;case`End`:e.preventDefault(),g(t.length-1);break;case`Tab`:k();break}};(0,o.useEffect)(()=>{p&&h>=0&&Array.from((x.floating.current??_.current)?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)||[])[h]?.focus({preventScroll:!0})},[h,p,x.floating]);let j=r?t.Root:`div`;return(0,c.jsx)(u.Provider,{value:{isOpen:p,toggle:O,close:k,menuId:E,triggerId:D,focusedIndex:h,setFocusedIndex:g,registerItem:w,containerRef:_,setReference:x.setReference,setFloating:x.setFloating,floatingStyles:S,floatingRef:x.floating,setAlign:b},children:(0,c.jsx)(j,{...d,role:`none`,className:(0,s.default)(`wim-dropdown`,a.default.root,n),ref:C,onKeyDown:A,children:(0,c.jsx)(t.Slottable,{children:e})})})});d.displayName=`Dropdown`;var f=(0,o.forwardRef)(({children:e,className:n,asChild:r=!1,...l},d)=>{let{toggle:f,isOpen:p,menuId:m,triggerId:h,setReference:g}=o.default.useContext(u),_=r?t.Root:`div`,v=i.mergeRefs(g,d);return(0,c.jsx)(_,{...l,ref:v,id:h,className:(0,s.default)(a.default.trigger,n),onClick:f,"aria-haspopup":`menu`,"aria-expanded":p,"aria-controls":p?m:void 0,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},children:(0,c.jsx)(t.Slottable,{children:e})})});f.displayName=`Dropdown.Trigger`;var p=(0,o.forwardRef)(({children:e,className:t,align:r=`left`,show:d,style:f,...p},m)=>{let{isOpen:h,menuId:g,triggerId:_,setFloating:v,floatingStyles:y,setAlign:b}=o.default.useContext(u);(0,o.useEffect)(()=>{b(r)},[r,b]);let x=i.mergeRefs(v,m);return(0,c.jsx)(l.FloatingPortal,{children:(0,c.jsx)(n.Transition,{...p,ref:x,show:d===void 0?h:d,preset:`fade`,id:g,style:{...y,...f},className:(0,s.default)(a.default.menu,t),role:`menu`,"aria-labelledby":_,children:e})})});p.displayName=`Dropdown.Menu`;var m=(0,o.forwardRef)(({children:e,onClick:t,disabled:n=!1,className:i,...l},d)=>{let{close:f,focusedIndex:p,setFocusedIndex:m,registerItem:h}=o.default.useContext(u),[g]=(0,o.useState)(()=>h()),_=p===g,v=e=>{n||(e.stopPropagation(),t&&t(),f())};return(0,c.jsx)(r.BaseListItem,{...l,ref:d,className:(0,s.default)(a.default.item,i),onClick:v,onFocus:()=>m(g),disabled:n,role:`menuitem`,tabIndex:_?0:-1,onKeyDown:e=>{!n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(e))},children:e})});m.displayName=`Dropdown.Item`;var h=(0,o.forwardRef)((e,t)=>(0,c.jsx)(d,{...e,ref:t}));h.displayName=`Dropdown`,h.Trigger=f,h.Menu=p,h.Item=m,exports.Dropdown=h,exports.default=h,exports.DropdownItem=m,exports.DropdownMenu=p,exports.DropdownTrigger=f;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../layout/Transition/Transition.cjs"),r=require("../../_internal/BaseListItem/BaseListItem.cjs"),i=require("../../_internal/mergeRefs.cjs"),a=require("./dropdown.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("@floating-ui/react");var u=o.default.createContext({isOpen:!1,toggle:()=>{},close:()=>{},menuId:``,triggerId:``,focusedIndex:-1,setFocusedIndex:()=>{},registerItem:()=>0,containerRef:{current:null},setReference:()=>{},setFloating:()=>{},floatingStyles:{},floatingRef:{current:null},setAlign:()=>{}}),d=(0,o.forwardRef)(({children:e,className:n,asChild:r=!1,defaultOpen:d=!1,open:f,onOpenChange:p,...m},h)=>{let[g,_]=(0,o.useState)(d),v=f??g,y=(0,o.useCallback)(e=>{f===void 0&&_(e),p?.(e)},[f,p]),[b,x]=(0,o.useState)(-1),S=(0,o.useRef)(null),C=(0,o.useRef)(0),[w,T]=(0,o.useState)(`left`),{refs:E,floatingStyles:D}=(0,l.useFloating)({open:v,placement:w===`right`?`bottom-end`:`bottom-start`,whileElementsMounted:l.autoUpdate,middleware:[(0,l.offset)(4),(0,l.flip)(),(0,l.shift)({padding:8})]}),O=i.mergeRefs(S,h);(0,o.useEffect)(()=>{C.current=0});let k=()=>{let e=C.current;return C.current+=1,e},A=(0,o.useId)(),j=`wim-dropdown-menu-${A}`,M=`wim-dropdown-trigger-${A}`,N=()=>{let e=!v;y(e),x(e?0:-1)},P=(0,o.useCallback)(()=>{y(!1),x(-1)},[y]);(0,o.useEffect)(()=>{let e=e=>{let t=e.target,n=E.floating.current?.contains(t)??!1;S.current&&!S.current.contains(t)&&!n&&P()},t=e=>{e.key===`Escape`&&P()};return v&&(document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t)),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[v,E.floating,P]);let F=e=>{if(!v)return;let t=Array.from((E.floating.current??S.current)?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)||[]);switch(e.key){case`ArrowDown`:e.preventDefault(),x(e=>e<t.length-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),x(e=>e>0?e-1:t.length-1);break;case`Home`:e.preventDefault(),x(0);break;case`End`:e.preventDefault(),x(t.length-1);break;case`Tab`:P();break}};(0,o.useEffect)(()=>{v&&b>=0&&Array.from((E.floating.current??S.current)?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)||[])[b]?.focus({preventScroll:!0})},[b,v,E.floating]);let I=r?t.Root:`div`;return(0,c.jsx)(u.Provider,{value:{isOpen:v,toggle:N,close:P,menuId:j,triggerId:M,focusedIndex:b,setFocusedIndex:x,registerItem:k,containerRef:S,setReference:E.setReference,setFloating:E.setFloating,floatingStyles:D,floatingRef:E.floating,setAlign:T},children:(0,c.jsx)(I,{...m,role:`none`,className:(0,s.default)(`wim-dropdown`,a.default.root,n),ref:O,onKeyDown:F,children:(0,c.jsx)(t.Slottable,{children:e})})})});d.displayName=`Dropdown`;var f=(0,o.forwardRef)(({children:e,className:n,asChild:r=!1,...l},d)=>{let{toggle:f,isOpen:p,menuId:m,triggerId:h,setReference:g}=o.default.useContext(u),_=r?t.Root:`div`,v=i.mergeRefs(g,d);return(0,c.jsx)(_,{...l,ref:v,id:h,className:(0,s.default)(a.default.trigger,n),onClick:f,"aria-haspopup":`menu`,"aria-expanded":p,"aria-controls":p?m:void 0,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},children:(0,c.jsx)(t.Slottable,{children:e})})});f.displayName=`Dropdown.Trigger`;var p=(0,o.forwardRef)(({children:e,className:t,align:r=`left`,show:d,style:f,...p},m)=>{let{isOpen:h,menuId:g,triggerId:_,setFloating:v,floatingStyles:y,setAlign:b}=o.default.useContext(u);(0,o.useEffect)(()=>{b(r)},[r,b]);let x=i.mergeRefs(v,m);return(0,c.jsx)(l.FloatingPortal,{children:(0,c.jsx)(n.Transition,{...p,ref:x,show:d===void 0?h:d,preset:`fade`,id:g,style:{...y,...f},className:(0,s.default)(a.default.menu,t),role:`menu`,"aria-labelledby":_,children:e})})});p.displayName=`Dropdown.Menu`;var m=(0,o.forwardRef)(({children:e,onClick:t,disabled:n=!1,className:i,...l},d)=>{let{close:f,focusedIndex:p,setFocusedIndex:m,registerItem:h}=o.default.useContext(u),[g]=(0,o.useState)(()=>h()),_=p===g,v=e=>{n||(e.stopPropagation(),t&&t(),f())};return(0,c.jsx)(r.BaseListItem,{...l,ref:d,className:(0,s.default)(a.default.item,i),onClick:v,onFocus:()=>m(g),disabled:n,role:`menuitem`,tabIndex:_?0:-1,onKeyDown:e=>{!n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(e))},children:e})});m.displayName=`Dropdown.Item`;var h=(0,o.forwardRef)((e,t)=>(0,c.jsx)(d,{...e,ref:t}));h.displayName=`Dropdown`,h.Trigger=f,h.Menu=p,h.Item=m,exports.Dropdown=h,exports.default=h,exports.DropdownItem=m,exports.DropdownMenu=p,exports.DropdownTrigger=f;
@@ -10,6 +10,20 @@ export interface DropdownProps extends React.ComponentPropsWithoutRef<"div"> {
10
10
  * If true, the dropdown will be rendered as its child, merging its props onto that child.
11
11
  */
12
12
  asChild?: boolean;
13
+ /**
14
+ * Whether the menu starts open. Use it for a screenshot, a test, or a menu that should
15
+ * already be showing. Ignored once `open` is provided.
16
+ */
17
+ defaultOpen?: boolean;
18
+ /**
19
+ * Controls the open state from the outside. Pass it together with `onOpenChange`.
20
+ */
21
+ open?: boolean;
22
+ /**
23
+ * Called with the next open state, both when the trigger is used and when the menu is
24
+ * dismissed by an outside click or Escape.
25
+ */
26
+ onOpenChange?: (open: boolean) => void;
13
27
  }
14
28
  export interface DropdownTriggerProps extends React.ComponentPropsWithoutRef<"div"> {
15
29
  children: ReactNode;
@@ -4,12 +4,12 @@ import { Transition as n } from "../../layout/Transition/Transition.js";
4
4
  import { BaseListItem as r } from "../../_internal/BaseListItem/BaseListItem.js";
5
5
  import { mergeRefs as i } from "../../_internal/mergeRefs.js";
6
6
  import a from "./dropdown.module.js";
7
- import o, { forwardRef as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
8
- import f from "classnames";
9
- import { jsx as p } from "react/jsx-runtime";
10
- import { FloatingPortal as m, autoUpdate as h, flip as g, offset as _, shift as v, useFloating as y } from "@floating-ui/react";
7
+ import o, { forwardRef as s, useCallback as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
8
+ import p from "classnames";
9
+ import { jsx as m } from "react/jsx-runtime";
10
+ import { FloatingPortal as h, autoUpdate as g, flip as _, offset as v, shift as y, useFloating as b } from "@floating-ui/react";
11
11
  //#region src/components/overlay/Dropdown/Dropdown.tsx
12
- var b = o.createContext({
12
+ var x = o.createContext({
13
13
  isOpen: !1,
14
14
  toggle: () => {},
15
15
  close: () => {},
@@ -24,150 +24,156 @@ var b = o.createContext({
24
24
  floatingStyles: {},
25
25
  floatingRef: { current: null },
26
26
  setAlign: () => {}
27
- }), x = s(({ children: n, className: r, asChild: o = !1, ...s }, m) => {
28
- let [x, S] = d(!1), [C, w] = d(-1), T = u(null), E = u(0), [D, O] = d("left"), { refs: k, floatingStyles: A } = y({
29
- open: x,
30
- placement: D === "right" ? "bottom-end" : "bottom-start",
31
- whileElementsMounted: h,
27
+ }), S = s(({ children: n, className: r, asChild: o = !1, defaultOpen: s = !1, open: h, onOpenChange: S, ...C }, w) => {
28
+ let [T, E] = f(s), D = h ?? T, O = c((e) => {
29
+ h === void 0 && E(e), S?.(e);
30
+ }, [h, S]), [k, A] = f(-1), j = d(null), M = d(0), [N, P] = f("left"), { refs: F, floatingStyles: I } = b({
31
+ open: D,
32
+ placement: N === "right" ? "bottom-end" : "bottom-start",
33
+ whileElementsMounted: g,
32
34
  middleware: [
33
- _(4),
34
- g(),
35
- v({ padding: 8 })
35
+ v(4),
36
+ _(),
37
+ y({ padding: 8 })
36
38
  ]
37
- }), j = i(T, m);
38
- c(() => {
39
- E.current = 0;
39
+ }), L = i(j, w);
40
+ l(() => {
41
+ M.current = 0;
40
42
  });
41
- let M = () => {
42
- let e = E.current;
43
- return E.current += 1, e;
44
- }, N = l(), P = `wim-dropdown-menu-${N}`, F = `wim-dropdown-trigger-${N}`, I = () => {
45
- let e = !x;
46
- S(e), w(e ? 0 : -1);
47
- }, L = () => {
48
- S(!1), w(-1);
49
- };
50
- c(() => {
43
+ let R = () => {
44
+ let e = M.current;
45
+ return M.current += 1, e;
46
+ }, z = u(), B = `wim-dropdown-menu-${z}`, V = `wim-dropdown-trigger-${z}`, H = () => {
47
+ let e = !D;
48
+ O(e), A(e ? 0 : -1);
49
+ }, U = c(() => {
50
+ O(!1), A(-1);
51
+ }, [O]);
52
+ l(() => {
51
53
  let e = (e) => {
52
- let t = e.target, n = k.floating.current?.contains(t) ?? !1;
53
- T.current && !T.current.contains(t) && !n && L();
54
+ let t = e.target, n = F.floating.current?.contains(t) ?? !1;
55
+ j.current && !j.current.contains(t) && !n && U();
54
56
  }, t = (e) => {
55
- e.key === "Escape" && L();
57
+ e.key === "Escape" && U();
56
58
  };
57
- return x && (document.addEventListener("mousedown", e), document.addEventListener("keydown", t)), () => {
59
+ return D && (document.addEventListener("mousedown", e), document.addEventListener("keydown", t)), () => {
58
60
  document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
59
61
  };
60
- }, [x, k.floating]);
61
- let R = (e) => {
62
- if (!x) return;
63
- let t = Array.from((k.floating.current ?? T.current)?.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])") || []);
62
+ }, [
63
+ D,
64
+ F.floating,
65
+ U
66
+ ]);
67
+ let W = (e) => {
68
+ if (!D) return;
69
+ let t = Array.from((F.floating.current ?? j.current)?.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])") || []);
64
70
  switch (e.key) {
65
71
  case "ArrowDown":
66
- e.preventDefault(), w((e) => e < t.length - 1 ? e + 1 : 0);
72
+ e.preventDefault(), A((e) => e < t.length - 1 ? e + 1 : 0);
67
73
  break;
68
74
  case "ArrowUp":
69
- e.preventDefault(), w((e) => e > 0 ? e - 1 : t.length - 1);
75
+ e.preventDefault(), A((e) => e > 0 ? e - 1 : t.length - 1);
70
76
  break;
71
77
  case "Home":
72
- e.preventDefault(), w(0);
78
+ e.preventDefault(), A(0);
73
79
  break;
74
80
  case "End":
75
- e.preventDefault(), w(t.length - 1);
81
+ e.preventDefault(), A(t.length - 1);
76
82
  break;
77
83
  case "Tab":
78
- L();
84
+ U();
79
85
  break;
80
86
  }
81
87
  };
82
- c(() => {
83
- x && C >= 0 && Array.from((k.floating.current ?? T.current)?.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])") || [])[C]?.focus({ preventScroll: !0 });
88
+ l(() => {
89
+ D && k >= 0 && Array.from((F.floating.current ?? j.current)?.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])") || [])[k]?.focus({ preventScroll: !0 });
84
90
  }, [
85
- C,
86
- x,
87
- k.floating
91
+ k,
92
+ D,
93
+ F.floating
88
94
  ]);
89
- let z = o ? e : "div";
90
- return /* @__PURE__ */ p(b.Provider, {
95
+ let G = o ? e : "div";
96
+ return /* @__PURE__ */ m(x.Provider, {
91
97
  value: {
92
- isOpen: x,
93
- toggle: I,
94
- close: L,
95
- menuId: P,
96
- triggerId: F,
97
- focusedIndex: C,
98
- setFocusedIndex: w,
99
- registerItem: M,
100
- containerRef: T,
101
- setReference: k.setReference,
102
- setFloating: k.setFloating,
103
- floatingStyles: A,
104
- floatingRef: k.floating,
105
- setAlign: O
98
+ isOpen: D,
99
+ toggle: H,
100
+ close: U,
101
+ menuId: B,
102
+ triggerId: V,
103
+ focusedIndex: k,
104
+ setFocusedIndex: A,
105
+ registerItem: R,
106
+ containerRef: j,
107
+ setReference: F.setReference,
108
+ setFloating: F.setFloating,
109
+ floatingStyles: I,
110
+ floatingRef: F.floating,
111
+ setAlign: P
106
112
  },
107
- children: /* @__PURE__ */ p(z, {
108
- ...s,
113
+ children: /* @__PURE__ */ m(G, {
114
+ ...C,
109
115
  role: "none",
110
- className: f("wim-dropdown", a.root, r),
111
- ref: j,
112
- onKeyDown: R,
113
- children: /* @__PURE__ */ p(t, { children: n })
116
+ className: p("wim-dropdown", a.root, r),
117
+ ref: L,
118
+ onKeyDown: W,
119
+ children: /* @__PURE__ */ m(t, { children: n })
114
120
  })
115
121
  });
116
122
  });
117
- x.displayName = "Dropdown";
118
- var S = s(({ children: n, className: r, asChild: s = !1, ...c }, l) => {
119
- let { toggle: u, isOpen: d, menuId: m, triggerId: h, setReference: g } = o.useContext(b), _ = s ? e : "div", v = i(g, l);
120
- return /* @__PURE__ */ p(_, {
123
+ S.displayName = "Dropdown";
124
+ var C = s(({ children: n, className: r, asChild: s = !1, ...c }, l) => {
125
+ let { toggle: u, isOpen: d, menuId: f, triggerId: h, setReference: g } = o.useContext(x), _ = s ? e : "div", v = i(g, l);
126
+ return /* @__PURE__ */ m(_, {
121
127
  ...c,
122
128
  ref: v,
123
129
  id: h,
124
- className: f(a.trigger, r),
130
+ className: p(a.trigger, r),
125
131
  onClick: u,
126
132
  "aria-haspopup": "menu",
127
133
  "aria-expanded": d,
128
- "aria-controls": d ? m : void 0,
134
+ "aria-controls": d ? f : void 0,
129
135
  role: "button",
130
136
  tabIndex: 0,
131
137
  onKeyDown: (e) => {
132
138
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), u());
133
139
  },
134
- children: /* @__PURE__ */ p(t, { children: n })
140
+ children: /* @__PURE__ */ m(t, { children: n })
135
141
  });
136
142
  });
137
- S.displayName = "Dropdown.Trigger";
138
- var C = s(({ children: e, className: t, align: r = "left", show: s, style: l, ...u }, d) => {
139
- let { isOpen: h, menuId: g, triggerId: _, setFloating: v, floatingStyles: y, setAlign: x } = o.useContext(b);
140
- c(() => {
141
- x(r);
142
- }, [r, x]);
143
+ C.displayName = "Dropdown.Trigger";
144
+ var w = s(({ children: e, className: t, align: r = "left", show: s, style: c, ...u }, d) => {
145
+ let { isOpen: f, menuId: g, triggerId: _, setFloating: v, floatingStyles: y, setAlign: b } = o.useContext(x);
146
+ l(() => {
147
+ b(r);
148
+ }, [r, b]);
143
149
  let S = i(v, d);
144
- return /* @__PURE__ */ p(m, { children: /* @__PURE__ */ p(n, {
150
+ return /* @__PURE__ */ m(h, { children: /* @__PURE__ */ m(n, {
145
151
  ...u,
146
152
  ref: S,
147
- show: s === void 0 ? h : s,
153
+ show: s === void 0 ? f : s,
148
154
  preset: "fade",
149
155
  id: g,
150
156
  style: {
151
157
  ...y,
152
- ...l
158
+ ...c
153
159
  },
154
- className: f(a.menu, t),
160
+ className: p(a.menu, t),
155
161
  role: "menu",
156
162
  "aria-labelledby": _,
157
163
  children: e
158
164
  }) });
159
165
  });
160
- C.displayName = "Dropdown.Menu";
161
- var w = s(({ children: e, onClick: t, disabled: n = !1, className: i, ...s }, c) => {
162
- let { close: l, focusedIndex: u, setFocusedIndex: m, registerItem: h } = o.useContext(b), [g] = d(() => h()), _ = u === g, v = (e) => {
166
+ w.displayName = "Dropdown.Menu";
167
+ var T = s(({ children: e, onClick: t, disabled: n = !1, className: i, ...s }, c) => {
168
+ let { close: l, focusedIndex: u, setFocusedIndex: d, registerItem: h } = o.useContext(x), [g] = f(() => h()), _ = u === g, v = (e) => {
163
169
  n || (e.stopPropagation(), t && t(), l());
164
170
  };
165
- return /* @__PURE__ */ p(r, {
171
+ return /* @__PURE__ */ m(r, {
166
172
  ...s,
167
173
  ref: c,
168
- className: f(a.item, i),
174
+ className: p(a.item, i),
169
175
  onClick: v,
170
- onFocus: () => m(g),
176
+ onFocus: () => d(g),
171
177
  disabled: n,
172
178
  role: "menuitem",
173
179
  tabIndex: _ ? 0 : -1,
@@ -177,11 +183,11 @@ var w = s(({ children: e, onClick: t, disabled: n = !1, className: i, ...s }, c)
177
183
  children: e
178
184
  });
179
185
  });
180
- w.displayName = "Dropdown.Item";
181
- var T = s((e, t) => /* @__PURE__ */ p(x, {
186
+ T.displayName = "Dropdown.Item";
187
+ var E = s((e, t) => /* @__PURE__ */ m(S, {
182
188
  ...e,
183
189
  ref: t
184
190
  }));
185
- T.displayName = "Dropdown", T.Trigger = S, T.Menu = C, T.Item = w;
191
+ E.displayName = "Dropdown", E.Trigger = C, E.Menu = w, E.Item = T;
186
192
  //#endregion
187
- export { T as Dropdown, T as default, w as DropdownItem, C as DropdownMenu, S as DropdownTrigger };
193
+ export { E as Dropdown, E as default, T as DropdownItem, w as DropdownMenu, C as DropdownTrigger };
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.30.0 — a React 19 component library: 225 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.31.0 — a React 19 component library: 225 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10
 
@@ -80,7 +80,7 @@ Single components are judged by state/a11y/token compliance. **Composed screens*
80
80
  10. Keep one elevation stance per screen: don't mix surfaces raised by shadow with surfaces cut by borders. `Card` and `Stats` default to `elevated`, so pass `variant="outline"` when the screen is border-led. If the outer container already casts a shadow, its contents need only a border. On admin/list screens, `Table`/`DataGrid` mobile cards must stay border-only like the toolbar and pagination — row cards with `shadow-sm` while chrome is flat outline is the same mixed stance.
81
81
  11. Never wrap a component that already draws its own frame. `<Card><Table card /></Card>` doubles the border and nests radii (12px inside 4px). `Table` takes a `card` prop and `Stats` is already a Card — place them directly.
82
82
  12. Always pass `intent` on `Badge` / `Tag` / `Chip`. Their default is `primary` (the accent), so an ordinary value like `pending` or `member` gets painted as loudly as an exception and the colour stops carrying information. Use `intent="neutral"` for ordinary values.
83
- 13. Pick colour by good/bad, not by direction. `Stats.Trend` ties the arrow and the colour together, so `up` is always the success colour — using it for a metric where up is bad (failures, error rate) renders the bad news as good. Use a colourless form such as `Stats.Description` instead. Don't approximate a meaning the API cannot express.
83
+ 13. Pick colour by good/bad, not by direction. On `Stats.Trend`, `direction` sets the arrow and `intent` sets the colour; without `intent` the colour follows the direction, so `up` is the success colour. For a metric where up is bad (failures, error rate, cost), write `direction="up" intent="danger"` — leaving it out renders the bad news as good. Don't approximate a meaning the API cannot express.
84
84
  14. Keep the chrome quiet. Breadcrumb, page title, summary line, toolbar and filter bar frame the content; they must not compete with the protagonist. Don't promote a one-line summary to an `Alert`/`Banner`, don't wrap the filter bar in a `Card` (its border doubles up with the data region's), keep primary surfaces out of the chrome, and don't stack a KPI tile row above a table screen. Corollary of protagonist and accent limits, but it is the rule most often broken on admin/list screens — the test is whether the eye lands on the data first.
85
85
  15. Add intentional "wobble": mix in 1–2 incomplete rows (a truncated long name, a missing optional field, an extreme value, an error/unread state) and show non-happy-path states (hover/focus/disabled/error/empty/loading).
86
86
  16. Check the screen at 390px and 768px before calling it done. The page itself must never scroll sideways (`document.scrollWidth > document.documentElement.clientWidth` is a bug — the usual cause is a group of controls that cannot wrap, e.g. several buttons packed into one `Toolbar.Group`; split them into separate groups). Data tables need their narrow mode turned on (`<DataGrid mobileCard>` / `<Table mobileCard>`) rather than an inner scrollbar: without it columns collapse and a short string like a `Code` lot number breaks one character per line. The default card switch is `container-down(sm)` (576px). Wide grids that still overflow at tablet should pass `mobileCard="md"` so cards continue through 768px.
@@ -2270,6 +2270,9 @@ Same derivation as `padding`. There is no `--wim-radius-xs` / `-3xl` /
2270
2270
  - `interval: number` = 5000 — Auto-play interval (in milliseconds)
2271
2271
  - `showIndicators: boolean` = true — Whether to show the indicators
2272
2272
  - `showControls: boolean` = true — Whether to show the previous/next buttons
2273
+ - `controlsPlacement: "overlay" | "outside"` = "overlay" — Where the arrows and indicators sit. `overlay` (default) places them on top of the
2274
+ slide, which suits full-bleed images. `outside` moves the arrows beside the viewport
2275
+ and the indicators below it, so they never cover a slide made of text.
2273
2276
  - `loop: boolean` = true — Whether to loop infinitely (seamless transitions)
2274
2277
  - `slidesToShow: number | Breakpoints` = 1 — Number of slides to show at once. A number or an object per breakpoint.
2275
2278
  - `aspectRatio: string` — Aspect ratio (e.g. '16/9', '4/3', '1/1').
@@ -2378,6 +2381,9 @@ drops secondary text below the AA contrast floor.
2378
2381
  - `description: React.ReactNode` — Description text to display.
2379
2382
  - `icon: React.ReactNode` — Icon to display.
2380
2383
  - `extra: React.ReactNode` — Element shown as an action (e.g. a button).
2384
+ - `align: "start" | "center"` = "start" — Horizontal alignment. Start-aligned reads as part of the card or table it sits
2385
+ in; use `"center"` only when the empty state is the only thing in its region.
2386
+ @default "start"
2381
2387
  - **FAQSection** — Frequently Asked Questions section
2382
2388
  - `items: FAQItem[]` (required) — FAQ items.
2383
2389
  - `title: React.ReactNode` — Main title of the section.
@@ -2433,7 +2439,8 @@ drops secondary text below the AA contrast floor.
2433
2439
  - **Marquee** — Scrolling text animation (aka Ticker)
2434
2440
  - `duration: number` = 20 — Animation speed (in seconds). Defaults to `20`.
2435
2441
  - `reverse: boolean` = false — Whether to run the animation in reverse.
2436
- - `pauseOnHover: boolean` = true — Whether to pause the animation on hover.
2442
+ - `pauseOnHover: boolean` = true — Whether to pause the animation on hover. Keyboard focus inside the marquee
2443
+ always pauses it, regardless of this option (WCAG 2.2.2).
2437
2444
  - `vertical: boolean` = false — Whether to scroll vertically.
2438
2445
  - `repeat: number` = 2 — Number of times the content is repeated. May need adjusting for a seamless loop. Defaults to `2`.
2439
2446
  - **NodeGraph** — Visualizes complex networks and relationships between nodes.
@@ -2664,6 +2671,11 @@ Cannot be combined with `onDelete` — the delete control is a second element, a
2664
2671
  - **Dropdown** — Overlay selection menu (aka Overflow Menu, Kebab Menu, Meatball Menu, Vertical Ellipsis, Horizontal Ellipsis, Three Dots Menu, More Menu, App Switcher, オーバーフローメニュー, ケバブメニュー, ミートボールメニュー)
2665
2672
  - `children: ReactNode` (required) — Dropdown parts (Dropdown.Trigger and Dropdown.Menu).
2666
2673
  - `asChild: boolean` = false — If true, the dropdown will be rendered as its child, merging its props onto that child.
2674
+ - `defaultOpen: boolean` = false — Whether the menu starts open. Use it for a screenshot, a test, or a menu that should
2675
+ already be showing. Ignored once `open` is provided.
2676
+ - `open: boolean` — Controls the open state from the outside. Pass it together with `onOpenChange`.
2677
+ - `onOpenChange: (open: boolean) => void` — Called with the next open state, both when the trigger is used and when the menu is
2678
+ dismissed by an outside click or Escape.
2667
2679
  - **FocusTrap** — Focus management
2668
2680
  - `children: React.ReactNode` (required) — Content to trap focus within.
2669
2681
  - `active: boolean` = true — Whether the trap is active.
package/dist/llms.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.30.0 — a React 19 component library: 225 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
7
+ **wimui** v0.31.0 — a React 19 component library: 225 documented components across 10 categories, with design tokens, dark mode, i18n (en/ja/pt-BR) and WAI-ARIA compliant a11y. Peer deps: react ^19, react-dom ^19 (plus optional peers for specific components — see package.json).
8
8
 
9
9
  ## Install & required setup
10
10
 
@@ -80,7 +80,7 @@ Single components are judged by state/a11y/token compliance. **Composed screens*
80
80
  10. Keep one elevation stance per screen: don't mix surfaces raised by shadow with surfaces cut by borders. `Card` and `Stats` default to `elevated`, so pass `variant="outline"` when the screen is border-led. If the outer container already casts a shadow, its contents need only a border. On admin/list screens, `Table`/`DataGrid` mobile cards must stay border-only like the toolbar and pagination — row cards with `shadow-sm` while chrome is flat outline is the same mixed stance.
81
81
  11. Never wrap a component that already draws its own frame. `<Card><Table card /></Card>` doubles the border and nests radii (12px inside 4px). `Table` takes a `card` prop and `Stats` is already a Card — place them directly.
82
82
  12. Always pass `intent` on `Badge` / `Tag` / `Chip`. Their default is `primary` (the accent), so an ordinary value like `pending` or `member` gets painted as loudly as an exception and the colour stops carrying information. Use `intent="neutral"` for ordinary values.
83
- 13. Pick colour by good/bad, not by direction. `Stats.Trend` ties the arrow and the colour together, so `up` is always the success colour — using it for a metric where up is bad (failures, error rate) renders the bad news as good. Use a colourless form such as `Stats.Description` instead. Don't approximate a meaning the API cannot express.
83
+ 13. Pick colour by good/bad, not by direction. On `Stats.Trend`, `direction` sets the arrow and `intent` sets the colour; without `intent` the colour follows the direction, so `up` is the success colour. For a metric where up is bad (failures, error rate, cost), write `direction="up" intent="danger"` — leaving it out renders the bad news as good. Don't approximate a meaning the API cannot express.
84
84
  14. Keep the chrome quiet. Breadcrumb, page title, summary line, toolbar and filter bar frame the content; they must not compete with the protagonist. Don't promote a one-line summary to an `Alert`/`Banner`, don't wrap the filter bar in a `Card` (its border doubles up with the data region's), keep primary surfaces out of the chrome, and don't stack a KPI tile row above a table screen. Corollary of protagonist and accent limits, but it is the rule most often broken on admin/list screens — the test is whether the eye lands on the data first.
85
85
  15. Add intentional "wobble": mix in 1–2 incomplete rows (a truncated long name, a missing optional field, an extreme value, an error/unread state) and show non-happy-path states (hover/focus/disabled/error/empty/loading).
86
86
  16. Check the screen at 390px and 768px before calling it done. The page itself must never scroll sideways (`document.scrollWidth > document.documentElement.clientWidth` is a bug — the usual cause is a group of controls that cannot wrap, e.g. several buttons packed into one `Toolbar.Group`; split them into separate groups). Data tables need their narrow mode turned on (`<DataGrid mobileCard>` / `<Table mobileCard>`) rather than an inner scrollbar: without it columns collapse and a short string like a `Code` lot number breaks one character per line. The default card switch is `container-down(sm)` (576px). Wide grids that still overflow at tablet should pass `mobileCard="md"` so cards continue through 768px.