wimui 0.66.0 → 0.67.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 (45) hide show
  1. package/dist/components/_internal/ChoiceLabel.cjs +2 -0
  2. package/dist/components/_internal/ChoiceLabel.d.ts +31 -0
  3. package/dist/components/_internal/ChoiceLabel.js +22 -0
  4. package/dist/components/_internal/choice-label.module.cjs +2 -0
  5. package/dist/components/_internal/choice-label.module.js +11 -0
  6. package/dist/components/_internal/rovingIndex.cjs +2 -0
  7. package/dist/components/_internal/rovingIndex.d.ts +38 -0
  8. package/dist/components/_internal/rovingIndex.js +16 -0
  9. package/dist/components/data-display/Card/Card.cjs +1 -1
  10. package/dist/components/data-display/Card/Card.d.ts +21 -0
  11. package/dist/components/data-display/Card/Card.js +7 -3
  12. package/dist/components/data-display/Card/card.module.cjs +1 -1
  13. package/dist/components/data-display/Card/card.module.js +17 -16
  14. package/dist/components/form/CheckboxGroup/CheckboxGroup.cjs +1 -1
  15. package/dist/components/form/CheckboxGroup/CheckboxGroup.d.ts +9 -0
  16. package/dist/components/form/CheckboxGroup/CheckboxGroup.js +42 -30
  17. package/dist/components/form/CheckboxGroup/checkbox-group.module.cjs +1 -1
  18. package/dist/components/form/CheckboxGroup/checkbox-group.module.js +4 -3
  19. package/dist/components/form/RadioGroup/RadioGroup.cjs +1 -1
  20. package/dist/components/form/RadioGroup/RadioGroup.d.ts +9 -0
  21. package/dist/components/form/RadioGroup/RadioGroup.js +46 -34
  22. package/dist/components/form/RadioGroup/radio-group.module.cjs +1 -1
  23. package/dist/components/form/RadioGroup/radio-group.module.js +4 -3
  24. package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
  25. package/dist/components/form/SegmentedControl/SegmentedControl.js +56 -68
  26. package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
  27. package/dist/components/form/ToggleGroup/ToggleGroup.js +80 -88
  28. package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
  29. package/dist/components/layout/Toolbar/Toolbar.js +52 -51
  30. package/dist/components/navigation/Stepper/Stepper.cjs +1 -1
  31. package/dist/components/navigation/Stepper/Stepper.js +51 -53
  32. package/dist/components/navigation/TabNavigation/TabNavigation.cjs +1 -1
  33. package/dist/components/navigation/TabNavigation/TabNavigation.js +47 -49
  34. package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
  35. package/dist/components/navigation/Tabs/Tabs.js +80 -73
  36. package/dist/data-display.cjs +1 -1
  37. package/dist/data-display.js +40 -40
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.js +174 -174
  40. package/dist/llms-full.txt +9 -1
  41. package/dist/llms.txt +1 -1
  42. package/dist/styles.css +1 -1
  43. package/dist/wimui.umd.css +1 -1
  44. package/dist/wimui.umd.js +5 -5
  45. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./choice-label.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i={card:t.default.card,top:t.default.top},a=({label:e,description:n,descriptionId:i,labelId:a})=>n?(0,r.jsxs)(`span`,{className:t.default.content,children:[(0,r.jsx)(`span`,{id:a,className:t.default.label,children:e}),(0,r.jsx)(`span`,{id:i,className:t.default.description,children:n})]}):(0,r.jsx)(r.Fragment,{children:e});exports.ChoiceLabel=a,exports.choiceLabelClasses=i;
