wimui 0.41.0 → 0.42.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.
@@ -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("./button-group.module.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=({children:e,gap:o=`8px`,className:s,joined:c=!1,variant:l,asChild:u=!1})=>{let d=c?{}:{gap:o},f=!u&&l?r.default.Children.map(e,e=>r.default.isValidElement(e)?r.default.cloneElement(e,{variant:l}):e):e;return(0,a.jsx)(u?t.Root:`div`,{className:(0,i.default)(`wim-button-group`,n.default.root,c&&n.default.joined,s),style:d,children:f})};exports.ButtonGroup=o;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("./button-group.module.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=({children:e,gap:o=`8px`,className:s,joined:c=!1,variant:l,justify:u=`start`,asChild:d=!1})=>{let f=c?{}:{gap:o},p=!d&&l?r.default.Children.map(e,e=>r.default.isValidElement(e)?r.default.cloneElement(e,{variant:l}):e):e;return(0,a.jsx)(d?t.Root:`div`,{className:(0,i.default)(`wim-button-group`,n.default.root,c&&n.default.joined,s),style:f,"data-justify":u,children:p})};exports.ButtonGroup=o;
@@ -11,8 +11,10 @@ type ButtonGroupProps = {
11
11
  joined?: boolean;
12
12
  /** Variant applied to all child buttons */
13
13
  variant?: ButtonVariant;
14
+ /** Where the buttons sit on the row. `start` keeps the group as wide as its buttons, so it lines up with other content; `center` / `end` / `stretch` take the full row (`stretch` grows every button to share it). */
15
+ justify?: "start" | "center" | "end" | "stretch";
14
16
  /** Whether to render as a child element. */
15
17
  asChild?: boolean;
16
18
  };
17
- export declare const ButtonGroup: ({ children, gap, className, joined, variant, asChild, }: ButtonGroupProps) => React.JSX.Element;
19
+ export declare const ButtonGroup: ({ children, gap, className, joined, variant, justify, asChild, }: ButtonGroupProps) => React.JSX.Element;
18
20
  export {};
@@ -5,12 +5,13 @@ import n from "react";
5
5
  import r from "classnames";
6
6
  import { jsx as i } from "react/jsx-runtime";
7
7
  //#region src/components/form/ButtonGroup/ButtonGroup.tsx
8
- var a = ({ children: a, gap: o = "8px", className: s, joined: c = !1, variant: l, asChild: u = !1 }) => {
9
- let d = c ? {} : { gap: o }, f = !u && l ? n.Children.map(a, (e) => n.isValidElement(e) ? n.cloneElement(e, { variant: l }) : e) : a;
10
- return /* @__PURE__ */ i(u ? e : "div", {
8
+ var a = ({ children: a, gap: o = "8px", className: s, joined: c = !1, variant: l, justify: u = "start", asChild: d = !1 }) => {
9
+ let f = c ? {} : { gap: o }, p = !d && l ? n.Children.map(a, (e) => n.isValidElement(e) ? n.cloneElement(e, { variant: l }) : e) : a;
10
+ return /* @__PURE__ */ i(d ? e : "div", {
11
11
  className: r("wim-button-group", t.root, c && t.joined, s),
12
- style: d,
13
- children: f
12
+ style: f,
13
+ "data-justify": u,
14
+ children: p
14
15
  });
15
16
  };
16
17
  //#endregion
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_1u998_4`,t=`_joined_1u998_12`,n={root:e,joined:t};exports.default=n,exports.joined=t,exports.root=e;
2
+ var e=`_root_13irk_4`,t=`_joined_13irk_23`,n={root:e,joined:t};exports.default=n,exports.joined=t,exports.root=e;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/form/ButtonGroup/button-group.module.scss
3
- var e = "_root_1u998_4", t = "_joined_1u998_12", n = {
3
+ var e = "_root_13irk_4", t = "_joined_13irk_23", n = {
4
4
  root: e,
5
5
  joined: t
6
6
  };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/Transition/Transition.cjs"),r=require("../../../icon/close.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("./popover.module.cjs"),o=require("../../_internal/useFloatingElement.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"),u=require("@floating-ui/react");var d=s.default.createContext(null),f=({children:e,className:t,defaultOpen:n=!1,open:r,onOpenChange:i,placement:s=`bottom-start`,variant:u=`default`})=>{let{isOpen:f,setOpen:p,refs:m,floatingStyles:h,context:g,getReferenceProps:_,getFloatingProps:v}=o.useFloatingElement({placement:s,open:r,defaultOpen:n,onOpenChange:i,trigger:`click`});return(0,l.jsx)(d.Provider,{value:{open:f,onOpenChange:p,refs:m,floatingStyles:h,context:g,getReferenceProps:_,getFloatingProps:v,close:()=>p(!1),variant:u},children:(0,l.jsx)(`div`,{className:(0,c.default)(`wim-popover`,a.default.root,t),children:e})})},p=s.default.forwardRef(({children:e,className:t,asChild:n,...r},i)=>{let o=s.default.useContext(d);if(o==null)throw Error(`Popover components must be wrapped in <Popover />`);let f=e.ref,p=(0,u.useMergeRefs)([o.refs.setReference,i,f??null]);if(n&&s.default.isValidElement(e)){let n=e.props,i=o.getReferenceProps({ref:p,...r,...n,className:(0,c.default)(t,n.className)});return s.default.cloneElement(e,{...i,"data-state":o.open?`open`:`closed`})}return(0,l.jsx)(`button`,{ref:p,type:`button`,className:(0,c.default)(a.default.trigger,t),"data-state":o.open?`open`:`closed`,...o.getReferenceProps(r),children:e})});p.displayName=`PopoverTrigger`;var m=s.default.forwardRef(({children:e,className:t,align:r,side:i,style:o,modal:f=!1,...p},m)=>{let h=s.default.useContext(d);if(h==null)throw Error(`Popover components must be wrapped in <Popover />`);let{open:g,refs:_,floatingStyles:v,getFloatingProps:y,context:b}=h,x=(0,u.useMergeRefs)([_.setFloating,m]);return(0,l.jsx)(u.FloatingPortal,{children:(0,l.jsx)(n.Transition,{show:g,preset:`fade`,children:(0,l.jsx)(u.FloatingFocusManager,{context:b,modal:f,children:(0,l.jsx)(`div`,{ref:x,style:{...v,...o},className:(0,c.default)(a.default.content,a.default[h.variant],t),role:`dialog`,...y(p),children:e})})})})});m.displayName=`PopoverContent`;var h=({children:e,className:n,asChild:o,ariaLabel:u,...f})=>{let{t:p}=t.useWimTranslation(`common`),m=u??p(`a11y.close`),h=s.default.useContext(d);if(!h)return null;let{close:g}=h,_=e=>{g(),f.onClick?.(e)};return o&&s.default.isValidElement(e)?s.default.cloneElement(e,{onClick:t=>{e.props.onClick?.(t),_(t)},className:(0,c.default)(n,e.props.className)}):(0,l.jsx)(`button`,{type:`button`,className:(0,c.default)(a.default.close,n),onClick:_,"aria-label":m,...f,children:e||(0,l.jsx)(i.Icon,{component:r.default,size:`sm`})})};exports.Popover=f,exports.PopoverClose=h,exports.PopoverContent=m,exports.PopoverTrigger=p;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../layout/Transition/Transition.cjs"),r=require("../../../icon/close.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("./popover.module.cjs"),o=require("../../_internal/useFloatingElement.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"),u=require("@floating-ui/react");var d=s.default.createContext(null),f=({children:e,className:t,defaultOpen:n=!1,open:r,onOpenChange:i,placement:u=`bottom-start`,variant:f=`default`})=>{let{isOpen:p,setOpen:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y}=o.useFloatingElement({placement:u,open:r,defaultOpen:n,onOpenChange:i,trigger:`click`}),b=()=>m(!1),x=s.default.useId(),[S,C]=s.default.useState(`wim-popover-trigger-${x}`);return(0,l.jsx)(d.Provider,{value:{open:p,onOpenChange:m,refs:h,floatingStyles:g,context:_,getReferenceProps:v,getFloatingProps:y,close:b,variant:f,triggerId:S,setTriggerId:C},children:(0,l.jsx)(`div`,{className:(0,c.default)(`wim-popover`,a.default.root,t),children:e})})},p=s.default.forwardRef(({children:e,className:t,asChild:n,...r},i)=>{let o=s.default.useContext(d);if(o==null)throw Error(`Popover components must be wrapped in <Popover />`);let f=e.ref,p=(0,u.useMergeRefs)([o.refs.setReference,i,f??null]),m=n&&s.default.isValidElement(e)?e.props.id:void 0,h=r.id??m??o.triggerId,{setTriggerId:g}=o;if(s.default.useLayoutEffect(()=>{g(h)},[h,g]),n&&s.default.isValidElement(e)){let n=e.props,i=o.getReferenceProps({ref:p,...r,...n,id:h,className:(0,c.default)(t,n.className)});return s.default.cloneElement(e,{...i,"data-state":o.open?`open`:`closed`})}return(0,l.jsx)(`button`,{ref:p,type:`button`,className:(0,c.default)(a.default.trigger,t),"data-state":o.open?`open`:`closed`,...o.getReferenceProps({...r,id:h}),children:e})});p.displayName=`PopoverTrigger`;var m=s.default.forwardRef(({children:e,className:t,align:r,side:i,style:o,modal:f=!1,...p},m)=>{let h=s.default.useContext(d);if(h==null)throw Error(`Popover components must be wrapped in <Popover />`);let{open:g,refs:_,floatingStyles:v,getFloatingProps:y,context:b,triggerId:x}=h,S=p[`aria-label`]!=null||p[`aria-labelledby`]!=null?p[`aria-labelledby`]:x,C=(0,u.useMergeRefs)([_.setFloating,m]);return(0,l.jsx)(u.FloatingPortal,{children:(0,l.jsx)(n.Transition,{show:g,preset:`fade`,children:(0,l.jsx)(u.FloatingFocusManager,{context:b,modal:f,children:(0,l.jsx)(`div`,{ref:C,style:{...v,...o},className:(0,c.default)(a.default.content,a.default[h.variant],t),role:`dialog`,...y(p),"aria-labelledby":S,children:e})})})})});m.displayName=`PopoverContent`;var h=({children:e,className:n,asChild:o,ariaLabel:u,...f})=>{let{t:p}=t.useWimTranslation(`common`),m=u??p(`a11y.close`),h=s.default.useContext(d);if(!h)return null;let{close:g}=h,_=e=>{g(),f.onClick?.(e)};return o&&s.default.isValidElement(e)?s.default.cloneElement(e,{onClick:t=>{e.props.onClick?.(t),_(t)},className:(0,c.default)(n,e.props.className)}):(0,l.jsx)(`button`,{type:`button`,className:(0,c.default)(a.default.close,n),onClick:_,"aria-label":m,...f,children:e||(0,l.jsx)(i.Icon,{component:r.default,size:`sm`})})};exports.Popover=f,exports.PopoverClose=h,exports.PopoverContent=m,exports.PopoverTrigger=p;
@@ -10,25 +10,27 @@ import s from "classnames";
10
10
  import { jsx as c } from "react/jsx-runtime";
11
11
  import { FloatingFocusManager as l, FloatingPortal as u, useMergeRefs as d } from "@floating-ui/react";
12
12
  //#region src/components/overlay/Popover/Popover.tsx
13
- var f = o.createContext(null), p = ({ children: e, className: t, defaultOpen: n = !1, open: r, onOpenChange: o, placement: l = "bottom-start", variant: u = "default" }) => {
14
- let { isOpen: d, setOpen: p, refs: m, floatingStyles: h, context: g, getReferenceProps: _, getFloatingProps: v } = a({
15
- placement: l,
13
+ var f = o.createContext(null), p = ({ children: e, className: t, defaultOpen: n = !1, open: r, onOpenChange: l, placement: u = "bottom-start", variant: d = "default" }) => {
14
+ let { isOpen: p, setOpen: m, refs: h, floatingStyles: g, context: _, getReferenceProps: v, getFloatingProps: y } = a({
15
+ placement: u,
16
16
  open: r,
17
17
  defaultOpen: n,
18
- onOpenChange: o,
18
+ onOpenChange: l,
19
19
  trigger: "click"
20
- });
20
+ }), b = () => m(!1), x = o.useId(), [S, C] = o.useState(`wim-popover-trigger-${x}`);
21
21
  return /* @__PURE__ */ c(f.Provider, {
22
22
  value: {
23
- open: d,
24
- onOpenChange: p,
25
- refs: m,
26
- floatingStyles: h,
27
- context: g,
28
- getReferenceProps: _,
29
- getFloatingProps: v,
30
- close: () => p(!1),
31
- variant: u
23
+ open: p,
24
+ onOpenChange: m,
25
+ refs: h,
26
+ floatingStyles: g,
27
+ context: _,
28
+ getReferenceProps: v,
29
+ getFloatingProps: y,
30
+ close: b,
31
+ variant: d,
32
+ triggerId: S,
33
+ setTriggerId: C
32
34
  },
33
35
  children: /* @__PURE__ */ c("div", {
34
36
  className: s("wim-popover", i.root, t),
@@ -42,12 +44,15 @@ var f = o.createContext(null), p = ({ children: e, className: t, defaultOpen: n
42
44
  l.refs.setReference,
43
45
  a,
44
46
  u ?? null
45
- ]);
46
- if (n && o.isValidElement(e)) {
47
+ ]), m = n && o.isValidElement(e) ? e.props.id : void 0, h = r.id ?? m ?? l.triggerId, { setTriggerId: g } = l;
48
+ if (o.useLayoutEffect(() => {
49
+ g(h);
50
+ }, [h, g]), n && o.isValidElement(e)) {
47
51
  let n = e.props, i = l.getReferenceProps({
48
52
  ref: p,
49
53
  ...r,
50
54
  ...n,
55
+ id: h,
51
56
  className: s(t, n.className)
52
57
  });
53
58
  return o.cloneElement(e, {
@@ -60,7 +65,10 @@ var f = o.createContext(null), p = ({ children: e, className: t, defaultOpen: n
60
65
  type: "button",
61
66
  className: s(i.trigger, t),
62
67
  "data-state": l.open ? "open" : "closed",
63
- ...l.getReferenceProps(r),
68
+ ...l.getReferenceProps({
69
+ ...r,
70
+ id: h
71
+ }),
64
72
  children: e
65
73
  });
66
74
  });
@@ -68,7 +76,7 @@ m.displayName = "PopoverTrigger";
68
76
  var h = o.forwardRef(({ children: e, className: n, align: r, side: a, style: p, modal: m = !1, ...h }, g) => {
69
77
  let _ = o.useContext(f);
70
78
  if (_ == null) throw Error("Popover components must be wrapped in <Popover />");
71
- let { open: v, refs: y, floatingStyles: b, getFloatingProps: x, context: S } = _, C = d([y.setFloating, g]);
79
+ let { open: v, refs: y, floatingStyles: b, getFloatingProps: x, context: S, triggerId: C } = _, w = h["aria-label"] != null || h["aria-labelledby"] != null ? h["aria-labelledby"] : C, T = d([y.setFloating, g]);
72
80
  return /* @__PURE__ */ c(u, { children: /* @__PURE__ */ c(t, {
73
81
  show: v,
74
82
  preset: "fade",
@@ -76,7 +84,7 @@ var h = o.forwardRef(({ children: e, className: n, align: r, side: a, style: p,
76
84
  context: S,
77
85
  modal: m,
78
86
  children: /* @__PURE__ */ c("div", {
79
- ref: C,
87
+ ref: T,
80
88
  style: {
81
89
  ...b,
82
90
  ...p
@@ -84,6 +92,7 @@ var h = o.forwardRef(({ children: e, className: n, align: r, side: a, style: p,
84
92
  className: s(i.content, i[_.variant], n),
85
93
  role: "dialog",
86
94
  ...x(h),
95
+ "aria-labelledby": w,
87
96
  children: e
88
97
  })
89
98
  })
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.41.0 — a React 19 component library: 227 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.42.0 — a React 19 component library: 227 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
 
@@ -949,6 +949,7 @@ Useful for using the button styles with Link components (e.g. from React Router
949
949
  - `className: string` — Additional class names
950
950
  - `joined: boolean` = false — Whether to join the buttons into a single connected unit
951
951
  - `variant: "solid" | "outline" | "ghost"` — Variant applied to all child buttons
952
+ - `justify: "start" | "center" | "end" | "stretch"` = "start" — Where the buttons sit on the row. `start` keeps the group as wide as its buttons, so it lines up with other content; `center` / `end` / `stretch` take the full row (`stretch` grows every button to share it).
952
953
  - `asChild: boolean` = false — Whether to render as a child element.
953
954
  - **Cascader** — Hierarchical selection (aka Column View, Miller Columns)
954
955
  - `options: CascaderOption[]` = [] — Hierarchical options to select from
package/dist/llms.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## What this is
6
6
 
7
- **wimui** v0.41.0 — a React 19 component library: 227 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.42.0 — a React 19 component library: 227 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