wimui 0.66.0 → 0.68.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.
- package/dist/components/_internal/ChoiceLabel.cjs +2 -0
- package/dist/components/_internal/ChoiceLabel.d.ts +31 -0
- package/dist/components/_internal/ChoiceLabel.js +22 -0
- package/dist/components/_internal/InlineDisclosure.cjs +2 -0
- package/dist/components/_internal/InlineDisclosure.d.ts +22 -0
- package/dist/components/_internal/InlineDisclosure.js +47 -0
- package/dist/components/_internal/choice-label.module.cjs +2 -0
- package/dist/components/_internal/choice-label.module.js +11 -0
- package/dist/components/_internal/inline-disclosure.module.cjs +2 -0
- package/dist/components/_internal/inline-disclosure.module.js +9 -0
- package/dist/components/_internal/rovingIndex.cjs +2 -0
- package/dist/components/_internal/rovingIndex.d.ts +38 -0
- package/dist/components/_internal/rovingIndex.js +16 -0
- package/dist/components/data-display/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.d.ts +10 -3
- package/dist/components/data-display/AvatarGroup/AvatarGroup.js +55 -27
- package/dist/components/data-display/AvatarGroup/avatar-group.module.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/avatar-group.module.js +8 -6
- package/dist/components/data-display/Card/Card.cjs +1 -1
- package/dist/components/data-display/Card/Card.d.ts +21 -0
- package/dist/components/data-display/Card/Card.js +7 -3
- package/dist/components/data-display/Card/card.module.cjs +1 -1
- package/dist/components/data-display/Card/card.module.js +17 -16
- package/dist/components/form/CheckboxGroup/CheckboxGroup.cjs +1 -1
- package/dist/components/form/CheckboxGroup/CheckboxGroup.d.ts +9 -0
- package/dist/components/form/CheckboxGroup/CheckboxGroup.js +42 -30
- package/dist/components/form/CheckboxGroup/checkbox-group.module.cjs +1 -1
- package/dist/components/form/CheckboxGroup/checkbox-group.module.js +4 -3
- package/dist/components/form/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/form/RadioGroup/RadioGroup.d.ts +9 -0
- package/dist/components/form/RadioGroup/RadioGroup.js +46 -34
- package/dist/components/form/RadioGroup/radio-group.module.cjs +1 -1
- package/dist/components/form/RadioGroup/radio-group.module.js +4 -3
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.js +56 -68
- package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.js +80 -88
- package/dist/components/layout/OverflowList/OverflowList.cjs +2 -0
- package/dist/components/layout/OverflowList/OverflowList.d.ts +81 -0
- package/dist/components/layout/OverflowList/OverflowList.js +85 -0
- package/dist/components/layout/OverflowList/getVisibleCount.cjs +2 -0
- package/dist/components/layout/OverflowList/getVisibleCount.d.ts +30 -0
- package/dist/components/layout/OverflowList/getVisibleCount.js +26 -0
- package/dist/components/layout/OverflowList/overflow-list.module.cjs +2 -0
- package/dist/components/layout/OverflowList/overflow-list.module.js +10 -0
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.js +52 -51
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +88 -53
- package/dist/components/navigation/Stepper/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper/Stepper.js +51 -53
- package/dist/components/navigation/TabNavigation/TabNavigation.cjs +1 -1
- package/dist/components/navigation/TabNavigation/TabNavigation.js +47 -49
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +80 -73
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +40 -40
- package/dist/i18n/generated/components.d.ts +1 -1
- package/dist/i18n/generated/data-display.cjs +1 -1
- package/dist/i18n/generated/data-display.d.ts +1 -1
- package/dist/i18n/generated/data-display.js +12 -3
- package/dist/i18n/generated/keys.d.ts +2 -1
- package/dist/i18n/generated/navigation.cjs +2 -0
- package/dist/i18n/generated/navigation.d.ts +3 -0
- package/dist/i18n/generated/navigation.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -174
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1 -0
- package/dist/layout.js +2 -1
- package/dist/llms-full.txt +45 -3
- package/dist/llms.txt +2 -1
- package/dist/locales/en/components.json +2 -1
- package/dist/locales/en/data-display.json +3 -0
- package/dist/locales/ja/components.json +2 -1
- package/dist/locales/ja/data-display.json +3 -0
- package/dist/locales/pt/components.json +2 -1
- package/dist/locales/pt/data-display.json +3 -0
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +30 -30
|
@@ -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("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../../icon/chevron-right.cjs"),a=require("../../media/Icon/Icon.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),r=require("../../../i18n/generated/common.cjs"),i=require("../../../icon/chevron-right.cjs"),a=require("../../../icon/more-horizontal.cjs"),o=require("../../media/Icon/Icon.cjs"),s=require("../../layout/OverflowList/OverflowList.cjs"),c=require("../../../i18n/generated/navigation.cjs"),l=require("./breadcrumb.module.cjs"),u=require("../Link/Link.cjs"),d=require("../../_internal/InlineDisclosure.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("classnames");p=e.__toESM(p,1);let m=require("react/jsx-runtime");var h=(0,f.forwardRef)(({items:e,separator:f,size:h=`md`,overflow:g=`wrap`,moreLabel:_,className:v,ariaLabel:y,asChild:b,children:x,...S},C)=>{let{t:w}=n.useWimTranslation([r.commonNs,c.navigationNs]),T=y??w(`a11y.breadcrumb`),E=b?t.Root:`nav`,D=(0,m.jsx)(o.Icon,{component:i.default,size:h,className:l.default.separatorIcon}),O=(t,n)=>{let r=n===e.length-1;return(0,m.jsxs)(`li`,{className:l.default.item,children:[(0,m.jsx)(`div`,{className:l.default.content,children:t.href&&!r?(0,m.jsx)(u.Link,{href:t.href,size:h,priority:`secondary`,iconName:t.iconName,className:l.default.link,styles:{label:l.default.linkLabel},children:t.label}):(0,m.jsxs)(`span`,{className:(0,p.default)(l.default.label,r&&l.default.current),"aria-current":r?`page`:void 0,tabIndex:r?0:void 0,role:r?`link`:void 0,children:[t.iconName&&(0,m.jsx)(o.Icon,{name:t.iconName,size:h,className:l.default.labelIcon}),t.label]})}),!r&&(0,m.jsx)(`span`,{className:l.default.separator,"aria-hidden":`true`,children:f||D})]},n)};return(0,m.jsxs)(E,{ref:C,"aria-label":T,className:(0,p.default)(`wim-breadcrumb`,l.default.root,l.default[h],v),onKeyDown:e=>{let t=e.currentTarget,n=Array.from(t.querySelectorAll(`.${l.default.link}, .${l.default.label}.${l.default.current}, button[aria-expanded]`)).filter(e=>!e.closest(`[aria-hidden="true"]`)),r=n.indexOf(document.activeElement);r!==-1&&(e.key===`ArrowRight`?(e.preventDefault(),n[(r+1)%n.length].focus()):e.key===`ArrowLeft`&&(e.preventDefault(),n[(r-1+n.length)%n.length].focus()))},...S,children:[g===`collapse`?(0,m.jsx)(s.OverflowList,{listElement:`ol`,collapseFrom:`middle`,minVisibleItems:Math.min(e.length,2),gap:`0`,items:e,renderItem:(e,t)=>O(e,t),renderOverflow:e=>(0,m.jsxs)(`li`,{className:l.default.item,children:[(0,m.jsx)(d.InlineDisclosure,{trigger:(0,m.jsx)(o.Icon,{component:a.default,size:h}),label:(_??(e=>w(`a11y.breadcrumb_more`,{count:e})))(e.length),children:e.map((e,t)=>(0,m.jsx)(`li`,{children:e.href?(0,m.jsx)(u.Link,{href:e.href,size:h,priority:`secondary`,iconName:e.iconName,children:e.label}):(0,m.jsx)(`span`,{className:l.default.label,children:e.label})},t))}),(0,m.jsx)(`span`,{className:l.default.separator,"aria-hidden":`true`,children:f||D})]})}):(0,m.jsx)(`ol`,{className:l.default.list,children:e.map((e,t)=>O(e,t))}),b?(0,m.jsx)(t.Slottable,{children:x}):null]})});h.displayName=`Breadcrumb`,exports.Breadcrumb=h;
|
|
@@ -20,6 +20,18 @@ type BreadcrumbProps = {
|
|
|
20
20
|
* @default "md"
|
|
21
21
|
*/
|
|
22
22
|
size?: ComponentSizeBasic;
|
|
23
|
+
/**
|
|
24
|
+
* What happens when the items do not fit on one line. `"wrap"` moves them onto more lines;
|
|
25
|
+
* `"collapse"` keeps the first item and the current page and folds the levels in between
|
|
26
|
+
* into a "…" button that lists them.
|
|
27
|
+
* @default "wrap"
|
|
28
|
+
*/
|
|
29
|
+
overflow?: "wrap" | "collapse";
|
|
30
|
+
/**
|
|
31
|
+
* Accessible name of the "…" button, from the number of hidden levels. Defaults to a localized
|
|
32
|
+
* "Show hidden levels (n)".
|
|
33
|
+
*/
|
|
34
|
+
moreLabel?: (count: number) => string;
|
|
23
35
|
/**
|
|
24
36
|
* Additional CSS class name for the container.
|
|
25
37
|
*/
|
|
@@ -3,65 +3,100 @@ import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react
|
|
|
3
3
|
import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
4
4
|
import { commonNs as r } from "../../../i18n/generated/common.js";
|
|
5
5
|
import i from "../../../icon/chevron-right.js";
|
|
6
|
-
import
|
|
7
|
-
import o from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import l from "
|
|
11
|
-
import {
|
|
6
|
+
import a from "../../../icon/more-horizontal.js";
|
|
7
|
+
import { Icon as o } from "../../media/Icon/Icon.js";
|
|
8
|
+
import { OverflowList as s } from "../../layout/OverflowList/OverflowList.js";
|
|
9
|
+
import { navigationNs as c } from "../../../i18n/generated/navigation.js";
|
|
10
|
+
import l from "./breadcrumb.module.js";
|
|
11
|
+
import { Link as u } from "../Link/Link.js";
|
|
12
|
+
import { InlineDisclosure as d } from "../../_internal/InlineDisclosure.js";
|
|
13
|
+
import { forwardRef as f } from "react";
|
|
14
|
+
import p from "classnames";
|
|
15
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
16
|
//#region src/components/navigation/Breadcrumb/Breadcrumb.tsx
|
|
13
|
-
var
|
|
14
|
-
let { t:
|
|
17
|
+
var g = f(({ items: f, separator: g, size: _ = "md", overflow: v = "wrap", moreLabel: y, className: b, ariaLabel: x, asChild: S, children: C, ...w }, T) => {
|
|
18
|
+
let { t: E } = n([r, c]), D = x ?? E("a11y.breadcrumb"), O = S ? e : "nav", k = /* @__PURE__ */ m(o, {
|
|
15
19
|
component: i,
|
|
16
|
-
size:
|
|
17
|
-
className:
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
size: _,
|
|
21
|
+
className: l.separatorIcon
|
|
22
|
+
}), A = (e, t) => {
|
|
23
|
+
let n = t === f.length - 1;
|
|
24
|
+
return /* @__PURE__ */ h("li", {
|
|
25
|
+
className: l.item,
|
|
26
|
+
children: [/* @__PURE__ */ m("div", {
|
|
27
|
+
className: l.content,
|
|
28
|
+
children: e.href && !n ? /* @__PURE__ */ m(u, {
|
|
29
|
+
href: e.href,
|
|
30
|
+
size: _,
|
|
31
|
+
priority: "secondary",
|
|
32
|
+
iconName: e.iconName,
|
|
33
|
+
className: l.link,
|
|
34
|
+
styles: { label: l.linkLabel },
|
|
35
|
+
children: e.label
|
|
36
|
+
}) : /* @__PURE__ */ h("span", {
|
|
37
|
+
className: p(l.label, n && l.current),
|
|
38
|
+
"aria-current": n ? "page" : void 0,
|
|
39
|
+
tabIndex: n ? 0 : void 0,
|
|
40
|
+
role: n ? "link" : void 0,
|
|
41
|
+
children: [e.iconName && /* @__PURE__ */ m(o, {
|
|
42
|
+
name: e.iconName,
|
|
43
|
+
size: _,
|
|
44
|
+
className: l.labelIcon
|
|
45
|
+
}), e.label]
|
|
46
|
+
})
|
|
47
|
+
}), !n && /* @__PURE__ */ m("span", {
|
|
48
|
+
className: l.separator,
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
children: g || k
|
|
51
|
+
})]
|
|
52
|
+
}, t);
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ h(O, {
|
|
55
|
+
ref: T,
|
|
56
|
+
"aria-label": D,
|
|
57
|
+
className: p("wim-breadcrumb", l.root, l[_], b),
|
|
23
58
|
onKeyDown: (e) => {
|
|
24
|
-
let t = e.currentTarget, n = Array.from(t.querySelectorAll(`.${
|
|
59
|
+
let t = e.currentTarget, n = Array.from(t.querySelectorAll(`.${l.link}, .${l.label}.${l.current}, button[aria-expanded]`)).filter((e) => !e.closest("[aria-hidden=\"true\"]")), r = n.indexOf(document.activeElement);
|
|
25
60
|
r !== -1 && (e.key === "ArrowRight" ? (e.preventDefault(), n[(r + 1) % n.length].focus()) : e.key === "ArrowLeft" && (e.preventDefault(), n[(r - 1 + n.length) % n.length].focus()));
|
|
26
61
|
},
|
|
27
|
-
...
|
|
28
|
-
children: [/* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: f || C
|
|
59
|
-
})]
|
|
60
|
-
}, t);
|
|
62
|
+
...w,
|
|
63
|
+
children: [v === "collapse" ? /* @__PURE__ */ m(s, {
|
|
64
|
+
listElement: "ol",
|
|
65
|
+
collapseFrom: "middle",
|
|
66
|
+
minVisibleItems: Math.min(f.length, 2),
|
|
67
|
+
gap: "0",
|
|
68
|
+
items: f,
|
|
69
|
+
renderItem: (e, t) => A(e, t),
|
|
70
|
+
renderOverflow: (e) => /* @__PURE__ */ h("li", {
|
|
71
|
+
className: l.item,
|
|
72
|
+
children: [/* @__PURE__ */ m(d, {
|
|
73
|
+
trigger: /* @__PURE__ */ m(o, {
|
|
74
|
+
component: a,
|
|
75
|
+
size: _
|
|
76
|
+
}),
|
|
77
|
+
label: (y ?? ((e) => E("a11y.breadcrumb_more", { count: e })))(e.length),
|
|
78
|
+
children: e.map((e, t) => /* @__PURE__ */ m("li", { children: e.href ? /* @__PURE__ */ m(u, {
|
|
79
|
+
href: e.href,
|
|
80
|
+
size: _,
|
|
81
|
+
priority: "secondary",
|
|
82
|
+
iconName: e.iconName,
|
|
83
|
+
children: e.label
|
|
84
|
+
}) : /* @__PURE__ */ m("span", {
|
|
85
|
+
className: l.label,
|
|
86
|
+
children: e.label
|
|
87
|
+
}) }, t))
|
|
88
|
+
}), /* @__PURE__ */ m("span", {
|
|
89
|
+
className: l.separator,
|
|
90
|
+
"aria-hidden": "true",
|
|
91
|
+
children: g || k
|
|
92
|
+
})]
|
|
61
93
|
})
|
|
62
|
-
})
|
|
94
|
+
}) : /* @__PURE__ */ m("ol", {
|
|
95
|
+
className: l.list,
|
|
96
|
+
children: f.map((e, t) => A(e, t))
|
|
97
|
+
}), S ? /* @__PURE__ */ m(t, { children: C }) : null]
|
|
63
98
|
});
|
|
64
99
|
});
|
|
65
|
-
|
|
100
|
+
g.displayName = "Breadcrumb";
|
|
66
101
|
//#endregion
|
|
67
|
-
export {
|
|
102
|
+
export { g as Breadcrumb };
|
|
@@ -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("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("./stepper.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../_internal/rovingIndex.cjs"),o=require("./stepper.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)(({steps:e=[],current:s=0,direction:u=`horizontal`,labelPlacement:d=`horizontal`,intent:f=`process`,className:p,ariaLabel:m,onChange:h,asChild:g,children:_,...v},y)=>{let b=g?t.Root:`div`,x=(e,t)=>t||(e<s?`finish`:e===s?f:`wait`),S=(e,t,a)=>a||(t===`finish`?(0,l.jsx)(i.Icon,{component:n.default,size:`sm`}):t===`error`?(0,l.jsx)(i.Icon,{component:r.default,size:`sm`}):(0,l.jsx)(`span`,{children:e+1}));return(0,l.jsx)(`div`,{className:o.default.container,children:(0,l.jsxs)(b,{ref:y,className:(0,c.default)(`wim-stepper`,o.default.root,o.default[u],d===`vertical`&&o.default.labelVertical,p),role:h?`tablist`:m?`group`:void 0,"aria-label":m,"aria-orientation":h?u:void 0,onKeyDown:t=>{if(!h)return;let n=Array.from(t.currentTarget.querySelectorAll(`[role="tab"]`)),r=document.activeElement;if(n.indexOf(r)===-1||!a.isRovingKey(t.key))return;t.preventDefault();let i=n.filter((t,n)=>!e[n]?.disabled),o=i.indexOf(r);if(o===-1)return;let s=a.getRovingIndex({key:t.key,current:o,count:i.length});if(s===null)return;let c=i[s];c.focus(),h(n.indexOf(c))},...v,children:[e.map((e,t)=>{let n=x(t,e.intent),r=!!h&&!e.disabled;return(0,l.jsxs)(`div`,{className:(0,c.default)(o.default.item,o.default[n],d===`vertical`&&o.default.labelVertical),onClick:()=>r&&h(t),style:{cursor:r?`pointer`:`default`},role:h?`tab`:void 0,"aria-selected":h?t===s:void 0,"aria-disabled":e.disabled?`true`:void 0,"data-testid":`stepper-item`,"data-status":n,tabIndex:h?!e.disabled&&t===s?0:-1:r?0:-1,onKeyDown:e=>{r&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),h(t))},children:[(0,l.jsx)(`div`,{className:o.default.line}),(0,l.jsx)(`div`,{className:o.default.iconContainer,children:S(t,n,e.icon)}),(0,l.jsxs)(`div`,{className:o.default.content,children:[(0,l.jsx)(`span`,{className:o.default.title,"data-testid":`stepper-title`,children:e.title}),e.description&&(0,l.jsx)(`span`,{className:o.default.description,children:e.description})]})]},t)}),g?(0,l.jsx)(t.Slottable,{children:_}):null]})})});u.displayName=`Stepper`,exports.Stepper=u,exports.default=u;
|
|
@@ -3,85 +3,83 @@ import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react
|
|
|
3
3
|
import n from "../../../icon/check.js";
|
|
4
4
|
import r from "../../../icon/close.js";
|
|
5
5
|
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
6
|
-
import a from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { getRovingIndex as a, isRovingKey as o } from "../../_internal/rovingIndex.js";
|
|
7
|
+
import s from "./stepper.module.js";
|
|
8
|
+
import { forwardRef as c } from "react";
|
|
9
|
+
import l from "classnames";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/navigation/Stepper/Stepper.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
12
|
+
var f = c(({ steps: c = [], current: f = 0, direction: p = "horizontal", labelPlacement: m = "horizontal", intent: h = "process", className: g, ariaLabel: _, onChange: v, asChild: y, children: b, ...x }, S) => {
|
|
13
|
+
let C = y ? e : "div", w = (e, t) => t || (e < f ? "finish" : e === f ? h : "wait"), T = (e, t, a) => a || (t === "finish" ? /* @__PURE__ */ u(i, {
|
|
13
14
|
component: n,
|
|
14
15
|
size: "sm"
|
|
15
|
-
}) : t === "error" ? /* @__PURE__ */
|
|
16
|
+
}) : t === "error" ? /* @__PURE__ */ u(i, {
|
|
16
17
|
component: r,
|
|
17
18
|
size: "sm"
|
|
18
|
-
}) : /* @__PURE__ */
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
className:
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
ref:
|
|
23
|
-
className:
|
|
24
|
-
role:
|
|
25
|
-
"aria-label":
|
|
26
|
-
"aria-orientation":
|
|
19
|
+
}) : /* @__PURE__ */ u("span", { children: e + 1 }));
|
|
20
|
+
return /* @__PURE__ */ u("div", {
|
|
21
|
+
className: s.container,
|
|
22
|
+
children: /* @__PURE__ */ d(C, {
|
|
23
|
+
ref: S,
|
|
24
|
+
className: l("wim-stepper", s.root, s[p], m === "vertical" && s.labelVertical, g),
|
|
25
|
+
role: v ? "tablist" : _ ? "group" : void 0,
|
|
26
|
+
"aria-label": _,
|
|
27
|
+
"aria-orientation": v ? p : void 0,
|
|
27
28
|
onKeyDown: (e) => {
|
|
28
|
-
if (!
|
|
29
|
+
if (!v) return;
|
|
29
30
|
let t = Array.from(e.currentTarget.querySelectorAll("[role=\"tab\"]")), n = document.activeElement;
|
|
30
|
-
if (t.indexOf(n) === -1 || !
|
|
31
|
-
"ArrowRight",
|
|
32
|
-
"ArrowLeft",
|
|
33
|
-
"ArrowDown",
|
|
34
|
-
"ArrowUp",
|
|
35
|
-
"Home",
|
|
36
|
-
"End"
|
|
37
|
-
].includes(e.key)) return;
|
|
31
|
+
if (t.indexOf(n) === -1 || !o(e.key)) return;
|
|
38
32
|
e.preventDefault();
|
|
39
|
-
let r = t.filter((e, t) => !
|
|
33
|
+
let r = t.filter((e, t) => !c[t]?.disabled), i = r.indexOf(n);
|
|
40
34
|
if (i === -1) return;
|
|
41
|
-
let a
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
let s = a({
|
|
36
|
+
key: e.key,
|
|
37
|
+
current: i,
|
|
38
|
+
count: r.length
|
|
39
|
+
});
|
|
40
|
+
if (s === null) return;
|
|
41
|
+
let l = r[s];
|
|
42
|
+
l.focus(), v(t.indexOf(l));
|
|
45
43
|
},
|
|
46
|
-
...
|
|
47
|
-
children: [
|
|
48
|
-
let n =
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
className: s
|
|
51
|
-
onClick: () => r &&
|
|
44
|
+
...x,
|
|
45
|
+
children: [c.map((e, t) => {
|
|
46
|
+
let n = w(t, e.intent), r = !!v && !e.disabled;
|
|
47
|
+
return /* @__PURE__ */ d("div", {
|
|
48
|
+
className: l(s.item, s[n], m === "vertical" && s.labelVertical),
|
|
49
|
+
onClick: () => r && v(t),
|
|
52
50
|
style: { cursor: r ? "pointer" : "default" },
|
|
53
|
-
role:
|
|
54
|
-
"aria-selected":
|
|
51
|
+
role: v ? "tab" : void 0,
|
|
52
|
+
"aria-selected": v ? t === f : void 0,
|
|
55
53
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
56
54
|
"data-testid": "stepper-item",
|
|
57
55
|
"data-status": n,
|
|
58
|
-
tabIndex:
|
|
56
|
+
tabIndex: v ? !e.disabled && t === f ? 0 : -1 : r ? 0 : -1,
|
|
59
57
|
onKeyDown: (e) => {
|
|
60
|
-
r && (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
58
|
+
r && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), v(t));
|
|
61
59
|
},
|
|
62
60
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
className:
|
|
66
|
-
children:
|
|
61
|
+
/* @__PURE__ */ u("div", { className: s.line }),
|
|
62
|
+
/* @__PURE__ */ u("div", {
|
|
63
|
+
className: s.iconContainer,
|
|
64
|
+
children: T(t, n, e.icon)
|
|
67
65
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
className:
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
className:
|
|
66
|
+
/* @__PURE__ */ d("div", {
|
|
67
|
+
className: s.content,
|
|
68
|
+
children: [/* @__PURE__ */ u("span", {
|
|
69
|
+
className: s.title,
|
|
72
70
|
"data-testid": "stepper-title",
|
|
73
71
|
children: e.title
|
|
74
|
-
}), e.description && /* @__PURE__ */
|
|
75
|
-
className:
|
|
72
|
+
}), e.description && /* @__PURE__ */ u("span", {
|
|
73
|
+
className: s.description,
|
|
76
74
|
children: e.description
|
|
77
75
|
})]
|
|
78
76
|
})
|
|
79
77
|
]
|
|
80
78
|
}, t);
|
|
81
|
-
}),
|
|
79
|
+
}), y ? /* @__PURE__ */ u(t, { children: b }) : null]
|
|
82
80
|
})
|
|
83
81
|
});
|
|
84
82
|
});
|
|
85
|
-
|
|
83
|
+
f.displayName = "Stepper";
|
|
86
84
|
//#endregion
|
|
87
|
-
export {
|
|
85
|
+
export { f as Stepper, f as default };
|
|
@@ -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("../../_internal/
|
|
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("../../_internal/rovingIndex.cjs"),i=require("../../_internal/useIndicator.cjs"),a=require("./tab-navigation.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=o.default.forwardRef(({className:e,children:t,variant:l=`underline`,align:u=`start`,size:d=`md`,...f},p)=>{let m=(0,o.useRef)(null),{containerRef:h,sliderStyle:g,isReady:_}=i.useIndicator({activeSelector:`.${a.default.active}`,variant:l}),v=n.useMergedRef(m,p,e=>{h&&(h.current=e?.querySelector(`.${a.default.list}`)||null)}),y=e=>{if(!r.isRovingKey(e.key))return;e.preventDefault();let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not([aria-disabled="true"])`));if(t.length===0)return;let n=t.indexOf(document.activeElement);if(n===-1)return;let i=r.getRovingIndex({key:e.key,current:n,count:t.length});if(i===null)return;let a=t[i];a.focus(),a.click()};return(0,c.jsx)(`nav`,{ref:v,className:(0,s.default)(`wim-tab-navigation`,a.default.root,a.default[l],a.default[u],a.default[d],_&&a.default.ready,e),...f,children:(0,c.jsxs)(`div`,{className:a.default.list,role:`tablist`,tabIndex:0,onKeyDown:y,children:[(0,c.jsx)(`div`,{className:a.default.slider,style:g,"aria-hidden":`true`}),t]})})});l.displayName=`TabNavigation`;var u=o.default.forwardRef(({asChild:e=!1,className:n,children:r,active:i,disabled:o,icon:l,href:u,onClick:d,...f},p)=>(0,c.jsxs)(e?t.Root:`a`,{ref:p,href:e?void 0:u,onClick:e=>{o?e.preventDefault():d&&(e.preventDefault(),d(e))},className:(0,s.default)(a.default.item,i&&a.default.active,o&&a.default.disabled,n),role:`tab`,"aria-selected":i,"aria-disabled":o,tabIndex:i&&!o?0:-1,...f,children:[l&&(0,c.jsx)(`span`,{className:a.default.icon,children:l}),(0,c.jsx)(t.Slottable,{children:r})]}));u.displayName=`TabNavigation.Item`;var d=l;d.Item=u,exports.TabNavigation=d,exports.default=d,exports.TabNavigationItem=u;
|
|
@@ -1,74 +1,72 @@
|
|
|
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 { useMergedRef as n } from "../../../hooks/useMergedRef.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import s from "
|
|
8
|
-
import
|
|
4
|
+
import { getRovingIndex as r, isRovingKey as i } from "../../_internal/rovingIndex.js";
|
|
5
|
+
import { useIndicator as a } from "../../_internal/useIndicator.js";
|
|
6
|
+
import o from "./tab-navigation.module.js";
|
|
7
|
+
import s, { useRef as c } from "react";
|
|
8
|
+
import l from "classnames";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/navigation/TabNavigation/TabNavigation.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
activeSelector: `.${
|
|
13
|
-
variant:
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
if (!
|
|
18
|
-
"ArrowLeft",
|
|
19
|
-
"ArrowRight",
|
|
20
|
-
"ArrowUp",
|
|
21
|
-
"ArrowDown",
|
|
22
|
-
"Home",
|
|
23
|
-
"End"
|
|
24
|
-
].includes(e.key)) return;
|
|
11
|
+
var f = s.forwardRef(({ className: e, children: t, variant: s = "underline", align: f = "start", size: p = "md", ...m }, h) => {
|
|
12
|
+
let g = c(null), { containerRef: _, sliderStyle: v, isReady: y } = a({
|
|
13
|
+
activeSelector: `.${o.active}`,
|
|
14
|
+
variant: s
|
|
15
|
+
}), b = n(g, h, (e) => {
|
|
16
|
+
_ && (_.current = e?.querySelector(`.${o.list}`) || null);
|
|
17
|
+
}), x = (e) => {
|
|
18
|
+
if (!i(e.key)) return;
|
|
25
19
|
e.preventDefault();
|
|
26
20
|
let t = Array.from(e.currentTarget.querySelectorAll("[role=\"tab\"]:not([aria-disabled=\"true\"])"));
|
|
27
21
|
if (t.length === 0) return;
|
|
28
22
|
let n = t.indexOf(document.activeElement);
|
|
29
23
|
if (n === -1) return;
|
|
30
|
-
let r
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
let a = r({
|
|
25
|
+
key: e.key,
|
|
26
|
+
current: n,
|
|
27
|
+
count: t.length
|
|
28
|
+
});
|
|
29
|
+
if (a === null) return;
|
|
30
|
+
let o = t[a];
|
|
31
|
+
o.focus(), o.click();
|
|
34
32
|
};
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
ref:
|
|
37
|
-
className:
|
|
38
|
-
...
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
className:
|
|
33
|
+
return /* @__PURE__ */ u("nav", {
|
|
34
|
+
ref: b,
|
|
35
|
+
className: l("wim-tab-navigation", o.root, o[s], o[f], o[p], y && o.ready, e),
|
|
36
|
+
...m,
|
|
37
|
+
children: /* @__PURE__ */ d("div", {
|
|
38
|
+
className: o.list,
|
|
41
39
|
role: "tablist",
|
|
42
40
|
tabIndex: 0,
|
|
43
|
-
onKeyDown:
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
className:
|
|
46
|
-
style:
|
|
41
|
+
onKeyDown: x,
|
|
42
|
+
children: [/* @__PURE__ */ u("div", {
|
|
43
|
+
className: o.slider,
|
|
44
|
+
style: v,
|
|
47
45
|
"aria-hidden": "true"
|
|
48
46
|
}), t]
|
|
49
47
|
})
|
|
50
48
|
});
|
|
51
49
|
});
|
|
52
|
-
|
|
53
|
-
var
|
|
50
|
+
f.displayName = "TabNavigation";
|
|
51
|
+
var p = s.forwardRef(({ asChild: n = !1, className: r, children: i, active: a, disabled: s, icon: c, href: f, onClick: p, ...m }, h) => /* @__PURE__ */ d(n ? e : "a", {
|
|
54
52
|
ref: h,
|
|
55
53
|
href: n ? void 0 : f,
|
|
56
54
|
onClick: (e) => {
|
|
57
|
-
|
|
55
|
+
s ? e.preventDefault() : p && (e.preventDefault(), p(e));
|
|
58
56
|
},
|
|
59
|
-
className:
|
|
57
|
+
className: l(o.item, a && o.active, s && o.disabled, r),
|
|
60
58
|
role: "tab",
|
|
61
|
-
"aria-selected":
|
|
62
|
-
"aria-disabled":
|
|
63
|
-
tabIndex:
|
|
59
|
+
"aria-selected": a,
|
|
60
|
+
"aria-disabled": s,
|
|
61
|
+
tabIndex: a && !s ? 0 : -1,
|
|
64
62
|
...m,
|
|
65
|
-
children: [
|
|
66
|
-
className:
|
|
67
|
-
children:
|
|
68
|
-
}), /* @__PURE__ */
|
|
63
|
+
children: [c && /* @__PURE__ */ u("span", {
|
|
64
|
+
className: o.icon,
|
|
65
|
+
children: c
|
|
66
|
+
}), /* @__PURE__ */ u(t, { children: i })]
|
|
69
67
|
}));
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
|
|
68
|
+
p.displayName = "TabNavigation.Item";
|
|
69
|
+
var m = f;
|
|
70
|
+
m.Item = p;
|
|
73
71
|
//#endregion
|
|
74
|
-
export {
|
|
72
|
+
export { m as TabNavigation, m as default, p as TabNavigationItem };
|
|
@@ -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("../../_internal/composeEventHandlers.cjs"),i=require("../../_internal/
|
|
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("../../_internal/composeEventHandlers.cjs"),i=require("../../_internal/rovingIndex.cjs"),a=require("../../_internal/useIndicator.cjs"),o=require("./tabs.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.createContext)(null),d=()=>{let e=(0,s.useContext)(u);if(!e)throw Error(`Tabs components must be used within a Tabs`);return e},f=s.default.forwardRef(({asChild:e=!1,defaultValue:n,value:r,onChange:i,orientation:a=`horizontal`,className:d,children:f,...p},m)=>{let[h,g]=(0,s.useState)(n),[_,v]=(0,s.useState)([]),[y,b]=(0,s.useState)([]),x=(0,s.useId)(),S=r!==void 0,C=S?r:h,w=(0,s.useCallback)(e=>{S||g(e),i?.(e)},[S,i]),T=(0,s.useCallback)(e=>{v(t=>t.includes(e)?t:[...t,e])},[]),E=(0,s.useCallback)(e=>{v(t=>t.filter(t=>t!==e))},[]),D=(0,s.useCallback)(e=>{b(t=>t.includes(e)?t:[...t,e])},[]),O=(0,s.useCallback)(e=>{b(t=>t.filter(t=>t!==e))},[]),k=e?t.Root:`div`;return(0,l.jsx)(u.Provider,{value:{value:C,onValueChange:w,orientation:a,id:x,items:_,registerItem:T,unregisterItem:E,panels:y,registerPanel:D,unregisterPanel:O},children:(0,l.jsx)(`div`,{className:o.default.container,children:(0,l.jsx)(k,{ref:m,className:(0,c.default)(`wim-tabs`,o.default.root,o.default[a],d),...p,children:(0,l.jsx)(t.Slottable,{children:f})})})})}),p=s.default.forwardRef(({asChild:e=!1,className:u,children:f,...p},m)=>{let{orientation:h,value:g,items:_,onValueChange:v}=d(),[y,b]=s.default.useState(!1),[x,S]=s.default.useState(0),[C,w]=s.default.useState(0),{containerRef:T,sliderStyle:E,isReady:D}=a.useIndicator({activeSelector:`.${o.default.trigger}.${o.default.active}`,orientation:h,dependence:g}),O=n.useMergedRef(T,m),k=e=>{h!==`vertical`&&(b(!0),S(e.pageX-(T.current?.offsetLeft||0)),w(T.current?.scrollLeft||0))},A=()=>{b(!1)},j=e=>{if(!y||h===`vertical`)return;e.preventDefault();let t=(e.pageX-(T.current?.offsetLeft||0)-x)*1.5;T.current&&(T.current.scrollLeft=C-t)},M=e=>{let t=g?_.indexOf(g):-1,n=i.getRovingIndex({key:e.key,current:t,count:_.length,orientation:h,isDisabled:e=>!!T.current?.querySelector(`[data-value="${_[e]}"]`)?.hasAttribute(`disabled`)});if(n!==null){e.preventDefault();let t=_[n];t&&(v(t),(T.current?.querySelector(`[data-value="${t}"]`))?.focus())}};return(0,l.jsxs)(e?t.Root:`div`,{ref:O,role:`tablist`,"aria-orientation":h,tabIndex:0,className:(0,c.default)(o.default.list,y&&o.default.dragging,D&&o.default.ready,u),...p,onMouseDown:e=>r.composeEventHandlers(p.onMouseDown,k)(e),onMouseUp:r.composeEventHandlers(p.onMouseUp,A),onMouseLeave:r.composeEventHandlers(p.onMouseLeave,A),onMouseMove:e=>r.composeEventHandlers(p.onMouseMove,j)(e),onKeyDown:e=>r.composeEventHandlers(p.onKeyDown,M)(e),children:[(0,l.jsx)(`div`,{className:o.default.slider,style:E,"aria-hidden":`true`}),(0,l.jsx)(t.Slottable,{children:f})]})}),m=s.default.forwardRef(({asChild:e=!1,value:n,disabled:i=!1,className:a,children:u,...f},p)=>{let{value:m,onValueChange:h,id:g,registerItem:_,unregisterItem:v,panels:y}=d(),b=m===n;return s.default.useEffect(()=>(_(n),()=>v(n)),[n,_,v]),(0,l.jsx)(e?t.Root:`button`,{ref:p,type:e?void 0:`button`,role:`tab`,"aria-selected":b,"aria-controls":y.includes(n)?`wim-tabs-${g}-panel-${n}`:void 0,id:`wim-tabs-${g}-tab-${n}`,"data-value":n,disabled:i,tabIndex:b?0:-1,className:(0,c.default)(o.default.trigger,b&&o.default.active,a),...f,onClick:r.composeEventHandlers(f.onClick,()=>h(n)),children:(0,l.jsx)(t.Slottable,{children:u})})}),h=s.default.forwardRef(({asChild:e=!1,value:n,className:r,children:i,...a},u)=>{let{value:f,id:p,registerPanel:m,unregisterPanel:h}=d(),g=f===n;return s.default.useEffect(()=>(m(n),()=>h(n)),[n,m,h]),g?(0,l.jsx)(e?t.Root:`div`,{ref:u,role:`tabpanel`,id:`wim-tabs-${p}-panel-${n}`,"aria-labelledby":`wim-tabs-${p}-tab-${n}`,tabIndex:0,className:(0,c.default)(o.default.content,r),...a,children:(0,l.jsx)(t.Slottable,{children:i})}):null});f.displayName=`Tabs`,p.displayName=`Tabs.List`,m.displayName=`Tabs.Trigger`,h.displayName=`Tabs.Content`;var g=f;g.List=p,g.Trigger=m,g.Content=h,exports.Tabs=g,exports.default=g,exports.TabsContent=h,exports.TabsList=p,exports.TabsTrigger=m;
|