wimui 0.58.1 → 0.60.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/ai/PromptInput/PromptInput.cjs +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +30 -30
- package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
- package/dist/components/ai/SourceCitation/SourceCitation.d.ts +5 -1
- package/dist/components/ai/SourceCitation/SourceCitation.js +10 -8
- package/dist/components/ai/Terminal/Terminal.cjs +2 -2
- package/dist/components/ai/Terminal/Terminal.js +16 -14
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.d.ts +5 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +54 -53
- package/dist/components/data-display/FAQSection/FAQSection.cjs +1 -1
- package/dist/components/data-display/FAQSection/FAQSection.d.ts +5 -1
- package/dist/components/data-display/FAQSection/FAQSection.js +5 -3
- package/dist/components/data-display/TreeView/TreeView.cjs +1 -1
- package/dist/components/data-display/TreeView/TreeView.d.ts +5 -1
- package/dist/components/data-display/TreeView/TreeView.js +87 -87
- package/dist/components/data-display/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/data-display/VirtualList/VirtualList.d.ts +2 -0
- package/dist/components/data-display/VirtualList/VirtualList.js +15 -14
- package/dist/components/feedback/Notification/Notification.cjs +1 -1
- package/dist/components/feedback/Notification/Notification.d.ts +5 -1
- package/dist/components/feedback/Notification/Notification.js +10 -8
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.d.ts +5 -1
- package/dist/components/feedback/Toast/Toast.js +11 -9
- package/dist/components/form/CopyButton/CopyButton.cjs +1 -1
- package/dist/components/form/CopyButton/CopyButton.d.ts +5 -1
- package/dist/components/form/CopyButton/CopyButton.js +17 -15
- package/dist/components/form/Dropzone/Dropzone.cjs +1 -1
- package/dist/components/form/Dropzone/Dropzone.d.ts +7 -1
- package/dist/components/form/Dropzone/Dropzone.js +29 -28
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.d.ts +7 -1
- package/dist/components/form/FileUpload/FileUpload.js +22 -17
- package/dist/components/form/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/form/ImageCropper/ImageCropper.js +102 -100
- package/dist/components/form/QueryBuilder/QueryBuilder.cjs +1 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.d.ts +7 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.js +104 -102
- package/dist/components/form/SignaturePad/SignaturePad.cjs +1 -1
- package/dist/components/form/SignaturePad/SignaturePad.d.ts +5 -1
- package/dist/components/form/SignaturePad/SignaturePad.js +47 -47
- package/dist/components/form/ThemeToggle/ThemeToggle.cjs +1 -1
- package/dist/components/form/ThemeToggle/ThemeToggle.js +59 -54
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +33 -31
- package/dist/components/navigation/BackTop/BackTop.cjs +1 -1
- package/dist/components/navigation/BackTop/BackTop.d.ts +4 -0
- package/dist/components/navigation/BackTop/BackTop.js +18 -16
- package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.d.ts +5 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.js +11 -6
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +5 -1
- package/dist/components/navigation/Pagination/Pagination.js +65 -63
- package/dist/components/overlay/Menu/Menu.cjs +1 -1
- package/dist/components/overlay/Menu/Menu.d.ts +4 -0
- package/dist/components/overlay/Menu/Menu.js +23 -21
- package/dist/llms-full.txt +33 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +4 -4
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/paperclip.cjs"),r=require("../../../icon/send.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../../form/FieldTemplate/FieldTemplate.cjs"),s=require("../../../hooks/useAutoResize.cjs"),c=require("../../_internal/FieldCharacterCount/FieldCharacterCount.cjs"),l=require("./prompt-input.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=u.default.forwardRef(({value:e,defaultValue:p=``,onChange:m,onSubmit:h,placeholder:g,maxLength:_,disabled:v=!1,loading:y=!1,showAttach:b=!1,onAttach:x,maxRows:S=8,fullWidth:C=!1,className:w,style:T,label:E,error:D,required:O,layout:k,id:A,...
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/paperclip.cjs"),r=require("../../../icon/send.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../../form/FieldTemplate/FieldTemplate.cjs"),s=require("../../../hooks/useAutoResize.cjs"),c=require("../../_internal/FieldCharacterCount/FieldCharacterCount.cjs"),l=require("./prompt-input.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");var p=u.default.forwardRef(({value:e,defaultValue:p=``,onChange:m,onSubmit:h,placeholder:g,maxLength:_,disabled:v=!1,loading:y=!1,showAttach:b=!1,onAttach:x,maxRows:S=8,fullWidth:C=!1,className:w,style:T,label:E,error:D,required:O,layout:k,id:A,"aria-label":j,"aria-labelledby":M,"aria-describedby":N,...P},F)=>{let{t:I}=t.useWimTranslation(a.formNs),L=e!==void 0,[R,z]=u.default.useState(p),B=L?e:R,V=s.useAutoResize(B,S);u.default.useImperativeHandle(F,()=>V.current);let H=g,U=u.default.useId(),W=A||`prompt-input-${U}`,G=D?`${W}-error`:void 0,K=E?`${W}-label`:void 0,q=(0,u.useCallback)(e=>{let t=e.target.value;L||z(t),m?.(t)},[L,m]),J=(0,u.useCallback)(()=>{!B.trim()||v||y||(h?.(B.trim()),L||z(``))},[B,v,y,L,h]),Y=(0,u.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),J())},[J]),X=B.trim().length>0&&!v&&!y;return(0,f.jsx)(o.FieldTemplate,{label:E,error:D,required:O,layout:k,labelId:K,htmlFor:W,errorId:G,className:w,style:C?{width:`100%`,minWidth:0,...T}:T,children:(0,f.jsxs)(`div`,{className:(0,d.default)(`wim-prompt-input`,l.default.root,{[l.default.disabled]:v,[l.default.loading]:y,[l.default.fullWidth]:C,[l.default.danger]:!!D}),...P,children:[(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.inputArea,{[l.default.noAttach]:!b}),children:[b&&(0,f.jsx)(`button`,{type:`button`,className:l.default.actionButton,onClick:x,"aria-label":I(`prompt_input.attach_label`),disabled:v||y,children:(0,f.jsx)(i.Icon,{component:n.default,size:`md`})}),(0,f.jsx)(`textarea`,{id:W,ref:V,className:l.default.textarea,value:B,onChange:q,onKeyDown:Y,placeholder:H,rows:1,disabled:v||y,maxLength:_,"aria-invalid":!!D,"aria-describedby":[N,G].filter(Boolean).join(` `)||void 0,"aria-labelledby":E?K:M,"aria-label":E||M?void 0:j??I(`prompt_input.aria_label`),"aria-required":O}),(0,f.jsx)(`button`,{type:`button`,className:(0,d.default)(l.default.actionButton,l.default.sendButton),onClick:J,disabled:!X,"aria-label":I(`prompt_input.send_label`),children:(0,f.jsx)(i.Icon,{component:r.default,size:`md`})})]}),(0,f.jsx)(c.FieldCharacterCount,{count:B.length,maxLength:_,className:l.default.charCount})]})})});p.displayName=`PromptInput`,exports.PromptInput=p;
|
|
@@ -12,31 +12,31 @@ import l, { useCallback as u } from "react";
|
|
|
12
12
|
import d from "classnames";
|
|
13
13
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/ai/PromptInput/PromptInput.tsx
|
|
15
|
-
var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _, placeholder: v, maxLength: y, disabled: b = !1, loading: x = !1, showAttach: S = !1, onAttach: C, maxRows: w = 8, fullWidth: T = !1, className: E, style: D, label: O, error: k, required: A, layout: j, id: M,
|
|
16
|
-
let { t:
|
|
17
|
-
l.useImperativeHandle(
|
|
18
|
-
let
|
|
15
|
+
var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _, placeholder: v, maxLength: y, disabled: b = !1, loading: x = !1, showAttach: S = !1, onAttach: C, maxRows: w = 8, fullWidth: T = !1, className: E, style: D, label: O, error: k, required: A, layout: j, id: M, "aria-label": N, "aria-labelledby": P, "aria-describedby": F, ...I }, L) => {
|
|
16
|
+
let { t: R } = e(i), z = m !== void 0, [B, V] = l.useState(h), H = z ? m : B, U = o(H, w);
|
|
17
|
+
l.useImperativeHandle(L, () => U.current);
|
|
18
|
+
let W = v, G = l.useId(), K = M || `prompt-input-${G}`, q = k ? `${K}-error` : void 0, J = O ? `${K}-label` : void 0, Y = u((e) => {
|
|
19
19
|
let t = e.target.value;
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
!
|
|
20
|
+
z || V(t), g?.(t);
|
|
21
|
+
}, [z, g]), X = u(() => {
|
|
22
|
+
!H.trim() || b || x || (_?.(H.trim()), z || V(""));
|
|
23
23
|
}, [
|
|
24
|
-
|
|
24
|
+
H,
|
|
25
25
|
b,
|
|
26
26
|
x,
|
|
27
|
-
|
|
27
|
+
z,
|
|
28
28
|
_
|
|
29
|
-
]),
|
|
30
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
31
|
-
}, [
|
|
29
|
+
]), Z = u((e) => {
|
|
30
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
|
|
31
|
+
}, [X]), Q = H.trim().length > 0 && !b && !x;
|
|
32
32
|
return /* @__PURE__ */ f(a, {
|
|
33
33
|
label: O,
|
|
34
34
|
error: k,
|
|
35
35
|
required: A,
|
|
36
36
|
layout: j,
|
|
37
|
-
labelId:
|
|
38
|
-
htmlFor:
|
|
39
|
-
errorId:
|
|
37
|
+
labelId: J,
|
|
38
|
+
htmlFor: K,
|
|
39
|
+
errorId: q,
|
|
40
40
|
className: E,
|
|
41
41
|
style: T ? {
|
|
42
42
|
width: "100%",
|
|
@@ -50,7 +50,7 @@ var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _
|
|
|
50
50
|
[c.fullWidth]: T,
|
|
51
51
|
[c.danger]: !!k
|
|
52
52
|
}),
|
|
53
|
-
...
|
|
53
|
+
...I,
|
|
54
54
|
children: [/* @__PURE__ */ p("div", {
|
|
55
55
|
className: d(c.inputArea, { [c.noAttach]: !S }),
|
|
56
56
|
children: [
|
|
@@ -58,7 +58,7 @@ var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _
|
|
|
58
58
|
type: "button",
|
|
59
59
|
className: c.actionButton,
|
|
60
60
|
onClick: C,
|
|
61
|
-
"aria-label":
|
|
61
|
+
"aria-label": R("prompt_input.attach_label"),
|
|
62
62
|
disabled: b || x,
|
|
63
63
|
children: /* @__PURE__ */ f(r, {
|
|
64
64
|
component: t,
|
|
@@ -66,28 +66,28 @@ var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _
|
|
|
66
66
|
})
|
|
67
67
|
}),
|
|
68
68
|
/* @__PURE__ */ f("textarea", {
|
|
69
|
-
id:
|
|
70
|
-
ref:
|
|
69
|
+
id: K,
|
|
70
|
+
ref: U,
|
|
71
71
|
className: c.textarea,
|
|
72
|
-
value:
|
|
73
|
-
onChange:
|
|
74
|
-
onKeyDown:
|
|
75
|
-
placeholder:
|
|
72
|
+
value: H,
|
|
73
|
+
onChange: Y,
|
|
74
|
+
onKeyDown: Z,
|
|
75
|
+
placeholder: W,
|
|
76
76
|
rows: 1,
|
|
77
77
|
disabled: b || x,
|
|
78
78
|
maxLength: y,
|
|
79
79
|
"aria-invalid": !!k,
|
|
80
|
-
"aria-describedby":
|
|
81
|
-
"aria-labelledby": O ?
|
|
82
|
-
"aria-label": O ? void 0 :
|
|
80
|
+
"aria-describedby": [F, q].filter(Boolean).join(" ") || void 0,
|
|
81
|
+
"aria-labelledby": O ? J : P,
|
|
82
|
+
"aria-label": O || P ? void 0 : N ?? R("prompt_input.aria_label"),
|
|
83
83
|
"aria-required": A
|
|
84
84
|
}),
|
|
85
85
|
/* @__PURE__ */ f("button", {
|
|
86
86
|
type: "button",
|
|
87
87
|
className: d(c.actionButton, c.sendButton),
|
|
88
|
-
onClick:
|
|
89
|
-
disabled: !
|
|
90
|
-
"aria-label":
|
|
88
|
+
onClick: X,
|
|
89
|
+
disabled: !Q,
|
|
90
|
+
"aria-label": R("prompt_input.send_label"),
|
|
91
91
|
children: /* @__PURE__ */ f(r, {
|
|
92
92
|
component: n,
|
|
93
93
|
size: "md"
|
|
@@ -95,7 +95,7 @@ var m = l.forwardRef(({ value: m, defaultValue: h = "", onChange: g, onSubmit: _
|
|
|
95
95
|
})
|
|
96
96
|
]
|
|
97
97
|
}), /* @__PURE__ */ f(s, {
|
|
98
|
-
count:
|
|
98
|
+
count: H.length,
|
|
99
99
|
maxLength: y,
|
|
100
100
|
className: c.charCount
|
|
101
101
|
})]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/external-link.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("./source-citation.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");function l(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}var u=({title:e,url:o,description:u,index:d,domain:f,className:p})=>{let{t:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/external-link.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("./source-citation.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");function l(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}var u=({title:e,url:o,description:u,index:d,domain:f,className:p,"aria-label":m,"aria-labelledby":h})=>{let{t:g}=t.useWimTranslation(i.formNs),_=f??(o?l(o):void 0),v=d==null?e:g(`source_citation.source_label`,{index:d}),y=h?void 0:m??v,b=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`div`,{className:a.default.header,children:[d!=null&&(0,c.jsx)(`span`,{className:a.default.index,"aria-hidden":`true`,children:d}),(0,c.jsx)(`span`,{className:a.default.title,children:e}),o&&(0,c.jsx)(r.Icon,{component:n.default,size:`xs`,className:a.default.externalIcon,"aria-hidden":`true`})]}),_&&(0,c.jsx)(`div`,{className:a.default.domain,children:_}),u&&(0,c.jsx)(`p`,{className:a.default.description,children:u})]});return o?(0,c.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:(0,s.default)(`wim-source-citation`,a.default.root,a.default.link,p),"aria-label":y,"aria-labelledby":h,children:b}):(0,c.jsx)(`div`,{className:(0,s.default)(`wim-source-citation`,a.default.root,p),role:`group`,"aria-label":y,"aria-labelledby":h,children:b})},d=o.default.forwardRef(({sources:e,className:t,...n},r)=>(0,c.jsx)(`div`,{ref:r,className:(0,s.default)(a.default.list,t),...n,children:e.map((e,t)=>(0,c.jsx)(u,{index:t+1,...e},e.url??e.title))}));d.displayName=`SourceCitationList`,exports.SourceCitation=u,exports.SourceCitationList=d;
|
|
@@ -12,6 +12,10 @@ export interface SourceCitationProps {
|
|
|
12
12
|
domain?: string;
|
|
13
13
|
/** Additional CSS class */
|
|
14
14
|
className?: string;
|
|
15
|
+
/** Accessible name for the citation. */
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
/** ID of the element that labels the citation. Takes precedence over `aria-label`. */
|
|
18
|
+
"aria-labelledby"?: string;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* SourceCitation displays a single cited source with optional link, index badge, and description.
|
|
@@ -21,7 +25,7 @@ export interface SourceCitationProps {
|
|
|
21
25
|
* - Managed by: App consumption
|
|
22
26
|
* - Scroll lock: No
|
|
23
27
|
*/
|
|
24
|
-
export declare const SourceCitation: ({ title, url, description, index, domain: domainProp, className, }: SourceCitationProps) => React.JSX.Element;
|
|
28
|
+
export declare const SourceCitation: ({ title, url, description, index, domain: domainProp, className, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: SourceCitationProps) => React.JSX.Element;
|
|
25
29
|
export interface SourceCitationListProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
26
30
|
/** Array of sources to display */
|
|
27
31
|
sources: SourceCitationProps[];
|
|
@@ -15,8 +15,8 @@ function u(e) {
|
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
var d = ({ title: a, url: d, description: f, index: p, domain: m, className: h }) => {
|
|
19
|
-
let { t:
|
|
18
|
+
var d = ({ title: a, url: d, description: f, index: p, domain: m, className: h, "aria-label": g, "aria-labelledby": _ }) => {
|
|
19
|
+
let { t: v } = e(r), y = m ?? (d ? u(d) : void 0), b = p == null ? a : v("source_citation.source_label", { index: p }), x = _ ? void 0 : g ?? b, S = /* @__PURE__ */ l(s, { children: [
|
|
20
20
|
/* @__PURE__ */ l("div", {
|
|
21
21
|
className: i.header,
|
|
22
22
|
children: [
|
|
@@ -37,9 +37,9 @@ var d = ({ title: a, url: d, description: f, index: p, domain: m, className: h }
|
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
40
|
-
|
|
40
|
+
y && /* @__PURE__ */ c("div", {
|
|
41
41
|
className: i.domain,
|
|
42
|
-
children:
|
|
42
|
+
children: y
|
|
43
43
|
}),
|
|
44
44
|
f && /* @__PURE__ */ c("p", {
|
|
45
45
|
className: i.description,
|
|
@@ -51,13 +51,15 @@ var d = ({ title: a, url: d, description: f, index: p, domain: m, className: h }
|
|
|
51
51
|
target: "_blank",
|
|
52
52
|
rel: "noopener noreferrer",
|
|
53
53
|
className: o("wim-source-citation", i.root, i.link, h),
|
|
54
|
-
"aria-label":
|
|
55
|
-
|
|
54
|
+
"aria-label": x,
|
|
55
|
+
"aria-labelledby": _,
|
|
56
|
+
children: S
|
|
56
57
|
}) : /* @__PURE__ */ c("div", {
|
|
57
58
|
className: o("wim-source-citation", i.root, h),
|
|
58
59
|
role: "group",
|
|
59
|
-
"aria-label":
|
|
60
|
-
|
|
60
|
+
"aria-label": x,
|
|
61
|
+
"aria-labelledby": _,
|
|
62
|
+
children: S
|
|
61
63
|
});
|
|
62
64
|
}, f = a.forwardRef(({ sources: e, className: t, ...n }, r) => /* @__PURE__ */ c("div", {
|
|
63
65
|
ref: r,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/copy.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("../../../i18n/generated/form.cjs"),s=require("./terminal.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={30:`#2d2d2d`,31:`#e06c75`,32:`#98c379`,33:`#e5c07b`,34:`#61afef`,35:`#c678dd`,36:`#56b6c2`,37:`#abb2bf`,90:`#9aa1ab`,91:`#e06c75`,92:`#98c379`,93:`#e5c07b`,94:`#61afef`,95:`#c678dd`,96:`#56b6c2`,97:`#ffffff`};function f(e){let t=RegExp(`\x1B\\[([0-9;]*)m`,`g`),n=[],r=0,i={},a=0;for(let o of e.matchAll(t)){o.index>r&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r,o.index)},a++));let t=o[1]?o[1].split(`;`).map(Number):[0],s={...i};for(let e of t)e===0?Object.assign(s,{color:void 0,bold:void 0}):e===1?s.bold=!0:d[e]&&(s.color=d[e]);i=s,r=o.index+o[0].length}return r<e.length&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r)},a++)),n.length===1?n[0]:(0,u.jsx)(u.Fragment,{children:n})}var p=c.default.forwardRef(({lines:e=[],title:d,height:p,autoScroll:m=!0,prompt:h=`$`,showCopy:g=!0,showWindowControls:_=!1,onClear:v,className:y,style:b,...
|
|
3
|
-
`);try{await navigator.clipboard.writeText(t),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/copy.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("../../../i18n/generated/form.cjs"),s=require("./terminal.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={30:`#2d2d2d`,31:`#e06c75`,32:`#98c379`,33:`#e5c07b`,34:`#61afef`,35:`#c678dd`,36:`#56b6c2`,37:`#abb2bf`,90:`#9aa1ab`,91:`#e06c75`,92:`#98c379`,93:`#e5c07b`,94:`#61afef`,95:`#c678dd`,96:`#56b6c2`,97:`#ffffff`};function f(e){let t=RegExp(`\x1B\\[([0-9;]*)m`,`g`),n=[],r=0,i={},a=0;for(let o of e.matchAll(t)){o.index>r&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r,o.index)},a++));let t=o[1]?o[1].split(`;`).map(Number):[0],s={...i};for(let e of t)e===0?Object.assign(s,{color:void 0,bold:void 0}):e===1?s.bold=!0:d[e]&&(s.color=d[e]);i=s,r=o.index+o[0].length}return r<e.length&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r)},a++)),n.length===1?n[0]:(0,u.jsx)(u.Fragment,{children:n})}var p=c.default.forwardRef(({lines:e=[],title:d,height:p,autoScroll:m=!0,prompt:h=`$`,showCopy:g=!0,showWindowControls:_=!1,onClear:v,className:y,style:b,"aria-label":x,"aria-labelledby":S,"aria-describedby":C,...w},T)=>{let{t:E}=t.useWimTranslation(o.formNs),[D,O]=c.default.useState(!1),k=(0,c.useRef)(null);(0,c.useEffect)(()=>{m&&k.current&&(k.current.scrollTop=k.current.scrollHeight)},[e,m]);let A=(0,c.useCallback)(async()=>{let t=e.map(e=>e.type===`input`?`${h} ${e.content}`:e.content).join(`
|
|
3
|
+
`);try{await navigator.clipboard.writeText(t),O(!0),setTimeout(()=>O(!1),2e3)}catch{}},[e,h]);return(0,u.jsxs)(`div`,{ref:T,"data-theme":`dark`,className:(0,l.default)(`wim-terminal`,s.default.root,y),style:{...p==null?{}:{height:p},...b},...w,children:[(0,u.jsxs)(`div`,{className:s.default.titleBar,children:[_&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`red`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`yellow`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`green`,"aria-hidden":`true`})]}),d&&(0,u.jsx)(`span`,{className:s.default.titleText,children:d}),(0,u.jsxs)(`div`,{className:s.default.titleActions,children:[g&&(0,u.jsx)(`button`,{type:`button`,className:(0,l.default)(s.default.titleBtn,D&&s.default.copied),onClick:A,"aria-label":E(D?`terminal.copied_label`:`terminal.copy_label`),children:(0,u.jsx)(a.Icon,{component:D?n.default:i.default,size:`sm`})}),v&&(0,u.jsx)(`button`,{type:`button`,className:s.default.titleBtn,onClick:v,"aria-label":E(`terminal.clear_label`),children:(0,u.jsx)(a.Icon,{component:r.default,size:`sm`})})]})]}),(0,u.jsx)(`div`,{ref:k,className:s.default.body,role:`log`,"aria-live":`polite`,"aria-label":S?void 0:x??d,"aria-labelledby":S,"aria-describedby":C,tabIndex:0,children:e.map((e,t)=>(0,u.jsxs)(`div`,{className:(0,l.default)(s.default.line,e.type&&s.default[e.type]),children:[e.type===`input`&&(0,u.jsx)(`span`,{className:s.default.prompt,"aria-hidden":`true`,children:h}),(0,u.jsx)(`span`,{className:s.default.content,children:f(e.content)})]},e.id??t))})]})});p.displayName=`Terminal`,exports.Terminal=p;
|
|
@@ -53,26 +53,26 @@ function g(e) {
|
|
|
53
53
|
children: e.slice(r)
|
|
54
54
|
}, a++)), n.length === 1 ? n[0] : /* @__PURE__ */ p(f, { children: n });
|
|
55
55
|
}
|
|
56
|
-
var _ = s.forwardRef(({ lines: h = [], title: _, height: v, autoScroll: y = !0, prompt: b = "$", showCopy: x = !0, showWindowControls: S = !1, onClear: C, className: w, style: T,
|
|
57
|
-
let { t:
|
|
56
|
+
var _ = s.forwardRef(({ lines: h = [], title: _, height: v, autoScroll: y = !0, prompt: b = "$", showCopy: x = !0, showWindowControls: S = !1, onClear: C, className: w, style: T, "aria-label": E, "aria-labelledby": D, "aria-describedby": O, ...k }, A) => {
|
|
57
|
+
let { t: j } = e(a), [M, N] = s.useState(!1), P = u(null);
|
|
58
58
|
l(() => {
|
|
59
|
-
y &&
|
|
59
|
+
y && P.current && (P.current.scrollTop = P.current.scrollHeight);
|
|
60
60
|
}, [h, y]);
|
|
61
|
-
let
|
|
61
|
+
let F = c(async () => {
|
|
62
62
|
let e = h.map((e) => e.type === "input" ? `${b} ${e.content}` : e.content).join("\n");
|
|
63
63
|
try {
|
|
64
|
-
await navigator.clipboard.writeText(e),
|
|
64
|
+
await navigator.clipboard.writeText(e), N(!0), setTimeout(() => N(!1), 2e3);
|
|
65
65
|
} catch {}
|
|
66
66
|
}, [h, b]);
|
|
67
67
|
return /* @__PURE__ */ m("div", {
|
|
68
|
-
ref:
|
|
68
|
+
ref: A,
|
|
69
69
|
"data-theme": "dark",
|
|
70
70
|
className: d("wim-terminal", o.root, w),
|
|
71
71
|
style: {
|
|
72
72
|
...v == null ? {} : { height: v },
|
|
73
73
|
...T
|
|
74
74
|
},
|
|
75
|
-
...
|
|
75
|
+
...k,
|
|
76
76
|
children: [/* @__PURE__ */ m("div", {
|
|
77
77
|
className: o.titleBar,
|
|
78
78
|
children: [
|
|
@@ -101,18 +101,18 @@ var _ = s.forwardRef(({ lines: h = [], title: _, height: v, autoScroll: y = !0,
|
|
|
101
101
|
className: o.titleActions,
|
|
102
102
|
children: [x && /* @__PURE__ */ p("button", {
|
|
103
103
|
type: "button",
|
|
104
|
-
className: d(o.titleBtn,
|
|
105
|
-
onClick:
|
|
106
|
-
"aria-label":
|
|
104
|
+
className: d(o.titleBtn, M && o.copied),
|
|
105
|
+
onClick: F,
|
|
106
|
+
"aria-label": j(M ? "terminal.copied_label" : "terminal.copy_label"),
|
|
107
107
|
children: /* @__PURE__ */ p(i, {
|
|
108
|
-
component:
|
|
108
|
+
component: M ? t : r,
|
|
109
109
|
size: "sm"
|
|
110
110
|
})
|
|
111
111
|
}), C && /* @__PURE__ */ p("button", {
|
|
112
112
|
type: "button",
|
|
113
113
|
className: o.titleBtn,
|
|
114
114
|
onClick: C,
|
|
115
|
-
"aria-label":
|
|
115
|
+
"aria-label": j("terminal.clear_label"),
|
|
116
116
|
children: /* @__PURE__ */ p(i, {
|
|
117
117
|
component: n,
|
|
118
118
|
size: "sm"
|
|
@@ -121,11 +121,13 @@ var _ = s.forwardRef(({ lines: h = [], title: _, height: v, autoScroll: y = !0,
|
|
|
121
121
|
})
|
|
122
122
|
]
|
|
123
123
|
}), /* @__PURE__ */ p("div", {
|
|
124
|
-
ref:
|
|
124
|
+
ref: P,
|
|
125
125
|
className: o.body,
|
|
126
126
|
role: "log",
|
|
127
127
|
"aria-live": "polite",
|
|
128
|
-
"aria-label": _,
|
|
128
|
+
"aria-label": D ? void 0 : E ?? _,
|
|
129
|
+
"aria-labelledby": D,
|
|
130
|
+
"aria-describedby": O,
|
|
129
131
|
tabIndex: 0,
|
|
130
132
|
children: h.map((e, t) => /* @__PURE__ */ m("div", {
|
|
131
133
|
className: d(o.line, e.type && o[e.type]),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../form/Checkbox/Checkbox.cjs"),i=require("../../navigation/Pagination/Pagination.cjs"),a=require("../Table/Table.cjs"),o=require("./useFixedColumns.cjs"),s=require("./useDataGridKeyboard.cjs"),c=require("./useInfiniteScroll.cjs"),l=require("./datagrid.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");function p({columns:e,data:p,rowKey:m=`id`,loading:h=!1,striped:g=!1,bordered:_=!1,hoverable:v=!0,stickyHeader:y=!0,height:b,maxHeight:x,emptyMessage:S,mobileCard:C=!1,selection:w,selectedRowKeys:T,onSelectionChange:E,sortConfig:D,onSortChange:O,pagination:k,infiniteScroll:A,className:j,ariaLabel:M}){let{t:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../form/Checkbox/Checkbox.cjs"),i=require("../../navigation/Pagination/Pagination.cjs"),a=require("../Table/Table.cjs"),o=require("./useFixedColumns.cjs"),s=require("./useDataGridKeyboard.cjs"),c=require("./useInfiniteScroll.cjs"),l=require("./datagrid.module.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("classnames");d=e.__toESM(d,1);let f=require("react/jsx-runtime");function p({columns:e,data:p,rowKey:m=`id`,loading:h=!1,striped:g=!1,bordered:_=!1,hoverable:v=!0,stickyHeader:y=!0,height:b,maxHeight:x,emptyMessage:S,mobileCard:C=!1,selection:w,selectedRowKeys:T,onSelectionChange:E,sortConfig:D,onSortChange:O,pagination:k,infiniteScroll:A,className:j,ariaLabel:M,"aria-label":N,"aria-labelledby":P}){let{t:F}=t.useWimTranslation(n.commonNs),I=h!==!1&&h!==void 0,L=h===!0||h===`blocking`,R=(0,u.useMemo)(()=>w?w===!0?{type:`checkbox`,selectedRowKeys:T??[],onChange:(e,t)=>{E?.(e,t)}}:w:null,[w,T,E]),{fixedLeftOffsets:z,fixedRightOffsets:B}=o.useFixedColumns(e,!!R),V=(e,t=!1)=>{let n=z[e];if(n)return{stickyLeft:!0,leftOffset:n.offset,stickyZIndex:t?1e3+n.zIndex:n.zIndex,className:(0,d.default)(l.default.cellFixed,n.isLast&&l.default.cellFixedLeftLast)};let r=B[e];return r?{stickyRight:!0,rightOffset:r.offset,stickyZIndex:t?1e3+r.zIndex:r.zIndex,className:(0,d.default)(l.default.cellFixed,r.isFirst&&l.default.cellFixedRightFirst)}:{}},H=(0,u.useCallback)(e=>typeof m==`function`?m(e):e[m],[m]),U=(0,u.useMemo)(()=>!R||p.length===0?!1:p.every(e=>R.selectedRowKeys.includes(H(e))),[p,R,H]),W=(0,u.useMemo)(()=>R?!U&&p.some(e=>R.selectedRowKeys.includes(H(e))):!1,[p,R,U,H]),G=e=>{if(!R)return;let t=e.target.checked,n=t?p.map(H):[],r=t?p:[];R.onChange(n,r)},K=(e,t)=>{if(!R)return;let n=t.target.checked,r=H(e),i=n?[...R.selectedRowKeys,r]:R.selectedRowKeys.filter(e=>e!==r),a=p.filter(e=>i.includes(H(e)));R.onChange(i,a)},{focusedCell:q,handleKeyDown:J,containerRef:Y}=s.useDataGridKeyboard(e,p,!!R),{loaderRef:X}=c.useInfiniteScroll(A),Z=e.length+ +!!R;return(0,f.jsxs)(`div`,{className:(0,d.default)(`wim-data-grid`,l.default.root,L&&l.default.loading,C===`md`?l.default.mobileCardMd:C&&l.default.mobileCard,j),"aria-busy":I||void 0,children:[(0,f.jsxs)(`div`,{className:l.default.container,style:{height:b,maxHeight:x},inert:L||void 0,children:[(0,f.jsxs)(a.Table,{ref:Y,onKeyDown:J,tabIndex:0,role:`grid`,"aria-label":P?void 0:N??M??F(`a11y.data_grid`),"aria-labelledby":P,"aria-rowcount":p.length+1,"aria-colcount":Z,striped:g,bordered:_,hoverable:v,stickyHeader:y,mobileCard:C,fullWidth:!0,className:(0,d.default)(`wim-table`,l.default.table),containerClassName:l.default.tableContainer,children:[(0,f.jsx)(a.Table.Header,{children:(0,f.jsxs)(a.Table.Row,{children:[R&&(0,f.jsx)(a.Table.Head,{role:`columnheader`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:1150,"data-row":-1,"data-col":-1,"aria-label":F(`a11y.select_all_rows`),tabIndex:q.row===-1&&q.col===-1?0:-1,children:(R.type??`checkbox`)===`checkbox`&&(0,f.jsx)(r.Checkbox,{checked:U,indeterminate:W,onChange:G,"aria-label":F(`a11y.select_all_rows`)})}),e.map((e,t)=>{let n=V(e.key,!0);return(0,f.jsx)(a.Table.Head,{role:`columnheader`,style:{width:e.width,minWidth:e.width},sortable:!!(e.sortable&&O),sortDirection:D?.key===e.key?D.direction:`none`,onSort:()=>{if(!e.sortable||!O)return;let t=D?.key===e.key?D.direction===`asc`?`desc`:D.direction===`desc`?`none`:`asc`:`asc`;O(e.key,t)},...n,tabIndex:q.row===-1&&q.col===(R?t+1:t)?0:-1,"data-row":-1,"data-col":R?t+1:t,children:e.title},e.key)})]})}),(0,f.jsx)(a.Table.Body,{children:p.map((t,n)=>{let i=H(t),o=R?.selectedRowKeys.includes(i);return(0,f.jsxs)(a.Table.Row,{selected:o,children:[R&&(0,f.jsx)(a.Table.Cell,{role:`gridcell`,selection:!0,stickyLeft:!0,leftOffset:0,stickyZIndex:150,"data-row":n,"data-col":-1,tabIndex:q.row===n&&q.col===-1?0:-1,children:(0,f.jsx)(r.Checkbox,{checked:o,onChange:e=>K(t,e),"aria-label":F(`a11y.select_row`)})}),e.map((e,r)=>{let i=V(e.key,!1),o=t[e.dataIndex??e.key];return(0,f.jsx)(a.Table.Cell,{role:`gridcell`,label:typeof e.title==`string`?e.title:void 0,...i,"data-row":n,"data-col":R?r+1:r,tabIndex:q.row===n&&q.col===(R?r+1:r)?0:-1,children:e.maxWidth==null?e.render?e.render(o,t,n):o:(0,f.jsx)(`div`,{style:{maxWidth:e.maxWidth},children:e.render?e.render(o,t,n):o})},e.key)})]},i)})})]}),p.length===0&&S&&(0,f.jsx)(`div`,{role:`status`,className:l.default.empty,children:S}),A?.hasMore&&(0,f.jsx)(`div`,{ref:X,className:l.default.loader,children:A.hasMore&&F(`dataGrid.loading_more`)})]}),k&&(0,f.jsxs)(`div`,{className:l.default.footer,inert:L||void 0,children:[(0,f.jsxs)(`div`,{className:l.default.info,children:[F(`dataGrid.displaying`,{shown:p.length,total:k.total}),R?.selectedRowKeys&&R.selectedRowKeys.length>0&&(0,f.jsx)(`span`,{className:l.default.selectionInfo,children:F(`dataGrid.rows_selected`,{selected:R.selectedRowKeys.length})})]}),(0,f.jsx)(`div`,{className:l.default.pagination,children:(0,f.jsx)(i.Pagination,{className:l.default.paginationContent,current:k.current,total:k.total,pageSize:k.pageSize,onChange:k.onChange})})]})]})}exports.DataGrid=p;
|
|
@@ -96,6 +96,10 @@ export type DataGridProps<T> = {
|
|
|
96
96
|
className?: string;
|
|
97
97
|
/** Accessibility label for the grid */
|
|
98
98
|
ariaLabel?: string;
|
|
99
|
+
/** Accessible name for the grid. Takes precedence over `ariaLabel`. */
|
|
100
|
+
"aria-label"?: string;
|
|
101
|
+
/** ID of the element that labels the grid. Takes precedence over `aria-label`. */
|
|
102
|
+
"aria-labelledby"?: string;
|
|
99
103
|
};
|
|
100
|
-
export declare function DataGrid<T extends Record<string, unknown>>({ columns, data, rowKey, loading, striped, bordered, hoverable, stickyHeader, height, maxHeight, emptyMessage, mobileCard, selection: selectionProp, selectedRowKeys: propsSelectedRowKeys, onSelectionChange, sortConfig, onSortChange, pagination, infiniteScroll, className, ariaLabel, }: DataGridProps<T>): React.JSX.Element;
|
|
104
|
+
export declare function DataGrid<T extends Record<string, unknown>>({ columns, data, rowKey, loading, striped, bordered, hoverable, stickyHeader, height, maxHeight, emptyMessage, mobileCard, selection: selectionProp, selectedRowKeys: propsSelectedRowKeys, onSelectionChange, sortConfig, onSortChange, pagination, infiniteScroll, className, ariaLabel, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: DataGridProps<T>): React.JSX.Element;
|
|
101
105
|
export {};
|
|
@@ -12,8 +12,8 @@ import { useCallback as l, useMemo as u } from "react";
|
|
|
12
12
|
import d from "classnames";
|
|
13
13
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/data-display/DataGrid/DataGrid.tsx
|
|
15
|
-
function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v = !1, bordered: y = !1, hoverable: b = !0, stickyHeader: x = !0, height: S, maxHeight: C, emptyMessage: w, mobileCard: T = !1, selection: E, selectedRowKeys: D, onSelectionChange: O, sortConfig: k, onSortChange: A, pagination: j, infiniteScroll: M, className: N, ariaLabel: P }) {
|
|
16
|
-
let { t:
|
|
15
|
+
function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v = !1, bordered: y = !1, hoverable: b = !0, stickyHeader: x = !0, height: S, maxHeight: C, emptyMessage: w, mobileCard: T = !1, selection: E, selectedRowKeys: D, onSelectionChange: O, sortConfig: k, onSortChange: A, pagination: j, infiniteScroll: M, className: N, ariaLabel: P, "aria-label": F, "aria-labelledby": I }) {
|
|
16
|
+
let { t: L } = e(t), R = _ !== !1 && _ !== void 0, z = _ === !0 || _ === "blocking", B = u(() => E ? E === !0 ? {
|
|
17
17
|
type: "checkbox",
|
|
18
18
|
selectedRowKeys: D ?? [],
|
|
19
19
|
onChange: (e, t) => {
|
|
@@ -23,58 +23,59 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
23
23
|
E,
|
|
24
24
|
D,
|
|
25
25
|
O
|
|
26
|
-
]), { fixedLeftOffsets:
|
|
27
|
-
let n =
|
|
26
|
+
]), { fixedLeftOffsets: V, fixedRightOffsets: H } = a(m, !!B), U = (e, t = !1) => {
|
|
27
|
+
let n = V[e];
|
|
28
28
|
if (n) return {
|
|
29
29
|
stickyLeft: !0,
|
|
30
30
|
leftOffset: n.offset,
|
|
31
31
|
stickyZIndex: t ? 1e3 + n.zIndex : n.zIndex,
|
|
32
32
|
className: d(c.cellFixed, n.isLast && c.cellFixedLeftLast)
|
|
33
33
|
};
|
|
34
|
-
let r =
|
|
34
|
+
let r = H[e];
|
|
35
35
|
return r ? {
|
|
36
36
|
stickyRight: !0,
|
|
37
37
|
rightOffset: r.offset,
|
|
38
38
|
stickyZIndex: t ? 1e3 + r.zIndex : r.zIndex,
|
|
39
39
|
className: d(c.cellFixed, r.isFirst && c.cellFixedRightFirst)
|
|
40
40
|
} : {};
|
|
41
|
-
},
|
|
41
|
+
}, W = l((e) => typeof g == "function" ? g(e) : e[g], [g]), G = u(() => !B || h.length === 0 ? !1 : h.every((e) => B.selectedRowKeys.includes(W(e))), [
|
|
42
42
|
h,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
]),
|
|
43
|
+
B,
|
|
44
|
+
W
|
|
45
|
+
]), K = u(() => B ? !G && h.some((e) => B.selectedRowKeys.includes(W(e))) : !1, [
|
|
46
46
|
h,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]),
|
|
51
|
-
if (!
|
|
52
|
-
let t = e.target.checked, n = t ? h.map(
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
if (!
|
|
56
|
-
let n = t.target.checked, r =
|
|
57
|
-
|
|
58
|
-
}, { focusedCell:
|
|
47
|
+
B,
|
|
48
|
+
G,
|
|
49
|
+
W
|
|
50
|
+
]), q = (e) => {
|
|
51
|
+
if (!B) return;
|
|
52
|
+
let t = e.target.checked, n = t ? h.map(W) : [], r = t ? h : [];
|
|
53
|
+
B.onChange(n, r);
|
|
54
|
+
}, J = (e, t) => {
|
|
55
|
+
if (!B) return;
|
|
56
|
+
let n = t.target.checked, r = W(e), i = n ? [...B.selectedRowKeys, r] : B.selectedRowKeys.filter((e) => e !== r), a = h.filter((e) => i.includes(W(e)));
|
|
57
|
+
B.onChange(i, a);
|
|
58
|
+
}, { focusedCell: Y, handleKeyDown: X, containerRef: Z } = o(m, h, !!B), { loaderRef: Q } = s(M), $ = m.length + +!!B;
|
|
59
59
|
return /* @__PURE__ */ p("div", {
|
|
60
|
-
className: d("wim-data-grid", c.root,
|
|
61
|
-
"aria-busy":
|
|
60
|
+
className: d("wim-data-grid", c.root, z && c.loading, T === "md" ? c.mobileCardMd : T && c.mobileCard, N),
|
|
61
|
+
"aria-busy": R || void 0,
|
|
62
62
|
children: [/* @__PURE__ */ p("div", {
|
|
63
63
|
className: c.container,
|
|
64
64
|
style: {
|
|
65
65
|
height: S,
|
|
66
66
|
maxHeight: C
|
|
67
67
|
},
|
|
68
|
-
inert:
|
|
68
|
+
inert: z || void 0,
|
|
69
69
|
children: [
|
|
70
70
|
/* @__PURE__ */ p(i, {
|
|
71
|
-
ref:
|
|
72
|
-
onKeyDown:
|
|
71
|
+
ref: Z,
|
|
72
|
+
onKeyDown: X,
|
|
73
73
|
tabIndex: 0,
|
|
74
74
|
role: "grid",
|
|
75
|
-
"aria-label": P ??
|
|
75
|
+
"aria-label": I ? void 0 : F ?? P ?? L("a11y.data_grid"),
|
|
76
|
+
"aria-labelledby": I,
|
|
76
77
|
"aria-rowcount": h.length + 1,
|
|
77
|
-
"aria-colcount":
|
|
78
|
+
"aria-colcount": $,
|
|
78
79
|
striped: v,
|
|
79
80
|
bordered: y,
|
|
80
81
|
hoverable: b,
|
|
@@ -83,7 +84,7 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
83
84
|
fullWidth: !0,
|
|
84
85
|
className: d("wim-table", c.table),
|
|
85
86
|
containerClassName: c.tableContainer,
|
|
86
|
-
children: [/* @__PURE__ */ f(i.Header, { children: /* @__PURE__ */ p(i.Row, { children: [
|
|
87
|
+
children: [/* @__PURE__ */ f(i.Header, { children: /* @__PURE__ */ p(i.Row, { children: [B && /* @__PURE__ */ f(i.Head, {
|
|
87
88
|
role: "columnheader",
|
|
88
89
|
selection: !0,
|
|
89
90
|
stickyLeft: !0,
|
|
@@ -91,16 +92,16 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
91
92
|
stickyZIndex: 1150,
|
|
92
93
|
"data-row": -1,
|
|
93
94
|
"data-col": -1,
|
|
94
|
-
"aria-label":
|
|
95
|
-
tabIndex:
|
|
96
|
-
children: (
|
|
97
|
-
checked:
|
|
98
|
-
indeterminate:
|
|
99
|
-
onChange:
|
|
100
|
-
"aria-label":
|
|
95
|
+
"aria-label": L("a11y.select_all_rows"),
|
|
96
|
+
tabIndex: Y.row === -1 && Y.col === -1 ? 0 : -1,
|
|
97
|
+
children: (B.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ f(n, {
|
|
98
|
+
checked: G,
|
|
99
|
+
indeterminate: K,
|
|
100
|
+
onChange: q,
|
|
101
|
+
"aria-label": L("a11y.select_all_rows")
|
|
101
102
|
})
|
|
102
103
|
}), m.map((e, t) => {
|
|
103
|
-
let n =
|
|
104
|
+
let n = U(e.key, !0);
|
|
104
105
|
return /* @__PURE__ */ f(i.Head, {
|
|
105
106
|
role: "columnheader",
|
|
106
107
|
style: {
|
|
@@ -115,16 +116,16 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
115
116
|
A(e.key, t);
|
|
116
117
|
},
|
|
117
118
|
...n,
|
|
118
|
-
tabIndex:
|
|
119
|
+
tabIndex: Y.row === -1 && Y.col === (B ? t + 1 : t) ? 0 : -1,
|
|
119
120
|
"data-row": -1,
|
|
120
|
-
"data-col":
|
|
121
|
+
"data-col": B ? t + 1 : t,
|
|
121
122
|
children: e.title
|
|
122
123
|
}, e.key);
|
|
123
124
|
})] }) }), /* @__PURE__ */ f(i.Body, { children: h.map((e, t) => {
|
|
124
|
-
let r =
|
|
125
|
+
let r = W(e), a = B?.selectedRowKeys.includes(r);
|
|
125
126
|
return /* @__PURE__ */ p(i.Row, {
|
|
126
127
|
selected: a,
|
|
127
|
-
children: [
|
|
128
|
+
children: [B && /* @__PURE__ */ f(i.Cell, {
|
|
128
129
|
role: "gridcell",
|
|
129
130
|
selection: !0,
|
|
130
131
|
stickyLeft: !0,
|
|
@@ -132,21 +133,21 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
132
133
|
stickyZIndex: 150,
|
|
133
134
|
"data-row": t,
|
|
134
135
|
"data-col": -1,
|
|
135
|
-
tabIndex:
|
|
136
|
+
tabIndex: Y.row === t && Y.col === -1 ? 0 : -1,
|
|
136
137
|
children: /* @__PURE__ */ f(n, {
|
|
137
138
|
checked: a,
|
|
138
|
-
onChange: (t) =>
|
|
139
|
-
"aria-label":
|
|
139
|
+
onChange: (t) => J(e, t),
|
|
140
|
+
"aria-label": L("a11y.select_row")
|
|
140
141
|
})
|
|
141
142
|
}), m.map((n, r) => {
|
|
142
|
-
let a =
|
|
143
|
+
let a = U(n.key, !1), o = e[n.dataIndex ?? n.key];
|
|
143
144
|
return /* @__PURE__ */ f(i.Cell, {
|
|
144
145
|
role: "gridcell",
|
|
145
146
|
label: typeof n.title == "string" ? n.title : void 0,
|
|
146
147
|
...a,
|
|
147
148
|
"data-row": t,
|
|
148
|
-
"data-col":
|
|
149
|
-
tabIndex:
|
|
149
|
+
"data-col": B ? r + 1 : r,
|
|
150
|
+
tabIndex: Y.row === t && Y.col === (B ? r + 1 : r) ? 0 : -1,
|
|
150
151
|
children: n.maxWidth == null ? n.render ? n.render(o, e, t) : o : /* @__PURE__ */ f("div", {
|
|
151
152
|
style: { maxWidth: n.maxWidth },
|
|
152
153
|
children: n.render ? n.render(o, e, t) : o
|
|
@@ -162,22 +163,22 @@ function m({ columns: m, data: h, rowKey: g = "id", loading: _ = !1, striped: v
|
|
|
162
163
|
children: w
|
|
163
164
|
}),
|
|
164
165
|
M?.hasMore && /* @__PURE__ */ f("div", {
|
|
165
|
-
ref:
|
|
166
|
+
ref: Q,
|
|
166
167
|
className: c.loader,
|
|
167
|
-
children: M.hasMore &&
|
|
168
|
+
children: M.hasMore && L("dataGrid.loading_more")
|
|
168
169
|
})
|
|
169
170
|
]
|
|
170
171
|
}), j && /* @__PURE__ */ p("div", {
|
|
171
172
|
className: c.footer,
|
|
172
|
-
inert:
|
|
173
|
+
inert: z || void 0,
|
|
173
174
|
children: [/* @__PURE__ */ p("div", {
|
|
174
175
|
className: c.info,
|
|
175
|
-
children: [
|
|
176
|
+
children: [L("dataGrid.displaying", {
|
|
176
177
|
shown: h.length,
|
|
177
178
|
total: j.total
|
|
178
|
-
}),
|
|
179
|
+
}), B?.selectedRowKeys && B.selectedRowKeys.length > 0 && /* @__PURE__ */ f("span", {
|
|
179
180
|
className: c.selectionInfo,
|
|
180
|
-
children:
|
|
181
|
+
children: L("dataGrid.rows_selected", { selected: B.selectedRowKeys.length })
|
|
181
182
|
})]
|
|
182
183
|
}), /* @__PURE__ */ f("div", {
|
|
183
184
|
className: c.pagination,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Text/Text.cjs"),n=require("../Accordion/Accordion.cjs"),r=require("../../typography/Title/Title.cjs"),i=require("./faq-section.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=({items:e,title:a,description:c,layout:l=`top`,accordionProps:u,className:d})=>{let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Text/Text.cjs"),n=require("../Accordion/Accordion.cjs"),r=require("../../typography/Title/Title.cjs"),i=require("./faq-section.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=({items:e,title:a,description:c,layout:l=`top`,accordionProps:u,className:d,"aria-label":f,"aria-labelledby":p})=>{let m=!!(a||c);return(0,s.jsxs)(`section`,{className:(0,o.default)(`wim-faq-section`,i.default.root,i.default[`layout-${l}`],d),"aria-label":p?void 0:f,"aria-labelledby":p,children:[m&&(0,s.jsxs)(`div`,{className:i.default.header,children:[a&&(0,s.jsx)(r.Title,{tag:`h2`,size:`xl`,className:i.default.title,children:a}),c&&(0,s.jsx)(t.Text,{content:c,color:`text-secondary`,className:i.default.description})]}),(0,s.jsx)(`div`,{className:i.default.content,children:(0,s.jsx)(n.Accordion,{type:`multiple`,collapsible:!0,...u,className:u?.className,children:e.map((e,t)=>(0,s.jsxs)(n.Accordion.Item,{value:`faq-item-${t}`,children:[(0,s.jsx)(n.Accordion.Trigger,{children:e.question}),(0,s.jsx)(n.Accordion.Content,{children:e.answer})]},t))})})]})};exports.FAQSection=c;
|
|
@@ -23,9 +23,13 @@ export interface FAQSectionProps {
|
|
|
23
23
|
accordionProps?: Omit<AccordionProps, "children">;
|
|
24
24
|
/** Additional class names. */
|
|
25
25
|
className?: string;
|
|
26
|
+
/** Accessible name for the section. A named section is exposed as a region landmark. */
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
/** ID of the element that labels the section. Takes precedence over `aria-label`. */
|
|
29
|
+
"aria-labelledby"?: string;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Section component for displaying frequently asked questions (FAQ).
|
|
29
33
|
* Built on top of the existing Accordion component.
|
|
30
34
|
*/
|
|
31
|
-
export declare const FAQSection: ({ items, title, description, layout, accordionProps, className, }: FAQSectionProps) => React.JSX.Element;
|
|
35
|
+
export declare const FAQSection: ({ items, title, description, layout, accordionProps, className, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: FAQSectionProps) => React.JSX.Element;
|
|
@@ -7,11 +7,13 @@ import "react";
|
|
|
7
7
|
import i from "classnames";
|
|
8
8
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/data-display/FAQSection/FAQSection.tsx
|
|
10
|
-
var s = ({ items: s, title: c, description: l, layout: u = "top", accordionProps: d, className: f }) => {
|
|
11
|
-
let
|
|
10
|
+
var s = ({ items: s, title: c, description: l, layout: u = "top", accordionProps: d, className: f, "aria-label": p, "aria-labelledby": m }) => {
|
|
11
|
+
let h = !!(c || l);
|
|
12
12
|
return /* @__PURE__ */ o("section", {
|
|
13
13
|
className: i("wim-faq-section", r.root, r[`layout-${u}`], f),
|
|
14
|
-
|
|
14
|
+
"aria-label": m ? void 0 : p,
|
|
15
|
+
"aria-labelledby": m,
|
|
16
|
+
children: [h && /* @__PURE__ */ o("div", {
|
|
15
17
|
className: r.header,
|
|
16
18
|
children: [c && /* @__PURE__ */ a(n, {
|
|
17
19
|
tag: "h2",
|