@@ -0,0 +1,31 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * 選択肢の根(`Radio` / `Checkbox` の `<label>`)に付けるクラス。
4
+ * `card` はカードの見た目、`top` は説明文があるときに入力を 1 行目へ揃える。
5
+ */
6
+ export declare const choiceLabelClasses: {
7
+ card: string;
8
+ top: string;
9
+ };
10
+ export interface ChoiceLabelProps {
11
+ /** The option's name */
12
+ label: string;
13
+ /** A second line that explains the option */
14
+ description?: string;
15
+ /** Id for the description, so the input can point at it with `aria-describedby` */
16
+ descriptionId?: string;
17
+ /** Id for the label text, so the input can take only the label as its name with `aria-labelledby` */
18
+ labelId?: string;
19
+ }
20
+ /**
21
+ * RadioGroup / CheckboxGroup の選択肢の文字(名前と、あれば説明文)。T365。
22
+ *
23
+ * 説明文は `<label>` の中に置く(カードのどこを押しても選べるように)。そのままでは説明文が
24
+ * 名前にも入り、`aria-describedby` と合わせて 2 回読まれる(Chrome の計算で確かめた)ので、
25
+ * 入力の名前は `aria-labelledby` で名前の文字だけを指し、説明文は `aria-describedby` で指す。
26
+ *
27
+ * Composition Contract:
28
+ * - Managed by: RadioGroup / CheckboxGroup(`options[].description` と `variant`)
29
+ * - Scroll lock: No
30
+ */
31
+ export declare const ChoiceLabel: ({ label, description, descriptionId, labelId }: ChoiceLabelProps) => React.ReactElement;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import e from "./choice-label.module.js";
3
+ import "react";
4
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region src/components/_internal/ChoiceLabel.tsx
6
+ var i = {
7
+ card: e.card,
8
+ top: e.top
9
+ }, a = ({ label: i, description: a, descriptionId: o, labelId: s }) => a ? /* @__PURE__ */ r("span", {
10
+ className: e.content,
11
+ children: [/* @__PURE__ */ n("span", {
12
+ id: s,
13
+ className: e.label,
14
+ children: i
15
+ }), /* @__PURE__ */ n("span", {
16
+ id: o,
17
+ className: e.description,
18
+ children: a
19
+ })]
20
+ }) : /* @__PURE__ */ n(t, { children: i });
21
+ //#endregion
22
+ export { a as ChoiceLabel, i as choiceLabelClasses };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=`_content_gpfhr_3`,t=`_label_gpfhr_9`,n=`_description_gpfhr_12`,r=`_top_gpfhr_17`,i=`_card_gpfhr_22`,a={content:e,label:t,description:n,top:r,card:i};exports.card=i,exports.content=e,exports.default=a,exports.description=n,exports.label=t,exports.top=r;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ //#region src/components/_internal/choice-label.module.scss
3
+ var e = "_content_gpfhr_3", t = "_label_gpfhr_9", n = "_description_gpfhr_12", r = "_top_gpfhr_17", i = "_card_gpfhr_22", a = {
4
+ content: e,
5
+ label: t,
6
+ description: n,
7
+ top: r,
8
+ card: i
9
+ };
10
+ //#endregion
11
+ export { i as card, e as content, a as default, n as description, t as label, r as top };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var e=e=>e===`ArrowRight`||e===`ArrowDown`,t=(e,t=`both`)=>e===`Home`||e===`End`||t!==`vertical`&&(e===`ArrowRight`||e===`ArrowLeft`)||t!==`horizontal`&&(e===`ArrowDown`||e===`ArrowUp`),n=({key:n,current:r,count:i,orientation:a=`both`,wrap:o=!0,isDisabled:s=()=>!1})=>{if(i<=0||!t(n,a))return null;let c=n===`Home`||n===`End`,l=n===`Home`||!c&&e(n)?1:-1,u=r>=0&&r<i,d=c||!u?l===1?-1:i:r;for(let e=0;e<i;e++){if(d+=l,d<0||d>=i){if(c||!o)return u&&!c?r:null;d=(d+i)%i}if(!s(d))return d}return null};exports.getRovingIndex=n,exports.isRovingKey=t;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 並んだ項目の上で、矢印キーと Home / End が「次にどこへ行くか」を決める(T366)。
3
+ *
4
+ * Tabs / TabNavigation / Toolbar / Stepper / SegmentedControl / ToggleGroup が、それぞれ
5
+ * 同じ計算を書いていた。ずれていたのは 3 点だけ ── 効く矢印の向き・無効の項目を飛ばすか・
6
+ * 端で折り返すか。ここでは計算だけを持ち、フォーカスを動かす・選択を変える、は各部品に残す
7
+ * (部品ごとに、項目の持ち方も、動いたあとにすることも違うため)。
8
+ *
9
+ * 無効の項目は飛ばす。飛ばさないと、Tabs では矢印で無効のタブが選ばれ、フォーカスだけが
10
+ * 元のタブに残っていた(無効のボタンにはフォーカスが乗らない。T366 で見つけた)。
11
+ *
12
+ * Composition Contract:
13
+ * - Managed by: 呼び出す部品(キーの処理・preventDefault・フォーカス・選択)
14
+ * - Scroll lock: No
15
+ */
16
+ /** どの矢印で動くか。`both` は上下左右のどれでも(向きを持たない並び)。 */
17
+ export type RovingOrientation = "horizontal" | "vertical" | "both";
18
+ export interface RovingIndexOptions {
19
+ /** `KeyboardEvent.key` */
20
+ key: string;
21
+ /** 今の位置。並びの外(-1)なら、次へは先頭・前へは末尾 */
22
+ current: number;
23
+ /** 項目の数 */
24
+ count: number;
25
+ /** @default "both" */
26
+ orientation?: RovingOrientation;
27
+ /** 端で反対の端へ折り返すか。@default true */
28
+ wrap?: boolean;
29
+ /** その位置の項目が無効か。無効の項目には止まらない */
30
+ isDisabled?: (index: number) => boolean;
31
+ }
32
+ /** この並びで扱うキーか(扱うなら、呼び出し側は `preventDefault` してよい) */
33
+ export declare const isRovingKey: (key: string, orientation?: RovingOrientation) => boolean;
34
+ /**
35
+ * 次の位置を返す。扱わないキー、または止まれる項目が 1 つも無いときは `null`。
36
+ * 折り返さない並びで端にいるときは、今の位置をそのまま返す。
37
+ */
38
+ export declare const getRovingIndex: ({ key, current, count, orientation, wrap, isDisabled, }: RovingIndexOptions) => number | null;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ //#region src/components/_internal/rovingIndex.ts
3
+ var e = (e) => e === "ArrowRight" || e === "ArrowDown", t = (e, t = "both") => e === "Home" || e === "End" || t !== "vertical" && (e === "ArrowRight" || e === "ArrowLeft") || t !== "horizontal" && (e === "ArrowDown" || e === "ArrowUp"), n = ({ key: n, current: r, count: i, orientation: a = "both", wrap: o = !0, isDisabled: s = () => !1 }) => {
4
+ if (i <= 0 || !t(n, a)) return null;
5
+ let c = n === "Home" || n === "End", l = n === "Home" || !c && e(n) ? 1 : -1, u = r >= 0 && r < i, d = c || !u ? l === 1 ? -1 : i : r;
6
+ for (let e = 0; e < i; e++) {
7
+ if (d += l, d < 0 || d >= i) {
8
+ if (c || !o) return u && !c ? r : null;
9
+ d = (d + i) % i;
10
+ }
11
+ if (!s(d)) return d;
12
+ }
13
+ return null;
14
+ };
15
+ //#endregion
16
+ export { n as getRovingIndex, t as isRovingKey };
@@ -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("../../../utilities/warn-unstyled-value.cjs"),r=require("./styled-values.cjs"),i=require("./card.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=a.default.forwardRef(({asChild:e=!1,variant:a=`outline`,padding:c=`md`,radius:l=`lg`,interactive:u=!1,className:d,children:f,...p},m)=>{let h=e?t.Root:`div`;return r.CARD_STYLED_PADDING.includes(c)||n.warnUnstyledValue(`Card`,`padding`,c,r.CARD_STYLED_PADDING),r.CARD_STYLED_RADIUS.includes(l)||n.warnUnstyledValue(`Card`,`radius`,l,r.CARD_STYLED_RADIUS),(0,s.jsx)(h,{ref:m,className:(0,o.default)(`wim-card`,i.default.root,i.default[a],i.default[`padding-${c}`],i.default[`radius-${l}`],u&&i.default.interactive,d),...p,children:f})});c.displayName=`Card`;var l=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.header,e),...n,children:t}),u=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.body,e),...n,children:t}),d=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.footer,e),...n,children:t});l.displayName=`Card.Header`,u.displayName=`Card.Body`,d.displayName=`Card.Footer`,c.Header=l,c.Body=u,c.Footer=d,exports.Card=c,exports.default=c,exports.CardBody=u,exports.CardFooter=d,exports.CardHeader=l;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/warn-unstyled-value.cjs"),r=require("./styled-values.cjs"),i=require("./card.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=a.default.forwardRef(({asChild:e=!1,variant:a=`outline`,padding:c=`md`,radius:l=`lg`,interactive:u=!1,className:d,children:f,...p},m)=>{let h=e?t.Root:`div`;return r.CARD_STYLED_PADDING.includes(c)||n.warnUnstyledValue(`Card`,`padding`,c,r.CARD_STYLED_PADDING),r.CARD_STYLED_RADIUS.includes(l)||n.warnUnstyledValue(`Card`,`radius`,l,r.CARD_STYLED_RADIUS),(0,s.jsx)(h,{ref:m,className:(0,o.default)(`wim-card`,i.default.root,i.default[a],i.default[`padding-${c}`],i.default[`radius-${l}`],u&&i.default.interactive,d),...p,children:f})});c.displayName=`Card`;var l=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.header,e),...n,children:t}),u=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.body,e),...n,children:t}),d=({className:e,children:t,...n})=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.footer,e),...n,children:t}),f=a.default.forwardRef(({asChild:e=!1,className:n,...r},a)=>(0,s.jsx)(e?t.Root:`a`,{ref:a,className:(0,o.default)(`wim-card-link`,i.default.link,n),...r}));l.displayName=`Card.Header`,u.displayName=`Card.Body`,d.displayName=`Card.Footer`,f.displayName=`Card.Link`,c.Header=l,c.Body=u,c.Footer=d,c.Link=f,exports.Card=c,exports.default=c,exports.CardBody=u,exports.CardFooter=d,exports.CardHeader=l,exports.CardLink=f;
@@ -35,6 +35,7 @@ interface CardComponent {
35
35
  Header: typeof CardHeader;
36
36
  Body: typeof CardBody;
37
37
  Footer: typeof CardFooter;
38
+ Link: typeof CardLink;
38
39
  }
39
40
  /**
40
41
  * `Card` はコンテンツをグループ化して表示するためのコンテナコンポーネントです。
@@ -52,4 +53,24 @@ export declare const CardFooter: {
52
53
  ({ className, children, ...props }: React.ComponentPropsWithoutRef<"div">): React.JSX.Element;
53
54
  displayName: string;
54
55
  };
56
+ export type CardLinkProps = React.ComponentPropsWithoutRef<"a"> & {
57
+ /** Render your own element (a router `Link`, or a `button`) instead of an `<a>`. */
58
+ asChild?: boolean;
59
+ };
60
+ /**
61
+ * The main link of a card, stretched over the whole card (T365).
62
+ *
63
+ * Put the link text where it reads naturally (usually the title). Clicking
64
+ * anywhere on the card follows it, while other buttons and links inside the
65
+ * card stay separate targets above it, so nothing interactive is nested in
66
+ * the link. Text inside the card cannot be selected by dragging, because the
67
+ * link covers it.
68
+ *
69
+ * Use one per card. Pair it with `interactive` on the `Card` for the hover
70
+ * and press feedback.
71
+ */
72
+ export declare const CardLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
73
+ /** Render your own element (a router `Link`, or a `button`) instead of an `<a>`. */
74
+ asChild?: boolean;
75
+ } & React.RefAttributes<HTMLAnchorElement>>;
55
76
  export default Card;
