wimui 0.56.2 → 0.57.1
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/ThoughtProcess/ThoughtProcess.cjs +1 -1
- package/dist/components/ai/ThoughtProcess/ThoughtProcess.d.ts +10 -1
- package/dist/components/ai/ThoughtProcess/ThoughtProcess.js +12 -12
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.js +1 -1
- package/dist/components/feedback/Toast/toast.module.cjs +1 -1
- package/dist/components/feedback/Toast/toast.module.js +8 -8
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.d.ts +1 -1
- package/dist/components/form/Cascader/Cascader.js +54 -54
- package/dist/components/form/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/form/DateRangePicker/DateRangePicker.d.ts +7 -1
- package/dist/components/form/DateRangePicker/DateRangePicker.js +9 -8
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +33 -29
- package/dist/components/form/Mentions/Mentions.cjs +1 -1
- package/dist/components/form/Mentions/Mentions.js +62 -60
- package/dist/components/form/OtpInput/OtpInput.cjs +1 -1
- package/dist/components/form/OtpInput/OtpInput.js +36 -35
- package/dist/components/form/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.d.ts +6 -0
- package/dist/components/form/PhoneInput/PhoneInput.js +59 -57
- package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.js +66 -64
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.d.ts +6 -0
- package/dist/components/form/SegmentedControl/SegmentedControl.js +18 -17
- package/dist/components/form/Slider/Slider.cjs +1 -1
- package/dist/components/form/Slider/Slider.js +44 -44
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.d.ts +7 -1
- package/dist/components/form/Transfer/Transfer.js +50 -49
- package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
- package/dist/components/layout/Dashboard/Dashboard.d.ts +6 -1
- package/dist/components/layout/Dashboard/Dashboard.js +2 -2
- package/dist/llms-full.txt +21 -2
- package/dist/llms.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../icon/alert-circle.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/chevron-right.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../data-display/Timeline/Timeline.cjs"),o=require("./thought-process.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=({children:e,status:r=`completed`,label:s,isLast:u=!1,isStreaming:d=!1})=>{let f=r===`pending`?(0,l.jsx)(`div`,{className:o.default.spinner,"aria-hidden":`true`}):r===`completed`?(0,l.jsx)(i.Icon,{component:n.default,size:`xs`}):r===`error`?(0,l.jsx)(i.Icon,{component:t.default,size:`xs`}):null,p=r===`completed`?`success`:r===`error`?`danger`:`neutral`;return(0,l.jsxs)(a.TimelineItem,{className:(0,c.default)(o.default.item,o.default[r]),"aria-busy":r===`pending`||void 0,children:[(0,l.jsxs)(a.TimelineSeparator,{children:[(0,l.jsx)(a.TimelinePoint,{intent:p,children:f}),!u&&(0,l.jsx)(a.TimelineConnector,{className:o.default.connector})]}),(0,l.jsxs)(a.TimelineContent,{className:o.default.content,children:[s&&(0,l.jsx)(`div`,{className:o.default.label,children:s}),(0,l.jsx)(`div`,{className:(0,c.default)(o.default.text,d&&o.default.streaming),children:e})]})]})},d=({children:e,title:t=`Thinking Process`,
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../icon/alert-circle.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/chevron-right.cjs"),i=require("../../media/Icon/Icon.cjs"),a=require("../../data-display/Timeline/Timeline.cjs"),o=require("./thought-process.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=({children:e,status:r=`completed`,label:s,isLast:u=!1,isStreaming:d=!1})=>{let f=r===`pending`?(0,l.jsx)(`div`,{className:o.default.spinner,"aria-hidden":`true`}):r===`completed`?(0,l.jsx)(i.Icon,{component:n.default,size:`xs`}):r===`error`?(0,l.jsx)(i.Icon,{component:t.default,size:`xs`}):null,p=r===`completed`?`success`:r===`error`?`danger`:`neutral`;return(0,l.jsxs)(a.TimelineItem,{className:(0,c.default)(o.default.item,o.default[r]),"aria-busy":r===`pending`||void 0,children:[(0,l.jsxs)(a.TimelineSeparator,{children:[(0,l.jsx)(a.TimelinePoint,{intent:p,children:f}),!u&&(0,l.jsx)(a.TimelineConnector,{className:o.default.connector})]}),(0,l.jsxs)(a.TimelineContent,{className:o.default.content,children:[s&&(0,l.jsx)(`div`,{className:o.default.label,children:s}),(0,l.jsx)(`div`,{className:(0,c.default)(o.default.text,d&&o.default.streaming),children:e})]})]})},d=({children:e,title:t=`Thinking Process`,titleLevel:n=3,className:u,isCollapsible:d=!0,defaultExpanded:f=!0,isThinking:p=!1})=>{let[m,h]=s.default.useState(f),g=(0,s.useId)();return(0,l.jsxs)(`div`,{className:(0,c.default)(`wim-thought-process`,o.default.root,p&&o.default.thinking,u),children:[d?(0,l.jsxs)(`button`,{type:`button`,className:o.default.header,onClick:()=>h(e=>!e),"aria-expanded":m,"aria-controls":g,children:[(0,l.jsx)(i.Icon,{component:r.default,size:`sm`,className:(0,c.default)(o.default.chevron,m&&o.default.expanded),"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:o.default.title,children:t})]}):(0,l.jsx)(`div`,{className:o.default.header,role:`heading`,"aria-level":n,children:(0,l.jsx)(`span`,{className:o.default.title,children:t})}),(0,l.jsx)(`div`,{id:g,className:(0,c.default)(o.default.bodyWrapper,m&&o.default.open),"aria-hidden":!m,children:(0,l.jsx)(`div`,{className:o.default.body,children:(0,l.jsx)(a.Timeline,{align:`left`,children:e})})})]})};exports.ThoughtProcess=d,exports.ThoughtStep=u;
|
|
@@ -12,11 +12,20 @@ export interface ThoughtStepProps {
|
|
|
12
12
|
isStreaming?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare const ThoughtStep: ({ children, status, label, isLast, isStreaming, }: ThoughtStepProps) => React.JSX.Element;
|
|
15
|
+
/** 見出しの段。`Dashboard` の `titleLevel` と同じ語彙に揃えてある(T333)。 */
|
|
16
|
+
export type ThoughtProcessTitleLevel = 2 | 3 | 4 | 5 | 6;
|
|
15
17
|
export interface ThoughtProcessProps {
|
|
16
18
|
/** Reasoning steps to display (typically ThoughtStep elements) */
|
|
17
19
|
children: React.ReactNode;
|
|
18
20
|
/** Header title */
|
|
19
21
|
title?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Heading level of the title when `isCollapsible` is false. Match it to the
|
|
24
|
+
* page: under an `h1` use `2`, under an `h3` use `4`. Has no effect when
|
|
25
|
+
* `isCollapsible` is true, where the title is a toggle button, not a heading.
|
|
26
|
+
* @default 3
|
|
27
|
+
*/
|
|
28
|
+
titleLevel?: ThoughtProcessTitleLevel;
|
|
20
29
|
/** Additional CSS class */
|
|
21
30
|
className?: string;
|
|
22
31
|
/** Whether the body can be collapsed */
|
|
@@ -34,4 +43,4 @@ export interface ThoughtProcessProps {
|
|
|
34
43
|
* - Managed by: App consumption
|
|
35
44
|
* - Scroll lock: No
|
|
36
45
|
*/
|
|
37
|
-
export declare const ThoughtProcess: ({ children, title, className, isCollapsible, defaultExpanded, isThinking, }: ThoughtProcessProps) => React.JSX.Element;
|
|
46
|
+
export declare const ThoughtProcess: ({ children, title, titleLevel, className, isCollapsible, defaultExpanded, isThinking, }: ThoughtProcessProps) => React.JSX.Element;
|
|
@@ -37,20 +37,20 @@ var g = ({ children: n, status: i = "completed", label: d, isLast: f = !1, isStr
|
|
|
37
37
|
})]
|
|
38
38
|
})]
|
|
39
39
|
});
|
|
40
|
-
}, _ = ({ children: e, title: t = "Thinking Process",
|
|
41
|
-
let [
|
|
40
|
+
}, _ = ({ children: e, title: t = "Thinking Process", titleLevel: a = 3, className: o, isCollapsible: s = !0, defaultExpanded: c = !0, isThinking: l = !1 }) => {
|
|
41
|
+
let [g, _] = d.useState(c), v = f();
|
|
42
42
|
return /* @__PURE__ */ h("div", {
|
|
43
|
-
className: p("wim-thought-process", u.root,
|
|
44
|
-
children: [
|
|
43
|
+
className: p("wim-thought-process", u.root, l && u.thinking, o),
|
|
44
|
+
children: [s ? /* @__PURE__ */ h("button", {
|
|
45
45
|
type: "button",
|
|
46
46
|
className: u.header,
|
|
47
|
-
onClick: () =>
|
|
48
|
-
"aria-expanded":
|
|
49
|
-
"aria-controls":
|
|
47
|
+
onClick: () => _((e) => !e),
|
|
48
|
+
"aria-expanded": g,
|
|
49
|
+
"aria-controls": v,
|
|
50
50
|
children: [/* @__PURE__ */ m(r, {
|
|
51
51
|
component: n,
|
|
52
52
|
size: "sm",
|
|
53
|
-
className: p(u.chevron,
|
|
53
|
+
className: p(u.chevron, g && u.expanded),
|
|
54
54
|
"aria-hidden": "true"
|
|
55
55
|
}), /* @__PURE__ */ m("span", {
|
|
56
56
|
className: u.title,
|
|
@@ -59,15 +59,15 @@ var g = ({ children: n, status: i = "completed", label: d, isLast: f = !1, isStr
|
|
|
59
59
|
}) : /* @__PURE__ */ m("div", {
|
|
60
60
|
className: u.header,
|
|
61
61
|
role: "heading",
|
|
62
|
-
"aria-level":
|
|
62
|
+
"aria-level": a,
|
|
63
63
|
children: /* @__PURE__ */ m("span", {
|
|
64
64
|
className: u.title,
|
|
65
65
|
children: t
|
|
66
66
|
})
|
|
67
67
|
}), /* @__PURE__ */ m("div", {
|
|
68
|
-
id:
|
|
69
|
-
className: p(u.bodyWrapper,
|
|
70
|
-
"aria-hidden": !
|
|
68
|
+
id: v,
|
|
69
|
+
className: p(u.bodyWrapper, g && u.open),
|
|
70
|
+
"aria-hidden": !g,
|
|
71
71
|
children: /* @__PURE__ */ m("div", {
|
|
72
72
|
className: u.body,
|
|
73
73
|
children: /* @__PURE__ */ m(i, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../_internal/FeedbackIcon.cjs"),r=require("../../_internal/FeedbackCloseButton.cjs"),i=require("./toast.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=({id:e,title:c,description:l,intent:u=`default`,duration:d=3e3,open:f=!0,onClose:p,className:m})=>{let[h,g]=(0,a.useState)(!0),_=(0,a.useCallback)(()=>{g(!1),p&&p(e)},[p,e]);return(0,a.useEffect)(()=>{if(f&&d>0&&h){let e=setTimeout(()=>{_()},d+300);return()=>clearTimeout(e)}},[f,d,e,p,h,_]),(0,s.jsxs)(t.Transition,{show:f&&h,enter:i.default.enter,enterFrom:i.default.enterFrom,enterTo:i.default.enterTo,leave:i.default.leave,leaveFrom:i.default.leaveFrom,leaveTo:i.default.leaveTo,className:(0,o.default)(`wim-toast`,i.default.root,i.default[u],m),role:`status`,"aria-live":`polite`,children:[(u===`success`||u===`warning`||u===`danger`||u===`info`)&&(0,s.jsx)(`div`,{className:i.default.icon,children:(0,s.jsx)(n.FeedbackIcon,{intent:u,size:`sm`})}),(0,s.jsxs)(`div`,{className:i.default.content,children:[c&&(0,s.jsx)(`
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../_internal/FeedbackIcon.cjs"),r=require("../../_internal/FeedbackCloseButton.cjs"),i=require("./toast.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=({id:e,title:c,description:l,intent:u=`default`,duration:d=3e3,open:f=!0,onClose:p,className:m})=>{let[h,g]=(0,a.useState)(!0),_=(0,a.useCallback)(()=>{g(!1),p&&p(e)},[p,e]);return(0,a.useEffect)(()=>{if(f&&d>0&&h){let e=setTimeout(()=>{_()},d+300);return()=>clearTimeout(e)}},[f,d,e,p,h,_]),(0,s.jsxs)(t.Transition,{show:f&&h,enter:i.default.enter,enterFrom:i.default.enterFrom,enterTo:i.default.enterTo,leave:i.default.leave,leaveFrom:i.default.leaveFrom,leaveTo:i.default.leaveTo,className:(0,o.default)(`wim-toast`,i.default.root,i.default[u],m),role:`status`,"aria-live":`polite`,children:[(u===`success`||u===`warning`||u===`danger`||u===`info`)&&(0,s.jsx)(`div`,{className:i.default.icon,children:(0,s.jsx)(n.FeedbackIcon,{intent:u,size:`sm`})}),(0,s.jsxs)(`div`,{className:i.default.content,children:[c&&(0,s.jsx)(`div`,{className:i.default.title,children:c}),l&&(0,s.jsx)(`p`,{className:i.default.description,children:l})]}),(0,s.jsx)(r.FeedbackCloseButton,{onClose:p?_:void 0,id:e,className:i.default.closeButton,size:`md`})]})},l=(0,a.createContext)(void 0),u=({children:e,position:t=`top-right`})=>{let[n,r]=(0,a.useState)([]),u=(0,a.useCallback)(e=>{let t=Math.random().toString(36).substr(2,9);r(n=>[...n,{...e,id:t}])},[]),d=(0,a.useCallback)(e=>{r(t=>t.filter(t=>t.id!==e))},[]);return(0,s.jsxs)(l.Provider,{value:{show:u,remove:d},children:[e,(0,s.jsx)(`div`,{className:(0,o.default)(i.default.container,i.default[t]),children:n.map(e=>(0,s.jsx)(c,{...e,onClose:()=>d(e.id)},e.id))})]})},d=()=>{let e=(0,a.useContext)(l);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e};exports.Toast=c,exports.ToastProvider=u,exports.useToast=d;
|
|
@@ -46,7 +46,7 @@ var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m =
|
|
|
46
46
|
}),
|
|
47
47
|
/* @__PURE__ */ d("div", {
|
|
48
48
|
className: r.content,
|
|
49
|
-
children: [o && /* @__PURE__ */ u("
|
|
49
|
+
children: [o && /* @__PURE__ */ u("div", {
|
|
50
50
|
className: r.title,
|
|
51
51
|
children: o
|
|
52
52
|
}), f && /* @__PURE__ */ u("p", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_container_7lhr6_3`,t=`_root_7lhr6_38`,n=`_icon_7lhr6_53`,r=`_title_7lhr6_64`,i=`_content_7lhr6_67`,a=`_description_7lhr6_88`,o=`_closeButton_7lhr6_96`,s=`_info_7lhr6_133`,c=`_success_7lhr6_140`,l=`_warning_7lhr6_147`,u=`_danger_7lhr6_154`,d=`_enter_7lhr6_161`,f=`_enterFrom_7lhr6_164`,p=`_enterTo_7lhr6_168`,m=`_leave_7lhr6_172`,h=`_leaveFrom_7lhr6_175`,g=`_leaveTo_7lhr6_179`,_={container:e,"top-right":`_top-right_7lhr6_12`,"top-left":`_top-left_7lhr6_16`,"top-center":`_top-center_7lhr6_20`,"bottom-right":`_bottom-right_7lhr6_25`,"bottom-left":`_bottom-left_7lhr6_29`,"bottom-center":`_bottom-center_7lhr6_33`,root:t,icon:n,title:r,content:i,description:a,closeButton:o,default:`_default_7lhr6_126`,info:s,success:c,warning:l,danger:u,enter:d,enterFrom:f,enterTo:p,leave:m,leaveFrom:h,leaveTo:g};exports.closeButton=o,exports.container=e,exports.content=i,exports.danger=u,exports.default=_,exports.description=a,exports.enter=d,exports.enterFrom=f,exports.enterTo=p,exports.icon=n,exports.info=s,exports.leave=m,exports.leaveFrom=h,exports.leaveTo=g,exports.root=t,exports.success=c,exports.title=r,exports.warning=l;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/feedback/Toast/toast.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_container_7lhr6_3", t = "_root_7lhr6_38", n = "_icon_7lhr6_53", r = "_title_7lhr6_64", i = "_content_7lhr6_67", a = "_description_7lhr6_88", o = "_closeButton_7lhr6_96", s = "_info_7lhr6_133", c = "_success_7lhr6_140", l = "_warning_7lhr6_147", u = "_danger_7lhr6_154", d = "_enter_7lhr6_161", f = "_enterFrom_7lhr6_164", p = "_enterTo_7lhr6_168", m = "_leave_7lhr6_172", h = "_leaveFrom_7lhr6_175", g = "_leaveTo_7lhr6_179", _ = {
|
|
4
4
|
container: e,
|
|
5
|
-
"top-right": "_top-
|
|
6
|
-
"top-left": "_top-
|
|
7
|
-
"top-center": "_top-
|
|
8
|
-
"bottom-right": "_bottom-
|
|
9
|
-
"bottom-left": "_bottom-
|
|
10
|
-
"bottom-center": "_bottom-
|
|
5
|
+
"top-right": "_top-right_7lhr6_12",
|
|
6
|
+
"top-left": "_top-left_7lhr6_16",
|
|
7
|
+
"top-center": "_top-center_7lhr6_20",
|
|
8
|
+
"bottom-right": "_bottom-right_7lhr6_25",
|
|
9
|
+
"bottom-left": "_bottom-left_7lhr6_29",
|
|
10
|
+
"bottom-center": "_bottom-center_7lhr6_33",
|
|
11
11
|
root: t,
|
|
12
12
|
icon: n,
|
|
13
13
|
title: r,
|
|
14
14
|
content: i,
|
|
15
15
|
description: a,
|
|
16
16
|
closeButton: o,
|
|
17
|
-
default: "
|
|
17
|
+
default: "_default_7lhr6_126",
|
|
18
18
|
info: s,
|
|
19
19
|
success: c,
|
|
20
20
|
warning: l,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../../icon/chevron-right.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../_internal/BaseListItem/BaseListItem.cjs"),a=require("../InputBase/InputBase.cjs"),o=require("./cascader.module.cjs"),s=require("../FieldTemplate/FieldTemplate.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");function d(e){return typeof e==`string`?e:typeof e==`number`?String(e):``}var f=({options:e=[],value:f,onChange:p,placeholder:m,label:h,error:g,required:_,layout:ee,className:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../../icon/chevron-right.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("../../_internal/BaseListItem/BaseListItem.cjs"),a=require("../InputBase/InputBase.cjs"),o=require("./cascader.module.cjs"),s=require("../FieldTemplate/FieldTemplate.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");function d(e){return typeof e==`string`?e:typeof e==`number`?String(e):``}var f=({options:e=[],value:f,onChange:p,placeholder:m,label:h,error:g,required:_,layout:ee,className:te,disabled:v=!1,defaultValue:y,id:ne,expandTrigger:re=`click`,separator:b=` / `,allowClear:ie=!1,"aria-label":x,"aria-labelledby":ae,"aria-describedby":oe,width:S,fullWidth:C=!1,...w})=>{let T=(0,c.useId)(),E=ne||`wim-cascader-${T}`,D=h?`${E}-label`:void 0,O=g?`${E}-error`:void 0,k=D??ae,A=`${E}-trigger`,j=`${E}-popup`,[M,N]=(0,c.useState)(!1),[se,P]=(0,c.useState)(y||[]),[F,I]=(0,c.useState)([]),[L,R]=(0,c.useState)(-1),[z,B]=(0,c.useState)([]),[V,H]=(0,c.useState)(!1),U=(0,c.useRef)(null),W=(0,c.useRef)(null),G=f!==void 0,K=G?f:se;(0,c.useEffect)(()=>{let e=e=>{U.current&&!U.current.contains(e.target)&&N(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,c.useEffect)(()=>{if(M&&L>=0){let e=z[L],t=`${E}-menu-${L}-option-${e}`,n=U.current?.querySelector(`#${t}`);n&&n.scrollIntoView({block:`nearest`,behavior:`smooth`})}},[L,z,M,E]);let q=()=>{if(!v){let e=!M;N(e),e?(I(K||[]),R(0),B([0])):R(-1)}},ce=()=>{if(!K||K.length===0)return null;let t=[],n=e;for(let e of K){let r=n.find(t=>t.value===e);if(r)t.push(r.label),n=r.children||[];else break}return t.length===0?null:t.map((e,n)=>(0,u.jsxs)(c.default.Fragment,{children:[e,n<t.length-1&&(0,u.jsx)(`span`,{children:b})]},n))},J=(t,n)=>{if(t.disabled)return;let r=[...F.slice(0,n),t.value];if(I(r),!t.children||t.children.length===0){if(G||P(r),p){let t=[],n=e;for(let e of r){let r=n.find(t=>t.value===e);r&&(t.push(r),n=r.children||[])}p(r,t)}N(!1),W.current?.focus()}},Y=e=>{e?.stopPropagation(),!v&&(G||P([]),p&&p([],[]))},le=(e,t)=>{re===`hover`&&!e.disabled&&I([...F.slice(0,t),e.value])},ue=t=>{if(H(!0),v)return;if(!M){(t.key===`Enter`||t.key===` `||t.key===`ArrowDown`||t.key===`ArrowDown`&&t.altKey)&&(t.preventDefault(),q());return}let n=[e],r=e;for(let e=0;e<F.length;e++){let t=F[e],i=r.find(e=>e.value===t);if(i&&i.children&&i.children.length>0)n.push(i.children),r=i.children;else break}let i=n[L]||[],a=z[L]||0;switch(t.key){case`ArrowDown`:t.preventDefault(),B(e=>{let t=[...e];return t[L]=Math.min(a+1,i.length-1),t});break;case`ArrowUp`:t.preventDefault(),B(e=>{let t=[...e];return t[L]=Math.max(a-1,0),t});break;case`ArrowRight`:{t.preventDefault();let e=i[a];e&&e.children&&e.children.length>0&&(I([...F.slice(0,L),e.value]),R(L+1),B(e=>[...e.slice(0,L+1),0]));break}case`ArrowLeft`:t.preventDefault(),L>0&&(R(L-1),B(e=>e.slice(0,L)));break;case`Enter`:case` `:{t.preventDefault();let e=i[a];e&&J(e,L);break}case`Escape`:t.preventDefault(),N(!1),R(-1),W.current?.focus();break;case`Home`:t.preventDefault(),B(e=>{let t=[...e];return t[L]=0,t});break;case`End`:t.preventDefault(),B(e=>{let t=[...e];return t[L]=i.length-1,t});break;case`Tab`:M&&(N(!1),R(-1))}},X=[e],Z=e;for(let e=0;e<F.length;e++){let t=F[e],n=Z.find(e=>e.value===t);if(n&&n.children&&n.children.length>0)X.push(n.children),Z=n.children;else break}let Q=ce(),$=()=>{if(!K||K.length===0)return``;let t=[],n=e;for(let e of K){let r=n.find(t=>t.value===e);if(r)t.push(d(r.label)),n=r.children||[];else break}return t.join(b)};return(0,u.jsx)(s.FieldTemplate,{label:h,error:g,required:_,layout:ee,labelId:D,errorId:O,className:(0,l.default)(`wim-cascader`,te),children:(0,u.jsxs)(`div`,{className:o.default.root,ref:U,onMouseMove:()=>H(!1),"data-keyboard-nav":V,...w,children:[(0,u.jsx)(a.InputBase,{disabled:v,allowClear:ie,hasValue:!!Q,onClear:Y,intent:g?`danger`:`default`,width:S,fullWidth:C,rightIcons:[{name:`ChevronDownIcon`,rotated:M}],className:(0,l.default)(M&&o.default.open),children:(0,u.jsx)(`div`,{id:A,ref:W,className:(0,l.default)(o.default.trigger,v&&o.default.disabled),onClick:q,onKeyDown:ue,tabIndex:v?-1:0,role:`combobox`,"aria-expanded":M,"aria-controls":M?j:void 0,"aria-haspopup":`listbox`,"aria-disabled":v,"aria-labelledby":k,"aria-label":k?void 0:x||$()||d(m),"aria-describedby":[oe,O].filter(Boolean).join(` `)||void 0,"aria-required":_,"aria-invalid":!!g,"aria-activedescendant":M&&L>=0?`${E}-menu-${L}-option-${z[L]}`:void 0,children:(0,u.jsx)(`div`,{className:(0,l.default)(o.default.value,!Q&&o.default.placeholder),children:Q||m})})}),(0,u.jsx)(t.Transition,{show:M&&!v,preset:`fade`,id:j,className:o.default.dropdown,children:X.map((e,t)=>(0,u.jsx)(`div`,{className:o.default.menu,role:`listbox`,"aria-labelledby":k,"aria-label":k?void 0:x||$()||d(m),children:e.map((e,a)=>{let s=F[t]===e.value,c=L===t&&z[t]===a,d=K[t]===e.value,f=e.children&&e.children.length>0;return(0,u.jsx)(i.BaseListItem,{className:(0,l.default)(o.default.menuItem,d&&o.default.selected),active:c||s,disabled:e.disabled,onClick:n=>{n.stopPropagation(),J(e,t)},onMouseEnter:()=>{le(e,t),R(t),B(e=>[...e.slice(0,t),a])},rightSection:f?(0,u.jsx)(r.Icon,{component:n.default,size:`sm`}):void 0,role:`option`,id:`${E}-menu-${t}-option-${a}`,"aria-selected":d,tabIndex:-1,children:e.label},e.value)})},t))})]})})};f.displayName=`Cascader`,exports.Cascader=f;
|
|
@@ -48,6 +48,6 @@ export type CascaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange
|
|
|
48
48
|
* Component for selecting a single option by walking through hierarchical data.
|
|
49
49
|
*/
|
|
50
50
|
export declare const Cascader: {
|
|
51
|
-
({ options, value, onChange, placeholder, label, error, required, layout, className, disabled, defaultValue, id: customId, expandTrigger, separator, allowClear, "aria-label": ariaLabel, width, fullWidth, ...props }: CascaderProps): React.JSX.Element;
|
|
51
|
+
({ options, value, onChange, placeholder, label, error, required, layout, className, disabled, defaultValue, id: customId, expandTrigger, separator, allowClear, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, width, fullWidth, ...props }: CascaderProps): React.JSX.Element;
|
|
52
52
|
displayName: string;
|
|
53
53
|
};
|
|
@@ -13,16 +13,16 @@ import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
|
13
13
|
function h(e) {
|
|
14
14
|
return typeof e == "string" ? e : typeof e == "number" ? String(e) : "";
|
|
15
15
|
}
|
|
16
|
-
var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, error: x, required: S, layout:
|
|
17
|
-
let
|
|
16
|
+
var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, error: x, required: S, layout: ee, className: te, disabled: C = !1, defaultValue: w, id: ne, expandTrigger: T = "click", separator: E = " / ", allowClear: re = !1, "aria-label": D, "aria-labelledby": ie, "aria-describedby": ae, width: oe, fullWidth: se = !1, ...O }) => {
|
|
17
|
+
let ce = l(), k = ne || `wim-cascader-${ce}`, A = b ? `${k}-label` : void 0, j = x ? `${k}-error` : void 0, M = A ?? ie, le = `${k}-trigger`, N = `${k}-popup`, [P, F] = d(!1), [ue, I] = d(w || []), [L, R] = d([]), [z, B] = d(-1), [V, H] = d([]), [de, U] = d(!1), W = u(null), G = u(null), K = _ !== void 0, q = K ? _ : ue;
|
|
18
18
|
c(() => {
|
|
19
19
|
let e = (e) => {
|
|
20
|
-
W.current && !W.current.contains(e.target) &&
|
|
20
|
+
W.current && !W.current.contains(e.target) && F(!1);
|
|
21
21
|
};
|
|
22
22
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
23
23
|
}, []), c(() => {
|
|
24
|
-
if (
|
|
25
|
-
let e = V[z], t = `${
|
|
24
|
+
if (P && z >= 0) {
|
|
25
|
+
let e = V[z], t = `${k}-menu-${z}-option-${e}`, n = W.current?.querySelector(`#${t}`);
|
|
26
26
|
n && n.scrollIntoView({
|
|
27
27
|
block: "nearest",
|
|
28
28
|
behavior: "smooth"
|
|
@@ -31,15 +31,15 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
31
31
|
}, [
|
|
32
32
|
z,
|
|
33
33
|
V,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
P,
|
|
35
|
+
k
|
|
36
36
|
]);
|
|
37
37
|
let J = () => {
|
|
38
|
-
if (!
|
|
39
|
-
let e = !
|
|
40
|
-
|
|
38
|
+
if (!C) {
|
|
39
|
+
let e = !P;
|
|
40
|
+
F(e), e ? (R(q || []), B(0), H([0])) : B(-1);
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, fe = () => {
|
|
43
43
|
if (!q || q.length === 0) return null;
|
|
44
44
|
let e = [], t = g;
|
|
45
45
|
for (let n of q) {
|
|
@@ -47,7 +47,7 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
47
47
|
if (r) e.push(r.label), t = r.children || [];
|
|
48
48
|
else break;
|
|
49
49
|
}
|
|
50
|
-
return e.length === 0 ? null : e.map((t, n) => /* @__PURE__ */ m(s.Fragment, { children: [t, n < e.length - 1 && /* @__PURE__ */ p("span", { children:
|
|
50
|
+
return e.length === 0 ? null : e.map((t, n) => /* @__PURE__ */ m(s.Fragment, { children: [t, n < e.length - 1 && /* @__PURE__ */ p("span", { children: E })] }, n));
|
|
51
51
|
}, Y = (e, t) => {
|
|
52
52
|
if (e.disabled) return;
|
|
53
53
|
let n = [...L.slice(0, t), e.value];
|
|
@@ -60,15 +60,15 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
60
60
|
}
|
|
61
61
|
v(n, e);
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
F(!1), G.current?.focus();
|
|
64
64
|
}
|
|
65
|
-
},
|
|
66
|
-
e?.stopPropagation(), !
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
if (U(!0),
|
|
71
|
-
if (!
|
|
65
|
+
}, pe = (e) => {
|
|
66
|
+
e?.stopPropagation(), !C && (K || I([]), v && v([], []));
|
|
67
|
+
}, me = (e, t) => {
|
|
68
|
+
T === "hover" && !e.disabled && R([...L.slice(0, t), e.value]);
|
|
69
|
+
}, he = (e) => {
|
|
70
|
+
if (U(!0), C) return;
|
|
71
|
+
if (!P) {
|
|
72
72
|
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowDown" && e.altKey) && (e.preventDefault(), J());
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -109,7 +109,7 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
case "Escape":
|
|
112
|
-
e.preventDefault(),
|
|
112
|
+
e.preventDefault(), F(!1), B(-1), G.current?.focus();
|
|
113
113
|
break;
|
|
114
114
|
case "Home":
|
|
115
115
|
e.preventDefault(), H((e) => {
|
|
@@ -123,7 +123,7 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
123
123
|
return t[z] = r.length - 1, t;
|
|
124
124
|
});
|
|
125
125
|
break;
|
|
126
|
-
case "Tab":
|
|
126
|
+
case "Tab": P && (F(!1), B(-1));
|
|
127
127
|
}
|
|
128
128
|
}, X = [g], Z = g;
|
|
129
129
|
for (let e = 0; e < L.length; e++) {
|
|
@@ -131,7 +131,7 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
131
131
|
if (n && n.children && n.children.length > 0) X.push(n.children), Z = n.children;
|
|
132
132
|
else break;
|
|
133
133
|
}
|
|
134
|
-
let Q =
|
|
134
|
+
let Q = fe(), $ = () => {
|
|
135
135
|
if (!q || q.length === 0) return "";
|
|
136
136
|
let e = [], t = g;
|
|
137
137
|
for (let n of q) {
|
|
@@ -139,68 +139,68 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
139
139
|
if (r) e.push(h(r.label)), t = r.children || [];
|
|
140
140
|
else break;
|
|
141
141
|
}
|
|
142
|
-
return e.join(
|
|
142
|
+
return e.join(E);
|
|
143
143
|
};
|
|
144
144
|
return /* @__PURE__ */ p(o, {
|
|
145
145
|
label: b,
|
|
146
146
|
error: x,
|
|
147
147
|
required: S,
|
|
148
|
-
layout:
|
|
149
|
-
labelId:
|
|
150
|
-
errorId:
|
|
151
|
-
className: f("wim-cascader",
|
|
148
|
+
layout: ee,
|
|
149
|
+
labelId: A,
|
|
150
|
+
errorId: j,
|
|
151
|
+
className: f("wim-cascader", te),
|
|
152
152
|
children: /* @__PURE__ */ m("div", {
|
|
153
153
|
className: a.root,
|
|
154
154
|
ref: W,
|
|
155
155
|
onMouseMove: () => U(!1),
|
|
156
|
-
"data-keyboard-nav":
|
|
157
|
-
...
|
|
156
|
+
"data-keyboard-nav": de,
|
|
157
|
+
...O,
|
|
158
158
|
children: [/* @__PURE__ */ p(i, {
|
|
159
|
-
disabled:
|
|
160
|
-
allowClear:
|
|
159
|
+
disabled: C,
|
|
160
|
+
allowClear: re,
|
|
161
161
|
hasValue: !!Q,
|
|
162
|
-
onClear:
|
|
162
|
+
onClear: pe,
|
|
163
163
|
intent: x ? "danger" : "default",
|
|
164
|
-
width:
|
|
165
|
-
fullWidth:
|
|
164
|
+
width: oe,
|
|
165
|
+
fullWidth: se,
|
|
166
166
|
rightIcons: [{
|
|
167
167
|
name: "ChevronDownIcon",
|
|
168
|
-
rotated:
|
|
168
|
+
rotated: P
|
|
169
169
|
}],
|
|
170
|
-
className: f(
|
|
170
|
+
className: f(P && a.open),
|
|
171
171
|
children: /* @__PURE__ */ p("div", {
|
|
172
|
-
id:
|
|
172
|
+
id: le,
|
|
173
173
|
ref: G,
|
|
174
|
-
className: f(a.trigger,
|
|
174
|
+
className: f(a.trigger, C && a.disabled),
|
|
175
175
|
onClick: J,
|
|
176
|
-
onKeyDown:
|
|
177
|
-
tabIndex:
|
|
176
|
+
onKeyDown: he,
|
|
177
|
+
tabIndex: C ? -1 : 0,
|
|
178
178
|
role: "combobox",
|
|
179
|
-
"aria-expanded":
|
|
180
|
-
"aria-controls":
|
|
179
|
+
"aria-expanded": P,
|
|
180
|
+
"aria-controls": P ? N : void 0,
|
|
181
181
|
"aria-haspopup": "listbox",
|
|
182
|
-
"aria-disabled":
|
|
183
|
-
"aria-labelledby":
|
|
184
|
-
"aria-label":
|
|
185
|
-
"aria-describedby":
|
|
182
|
+
"aria-disabled": C,
|
|
183
|
+
"aria-labelledby": M,
|
|
184
|
+
"aria-label": M ? void 0 : D || $() || h(y),
|
|
185
|
+
"aria-describedby": [ae, j].filter(Boolean).join(" ") || void 0,
|
|
186
186
|
"aria-required": S,
|
|
187
187
|
"aria-invalid": !!x,
|
|
188
|
-
"aria-activedescendant":
|
|
188
|
+
"aria-activedescendant": P && z >= 0 ? `${k}-menu-${z}-option-${V[z]}` : void 0,
|
|
189
189
|
children: /* @__PURE__ */ p("div", {
|
|
190
190
|
className: f(a.value, !Q && a.placeholder),
|
|
191
191
|
children: Q || y
|
|
192
192
|
})
|
|
193
193
|
})
|
|
194
194
|
}), /* @__PURE__ */ p(e, {
|
|
195
|
-
show:
|
|
195
|
+
show: P && !C,
|
|
196
196
|
preset: "fade",
|
|
197
|
-
id:
|
|
197
|
+
id: N,
|
|
198
198
|
className: a.dropdown,
|
|
199
199
|
children: X.map((e, i) => /* @__PURE__ */ p("div", {
|
|
200
200
|
className: a.menu,
|
|
201
201
|
role: "listbox",
|
|
202
|
-
"aria-labelledby":
|
|
203
|
-
"aria-label":
|
|
202
|
+
"aria-labelledby": M,
|
|
203
|
+
"aria-label": M ? void 0 : D || $() || h(y),
|
|
204
204
|
children: e.map((e, o) => {
|
|
205
205
|
let s = L[i] === e.value, c = z === i && V[i] === o, l = q[i] === e.value, u = e.children && e.children.length > 0;
|
|
206
206
|
return /* @__PURE__ */ p(r, {
|
|
@@ -211,14 +211,14 @@ var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, err
|
|
|
211
211
|
t.stopPropagation(), Y(e, i);
|
|
212
212
|
},
|
|
213
213
|
onMouseEnter: () => {
|
|
214
|
-
|
|
214
|
+
me(e, i), B(i), H((e) => [...e.slice(0, i), o]);
|
|
215
215
|
},
|
|
216
216
|
rightSection: u ? /* @__PURE__ */ p(n, {
|
|
217
217
|
component: t,
|
|
218
218
|
size: "sm"
|
|
219
219
|
}) : void 0,
|
|
220
220
|
role: "option",
|
|
221
|
-
id: `${
|
|
221
|
+
id: `${k}-menu-${i}-option-${o}`,
|
|
222
222
|
"aria-selected": l,
|
|
223
223
|
tabIndex: -1,
|
|
224
224
|
children: e.label
|
|
@@ -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/components.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("../DatePicker/DatePicker.cjs"),a=require("./date-range-picker.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=({startProps:e,endProps:l,className:u,label:d,error:f,required:p,layout:m=`vertical
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/components.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("../DatePicker/DatePicker.cjs"),a=require("./date-range-picker.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=({startProps:e,endProps:l,className:u,label:d,error:f,required:p,layout:m=`vertical`,"aria-label":h,"aria-labelledby":g,"aria-describedby":_})=>{let{t:v}=t.useWimTranslation(n.componentsNs),y=`wim-daterangepicker-${(0,o.useId)()}`,b=d?`${y}-label`:void 0,x=f?`${y}-error`:void 0,S=e?.label?void 0:v(`daterangepicker.start`),C=l?.label?void 0:v(`daterangepicker.end`);return(0,c.jsx)(r.FieldTemplate,{label:d,error:f,required:p,layout:m,labelId:b,errorId:x,className:(0,s.default)(`wim-date-range-picker`,a.default.container,u),children:(0,c.jsxs)(`div`,{className:a.default.root,role:`group`,"aria-labelledby":b??g,"aria-label":d||g?void 0:h,"aria-describedby":[_,x].filter(Boolean).join(` `)||void 0,children:[(0,c.jsx)(`div`,{className:a.default.pickerWrapper,children:(0,c.jsx)(i.DatePicker,{"aria-label":S,...e,intent:f?`danger`:e?.intent,fullWidth:!0})}),(0,c.jsx)(`span`,{className:a.default.separator,children:`~`}),(0,c.jsx)(`div`,{className:a.default.pickerWrapper,children:(0,c.jsx)(i.DatePicker,{"aria-label":C,...l,intent:f?`danger`:l?.intent,fullWidth:!0})})]})})};exports.DateRangePicker=l;
|
|
@@ -15,9 +15,15 @@ type DateRangePickerProps = {
|
|
|
15
15
|
required?: boolean;
|
|
16
16
|
/** Layout direction of label and field */
|
|
17
17
|
layout?: "vertical" | "horizontal";
|
|
18
|
+
/** Accessible name for the group of the two date fields when no visible `label` is provided. */
|
|
19
|
+
"aria-label"?: string;
|
|
20
|
+
/** ID of the element that labels the group of the two date fields when no visible `label` is provided. */
|
|
21
|
+
"aria-labelledby"?: string;
|
|
22
|
+
/** ID of the element that describes the group. Announced together with the error message. */
|
|
23
|
+
"aria-describedby"?: string;
|
|
18
24
|
};
|
|
19
25
|
/**
|
|
20
26
|
* Component for selecting a date range (start and end dates).
|
|
21
27
|
*/
|
|
22
|
-
export declare const DateRangePicker: ({ startProps, endProps, className, label, error, required, layout, }: DateRangePickerProps) => React.JSX.Element;
|
|
28
|
+
export declare const DateRangePicker: ({ startProps, endProps, className, label, error, required, layout, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: DateRangePickerProps) => React.JSX.Element;
|
|
23
29
|
export {};
|
|
@@ -8,26 +8,27 @@ import { useId as a } from "react";
|
|
|
8
8
|
import o from "classnames";
|
|
9
9
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/form/DateRangePicker/DateRangePicker.tsx
|
|
11
|
-
var l = ({ startProps: l, endProps: u, className: d, label: f, error: p, required: m, layout: h = "vertical" }) => {
|
|
12
|
-
let { t:
|
|
11
|
+
var l = ({ startProps: l, endProps: u, className: d, label: f, error: p, required: m, layout: h = "vertical", "aria-label": g, "aria-labelledby": _, "aria-describedby": v }) => {
|
|
12
|
+
let { t: y } = e(t), b = `wim-daterangepicker-${a()}`, x = f ? `${b}-label` : void 0, S = p ? `${b}-error` : void 0, C = l?.label ? void 0 : y("daterangepicker.start"), w = u?.label ? void 0 : y("daterangepicker.end");
|
|
13
13
|
return /* @__PURE__ */ s(n, {
|
|
14
14
|
label: f,
|
|
15
15
|
error: p,
|
|
16
16
|
required: m,
|
|
17
17
|
layout: h,
|
|
18
|
-
labelId:
|
|
19
|
-
errorId:
|
|
18
|
+
labelId: x,
|
|
19
|
+
errorId: S,
|
|
20
20
|
className: o("wim-date-range-picker", i.container, d),
|
|
21
21
|
children: /* @__PURE__ */ c("div", {
|
|
22
22
|
className: i.root,
|
|
23
23
|
role: "group",
|
|
24
|
-
"aria-labelledby":
|
|
25
|
-
"aria-
|
|
24
|
+
"aria-labelledby": x ?? _,
|
|
25
|
+
"aria-label": f || _ ? void 0 : g,
|
|
26
|
+
"aria-describedby": [v, S].filter(Boolean).join(" ") || void 0,
|
|
26
27
|
children: [
|
|
27
28
|
/* @__PURE__ */ s("div", {
|
|
28
29
|
className: i.pickerWrapper,
|
|
29
30
|
children: /* @__PURE__ */ s(r, {
|
|
30
|
-
"aria-label":
|
|
31
|
+
"aria-label": C,
|
|
31
32
|
...l,
|
|
32
33
|
intent: p ? "danger" : l?.intent,
|
|
33
34
|
fullWidth: !0
|
|
@@ -40,7 +41,7 @@ var l = ({ startProps: l, endProps: u, className: d, label: f, error: p, require
|
|
|
40
41
|
/* @__PURE__ */ s("div", {
|
|
41
42
|
className: i.pickerWrapper,
|
|
42
43
|
children: /* @__PURE__ */ s(r, {
|
|
43
|
-
"aria-label":
|
|
44
|
+
"aria-label": w,
|
|
44
45
|
...u,
|
|
45
46
|
intent: p ? "danger" : u?.intent,
|
|
46
47
|
fullWidth: !0
|
|
@@ -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("../FieldTemplate/FieldTemplate.cjs"),i=require("../Input/Input.cjs"),a=require("../IconButton/IconButton.cjs"),o=require("./inline-edit.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=s.default.forwardRef(({value:e,defaultValue:u,onChange:d,onSave:f,onCancel:p,onEdit:m,placeholder:h,disabled:g=!1,fullWidth:_=!1,label:v,className:y,"aria-label":b,...
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("../Input/Input.cjs"),a=require("../IconButton/IconButton.cjs"),o=require("./inline-edit.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=s.default.forwardRef(({value:e,defaultValue:u,onChange:d,onSave:f,onCancel:p,onEdit:m,placeholder:h,disabled:g=!1,fullWidth:_=!1,label:v,className:y,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,...C},w)=>{let{t:T}=t.useWimTranslation(n.commonNs),[E,D]=(0,s.useState)(!1),[O,k]=(0,s.useState)(u??``),[A,j]=(0,s.useState)(u??``),M=(0,s.useRef)(null),N=e!==void 0,P=N?e:A,F=()=>{g||(N||j(O),D(!0),m?.())},I=()=>{g||(N||k(P),D(!1),f?.(P))},L=()=>{g||(N||j(O),D(!1),p?.())},R=e=>{let t=e.target.value;N||j(t),d?.(t)},z=e=>{e.key===`Enter`?(e.preventDefault(),I()):e.key===`Escape`&&(e.preventDefault(),L())};return(0,s.useEffect)(()=>{E&&M.current&&M.current.focus()},[E]),(0,l.jsx)(r.FieldTemplate,{label:v,className:y,children:(0,l.jsx)(`div`,{ref:w,className:(0,c.default)(`wim-inline-edit`,o.default.root,_&&o.default.fullWidth,g&&o.default.disabled),...C,children:E?(0,l.jsxs)(`div`,{className:o.default.editWrapper,children:[(0,l.jsx)(i.Input,{ref:M,value:P,onChange:R,onKeyDown:z,disabled:g,placeholder:h,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,fullWidth:_,className:o.default.input}),(0,l.jsxs)(`div`,{className:o.default.editActions,children:[(0,l.jsx)(a.IconButton,{iconName:`CheckIcon`,intent:`success`,variant:`outline`,"aria-label":T(`action.save`),onClick:I,disabled:g}),(0,l.jsx)(a.IconButton,{iconName:`CloseIcon`,intent:`default`,variant:`outline`,"aria-label":T(`action.cancel`),onClick:L,disabled:g})]})]}):(0,l.jsxs)(`div`,{className:o.default.preview,onClick:F,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},tabIndex:g?-1:0,role:`button`,"aria-label":b,"aria-labelledby":x,"aria-describedby":S,"aria-disabled":g,children:[(0,l.jsx)(`span`,{className:(0,c.default)(o.default.text,!P&&o.default.placeholder),children:P||h||`\xA0`}),(0,l.jsx)(`span`,{className:o.default.editIconWrapper,children:(0,l.jsx)(a.IconButton,{iconName:`EditIcon`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":T(`action.edit`),"aria-hidden":`true`,asChild:!0,children:(0,l.jsx)(`span`,{})})})]})})})});u.displayName=`InlineEdit`,exports.InlineEdit=u;
|