wimui 0.65.2 → 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.
- package/dist/ai.cjs +1 -1
- package/dist/ai.js +3 -3
- 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/choice-label.module.cjs +2 -0
- package/dist/components/_internal/choice-label.module.js +11 -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/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.d.ts +83 -1
- package/dist/components/ai/ChatUI/ChatUI.js +184 -81
- package/dist/components/ai/ChatUI/chat-ui.module.cjs +1 -1
- package/dist/components/ai/ChatUI/chat-ui.module.js +46 -26
- 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/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.js +52 -51
- 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/common.cjs +1 -1
- package/dist/i18n/generated/common.d.ts +1 -1
- package/dist/i18n/generated/common.js +9 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +174 -174
- package/dist/llms-full.txt +9 -1
- package/dist/llms.txt +1 -1
- package/dist/locales/en/common.json +3 -1
- package/dist/locales/ja/common.json +3 -1
- package/dist/locales/pt/common.json +3 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +3 -3
|
@@ -2,96 +2,84 @@
|
|
|
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
4
|
import { Icon as r } from "../../media/Icon/Icon.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import o from "
|
|
8
|
-
import
|
|
9
|
-
import u from "
|
|
10
|
-
import
|
|
5
|
+
import { getRovingIndex as i } from "../../_internal/rovingIndex.js";
|
|
6
|
+
import { FieldTemplate as a } from "../FieldTemplate/FieldTemplate.js";
|
|
7
|
+
import { useIndicator as o } from "../../_internal/useIndicator.js";
|
|
8
|
+
import s from "./segmented-control.module.js";
|
|
9
|
+
import { forwardRef as c, useId as l, useRef as u } from "react";
|
|
10
|
+
import d from "classnames";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/SegmentedControl/SegmentedControl.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
activeSelector: `.${
|
|
15
|
-
dependence:
|
|
16
|
-
}),
|
|
17
|
-
let n
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return /* @__PURE__ */ d(i, {
|
|
38
|
-
label: v,
|
|
39
|
-
error: y,
|
|
40
|
-
required: b,
|
|
41
|
-
layout: x,
|
|
42
|
-
labelId: P,
|
|
43
|
-
htmlFor: V,
|
|
44
|
-
errorId: F,
|
|
45
|
-
className: _,
|
|
46
|
-
children: /* @__PURE__ */ f(C ? e : "div", {
|
|
47
|
-
ref: n(I, A),
|
|
48
|
-
id: N,
|
|
49
|
-
className: u("wim-segmented-control", o.root, o[h], g && o.fullWidth, R && o.ready, y && o.danger, E?.root),
|
|
13
|
+
var m = c(({ options: c, value: m, onChange: h, size: g = "md", fullWidth: _ = !1, className: v, label: y, error: b, required: x, layout: S = "vertical", disabled: C = !1, asChild: w = !1, children: T, id: E, styles: D, "aria-label": O, "aria-labelledby": k, "aria-describedby": A }, j) => {
|
|
14
|
+
let M = u([]), N = l(), P = E || `wim-segmented-${N}`, F = `${P}-label`, I = `${P}-error`, { containerRef: L, sliderStyle: R, isReady: z } = o({
|
|
15
|
+
activeSelector: `.${s.active}`,
|
|
16
|
+
dependence: c.length
|
|
17
|
+
}), B = c.findIndex((e) => e.value === m), V = (e, t) => {
|
|
18
|
+
let n = i({
|
|
19
|
+
key: e.key,
|
|
20
|
+
current: t,
|
|
21
|
+
count: c.length
|
|
22
|
+
});
|
|
23
|
+
n !== null && (e.preventDefault(), h(c[n].value), M.current[n]?.focus());
|
|
24
|
+
}, H = `${P}-item-0`;
|
|
25
|
+
return /* @__PURE__ */ f(a, {
|
|
26
|
+
label: y,
|
|
27
|
+
error: b,
|
|
28
|
+
required: x,
|
|
29
|
+
layout: S,
|
|
30
|
+
labelId: F,
|
|
31
|
+
htmlFor: H,
|
|
32
|
+
errorId: I,
|
|
33
|
+
className: v,
|
|
34
|
+
children: /* @__PURE__ */ p(w ? e : "div", {
|
|
35
|
+
ref: n(L, j),
|
|
36
|
+
id: P,
|
|
37
|
+
className: d("wim-segmented-control", s.root, s[g], _ && s.fullWidth, z && s.ready, b && s.danger, D?.root),
|
|
50
38
|
role: "radiogroup",
|
|
51
|
-
"aria-labelledby":
|
|
52
|
-
"aria-label":
|
|
53
|
-
"aria-required":
|
|
54
|
-
"aria-invalid":
|
|
55
|
-
"aria-describedby": [
|
|
39
|
+
"aria-labelledby": y ? F : k,
|
|
40
|
+
"aria-label": y || k ? void 0 : O,
|
|
41
|
+
"aria-required": x,
|
|
42
|
+
"aria-invalid": b ? !0 : void 0,
|
|
43
|
+
"aria-describedby": [A, b ? I : void 0].filter(Boolean).join(" ") || void 0,
|
|
56
44
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
className:
|
|
59
|
-
style:
|
|
45
|
+
/* @__PURE__ */ f("div", {
|
|
46
|
+
className: d(s.slider, D?.slider),
|
|
47
|
+
style: R,
|
|
60
48
|
"aria-hidden": "true"
|
|
61
49
|
}),
|
|
62
|
-
|
|
63
|
-
let n = e.value ===
|
|
64
|
-
return /* @__PURE__ */
|
|
50
|
+
c.map((e, t) => {
|
|
51
|
+
let n = e.value === m, i = n || B === -1 && t === 0, a = `${P}-item-${t}`;
|
|
52
|
+
return /* @__PURE__ */ p("button", {
|
|
65
53
|
id: a,
|
|
66
54
|
ref: (e) => {
|
|
67
|
-
|
|
55
|
+
M.current[t] = e;
|
|
68
56
|
},
|
|
69
57
|
type: "button",
|
|
70
|
-
className:
|
|
71
|
-
onClick: () =>
|
|
72
|
-
onKeyDown: (e) =>
|
|
58
|
+
className: d(s.item, n && s.active, !e.label && e.iconName && s.iconOnly, D?.item),
|
|
59
|
+
onClick: () => h(e.value),
|
|
60
|
+
onKeyDown: (e) => V(e, t),
|
|
73
61
|
onFocus: () => {},
|
|
74
62
|
onBlur: () => {},
|
|
75
63
|
role: "radio",
|
|
76
64
|
"aria-checked": n,
|
|
77
65
|
tabIndex: i ? 0 : -1,
|
|
78
66
|
"aria-label": e.label ? void 0 : e.value,
|
|
79
|
-
disabled:
|
|
80
|
-
children: [e.iconName && /* @__PURE__ */
|
|
67
|
+
disabled: C,
|
|
68
|
+
children: [e.iconName && /* @__PURE__ */ f(r, {
|
|
81
69
|
name: e.iconName,
|
|
82
|
-
size:
|
|
83
|
-
className:
|
|
84
|
-
}), e.label && /* @__PURE__ */
|
|
85
|
-
className:
|
|
70
|
+
size: g,
|
|
71
|
+
className: s.icon
|
|
72
|
+
}), e.label && /* @__PURE__ */ f("span", {
|
|
73
|
+
className: d(s.label, D?.label),
|
|
86
74
|
children: e.label
|
|
87
75
|
})]
|
|
88
76
|
}, e.value);
|
|
89
77
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ f(t, { children: T })
|
|
91
79
|
]
|
|
92
80
|
})
|
|
93
81
|
});
|
|
94
82
|
});
|
|
95
|
-
|
|
83
|
+
m.displayName = "SegmentedControl";
|
|
96
84
|
//#endregion
|
|
97
|
-
export {
|
|
85
|
+
export { m as SegmentedControl };
|
|
@@ -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"),
|
|
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("./toggle-group.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,defaultValue:f,onChange:p,selectionMode:m=`single`,size:h=`md`,fullWidth:g=!1,className:_,"aria-label":v,"aria-labelledby":y,"aria-describedby":b,disabled:x=!1,label:S,error:C,required:w,layout:T=`vertical`,id:E,asChild:D=!1,children:O},k)=>{let A=c.default.useId(),j=E||`wim-toggle-group-${A}`,M=`${j}-label`,N=`${j}-error`,P=d!==void 0,[F,I]=(0,c.useState)(f??(m===`multiple`?[]:``)),L=P?d:F,{containerRef:R,sliderStyle:z,isReady:B}=o.useIndicator({activeSelector:`.${s.default.active}`,dependence:e.length}),V=(0,c.useRef)([]),H=e.findIndex(e=>!e.disabled),[U,W]=(0,c.useState)(()=>{if(m===`single`){let t=P?d:f;if(typeof t==`string`){let n=e.findIndex(e=>!e.disabled&&e.value===t);if(n>=0)return n}}return H>=0?H:0});(0,c.useEffect)(()=>{if(m===`single`&&P&&typeof d==`string`){let t=e.findIndex(e=>!e.disabled&&e.value===d);t>=0&&W(t)}},[d,m,P,e]);let G=e=>{let t;if(m===`multiple`){let n=Array.isArray(L)?L:[];t=n.includes(e)?n.filter(t=>t!==e):[...n,e]}else t=L===e?``:e;P||I(t),p?.(t)},K=e=>m===`multiple`?(Array.isArray(L)?L:[]).includes(e):L===e,q=(t,n)=>{if(!i.isRovingKey(n.key))return;n.preventDefault();let r=i.getRovingIndex({key:n.key,current:t,count:e.length,isDisabled:t=>!!e[t].disabled});r!==null&&r!==t&&(W(r),V.current[r]?.focus(),m===`single`&&G(e[r].value))},J=m===`single`?`radiogroup`:`toolbar`,Y=`${j}-item-0`;return(0,u.jsx)(a.FieldTemplate,{label:S,error:C,required:w,layout:T,labelId:M,htmlFor:Y,errorId:N,className:_,children:(0,u.jsxs)(D?t.Root:`div`,{ref:n.useMergedRef(R,k),id:j,className:(0,l.default)(`wim-toggle-group`,s.default.root,s.default[h],s.default[m],g&&s.default.fullWidth,B&&s.default.ready,C&&s.default.danger),role:J,"aria-label":v,"aria-labelledby":S?M:y,"aria-orientation":`horizontal`,"aria-invalid":C?!0:void 0,"aria-describedby":[b,C?N:void 0].filter(Boolean).join(` `)||void 0,children:[(0,u.jsx)(`div`,{className:(0,l.default)(s.default.slider,s.default[m],B&&s.default.ready),style:z,"aria-hidden":`true`}),e.map((e,t)=>{let n=`${j}-item-${t}`;return(0,u.jsxs)(`button`,{id:n,ref:e=>{V.current[t]=e},type:`button`,className:(0,l.default)(s.default.item,s.default[m],K(e.value)&&s.default.active,!e.label&&e.iconName&&s.default.iconOnly),onClick:()=>{W(t),G(e.value)},onKeyDown:e=>q(t,e),disabled:x||e.disabled,role:m===`single`?`radio`:`button`,"aria-checked":m===`single`?K(e.value):void 0,"aria-pressed":m===`multiple`?K(e.value):void 0,"aria-label":e.label?void 0:e.value,tabIndex:!e.disabled&&t===U?0:-1,children:[e.iconName&&(0,u.jsx)(r.Icon,{name:e.iconName,size:h,className:s.default.icon}),e.label&&(0,u.jsx)(`span`,{children:e.label})]},e.value)}),(0,u.jsx)(t.Slottable,{children:O})]})})});d.displayName=`ToggleGroup`,exports.ToggleGroup=d;
|
|
@@ -2,121 +2,113 @@
|
|
|
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
4
|
import { Icon as r } from "../../media/Icon/Icon.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import f from "
|
|
10
|
-
import
|
|
5
|
+
import { getRovingIndex as i, isRovingKey as a } from "../../_internal/rovingIndex.js";
|
|
6
|
+
import { FieldTemplate as o } from "../FieldTemplate/FieldTemplate.js";
|
|
7
|
+
import { useIndicator as s } from "../../_internal/useIndicator.js";
|
|
8
|
+
import c from "./toggle-group.module.js";
|
|
9
|
+
import l, { forwardRef as u, useEffect as d, useRef as f, useState as p } from "react";
|
|
10
|
+
import m from "classnames";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/ToggleGroup/ToggleGroup.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
activeSelector: `.${
|
|
15
|
-
dependence:
|
|
16
|
-
}),
|
|
17
|
-
if (
|
|
18
|
-
let e =
|
|
13
|
+
var _ = u(({ options: u, value: _, defaultValue: v, onChange: y, selectionMode: b = "single", size: x = "md", fullWidth: S = !1, className: C, "aria-label": w, "aria-labelledby": T, "aria-describedby": E, disabled: D = !1, label: O, error: k, required: A, layout: j = "vertical", id: M, asChild: N = !1, children: P }, F) => {
|
|
14
|
+
let I = l.useId(), L = M || `wim-toggle-group-${I}`, R = `${L}-label`, z = `${L}-error`, B = _ !== void 0, [V, H] = p(v ?? (b === "multiple" ? [] : "")), U = B ? _ : V, { containerRef: W, sliderStyle: G, isReady: K } = s({
|
|
15
|
+
activeSelector: `.${c.active}`,
|
|
16
|
+
dependence: u.length
|
|
17
|
+
}), q = f([]), J = u.findIndex((e) => !e.disabled), [Y, X] = p(() => {
|
|
18
|
+
if (b === "single") {
|
|
19
|
+
let e = B ? _ : v;
|
|
19
20
|
if (typeof e == "string") {
|
|
20
|
-
let t =
|
|
21
|
+
let t = u.findIndex((t) => !t.disabled && t.value === e);
|
|
21
22
|
if (t >= 0) return t;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return J >= 0 ? J : 0;
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
let e =
|
|
29
|
-
e >= 0 &&
|
|
27
|
+
d(() => {
|
|
28
|
+
if (b === "single" && B && typeof _ == "string") {
|
|
29
|
+
let e = u.findIndex((e) => !e.disabled && e.value === _);
|
|
30
|
+
e >= 0 && X(e);
|
|
30
31
|
}
|
|
31
32
|
}, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
_,
|
|
34
|
+
b,
|
|
35
|
+
B,
|
|
36
|
+
u
|
|
36
37
|
]);
|
|
37
|
-
let
|
|
38
|
+
let Z = (e) => {
|
|
38
39
|
let t;
|
|
39
|
-
if (
|
|
40
|
-
let n = Array.isArray(
|
|
40
|
+
if (b === "multiple") {
|
|
41
|
+
let n = Array.isArray(U) ? U : [];
|
|
41
42
|
t = n.includes(e) ? n.filter((t) => t !== e) : [...n, e];
|
|
42
|
-
} else t =
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
errorId: L,
|
|
72
|
-
className: x,
|
|
73
|
-
children: /* @__PURE__ */ m(j ? e : "div", {
|
|
74
|
-
ref: n(H, N),
|
|
75
|
-
id: F,
|
|
76
|
-
className: f("wim-toggle-group", o.root, o[y], o[v], b && o.fullWidth, W && o.ready, D && o.danger),
|
|
77
|
-
role: $,
|
|
78
|
-
"aria-label": S,
|
|
79
|
-
"aria-labelledby": E ? I : C,
|
|
43
|
+
} else t = U === e ? "" : e;
|
|
44
|
+
B || H(t), y?.(t);
|
|
45
|
+
}, Q = (e) => b === "multiple" ? (Array.isArray(U) ? U : []).includes(e) : U === e, $ = (e, t) => {
|
|
46
|
+
if (!a(t.key)) return;
|
|
47
|
+
t.preventDefault();
|
|
48
|
+
let n = i({
|
|
49
|
+
key: t.key,
|
|
50
|
+
current: e,
|
|
51
|
+
count: u.length,
|
|
52
|
+
isDisabled: (e) => !!u[e].disabled
|
|
53
|
+
});
|
|
54
|
+
n !== null && n !== e && (X(n), q.current[n]?.focus(), b === "single" && Z(u[n].value));
|
|
55
|
+
}, ee = b === "single" ? "radiogroup" : "toolbar", te = `${L}-item-0`;
|
|
56
|
+
return /* @__PURE__ */ h(o, {
|
|
57
|
+
label: O,
|
|
58
|
+
error: k,
|
|
59
|
+
required: A,
|
|
60
|
+
layout: j,
|
|
61
|
+
labelId: R,
|
|
62
|
+
htmlFor: te,
|
|
63
|
+
errorId: z,
|
|
64
|
+
className: C,
|
|
65
|
+
children: /* @__PURE__ */ g(N ? e : "div", {
|
|
66
|
+
ref: n(W, F),
|
|
67
|
+
id: L,
|
|
68
|
+
className: m("wim-toggle-group", c.root, c[x], c[b], S && c.fullWidth, K && c.ready, k && c.danger),
|
|
69
|
+
role: ee,
|
|
70
|
+
"aria-label": w,
|
|
71
|
+
"aria-labelledby": O ? R : T,
|
|
80
72
|
"aria-orientation": "horizontal",
|
|
81
|
-
"aria-invalid":
|
|
82
|
-
"aria-describedby": [
|
|
73
|
+
"aria-invalid": k ? !0 : void 0,
|
|
74
|
+
"aria-describedby": [E, k ? z : void 0].filter(Boolean).join(" ") || void 0,
|
|
83
75
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
className:
|
|
86
|
-
style:
|
|
76
|
+
/* @__PURE__ */ h("div", {
|
|
77
|
+
className: m(c.slider, c[b], K && c.ready),
|
|
78
|
+
style: G,
|
|
87
79
|
"aria-hidden": "true"
|
|
88
80
|
}),
|
|
89
|
-
|
|
90
|
-
let n = `${
|
|
91
|
-
return /* @__PURE__ */
|
|
81
|
+
u.map((e, t) => {
|
|
82
|
+
let n = `${L}-item-${t}`;
|
|
83
|
+
return /* @__PURE__ */ g("button", {
|
|
92
84
|
id: n,
|
|
93
85
|
ref: (e) => {
|
|
94
|
-
|
|
86
|
+
q.current[t] = e;
|
|
95
87
|
},
|
|
96
88
|
type: "button",
|
|
97
|
-
className:
|
|
89
|
+
className: m(c.item, c[b], Q(e.value) && c.active, !e.label && e.iconName && c.iconOnly),
|
|
98
90
|
onClick: () => {
|
|
99
|
-
|
|
91
|
+
X(t), Z(e.value);
|
|
100
92
|
},
|
|
101
|
-
onKeyDown: (e) =>
|
|
102
|
-
disabled:
|
|
103
|
-
role:
|
|
104
|
-
"aria-checked":
|
|
105
|
-
"aria-pressed":
|
|
93
|
+
onKeyDown: (e) => $(t, e),
|
|
94
|
+
disabled: D || e.disabled,
|
|
95
|
+
role: b === "single" ? "radio" : "button",
|
|
96
|
+
"aria-checked": b === "single" ? Q(e.value) : void 0,
|
|
97
|
+
"aria-pressed": b === "multiple" ? Q(e.value) : void 0,
|
|
106
98
|
"aria-label": e.label ? void 0 : e.value,
|
|
107
|
-
tabIndex: !e.disabled && t ===
|
|
108
|
-
children: [e.iconName && /* @__PURE__ */
|
|
99
|
+
tabIndex: !e.disabled && t === Y ? 0 : -1,
|
|
100
|
+
children: [e.iconName && /* @__PURE__ */ h(r, {
|
|
109
101
|
name: e.iconName,
|
|
110
|
-
size:
|
|
111
|
-
className:
|
|
112
|
-
}), e.label && /* @__PURE__ */
|
|
102
|
+
size: x,
|
|
103
|
+
className: c.icon
|
|
104
|
+
}), e.label && /* @__PURE__ */ h("span", { children: e.label })]
|
|
113
105
|
}, e.value);
|
|
114
106
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ h(t, { children: P })
|
|
116
108
|
]
|
|
117
109
|
})
|
|
118
110
|
});
|
|
119
111
|
});
|
|
120
|
-
|
|
112
|
+
_.displayName = "ToggleGroup";
|
|
121
113
|
//#endregion
|
|
122
|
-
export {
|
|
114
|
+
export { _ as ToggleGroup };
|
|
@@ -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("./toolbar.module.cjs");let
|
|
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("./toolbar.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=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]`,l=`data-wim-toolbar-roving`,u=/^(button|checkbox|radio|submit|reset|image|file|color)$/,d=e=>e.tagName===`TEXTAREA`||e.tagName===`SELECT`||e.isContentEditable||e.tagName===`INPUT`&&!u.test(e.type),f=e=>Array.from(e.querySelectorAll(c)).filter(e=>!d(e)&&!e.closest(`[aria-hidden="true"]`)&&(e.getAttribute(`tabindex`)!==`-1`||e.hasAttribute(l))),p=a.default.forwardRef(({asChild:e=!1,size:c=`md`,orientation:u=`horizontal`,className:d,children:p,onKeyDownCapture:m,onFocus:h,...g},_)=>{let v=(0,a.useRef)(null),y=n.useMergedRef(_,v),b=(0,a.useRef)(null),x=(0,a.useRef)(null),S=(0,a.useCallback)(()=>{let e=v.current;if(!e)return;let t=f(e),n=document.activeElement,r=n&&t.includes(n)?n:b.current&&t.includes(b.current)?b.current:t[0];b.current=r??null;for(let e of t)e===r?e.hasAttribute(l)&&(e.removeAttribute(l),e.setAttribute(`tabindex`,`0`)):e.getAttribute(`tabindex`)!==`-1`&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(l,``));x.current?.takeRecords()},[]);return(0,a.useLayoutEffect)(S),(0,a.useEffect)(()=>{let e=v.current;if(!e)return;let t=new MutationObserver(()=>S());return t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`disabled`,`tabindex`,`aria-hidden`]}),x.current=t,()=>{t.disconnect(),x.current=null}},[S]),(0,s.jsx)(e?t.Root:`div`,{ref:y,role:`toolbar`,"aria-orientation":u,"data-size":c,"data-orientation":u,className:(0,o.default)(`wim-toolbar`,i.default.root,i.default[`size-${c}`],i.default[u],d),onKeyDownCapture:e=>{if(m?.(e),e.defaultPrevented)return;let t=v.current;if(!t)return;let n=f(t);if(n.length===0)return;let i=n.indexOf(document.activeElement);if(i<0)return;let a=r.getRovingIndex({key:e.key,current:i,count:n.length,orientation:u});a!==null&&(e.preventDefault(),e.stopPropagation(),n[a]?.focus())},onFocus:e=>{h?.(e);let t=v.current,n=e.target;t&&n!==b.current&&f(t).includes(n)&&(b.current=n,S())},...g,children:p})});p.displayName=`Toolbar`;var m=a.default.forwardRef(({asChild:e=!1,className:n,children:r,...a},c)=>(0,s.jsx)(e?t.Root:`div`,{ref:c,role:`group`,className:(0,o.default)(i.default.group,n),...a,children:r}));m.displayName=`Toolbar.Group`;var h=a.default.forwardRef(({className:e,...t},n)=>(0,s.jsx)(`div`,{ref:n,role:`separator`,"aria-hidden":`true`,className:(0,o.default)(i.default.separator,e),...t}));h.displayName=`Toolbar.Separator`;var g=p;g.Group=m,g.Separator=h,exports.Toolbar=g,exports.default=g,exports.ToolbarGroup=m,exports.ToolbarSeparator=h;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useMergedRef as t } from "../../../hooks/useMergedRef.js";
|
|
4
|
-
import n from "
|
|
5
|
-
import r
|
|
6
|
-
import c from "
|
|
7
|
-
import
|
|
4
|
+
import { getRovingIndex as n } from "../../_internal/rovingIndex.js";
|
|
5
|
+
import r from "./toolbar.module.js";
|
|
6
|
+
import i, { useCallback as a, useEffect as o, useLayoutEffect as s, useRef as c } from "react";
|
|
7
|
+
import l from "classnames";
|
|
8
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/layout/Toolbar/Toolbar.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
let e =
|
|
10
|
+
var d = "button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]", f = "data-wim-toolbar-roving", p = /^(button|checkbox|radio|submit|reset|image|file|color)$/, m = (e) => e.tagName === "TEXTAREA" || e.tagName === "SELECT" || e.isContentEditable || e.tagName === "INPUT" && !p.test(e.type), h = (e) => Array.from(e.querySelectorAll(d)).filter((e) => !m(e) && !e.closest("[aria-hidden=\"true\"]") && (e.getAttribute("tabindex") !== "-1" || e.hasAttribute(f))), g = i.forwardRef(({ asChild: i = !1, size: d = "md", orientation: p = "horizontal", className: m, children: g, onKeyDownCapture: _, onFocus: v, ...y }, b) => {
|
|
11
|
+
let x = c(null), S = t(b, x), C = c(null), w = c(null), T = a(() => {
|
|
12
|
+
let e = x.current;
|
|
12
13
|
if (!e) return;
|
|
13
|
-
let t =
|
|
14
|
-
|
|
15
|
-
for (let e of t) e === r ? e.hasAttribute(
|
|
16
|
-
|
|
14
|
+
let t = h(e), n = document.activeElement, r = n && t.includes(n) ? n : C.current && t.includes(C.current) ? C.current : t[0];
|
|
15
|
+
C.current = r ?? null;
|
|
16
|
+
for (let e of t) e === r ? e.hasAttribute(f) && (e.removeAttribute(f), e.setAttribute("tabindex", "0")) : e.getAttribute("tabindex") !== "-1" && (e.setAttribute("tabindex", "-1"), e.setAttribute(f, ""));
|
|
17
|
+
w.current?.takeRecords();
|
|
17
18
|
}, []);
|
|
18
|
-
return
|
|
19
|
-
let e =
|
|
19
|
+
return s(T), o(() => {
|
|
20
|
+
let e = x.current;
|
|
20
21
|
if (!e) return;
|
|
21
|
-
let t = new MutationObserver(() =>
|
|
22
|
+
let t = new MutationObserver(() => T());
|
|
22
23
|
return t.observe(e, {
|
|
23
24
|
subtree: !0,
|
|
24
25
|
childList: !0,
|
|
@@ -28,59 +29,59 @@ var u = "button:not([disabled]), [href], input:not([disabled]), select:not([disa
|
|
|
28
29
|
"tabindex",
|
|
29
30
|
"aria-hidden"
|
|
30
31
|
]
|
|
31
|
-
}),
|
|
32
|
-
t.disconnect(),
|
|
32
|
+
}), w.current = t, () => {
|
|
33
|
+
t.disconnect(), w.current = null;
|
|
33
34
|
};
|
|
34
|
-
}, [
|
|
35
|
-
ref:
|
|
35
|
+
}, [T]), /* @__PURE__ */ u(i ? e : "div", {
|
|
36
|
+
ref: S,
|
|
36
37
|
role: "toolbar",
|
|
37
|
-
"aria-orientation":
|
|
38
|
-
"data-size":
|
|
39
|
-
"data-orientation":
|
|
40
|
-
className:
|
|
38
|
+
"aria-orientation": p,
|
|
39
|
+
"data-size": d,
|
|
40
|
+
"data-orientation": p,
|
|
41
|
+
className: l("wim-toolbar", r.root, r[`size-${d}`], r[p], m),
|
|
41
42
|
onKeyDownCapture: (e) => {
|
|
42
|
-
if (
|
|
43
|
-
let t =
|
|
43
|
+
if (_?.(e), e.defaultPrevented) return;
|
|
44
|
+
let t = x.current;
|
|
44
45
|
if (!t) return;
|
|
45
|
-
let
|
|
46
|
-
if (
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
e.stopPropagation(),
|
|
46
|
+
let r = h(t);
|
|
47
|
+
if (r.length === 0) return;
|
|
48
|
+
let i = r.indexOf(document.activeElement);
|
|
49
|
+
if (i < 0) return;
|
|
50
|
+
let a = n({
|
|
51
|
+
key: e.key,
|
|
52
|
+
current: i,
|
|
53
|
+
count: r.length,
|
|
54
|
+
orientation: p
|
|
55
|
+
});
|
|
56
|
+
a !== null && (e.preventDefault(), e.stopPropagation(), r[a]?.focus());
|
|
56
57
|
},
|
|
57
58
|
onFocus: (e) => {
|
|
58
|
-
|
|
59
|
-
let t =
|
|
60
|
-
t && n !==
|
|
59
|
+
v?.(e);
|
|
60
|
+
let t = x.current, n = e.target;
|
|
61
|
+
t && n !== C.current && h(t).includes(n) && (C.current = n, T());
|
|
61
62
|
},
|
|
62
|
-
...
|
|
63
|
-
children:
|
|
63
|
+
...y,
|
|
64
|
+
children: g
|
|
64
65
|
});
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
var
|
|
67
|
+
g.displayName = "Toolbar";
|
|
68
|
+
var _ = i.forwardRef(({ asChild: t = !1, className: n, children: i, ...a }, o) => /* @__PURE__ */ u(t ? e : "div", {
|
|
68
69
|
ref: o,
|
|
69
70
|
role: "group",
|
|
70
|
-
className:
|
|
71
|
+
className: l(r.group, n),
|
|
71
72
|
...a,
|
|
72
73
|
children: i
|
|
73
74
|
}));
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
ref:
|
|
75
|
+
_.displayName = "Toolbar.Group";
|
|
76
|
+
var v = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u("div", {
|
|
77
|
+
ref: n,
|
|
77
78
|
role: "separator",
|
|
78
79
|
"aria-hidden": "true",
|
|
79
|
-
className:
|
|
80
|
+
className: l(r.separator, e),
|
|
80
81
|
...t
|
|
81
82
|
}));
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
|
|
83
|
+
v.displayName = "Toolbar.Separator";
|
|
84
|
+
var y = g;
|
|
85
|
+
y.Group = _, y.Separator = v;
|
|
85
86
|
//#endregion
|
|
86
|
-
export {
|
|
87
|
+
export { y as Toolbar, y as default, _ as ToolbarGroup, v as ToolbarSeparator };
|
|
@@ -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;
|