@@ -28,7 +28,11 @@ var l = ({ className: e, children: t, ...n }) => /* @__PURE__ */ s("div", {
28
28
  className: o(i.footer, e),
29
29
  ...n,
30
30
  children: t
31
- });
32
- l.displayName = "Card.Header", u.displayName = "Card.Body", d.displayName = "Card.Footer", c.Header = l, c.Body = u, c.Footer = d;
31
+ }), f = a.forwardRef(({ asChild: t = !1, className: n, ...r }, a) => /* @__PURE__ */ s(t ? e : "a", {
32
+ ref: a,
33
+ className: o("wim-card-link", i.link, n),
34
+ ...r
35
+ }));
36
+ l.displayName = "Card.Header", u.displayName = "Card.Body", d.displayName = "Card.Footer", f.displayName = "Card.Link", c.Header = l, c.Body = u, c.Footer = d, c.Link = f;
33
37
  //#endregion
34
- export { c as Card, c as default, u as CardBody, d as CardFooter, l as CardHeader };
38
+ export { c as Card, c as default, u as CardBody, d as CardFooter, l as CardHeader, f as CardLink };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_lfz7s_3`,t=`_elevated_lfz7s_14`,n=`_interactive_lfz7s_18`,r=`_outline_lfz7s_21`,i=`_flat_lfz7s_27`,a=`_glass_lfz7s_34`,o=`_header_lfz7s_55`,s=`_body_lfz7s_55`,c=`_footer_lfz7s_55`,l={root:e,elevated:t,interactive:n,outline:r,flat:i,glass:a,"padding-none":`_padding-none_lfz7s_52`,header:o,body:s,footer:c,"padding-xs":`_padding-xs_lfz7s_58`,"padding-sm":`_padding-sm_lfz7s_64`,"padding-md":`_padding-md_lfz7s_70`,"padding-lg":`_padding-lg_lfz7s_76`,"padding-xl":`_padding-xl_lfz7s_96`,"padding-2xl":`_padding-2xl_lfz7s_102`,"padding-3xl":`_padding-3xl_lfz7s_108`,"radius-none":`_radius-none_lfz7s_117`,"radius-sm":`_radius-sm_lfz7s_120`,"radius-md":`_radius-md_lfz7s_123`,"radius-lg":`_radius-lg_lfz7s_126`,"radius-xl":`_radius-xl_lfz7s_134`,"radius-2xl":`_radius-2xl_lfz7s_137`};exports.body=s,exports.default=l,exports.elevated=t,exports.flat=i,exports.footer=c,exports.glass=a,exports.header=o,exports.interactive=n,exports.outline=r,exports.root=e;
2
+ var e=`_root_1jf6x_3`,t=`_elevated_1jf6x_14`,n=`_interactive_1jf6x_18`,r=`_outline_1jf6x_21`,i=`_flat_1jf6x_27`,a=`_glass_1jf6x_34`,o=`_header_1jf6x_55`,s=`_body_1jf6x_55`,c=`_footer_1jf6x_55`,l=`_link_1jf6x_158`,u={root:e,elevated:t,interactive:n,outline:r,flat:i,glass:a,"padding-none":`_padding-none_1jf6x_52`,header:o,body:s,footer:c,"padding-xs":`_padding-xs_1jf6x_58`,"padding-sm":`_padding-sm_1jf6x_64`,"padding-md":`_padding-md_1jf6x_70`,"padding-lg":`_padding-lg_1jf6x_76`,"padding-xl":`_padding-xl_1jf6x_96`,"padding-2xl":`_padding-2xl_1jf6x_102`,"padding-3xl":`_padding-3xl_1jf6x_108`,"radius-none":`_radius-none_1jf6x_117`,"radius-sm":`_radius-sm_1jf6x_121`,"radius-md":`_radius-md_1jf6x_125`,"radius-lg":`_radius-lg_1jf6x_129`,"radius-xl":`_radius-xl_1jf6x_138`,"radius-2xl":`_radius-2xl_1jf6x_142`,link:l};exports.body=s,exports.default=u,exports.elevated=t,exports.flat=i,exports.footer=c,exports.glass=a,exports.header=o,exports.interactive=n,exports.link=l,exports.outline=r,exports.root=e;
@@ -1,29 +1,30 @@
1
1
  "use client";
2
2
  //#region src/components/data-display/Card/card.module.scss
3
- var e = "_root_lfz7s_3", t = "_elevated_lfz7s_14", n = "_interactive_lfz7s_18", r = "_outline_lfz7s_21", i = "_flat_lfz7s_27", a = "_glass_lfz7s_34", o = "_header_lfz7s_55", s = "_body_lfz7s_55", c = "_footer_lfz7s_55", l = {
3
+ var e = "_root_1jf6x_3", t = "_elevated_1jf6x_14", n = "_interactive_1jf6x_18", r = "_outline_1jf6x_21", i = "_flat_1jf6x_27", a = "_glass_1jf6x_34", o = "_header_1jf6x_55", s = "_body_1jf6x_55", c = "_footer_1jf6x_55", l = "_link_1jf6x_158", u = {
4
4
  root: e,
5
5
  elevated: t,
6
6
  interactive: n,
7
7
  outline: r,
8
8
  flat: i,
9
9
  glass: a,
10
- "padding-none": "_padding-none_lfz7s_52",
10
+ "padding-none": "_padding-none_1jf6x_52",
11
11
  header: o,
12
12
  body: s,
13
13
  footer: c,
14
- "padding-xs": "_padding-xs_lfz7s_58",
15
- "padding-sm": "_padding-sm_lfz7s_64",
16
- "padding-md": "_padding-md_lfz7s_70",
17
- "padding-lg": "_padding-lg_lfz7s_76",
18
- "padding-xl": "_padding-xl_lfz7s_96",
19
- "padding-2xl": "_padding-2xl_lfz7s_102",
20
- "padding-3xl": "_padding-3xl_lfz7s_108",
21
- "radius-none": "_radius-none_lfz7s_117",
22
- "radius-sm": "_radius-sm_lfz7s_120",
23
- "radius-md": "_radius-md_lfz7s_123",
24
- "radius-lg": "_radius-lg_lfz7s_126",
25
- "radius-xl": "_radius-xl_lfz7s_134",
26
- "radius-2xl": "_radius-2xl_lfz7s_137"
14
+ "padding-xs": "_padding-xs_1jf6x_58",
15
+ "padding-sm": "_padding-sm_1jf6x_64",
16
+ "padding-md": "_padding-md_1jf6x_70",
17
+ "padding-lg": "_padding-lg_1jf6x_76",
18
+ "padding-xl": "_padding-xl_1jf6x_96",
19
+ "padding-2xl": "_padding-2xl_1jf6x_102",
20
+ "padding-3xl": "_padding-3xl_1jf6x_108",
21
+ "radius-none": "_radius-none_1jf6x_117",
22
+ "radius-sm": "_radius-sm_1jf6x_121",
23
+ "radius-md": "_radius-md_1jf6x_125",
24
+ "radius-lg": "_radius-lg_1jf6x_129",
25
+ "radius-xl": "_radius-xl_1jf6x_138",
26
+ "radius-2xl": "_radius-2xl_1jf6x_142",
27
+ link: l
27
28
  };
28
29
  //#endregion
29
- export { s as body, l as default, t as elevated, i as flat, c as footer, a as glass, o as header, n as interactive, r as outline, e as root };
30
+ export { s as body, u as default, t as elevated, i as flat, c as footer, a as glass, o as header, n as interactive, l as link, r as outline, e as root };
@@ -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("../FieldTemplate/FieldTemplate.cjs"),r=require("../Checkbox/Checkbox.cjs"),i=require("./checkbox-group.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(0,a.forwardRef)(({options:e,value:c,defaultValue:l=[],onChange:u,direction:d=`vertical`,name:f,className:p,label:m,error:h,required:g,disabled:_,asChild:v=!1,children:y,...b},x)=>{let S=c!==void 0,[C,w]=(0,a.useState)(l),T=`wim-checkbox-group-${(0,a.useId)()}`,E=`${T}-label`,D=h?`${T}-error`:void 0,O=S?c:C,k=(e,t)=>{let n;n=t?[...O,e]:O.filter(t=>t!==e),S||w(n),u&&u(n)};return(0,s.jsx)(n.FieldTemplate,{label:m,error:h,required:g,labelId:E,errorId:D,className:p,children:(0,s.jsxs)(v?t.Root:`div`,{...b,ref:x,className:(0,o.default)(`wim-checkbox-group`,i.default.root,d===`horizontal`&&i.default.horizontal),role:`group`,"aria-labelledby":m?E:b[`aria-labelledby`],"aria-describedby":[b[`aria-describedby`],D].filter(Boolean).join(` `)||void 0,children:[e.map(e=>(0,s.jsx)(r.Checkbox,{value:e.value,checked:O.includes(e.value),disabled:_||e.disabled,error:!!h,name:f,onChange:t=>k(e.value,t.target.checked),children:e.label},e.value)),(0,s.jsx)(t.Slottable,{children:y})]})})});c.displayName=`CheckboxGroup`,exports.CheckboxGroup=c,exports.default=c;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),r=require("../Checkbox/Checkbox.cjs"),i=require("./checkbox-group.module.cjs"),a=require("../../_internal/ChoiceLabel.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");var l=(0,o.forwardRef)(({options:e,value:l,defaultValue:u=[],onChange:d,direction:f=`vertical`,variant:p=`default`,name:m,className:h,label:g,error:_,required:v,disabled:y,asChild:b=!1,children:x,...S},C)=>{let w=l!==void 0,[T,E]=(0,o.useState)(u),D=`wim-checkbox-group-${(0,o.useId)()}`,O=`${D}-label`,k=_?`${D}-error`:void 0,A=w?l:T,j=(e,t)=>{let n;n=t?[...A,e]:A.filter(t=>t!==e),w||E(n),d&&d(n)};return(0,c.jsx)(n.FieldTemplate,{label:g,error:_,required:v,labelId:O,errorId:k,className:h,children:(0,c.jsxs)(b?t.Root:`div`,{...S,ref:C,className:(0,s.default)(`wim-checkbox-group`,i.default.root,f===`horizontal`&&i.default.horizontal,p===`card`&&i.default.cards),role:`group`,"aria-labelledby":g?O:S[`aria-labelledby`],"aria-describedby":[S[`aria-describedby`],k].filter(Boolean).join(` `)||void 0,children:[e.map(e=>{let t=e.description?`${D}-${e.value}-description`:void 0,n=e.description?`${D}-${e.value}-label`:void 0;return(0,c.jsx)(r.Checkbox,{value:e.value,checked:A.includes(e.value),disabled:y||e.disabled,error:!!_,name:m,onChange:t=>j(e.value,t.target.checked),"aria-describedby":t,"aria-labelledby":n,className:(0,s.default)(p===`card`&&a.choiceLabelClasses.card,e.description&&a.choiceLabelClasses.top),children:(0,c.jsx)(a.ChoiceLabel,{label:e.label,description:e.description,descriptionId:t,labelId:n})},e.value)}),(0,c.jsx)(t.Slottable,{children:x})]})})});l.displayName=`CheckboxGroup`,exports.CheckboxGroup=l,exports.default=l;
@@ -3,6 +3,8 @@ type Option = {
3
3
  label: string;
4
4
  value: string;
5
5
  disabled?: boolean;
6
+ /** A second line that explains the option (shown under the label, and linked with `aria-describedby`) */
7
+ description?: string;
6
8
  };
7
9
  export interface CheckboxGroupProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue"> {
8
10
  /** List of checkbox options */
@@ -15,6 +17,13 @@ export interface CheckboxGroupProps extends Omit<React.ComponentPropsWithoutRef<
15
17
  onChange?: (value: string[]) => void;
16
18
  /** Layout direction of the checkboxes */
17
19
  direction?: "vertical" | "horizontal";
20
+ /**
21
+ * `card` draws each option as a bordered card that is selectable as a whole
22
+ * (the card is the option's `<label>`). Keys and group semantics stay those
23
+ * of a checkbox group. Use with `description` when the options need explaining.
24
+ * @default "default"
25
+ */
26
+ variant?: "default" | "card";
18
27
  /** Name attribute shared by the checkbox inputs */
19
28
  name?: string;
20
29
  /** Whether to render as a child element. */
@@ -3,41 +3,53 @@ import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react
3
3
  import { FieldTemplate as n } from "../FieldTemplate/FieldTemplate.js";
4
4
  import { Checkbox as r } from "../Checkbox/Checkbox.js";
5
5
  import i from "./checkbox-group.module.js";
6
- import { forwardRef as a, useId as o, useState as s } from "react";
7
- import c from "classnames";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ import { ChoiceLabel as a, choiceLabelClasses as o } from "../../_internal/ChoiceLabel.js";
7
+ import { forwardRef as s, useId as c, useState as l } from "react";
8
+ import u from "classnames";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
10
  //#region src/components/form/CheckboxGroup/CheckboxGroup.tsx
10
- var d = a(({ options: a, value: d, defaultValue: f = [], onChange: p, direction: m = "vertical", name: h, className: g, label: _, error: v, required: y, disabled: b, asChild: x = !1, children: S, ...C }, w) => {
11
- let T = d !== void 0, [E, D] = s(f), O = `wim-checkbox-group-${o()}`, k = `${O}-label`, A = v ? `${O}-error` : void 0, j = T ? d : E, M = (e, t) => {
11
+ var p = s(({ options: s, value: p, defaultValue: m = [], onChange: h, direction: g = "vertical", variant: _ = "default", name: v, className: y, label: b, error: x, required: S, disabled: C, asChild: w = !1, children: T, ...E }, D) => {
12
+ let O = p !== void 0, [k, A] = l(m), j = `wim-checkbox-group-${c()}`, M = `${j}-label`, N = x ? `${j}-error` : void 0, P = O ? p : k, F = (e, t) => {
12
13
  let n;
13
- n = t ? [...j, e] : j.filter((t) => t !== e), T || D(n), p && p(n);
14
+ n = t ? [...P, e] : P.filter((t) => t !== e), O || A(n), h && h(n);
14
15
  };
15
- return /* @__PURE__ */ l(n, {
16
- label: _,
17
- error: v,
18
- required: y,
19
- labelId: k,
20
- errorId: A,
21
- className: g,
22
- children: /* @__PURE__ */ u(x ? e : "div", {
23
- ...C,
24
- ref: w,
25
- className: c("wim-checkbox-group", i.root, m === "horizontal" && i.horizontal),
16
+ return /* @__PURE__ */ d(n, {
17
+ label: b,
18
+ error: x,
19
+ required: S,
20
+ labelId: M,
21
+ errorId: N,
22
+ className: y,
23
+ children: /* @__PURE__ */ f(w ? e : "div", {
24
+ ...E,
25
+ ref: D,
26
+ className: u("wim-checkbox-group", i.root, g === "horizontal" && i.horizontal, _ === "card" && i.cards),
26
27
  role: "group",
27
- "aria-labelledby": _ ? k : C["aria-labelledby"],
28
- "aria-describedby": [C["aria-describedby"], A].filter(Boolean).join(" ") || void 0,
29
- children: [a.map((e) => /* @__PURE__ */ l(r, {
30
- value: e.value,
31
- checked: j.includes(e.value),
32
- disabled: b || e.disabled,
33
- error: !!v,
34
- name: h,
35
- onChange: (t) => M(e.value, t.target.checked),
36
- children: e.label
37
- }, e.value)), /* @__PURE__ */ l(t, { children: S })]
28
+ "aria-labelledby": b ? M : E["aria-labelledby"],
29
+ "aria-describedby": [E["aria-describedby"], N].filter(Boolean).join(" ") || void 0,
30
+ children: [s.map((e) => {
31
+ let t = e.description ? `${j}-${e.value}-description` : void 0, n = e.description ? `${j}-${e.value}-label` : void 0;
32
+ return /* @__PURE__ */ d(r, {
33
+ value: e.value,
34
+ checked: P.includes(e.value),
35
+ disabled: C || e.disabled,
36
+ error: !!x,
37
+ name: v,
38
+ onChange: (t) => F(e.value, t.target.checked),
39
+ "aria-describedby": t,
40
+ "aria-labelledby": n,
41
+ className: u(_ === "card" && o.card, e.description && o.top),
42
+ children: /* @__PURE__ */ d(a, {
43
+ label: e.label,
44
+ description: e.description,
45
+ descriptionId: t,
46
+ labelId: n
47
+ })
48
+ }, e.value);
49
+ }), /* @__PURE__ */ d(t, { children: T })]
38
50
  })
39
51
  });
40
52
  });
41
- d.displayName = "CheckboxGroup";
53
+ p.displayName = "CheckboxGroup";
42
54
  //#endregion
43
- export { d as CheckboxGroup, d as default };
55
+ export { p as CheckboxGroup, p as default };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_hvp3f_2`,t=`_horizontal_hvp3f_7`,n={root:e,horizontal:t};exports.default=n,exports.horizontal=t,exports.root=e;
2
+ var e=`_root_1pbiw_3`,t=`_horizontal_1pbiw_8`,n=`_cards_1pbiw_15`,r={root:e,horizontal:t,cards:n};exports.cards=n,exports.default=r,exports.horizontal=t,exports.root=e;
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  //#region src/components/form/CheckboxGroup/checkbox-group.module.scss
3
- var e = "_root_hvp3f_2", t = "_horizontal_hvp3f_7", n = {
3
+ var e = "_root_1pbiw_3", t = "_horizontal_1pbiw_8", n = "_cards_1pbiw_15", r = {
4
4
  root: e,
5
- horizontal: t
5
+ horizontal: t,
6
+ cards: n
6
7
  };
7
8
  //#endregion
8
- export { n as default, t as horizontal, e as root };
9
+ export { n as cards, r as default, t as horizontal, e as root };
@@ -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("../FieldTemplate/FieldTemplate.cjs"),r=require("../Radio/Radio.cjs"),i=require("./radio-group.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(0,a.forwardRef)(({options:e,value:c,defaultValue:l,onChange:u,direction:d=`vertical`,name:f,className:p,label:m,error:h,required:g,disabled:_,asChild:v=!1,children:y,...b},x)=>{let S=c!==void 0,[C,w]=(0,a.useState)(l),T=`wim-radio-group-${(0,a.useId)()}`,E=`${T}-label`,D=h?`${T}-error`:void 0,O=S?c:C,k=e=>{S||w(e),u&&u(e)};return(0,s.jsx)(n.FieldTemplate,{label:m,error:h,required:g,labelId:E,errorId:D,className:p,children:(0,s.jsxs)(v?t.Root:`div`,{...b,ref:x,className:(0,o.default)(`wim-radio-group`,i.default.root,d===`horizontal`&&i.default.horizontal),role:`radiogroup`,"aria-labelledby":m?E:b[`aria-labelledby`],"aria-describedby":[b[`aria-describedby`],D].filter(Boolean).join(` `)||void 0,"aria-required":g,"aria-invalid":!!h,children:[e.map(e=>(0,s.jsx)(r.Radio,{value:e.value,checked:O===e.value,disabled:_||e.disabled,error:!!h,name:f,onChange:()=>k(e.value),children:e.label},e.value)),(0,s.jsx)(t.Slottable,{children:y})]})})});c.displayName=`RadioGroup`,exports.RadioGroup=c,exports.default=c;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),r=require("../../_internal/ChoiceLabel.cjs"),i=require("../Radio/Radio.cjs"),a=require("./radio-group.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");var l=(0,o.forwardRef)(({options:e,value:l,defaultValue:u,onChange:d,direction:f=`vertical`,variant:p=`default`,name:m,className:h,label:g,error:_,required:v,disabled:y,asChild:b=!1,children:x,...S},C)=>{let w=l!==void 0,[T,E]=(0,o.useState)(u),D=`wim-radio-group-${(0,o.useId)()}`,O=`${D}-label`,k=_?`${D}-error`:void 0,A=w?l:T,j=e=>{w||E(e),d&&d(e)};return(0,c.jsx)(n.FieldTemplate,{label:g,error:_,required:v,labelId:O,errorId:k,className:h,children:(0,c.jsxs)(b?t.Root:`div`,{...S,ref:C,className:(0,s.default)(`wim-radio-group`,a.default.root,f===`horizontal`&&a.default.horizontal,p===`card`&&a.default.cards),role:`radiogroup`,"aria-labelledby":g?O:S[`aria-labelledby`],"aria-describedby":[S[`aria-describedby`],k].filter(Boolean).join(` `)||void 0,"aria-required":v,"aria-invalid":!!_,children:[e.map(e=>{let t=e.description?`${D}-${e.value}-description`:void 0,n=e.description?`${D}-${e.value}-label`:void 0;return(0,c.jsx)(i.Radio,{value:e.value,checked:A===e.value,disabled:y||e.disabled,error:!!_,name:m,onChange:()=>j(e.value),"aria-describedby":t,"aria-labelledby":n,className:(0,s.default)(p===`card`&&r.choiceLabelClasses.card,e.description&&r.choiceLabelClasses.top),children:(0,c.jsx)(r.ChoiceLabel,{label:e.label,description:e.description,descriptionId:t,labelId:n})},e.value)}),(0,c.jsx)(t.Slottable,{children:x})]})})});l.displayName=`RadioGroup`,exports.RadioGroup=l,exports.default=l;
@@ -3,6 +3,8 @@ type Option = {
3
3
  label: string;
4
4
  value: string;
5
5
  disabled?: boolean;
6
+ /** A second line that explains the option (shown under the label, and linked with `aria-describedby`) */
7
+ description?: string;
6
8
  };
7
9
  export interface RadioGroupProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue"> {
8
10
  /** List of radio options */
@@ -15,6 +17,13 @@ export interface RadioGroupProps extends Omit<React.ComponentPropsWithoutRef<"di
15
17
  onChange?: (value: string) => void;
16
18
  /** Layout direction of the radio buttons */
17
19
  direction?: "vertical" | "horizontal";
20
+ /**
21
+ * `card` draws each option as a bordered card that is selectable as a whole
22
+ * (the card is the option's `<label>`). Keys and group semantics stay those
23
+ * of a radio group. Use with `description` when the options need explaining.
24
+ * @default "default"
25
+ */
26
+ variant?: "default" | "card";
18
27
  /** Name attribute shared by the radio inputs */
19
28
  name?: string;
20
29
  /** Whether to render as a child element. */
@@ -1,44 +1,56 @@
1
1
  "use client";
2
2
  import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
3
3
  import { FieldTemplate as n } from "../FieldTemplate/FieldTemplate.js";
4
- import { Radio as r } from "../Radio/Radio.js";
5
- import i from "./radio-group.module.js";
6
- import { forwardRef as a, useId as o, useState as s } from "react";
7
- import c from "classnames";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
4
+ import { ChoiceLabel as r, choiceLabelClasses as i } from "../../_internal/ChoiceLabel.js";
5
+ import { Radio as a } from "../Radio/Radio.js";
6
+ import o from "./radio-group.module.js";
7
+ import { forwardRef as s, useId as c, useState as l } from "react";
8
+ import u from "classnames";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
10
  //#region src/components/form/RadioGroup/RadioGroup.tsx
10
- var d = a(({ options: a, value: d, defaultValue: f, onChange: p, direction: m = "vertical", name: h, className: g, label: _, error: v, required: y, disabled: b, asChild: x = !1, children: S, ...C }, w) => {
11
- let T = d !== void 0, [E, D] = s(f), O = `wim-radio-group-${o()}`, k = `${O}-label`, A = v ? `${O}-error` : void 0, j = T ? d : E, M = (e) => {
12
- T || D(e), p && p(e);
11
+ var p = s(({ options: s, value: p, defaultValue: m, onChange: h, direction: g = "vertical", variant: _ = "default", name: v, className: y, label: b, error: x, required: S, disabled: C, asChild: w = !1, children: T, ...E }, D) => {
12
+ let O = p !== void 0, [k, A] = l(m), j = `wim-radio-group-${c()}`, M = `${j}-label`, N = x ? `${j}-error` : void 0, P = O ? p : k, F = (e) => {
13
+ O || A(e), h && h(e);
13
14
  };
14
- return /* @__PURE__ */ l(n, {
15
- label: _,
16
- error: v,
17
- required: y,
18
- labelId: k,
19
- errorId: A,
20
- className: g,
21
- children: /* @__PURE__ */ u(x ? e : "div", {
22
- ...C,
23
- ref: w,
24
- className: c("wim-radio-group", i.root, m === "horizontal" && i.horizontal),
15
+ return /* @__PURE__ */ d(n, {
16
+ label: b,
17
+ error: x,
18
+ required: S,
19
+ labelId: M,
20
+ errorId: N,
21
+ className: y,
22
+ children: /* @__PURE__ */ f(w ? e : "div", {
23
+ ...E,
24
+ ref: D,
25
+ className: u("wim-radio-group", o.root, g === "horizontal" && o.horizontal, _ === "card" && o.cards),
25
26
  role: "radiogroup",
26
- "aria-labelledby": _ ? k : C["aria-labelledby"],
27
- "aria-describedby": [C["aria-describedby"], A].filter(Boolean).join(" ") || void 0,
28
- "aria-required": y,
29
- "aria-invalid": !!v,
30
- children: [a.map((e) => /* @__PURE__ */ l(r, {
31
- value: e.value,
32
- checked: j === e.value,
33
- disabled: b || e.disabled,
34
- error: !!v,
35
- name: h,
36
- onChange: () => M(e.value),
37
- children: e.label
38
- }, e.value)), /* @__PURE__ */ l(t, { children: S })]
27
+ "aria-labelledby": b ? M : E["aria-labelledby"],
28
+ "aria-describedby": [E["aria-describedby"], N].filter(Boolean).join(" ") || void 0,
29
+ "aria-required": S,
30
+ "aria-invalid": !!x,
31
+ children: [s.map((e) => {
32
+ let t = e.description ? `${j}-${e.value}-description` : void 0, n = e.description ? `${j}-${e.value}-label` : void 0;
33
+ return /* @__PURE__ */ d(a, {
34
+ value: e.value,
35
+ checked: P === e.value,
36
+ disabled: C || e.disabled,
37
+ error: !!x,
38
+ name: v,
39
+ onChange: () => F(e.value),
40
+ "aria-describedby": t,
41
+ "aria-labelledby": n,
42
+ className: u(_ === "card" && i.card, e.description && i.top),
43
+ children: /* @__PURE__ */ d(r, {
44
+ label: e.label,
45
+ description: e.description,
46
+ descriptionId: t,
47
+ labelId: n
48
+ })
49
+ }, e.value);
50
+ }), /* @__PURE__ */ d(t, { children: T })]
39
51
  })
40
52
  });
41
53
  });
42
- d.displayName = "RadioGroup";
54
+ p.displayName = "RadioGroup";
43
55
  //#endregion
44
- export { d as RadioGroup, d as default };
56
+ export { p as RadioGroup, p as default };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_hvp3f_2`,t=`_horizontal_hvp3f_7`,n={root:e,horizontal:t};exports.default=n,exports.horizontal=t,exports.root=e;
2
+ var e=`_root_1pbiw_3`,t=`_horizontal_1pbiw_8`,n=`_cards_1pbiw_15`,r={root:e,horizontal:t,cards:n};exports.cards=n,exports.default=r,exports.horizontal=t,exports.root=e;
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  //#region src/components/form/RadioGroup/radio-group.module.scss
3
- var e = "_root_hvp3f_2", t = "_horizontal_hvp3f_7", n = {
3
+ var e = "_root_1pbiw_3", t = "_horizontal_1pbiw_8", n = "_cards_1pbiw_15", r = {
4
4
  root: e,
5
- horizontal: t
5
+ horizontal: t,
6
+ cards: n
6
7
  };
7
8
  //#endregion
8
- export { n as default, t as horizontal, e as root };
9
+ export { n as cards, r as default, t as horizontal, e as root };
@@ -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("../../../hooks/useMergedRef.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../FieldTemplate/FieldTemplate.cjs"),a=require("../../_internal/useIndicator.cjs"),o=require("./segmented-control.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=(0,s.forwardRef)(({options:e,value:u,onChange:d,size:f=`md`,fullWidth:p=!1,className:m,label:h,error:g,required:_,layout:v=`vertical`,disabled:y=!1,asChild:b=!1,children:x,id:S,styles:C,"aria-label":w,"aria-labelledby":T,"aria-describedby":E},D)=>{let O=(0,s.useRef)([]),k=(0,s.useId)(),A=S||`wim-segmented-${k}`,j=`${A}-label`,M=`${A}-error`,{containerRef:N,sliderStyle:P,isReady:F}=a.useIndicator({activeSelector:`.${o.default.active}`,dependence:e.length}),I=e.findIndex(e=>e.value===u),L=(t,n)=>{let r;switch(t.key){case`ArrowLeft`:case`ArrowUp`:r=n-1,r<0&&(r=e.length-1);break;case`ArrowRight`:case`ArrowDown`:r=n+1,r>=e.length&&(r=0);break;case`Home`:r=0;break;case`End`:r=e.length-1;break;default:return}t.preventDefault(),d(e[r].value),O.current[r]?.focus()},R=`${A}-item-0`;return(0,l.jsx)(i.FieldTemplate,{label:h,error:g,required:_,layout:v,labelId:j,htmlFor:R,errorId:M,className:m,children:(0,l.jsxs)(b?t.Root:`div`,{ref:n.useMergedRef(N,D),id:A,className:(0,c.default)(`wim-segmented-control`,o.default.root,o.default[f],p&&o.default.fullWidth,F&&o.default.ready,g&&o.default.danger,C?.root),role:`radiogroup`,"aria-labelledby":h?j:T,"aria-label":h||T?void 0:w,"aria-required":_,"aria-invalid":g?!0:void 0,"aria-describedby":[E,g?M:void 0].filter(Boolean).join(` `)||void 0,children:[(0,l.jsx)(`div`,{className:(0,c.default)(o.default.slider,C?.slider),style:P,"aria-hidden":`true`}),e.map((e,t)=>{let n=e.value===u,i=n||I===-1&&t===0,a=`${A}-item-${t}`;return(0,l.jsxs)(`button`,{id:a,ref:e=>{O.current[t]=e},type:`button`,className:(0,c.default)(o.default.item,n&&o.default.active,!e.label&&e.iconName&&o.default.iconOnly,C?.item),onClick:()=>d(e.value),onKeyDown:e=>L(e,t),onFocus:()=>{},onBlur:()=>{},role:`radio`,"aria-checked":n,tabIndex:i?0:-1,"aria-label":e.label?void 0:e.value,disabled:y,children:[e.iconName&&(0,l.jsx)(r.Icon,{name:e.iconName,size:f,className:o.default.icon}),e.label&&(0,l.jsx)(`span`,{className:(0,c.default)(o.default.label,C?.label),children:e.label})]},e.value)}),(0,l.jsx)(t.Slottable,{children:x})]})})});u.displayName=`SegmentedControl`,exports.SegmentedControl=u;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../_internal/rovingIndex.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("../../_internal/useIndicator.cjs"),s=require("./segmented-control.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=(0,c.forwardRef)(({options:e,value:d,onChange:f,size:p=`md`,fullWidth:m=!1,className:h,label:g,error:_,required:v,layout:y=`vertical`,disabled:b=!1,asChild:x=!1,children:S,id:C,styles:w,"aria-label":T,"aria-labelledby":E,"aria-describedby":D},O)=>{let k=(0,c.useRef)([]),A=(0,c.useId)(),j=C||`wim-segmented-${A}`,M=`${j}-label`,N=`${j}-error`,{containerRef:P,sliderStyle:F,isReady:I}=o.useIndicator({activeSelector:`.${s.default.active}`,dependence:e.length}),L=e.findIndex(e=>e.value===d),R=(t,n)=>{let r=i.getRovingIndex({key:t.key,current:n,count:e.length});r!==null&&(t.preventDefault(),f(e[r].value),k.current[r]?.focus())},z=`${j}-item-0`;return(0,u.jsx)(a.FieldTemplate,{label:g,error:_,required:v,layout:y,labelId:M,htmlFor:z,errorId:N,className:h,children:(0,u.jsxs)(x?t.Root:`div`,{ref:n.useMergedRef(P,O),id:j,className:(0,l.default)(`wim-segmented-control`,s.default.root,s.default[p],m&&s.default.fullWidth,I&&s.default.ready,_&&s.default.danger,w?.root),role:`radiogroup`,"aria-labelledby":g?M:E,"aria-label":g||E?void 0:T,"aria-required":v,"aria-invalid":_?!0:void 0,"aria-describedby":[D,_?N:void 0].filter(Boolean).join(` `)||void 0,children:[(0,u.jsx)(`div`,{className:(0,l.default)(s.default.slider,w?.slider),style:F,"aria-hidden":`true`}),e.map((e,t)=>{let n=e.value===d,i=n||L===-1&&t===0,a=`${j}-item-${t}`;return(0,u.jsxs)(`button`,{id:a,ref:e=>{k.current[t]=e},type:`button`,className:(0,l.default)(s.default.item,n&&s.default.active,!e.label&&e.iconName&&s.default.iconOnly,w?.item),onClick:()=>f(e.value),onKeyDown:e=>R(e,t),onFocus:()=>{},onBlur:()=>{},role:`radio`,"aria-checked":n,tabIndex:i?0:-1,"aria-label":e.label?void 0:e.value,disabled:b,children:[e.iconName&&(0,u.jsx)(r.Icon,{name:e.iconName,size:p,className:s.default.icon}),e.label&&(0,u.jsx)(`span`,{className:(0,l.default)(s.default.label,w?.label),children:e.label})]},e.value)}),(0,u.jsx)(t.Slottable,{children:S})]})})});d.displayName=`SegmentedControl`,exports.SegmentedControl=d;