@progress/kendo-react-buttons 14.5.0-develop.8 → 14.5.0-develop.9
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/Button.d.ts +2 -2
- package/Button.js +1 -1
- package/Button.mjs +31 -33
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +72 -82
- package/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +1 -7
- package/FloatingActionButton/models/size.d.ts +2 -1
- package/FloatingActionButton/models/theme-color.d.ts +2 -8
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +0 -2
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +2 -4
- package/ListButton/models/ListButtonProps.d.ts +2 -2
- package/SegmentedControl/SegmentedControl.js +1 -1
- package/SegmentedControl/SegmentedControl.mjs +28 -27
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +10 -10
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -6
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +9 -9
package/Button.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface ButtonProps extends ButtonInterface, React.ButtonHTMLAttributes
|
|
|
27
27
|
* <Button size="large">Large Button</Button>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
size?: 'small' | 'medium' | 'large';
|
|
30
|
+
size?: 'xsmall' | 'xs' | 'small' | 'medium' | 'large';
|
|
31
31
|
/**
|
|
32
32
|
* Configures the `roundness` of the Button. See [Button Appearance](https://www.telerik.com/kendo-react-ui/components/buttons/button/appearance).
|
|
33
33
|
*
|
|
@@ -71,7 +71,7 @@ export interface ButtonProps extends ButtonInterface, React.ButtonHTMLAttributes
|
|
|
71
71
|
* <Button themeColor="primary">Primary Button</Button>
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
|
-
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | '
|
|
74
|
+
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'inverse';
|
|
75
75
|
/**
|
|
76
76
|
* Sets an SVG icon or custom element before the content of the Button. For the custom component, consider using
|
|
77
77
|
* [Phrasing content](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#phrasing_content).
|
package/Button.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),r=require("prop-types"),e=require("@progress/kendo-react-common");function F(o){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(l,s,n.get?n:{enumerable:!0,get:()=>o[s]})}}return l.default=o,Object.freeze(l)}const t=F(W);function G({imageUrl:o,name:l,iconClass:s,svgIcon:n,imageAlt:u,buttonClasses:a,iconSize:c}){return o?t.createElement("img",{role:"presentation",className:e.classNames(e.uButton.icon({c:a})),alt:u,src:o}):l||n?t.createElement(e.IconWrap,{className:e.classNames(e.uButton.icon({c:a})),name:l,icon:n,size:c}):s?t.createElement("span",{role:"presentation",className:e.classNames(e.uButton.icon({c:a}),s)}):null}const g=t.forwardRef((o,l)=>{const{children:s,togglable:n,dir:u,disabled:a,selected:c,icon:v,iconClass:b,svgIcon:y,imageUrl:N,imageAlt:P,className:S,startIcon:h,endIcon:B,onClick:C,size:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),r=require("prop-types"),e=require("@progress/kendo-react-common");function F(o){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(l,s,n.get?n:{enumerable:!0,get:()=>o[s]})}}return l.default=o,Object.freeze(l)}const t=F(W);function G({imageUrl:o,name:l,iconClass:s,svgIcon:n,imageAlt:u,buttonClasses:a,iconSize:c}){return o?t.createElement("img",{role:"presentation",className:e.classNames(e.uButton.icon({c:a})),alt:u,src:o}):l||n?t.createElement(e.IconWrap,{className:e.classNames(e.uButton.icon({c:a})),name:l,icon:n,size:c}):s?t.createElement("span",{role:"presentation",className:e.classNames(e.uButton.icon({c:a}),s)}):null}const g=t.forwardRef((o,l)=>{const{children:s,togglable:n,dir:u,disabled:a,selected:c,icon:v,iconClass:b,svgIcon:y,imageUrl:N,imageAlt:P,className:S,startIcon:h,endIcon:B,onClick:C,size:z=p.size,rounded:k=p.rounded,fillMode:T=p.fillMode,themeColor:j=p.themeColor,ariaPressed:E,iconSize:A,...w}=o,x=()=>{n&&c===void 0&&(d.current=!i,R(!i))},q=f=>{x(),C&&C.call(void 0,f)},d=t.useRef(void 0),O=t.useRef(null),[i,R]=t.useState(n===!0&&c===!0),U=y!==void 0||v!==void 0||b!==void 0||N!==void 0,_=s!==void 0,D=e.useUnstyled(),I=o.unstyled||D,m=I&&I.uButton;t.useImperativeHandle(l,()=>({element:O.current,selected:d.current!==void 0?d.current:i})),t.useMemo(()=>{n&&c!==void 0&&c!==i&&R(c)},[n,c]),t.useEffect(()=>{d.current=void 0},[i]);const H=G({name:v,svgIcon:y,iconClass:b,imageUrl:N,imageAlt:P,buttonClasses:m,iconSize:A}),M=f=>t.cloneElement(f,{className:e.classNames(e.uButton.icon({c:m}),f.props.className)}),K=t.useMemo(()=>n?i:E||void 0,[n,i,E]);return t.createElement("button",{ref:O,"aria-pressed":K,...w,dir:u,disabled:a,onClick:q,className:e.classNames(e.uButton.wrapper({c:m,isRtl:u==="rtl",selected:i,disabled:a,size:z,fillMode:T,rounded:k,themeColor:j,iconButton:!_&&U}),S)},h&&M(h),H,s&&t.createElement("span",{className:e.classNames(e.uButton.text({c:m}))},s),B&&M(B))}),p={size:void 0,rounded:void 0,fillMode:void 0,themeColor:void 0};g.displayName="KendoReactButton";g.propTypes={children:r.node,selected:r.bool,togglable:r.bool,icon:r.string,svgIcon:e.svgIconPropType,iconClass:r.string,imageUrl:r.string,imageAlt:r.string,size:r.oneOf(["xsmall","xs","small","medium","large"]),rounded:r.oneOf(["small","medium","large","full","none"]),fillMode:r.oneOf(["flat","link","outline","solid","clear"]),themeColor:r.oneOf(["base","primary","secondary","tertiary","info","success","warning","error","inverse"])};exports.Button=g;
|
package/Button.mjs
CHANGED
|
@@ -7,29 +7,29 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
9
|
import t from "prop-types";
|
|
10
|
-
import { useUnstyled as G, classNames as
|
|
11
|
-
function Q({ imageUrl: a, name: d, iconClass:
|
|
10
|
+
import { useUnstyled as G, classNames as c, uButton as i, IconWrap as J, svgIconPropType as L } from "@progress/kendo-react-common";
|
|
11
|
+
function Q({ imageUrl: a, name: d, iconClass: r, svgIcon: o, imageAlt: u, buttonClasses: l, iconSize: n }) {
|
|
12
12
|
return a ? /* @__PURE__ */ e.createElement(
|
|
13
13
|
"img",
|
|
14
14
|
{
|
|
15
15
|
role: "presentation",
|
|
16
|
-
className: i
|
|
16
|
+
className: c(i.icon({ c: l })),
|
|
17
17
|
alt: u,
|
|
18
18
|
src: a
|
|
19
19
|
}
|
|
20
20
|
) : d || o ? /* @__PURE__ */ e.createElement(
|
|
21
21
|
J,
|
|
22
22
|
{
|
|
23
|
-
className: i
|
|
23
|
+
className: c(i.icon({ c: l })),
|
|
24
24
|
name: d,
|
|
25
25
|
icon: o,
|
|
26
26
|
size: n
|
|
27
27
|
}
|
|
28
|
-
) :
|
|
28
|
+
) : r ? /* @__PURE__ */ e.createElement("span", { role: "presentation", className: c(i.icon({ c: l }), r) }) : null;
|
|
29
29
|
}
|
|
30
30
|
const A = e.forwardRef((a, d) => {
|
|
31
31
|
const {
|
|
32
|
-
children:
|
|
32
|
+
children: r,
|
|
33
33
|
togglable: o,
|
|
34
34
|
dir: u,
|
|
35
35
|
disabled: l,
|
|
@@ -43,26 +43,26 @@ const A = e.forwardRef((a, d) => {
|
|
|
43
43
|
startIcon: E,
|
|
44
44
|
endIcon: N,
|
|
45
45
|
onClick: b,
|
|
46
|
-
size:
|
|
47
|
-
rounded:
|
|
48
|
-
fillMode:
|
|
49
|
-
themeColor:
|
|
46
|
+
size: k = g.size,
|
|
47
|
+
rounded: O = g.rounded,
|
|
48
|
+
fillMode: S = g.fillMode,
|
|
49
|
+
themeColor: T = g.themeColor,
|
|
50
50
|
ariaPressed: I,
|
|
51
|
-
iconSize:
|
|
51
|
+
iconSize: w,
|
|
52
52
|
...U
|
|
53
53
|
} = a, H = () => {
|
|
54
|
-
o && n === void 0 && (m.current = !
|
|
54
|
+
o && n === void 0 && (m.current = !s, z(!s));
|
|
55
55
|
}, K = (p) => {
|
|
56
56
|
H(), b && b.call(void 0, p);
|
|
57
|
-
}, m = e.useRef(void 0), R = e.useRef(null), [
|
|
57
|
+
}, m = e.useRef(void 0), R = e.useRef(null), [s, z] = e.useState(o === !0 && n === !0), W = y !== void 0 || v !== void 0 || h !== void 0 || C !== void 0, j = r !== void 0, q = G(), M = a.unstyled || q, f = M && M.uButton;
|
|
58
58
|
e.useImperativeHandle(d, () => ({
|
|
59
59
|
element: R.current,
|
|
60
|
-
selected: m.current !== void 0 ? m.current :
|
|
60
|
+
selected: m.current !== void 0 ? m.current : s
|
|
61
61
|
})), e.useMemo(() => {
|
|
62
|
-
o && n !== void 0 && n !==
|
|
62
|
+
o && n !== void 0 && n !== s && z(n);
|
|
63
63
|
}, [o, n]), e.useEffect(() => {
|
|
64
64
|
m.current = void 0;
|
|
65
|
-
}, [
|
|
65
|
+
}, [s]);
|
|
66
66
|
const D = Q({
|
|
67
67
|
name: v,
|
|
68
68
|
svgIcon: y,
|
|
@@ -70,10 +70,10 @@ const A = e.forwardRef((a, d) => {
|
|
|
70
70
|
imageUrl: C,
|
|
71
71
|
imageAlt: B,
|
|
72
72
|
buttonClasses: f,
|
|
73
|
-
iconSize:
|
|
74
|
-
}),
|
|
75
|
-
className: i
|
|
76
|
-
}), F = e.useMemo(() => o ?
|
|
73
|
+
iconSize: w
|
|
74
|
+
}), x = (p) => e.cloneElement(p, {
|
|
75
|
+
className: c(i.icon({ c: f }), p.props.className)
|
|
76
|
+
}), F = e.useMemo(() => o ? s : I || void 0, [o, s, I]);
|
|
77
77
|
return /* @__PURE__ */ e.createElement(
|
|
78
78
|
"button",
|
|
79
79
|
{
|
|
@@ -83,25 +83,25 @@ const A = e.forwardRef((a, d) => {
|
|
|
83
83
|
dir: u,
|
|
84
84
|
disabled: l,
|
|
85
85
|
onClick: K,
|
|
86
|
-
className:
|
|
87
|
-
|
|
86
|
+
className: c(
|
|
87
|
+
i.wrapper({
|
|
88
88
|
c: f,
|
|
89
89
|
isRtl: u === "rtl",
|
|
90
|
-
selected:
|
|
90
|
+
selected: s,
|
|
91
91
|
disabled: l,
|
|
92
|
-
size:
|
|
93
|
-
fillMode:
|
|
94
|
-
rounded:
|
|
95
|
-
themeColor:
|
|
92
|
+
size: k,
|
|
93
|
+
fillMode: S,
|
|
94
|
+
rounded: O,
|
|
95
|
+
themeColor: T,
|
|
96
96
|
iconButton: !j && W
|
|
97
97
|
}),
|
|
98
98
|
P
|
|
99
99
|
)
|
|
100
100
|
},
|
|
101
|
-
E &&
|
|
101
|
+
E && x(E),
|
|
102
102
|
D,
|
|
103
|
-
|
|
104
|
-
N &&
|
|
103
|
+
r && /* @__PURE__ */ e.createElement("span", { className: c(i.text({ c: f })) }, r),
|
|
104
|
+
N && x(N)
|
|
105
105
|
);
|
|
106
106
|
}), g = {
|
|
107
107
|
size: void 0,
|
|
@@ -119,7 +119,7 @@ A.propTypes = {
|
|
|
119
119
|
iconClass: t.string,
|
|
120
120
|
imageUrl: t.string,
|
|
121
121
|
imageAlt: t.string,
|
|
122
|
-
size: t.oneOf(["small", "medium", "large"]),
|
|
122
|
+
size: t.oneOf(["xsmall", "xs", "small", "medium", "large"]),
|
|
123
123
|
rounded: t.oneOf(["small", "medium", "large", "full", "none"]),
|
|
124
124
|
fillMode: t.oneOf(["flat", "link", "outline", "solid", "clear"]),
|
|
125
125
|
themeColor: t.oneOf([
|
|
@@ -131,8 +131,6 @@ A.propTypes = {
|
|
|
131
131
|
"success",
|
|
132
132
|
"warning",
|
|
133
133
|
"error",
|
|
134
|
-
"dark",
|
|
135
|
-
"light",
|
|
136
134
|
"inverse"
|
|
137
135
|
])
|
|
138
136
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),s=require("prop-types"),o=require("@progress/kendo-react-common"),he=require("./FloatingActionButtonItem.js"),O=require("./utils.js"),ve=require("@progress/kendo-react-popup");function Ce(d){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const r in d)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(d,r);Object.defineProperty(g,r,k.get?k:{enumerable:!0,get:()=>d[r]})}}return g.default=d,Object.freeze(g)}const t=Ce(ye),Ie=2,Ee=100,M=t.forwardRef((d,g)=>{const{align:r=C.align,alignOffset:k,className:q,disabled:f,icon:R,svgIcon:A,iconClass:$,id:j,items:n,item:ee,text:I,positionMode:w=C.positionMode,size:y=C.size,style:te,rounded:E=C.rounded,themeColor:F=C.themeColor,overlayStyle:oe,tabIndex:se,accessKey:ae,popupSettings:x={},modal:ne,onClick:P,onItemClick:_,onFocus:S,onBlur:W,onKeyDown:Z,onOpen:H,onClose:L,...le}=d,X=o.useZIndexContext(),U=X?X+Ie:Ee,G=t.useRef(null),i=t.useRef(null),ie=t.useRef(null),re=t.useRef(null),J=t.useCallback(()=>{i.current&&i.current.focus()},[]),p=t.useCallback(()=>({element:i.current,focus:J}),[J]);t.useImperativeHandle(G,p),t.useImperativeHandle(g,()=>G.current);const[c,u]=t.useState(!1),[D,m]=t.useState(!1),[h,l]=t.useState(-1),ce=o.useId()+"-button-id",T=o.useDir(i,d.dir),v=T==="rtl",N=o.useId()+"-list-id";t.useEffect(()=>{O.position(i,r,k,v)},[i,r,k,v]),t.useEffect(()=>{D&&i&&i.current&&i.current.focus()},[D,i]);const b=t.useCallback((e,a)=>{n&&o.dispatchEvent(a?H:L,e,p(),void 0)},[H,L,n]),Q=t.useCallback(e=>{!e.target||f||(!n&&P?o.dispatchEvent(P,e,p(),void 0):(u(!c),m(!0),l(c?-1:0),b(e,!c)))},[u,m,l,P,b,c,n,f]),ue=t.useCallback(e=>{m(!0),l(c?0:-1),S&&o.dispatchEvent(S,e,p(),void 0)},[S,m,l]),de=t.useCallback(e=>{m(!1),u(!1),l(-1),o.dispatchEvent(W,e,p(),void 0),c&&b(e,!1)},[W,m,u,l,b]),fe=t.useCallback(e=>{e.preventDefault()},[]),z=t.useCallback((e,a)=>{n&&(n[a].disabled||o.dispatchEvent(_,e,p(),{itemProps:n[a],itemIndex:a}))},[_]),pe=t.useCallback((e,a)=>{!e.target||!n||(l(a),u(!1),z(e,a),b(e,!1))},[l,u,z,b]),me=t.useCallback(e=>{o.getActiveElement(document)===i.current&&e.preventDefault()},[i]),be=t.useCallback(e=>{const a=h,B=n?n.length:-1;if(e.altKey){!c&&e.keyCode===o.Keys.down&&(e.preventDefault(),u(!0),l(0)),c&&e.keyCode===o.Keys.up&&(e.preventDefault(),u(!1),l(-1));return}switch(e.keyCode){case o.Keys.enter:case o.Keys.space:a>=0&&z(e,a),n||Q(e),e.preventDefault(),u(!c),l(c?-1:0);break;case o.Keys.esc:e.preventDefault(),u(!1),l(-1);break;case o.Keys.home:e.preventDefault(),l(0);break;case o.Keys.end:e.preventDefault(),l(B-1);break;case o.Keys.down:case o.Keys.right:e.preventDefault(),l(a+1>=B?0:a+1);break;case o.Keys.up:case o.Keys.left:e.preventDefault(),l(a-1<0?B-1:a-1);break}o.dispatchEvent(Z,e,p(),void 0)},[Z,h,l,v,u]),ge=t.useMemo(()=>o.classNames("k-fab",{"k-fab-xs":y==="xsmall","k-fab-sm":y==="small","k-fab-md":y==="medium","k-fab-lg":y==="large","k-disabled":f,"k-pos-absolute":w==="absolute","k-pos-fixed":w==="fixed","k-focus":D,[`k-rounded-${o.kendoThemeMaps.roundedMap[E]||E}`]:E,[`k-fab-${F}`]:F},`k-${r.vertical}-${r.horizontal}`,q),[F,y,E,f,w,r,D,q]),ke=n&&n.map((e,a)=>t.createElement(he.FloatingActionButtonItem,{...e,key:a,index:a,id:`${N}-${a}`,disabled:f||e.disabled,focused:h===a,dataItem:e,item:ee,className:o.classNames(e.className,O.getTextDirectionClass(T||"ltr",r.horizontal)),onClick:pe,onDown:me})),V=!!((R||A)&&!I),Y=(i.current?i.current.offsetWidth:0)/2-32/2;let K;return R||A?K=t.createElement(o.IconWrap,{className:"k-fab-icon",name:R,icon:A}):$?K=t.createElement("span",{role:"presentation",className:$}):K=null,t.createElement(o.ZIndexContext.Provider,{value:U},t.createElement(t.Fragment,null,t.createElement("button",{ref:i,id:j||ce,role:"button",type:"button","aria-disabled":f,"aria-expanded":n?c:void 0,"aria-haspopup":!!n,"aria-label":`${I||""} floatingactionbutton`,"aria-owns":n?N:void 0,"aria-activedescendant":h>=0&&n?`${N}-${h}`:void 0,tabIndex:o.getTabIndex(se,f),accessKey:ae,dir:T,disabled:f,className:ge,style:te,onClick:Q,onMouseDown:fe,onFocus:ue,onBlur:de,onKeyDown:be,...le},K,I&&t.createElement("span",{className:"k-fab-text"},I)),ne&&c&&t.createElement("div",{className:"k-overlay",style:{zIndex:U,...oe}}),t.createElement(ve.Popup,{ref:re,anchor:i.current,show:c,animate:x.animate,popupClass:o.classNames("k-popup-transparent k-fab-popup",x.popupClass),anchorAlign:x.anchorAlign||O.getAnchorAlign(r,v),popupAlign:x.popupAlign||O.getPopupAlign(r,v),style:{boxShadow:"none"}},t.createElement("ul",{ref:ie,role:"menu","aria-labelledby":j,id:N,className:o.classNames("k-fab-items",{"k-fab-items-bottom":r.vertical!=="bottom","k-fab-items-top":r.vertical==="bottom"}),style:{paddingLeft:V?Y:void 0,paddingRight:V?Y:void 0}},ke))))});M.propTypes={className:s.string,style:s.object,id:s.string,dir:s.string,tabIndex:s.number,accessKey:s.string,disabled:s.bool,icon:s.string,svgIcon:o.svgIconPropType,iconClass:s.string,text:s.string,alignOffset:s.shape({x:s.oneOfType([s.number,s.string]).isRequired,y:s.oneOfType([s.number,s.string]).isRequired}),align:s.shape({vertical:s.oneOf(["top","middle","bottom"]).isRequired,horizontal:s.oneOf(["start","center","end"]).isRequired}),positionMode:s.oneOf(["absolute","fixed"]),size:s.oneOf(["xsmall","small","medium","large"]),rounded:s.oneOf(["small","medium","large","full","none"]),themeColor:s.oneOf(["base","primary","secondary","tertiary"]),modal:s.bool,overlayStyle:s.object};const C={align:{vertical:"bottom",horizontal:"end"},size:void 0,rounded:void 0,themeColor:void 0,positionMode:"fixed"};M.displayName="KendoFloatingActionButton";exports.FloatingActionButton=M;
|
|
@@ -7,33 +7,33 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import { useZIndexContext as ye, useId as Y, useDir as
|
|
11
|
-
import { FloatingActionButtonItem as
|
|
10
|
+
import { useZIndexContext as ye, useId as Y, useDir as Ie, dispatchEvent as b, getActiveElement as ve, Keys as c, classNames as N, kendoThemeMaps as xe, ZIndexContext as Ee, getTabIndex as De, IconWrap as Ne, svgIconPropType as Re } from "@progress/kendo-react-common";
|
|
11
|
+
import { FloatingActionButtonItem as we } from "./FloatingActionButtonItem.mjs";
|
|
12
12
|
import { position as Ae, getTextDirectionClass as Fe, getPopupAlign as Oe, getAnchorAlign as ze } from "./utils.mjs";
|
|
13
13
|
import { Popup as Te } from "@progress/kendo-react-popup";
|
|
14
14
|
const Be = 2, Me = 100, ee = t.forwardRef(
|
|
15
15
|
(P, te) => {
|
|
16
16
|
const {
|
|
17
|
-
align: u =
|
|
17
|
+
align: u = C.align,
|
|
18
18
|
alignOffset: $,
|
|
19
19
|
className: K,
|
|
20
20
|
disabled: d,
|
|
21
|
-
icon:
|
|
22
|
-
svgIcon:
|
|
21
|
+
icon: R,
|
|
22
|
+
svgIcon: w,
|
|
23
23
|
iconClass: S,
|
|
24
24
|
id: W,
|
|
25
|
-
items:
|
|
25
|
+
items: s,
|
|
26
26
|
item: oe,
|
|
27
|
-
text:
|
|
28
|
-
positionMode: A =
|
|
29
|
-
size:
|
|
27
|
+
text: y,
|
|
28
|
+
positionMode: A = C.positionMode,
|
|
29
|
+
size: g = C.size,
|
|
30
30
|
style: ae,
|
|
31
|
-
rounded:
|
|
32
|
-
themeColor: F =
|
|
33
|
-
overlayStyle:
|
|
34
|
-
tabIndex:
|
|
31
|
+
rounded: I = C.rounded,
|
|
32
|
+
themeColor: F = C.themeColor,
|
|
33
|
+
overlayStyle: se,
|
|
34
|
+
tabIndex: ne,
|
|
35
35
|
accessKey: le,
|
|
36
|
-
popupSettings:
|
|
36
|
+
popupSettings: v = {},
|
|
37
37
|
modal: ie,
|
|
38
38
|
onClick: O,
|
|
39
39
|
onItemClick: Z,
|
|
@@ -56,95 +56,95 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
56
56
|
te,
|
|
57
57
|
() => U.current
|
|
58
58
|
);
|
|
59
|
-
const [i, r] = t.useState(!1), [
|
|
59
|
+
const [i, r] = t.useState(!1), [x, p] = t.useState(!1), [k, n] = t.useState(-1), de = Y() + "-button-id", T = Ie(l, P.dir), h = T === "rtl", E = Y() + "-list-id";
|
|
60
60
|
t.useEffect(() => {
|
|
61
|
-
Ae(l, u, $,
|
|
62
|
-
}, [l, u, $,
|
|
63
|
-
|
|
64
|
-
}, [
|
|
61
|
+
Ae(l, u, $, h);
|
|
62
|
+
}, [l, u, $, h]), t.useEffect(() => {
|
|
63
|
+
x && l && l.current && l.current.focus();
|
|
64
|
+
}, [x, l]);
|
|
65
65
|
const m = t.useCallback(
|
|
66
66
|
(e, a) => {
|
|
67
|
-
|
|
67
|
+
s && b(a ? H : j, e, f(), void 0);
|
|
68
68
|
},
|
|
69
|
-
[H, j,
|
|
69
|
+
[H, j, s]
|
|
70
70
|
), J = t.useCallback(
|
|
71
71
|
(e) => {
|
|
72
|
-
!e.target || d || (!
|
|
72
|
+
!e.target || d || (!s && O ? b(
|
|
73
73
|
O,
|
|
74
74
|
e,
|
|
75
75
|
f(),
|
|
76
76
|
void 0
|
|
77
|
-
) : (r(!i), p(!0),
|
|
77
|
+
) : (r(!i), p(!0), n(i ? -1 : 0), m(e, !i)));
|
|
78
78
|
},
|
|
79
|
-
[r, p,
|
|
79
|
+
[r, p, n, O, m, i, s, d]
|
|
80
80
|
), fe = t.useCallback(
|
|
81
81
|
(e) => {
|
|
82
|
-
p(!0),
|
|
82
|
+
p(!0), n(i ? 0 : -1), z && b(
|
|
83
83
|
z,
|
|
84
84
|
e,
|
|
85
85
|
f(),
|
|
86
86
|
void 0
|
|
87
87
|
);
|
|
88
88
|
},
|
|
89
|
-
[z, p,
|
|
89
|
+
[z, p, n]
|
|
90
90
|
), pe = t.useCallback(
|
|
91
91
|
(e) => {
|
|
92
|
-
p(!1), r(!1),
|
|
92
|
+
p(!1), r(!1), n(-1), b(
|
|
93
93
|
q,
|
|
94
94
|
e,
|
|
95
95
|
f(),
|
|
96
96
|
void 0
|
|
97
97
|
), i && m(e, !1);
|
|
98
98
|
},
|
|
99
|
-
[q, p, r,
|
|
99
|
+
[q, p, r, n, m]
|
|
100
100
|
), me = t.useCallback((e) => {
|
|
101
101
|
e.preventDefault();
|
|
102
102
|
}, []), B = t.useCallback(
|
|
103
103
|
(e, a) => {
|
|
104
|
-
|
|
105
|
-
itemProps:
|
|
104
|
+
s && (s[a].disabled || b(Z, e, f(), {
|
|
105
|
+
itemProps: s[a],
|
|
106
106
|
itemIndex: a
|
|
107
107
|
}));
|
|
108
108
|
},
|
|
109
109
|
[Z]
|
|
110
110
|
), be = t.useCallback(
|
|
111
111
|
(e, a) => {
|
|
112
|
-
!e.target || !
|
|
112
|
+
!e.target || !s || (n(a), r(!1), B(e, a), m(e, !1));
|
|
113
113
|
},
|
|
114
|
-
[
|
|
114
|
+
[n, r, B, m]
|
|
115
115
|
), ge = t.useCallback(
|
|
116
116
|
(e) => {
|
|
117
|
-
|
|
117
|
+
ve(document) === l.current && e.preventDefault();
|
|
118
118
|
},
|
|
119
119
|
[l]
|
|
120
120
|
), ke = t.useCallback(
|
|
121
121
|
(e) => {
|
|
122
|
-
const a =
|
|
122
|
+
const a = k, M = s ? s.length : -1;
|
|
123
123
|
if (e.altKey) {
|
|
124
|
-
!i && e.keyCode === c.down && (e.preventDefault(), r(!0),
|
|
124
|
+
!i && e.keyCode === c.down && (e.preventDefault(), r(!0), n(0)), i && e.keyCode === c.up && (e.preventDefault(), r(!1), n(-1));
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
switch (e.keyCode) {
|
|
128
128
|
case c.enter:
|
|
129
129
|
case c.space:
|
|
130
|
-
a >= 0 && B(e, a),
|
|
130
|
+
a >= 0 && B(e, a), s || J(e), e.preventDefault(), r(!i), n(i ? -1 : 0);
|
|
131
131
|
break;
|
|
132
132
|
case c.esc:
|
|
133
|
-
e.preventDefault(), r(!1),
|
|
133
|
+
e.preventDefault(), r(!1), n(-1);
|
|
134
134
|
break;
|
|
135
135
|
case c.home:
|
|
136
|
-
e.preventDefault(),
|
|
136
|
+
e.preventDefault(), n(0);
|
|
137
137
|
break;
|
|
138
138
|
case c.end:
|
|
139
|
-
e.preventDefault(),
|
|
139
|
+
e.preventDefault(), n(M - 1);
|
|
140
140
|
break;
|
|
141
141
|
case c.down:
|
|
142
142
|
case c.right:
|
|
143
|
-
e.preventDefault(),
|
|
143
|
+
e.preventDefault(), n(a + 1 >= M ? 0 : a + 1);
|
|
144
144
|
break;
|
|
145
145
|
case c.up:
|
|
146
146
|
case c.left:
|
|
147
|
-
e.preventDefault(),
|
|
147
|
+
e.preventDefault(), n(a - 1 < 0 ? M - 1 : a - 1);
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
b(
|
|
@@ -154,43 +154,44 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
154
154
|
void 0
|
|
155
155
|
);
|
|
156
156
|
},
|
|
157
|
-
[_,
|
|
157
|
+
[_, k, n, h, r]
|
|
158
158
|
), he = t.useMemo(
|
|
159
159
|
() => N(
|
|
160
160
|
"k-fab",
|
|
161
161
|
{
|
|
162
|
-
"k-fab-
|
|
163
|
-
"k-fab-
|
|
164
|
-
"k-fab-
|
|
162
|
+
"k-fab-xs": g === "xsmall",
|
|
163
|
+
"k-fab-sm": g === "small",
|
|
164
|
+
"k-fab-md": g === "medium",
|
|
165
|
+
"k-fab-lg": g === "large",
|
|
165
166
|
"k-disabled": d,
|
|
166
167
|
"k-pos-absolute": A === "absolute",
|
|
167
168
|
"k-pos-fixed": A === "fixed",
|
|
168
|
-
"k-focus":
|
|
169
|
-
[`k-rounded-${
|
|
169
|
+
"k-focus": x,
|
|
170
|
+
[`k-rounded-${xe.roundedMap[I] || I}`]: I,
|
|
170
171
|
[`k-fab-${F}`]: F
|
|
171
172
|
},
|
|
172
173
|
`k-${u.vertical}-${u.horizontal}`,
|
|
173
174
|
K
|
|
174
175
|
),
|
|
175
|
-
[F,
|
|
176
|
-
), Ce =
|
|
177
|
-
|
|
176
|
+
[F, g, I, d, A, u, x, K]
|
|
177
|
+
), Ce = s && s.map((e, a) => /* @__PURE__ */ t.createElement(
|
|
178
|
+
we,
|
|
178
179
|
{
|
|
179
180
|
...e,
|
|
180
181
|
key: a,
|
|
181
182
|
index: a,
|
|
182
|
-
id: `${
|
|
183
|
+
id: `${E}-${a}`,
|
|
183
184
|
disabled: d || e.disabled,
|
|
184
|
-
focused:
|
|
185
|
+
focused: k === a,
|
|
185
186
|
dataItem: e,
|
|
186
187
|
item: oe,
|
|
187
188
|
className: N(e.className, Fe(T || "ltr", u.horizontal)),
|
|
188
189
|
onClick: be,
|
|
189
190
|
onDown: ge
|
|
190
191
|
}
|
|
191
|
-
)), Q = !!((
|
|
192
|
+
)), Q = !!((R || w) && !y), V = (l.current ? l.current.offsetWidth : 0) / 2 - 32 / 2;
|
|
192
193
|
let D;
|
|
193
|
-
return
|
|
194
|
+
return R || w ? D = /* @__PURE__ */ t.createElement(Ne, { className: "k-fab-icon", name: R, icon: w }) : S ? D = /* @__PURE__ */ t.createElement("span", { role: "presentation", className: S }) : D = null, /* @__PURE__ */ t.createElement(Ee.Provider, { value: X }, /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
194
195
|
"button",
|
|
195
196
|
{
|
|
196
197
|
ref: l,
|
|
@@ -198,12 +199,12 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
198
199
|
role: "button",
|
|
199
200
|
type: "button",
|
|
200
201
|
"aria-disabled": d,
|
|
201
|
-
"aria-expanded":
|
|
202
|
-
"aria-haspopup": !!
|
|
203
|
-
"aria-label": `${
|
|
204
|
-
"aria-owns":
|
|
205
|
-
"aria-activedescendant":
|
|
206
|
-
tabIndex: De(
|
|
202
|
+
"aria-expanded": s ? i : void 0,
|
|
203
|
+
"aria-haspopup": !!s,
|
|
204
|
+
"aria-label": `${y || ""} floatingactionbutton`,
|
|
205
|
+
"aria-owns": s ? E : void 0,
|
|
206
|
+
"aria-activedescendant": k >= 0 && s ? `${E}-${k}` : void 0,
|
|
207
|
+
tabIndex: De(ne, d),
|
|
207
208
|
accessKey: le,
|
|
208
209
|
dir: T,
|
|
209
210
|
disabled: d,
|
|
@@ -217,14 +218,14 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
217
218
|
...re
|
|
218
219
|
},
|
|
219
220
|
D,
|
|
220
|
-
|
|
221
|
+
y && /* @__PURE__ */ t.createElement("span", { className: "k-fab-text" }, y)
|
|
221
222
|
), ie && i && /* @__PURE__ */ t.createElement(
|
|
222
223
|
"div",
|
|
223
224
|
{
|
|
224
225
|
className: "k-overlay",
|
|
225
226
|
style: {
|
|
226
227
|
zIndex: X,
|
|
227
|
-
...
|
|
228
|
+
...se
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
), /* @__PURE__ */ t.createElement(
|
|
@@ -233,10 +234,10 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
233
234
|
ref: ue,
|
|
234
235
|
anchor: l.current,
|
|
235
236
|
show: i,
|
|
236
|
-
animate:
|
|
237
|
-
popupClass: N("k-popup-transparent k-fab-popup",
|
|
238
|
-
anchorAlign:
|
|
239
|
-
popupAlign:
|
|
237
|
+
animate: v.animate,
|
|
238
|
+
popupClass: N("k-popup-transparent k-fab-popup", v.popupClass),
|
|
239
|
+
anchorAlign: v.anchorAlign || ze(u, h),
|
|
240
|
+
popupAlign: v.popupAlign || Oe(u, h),
|
|
240
241
|
style: { boxShadow: "none" }
|
|
241
242
|
},
|
|
242
243
|
/* @__PURE__ */ t.createElement(
|
|
@@ -245,7 +246,7 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
245
246
|
ref: ce,
|
|
246
247
|
role: "menu",
|
|
247
248
|
"aria-labelledby": W,
|
|
248
|
-
id:
|
|
249
|
+
id: E,
|
|
249
250
|
className: N("k-fab-items", {
|
|
250
251
|
"k-fab-items-bottom": u.vertical !== "bottom",
|
|
251
252
|
"k-fab-items-top": u.vertical === "bottom"
|
|
@@ -269,7 +270,7 @@ ee.propTypes = {
|
|
|
269
270
|
accessKey: o.string,
|
|
270
271
|
disabled: o.bool,
|
|
271
272
|
icon: o.string,
|
|
272
|
-
svgIcon:
|
|
273
|
+
svgIcon: Re,
|
|
273
274
|
iconClass: o.string,
|
|
274
275
|
text: o.string,
|
|
275
276
|
alignOffset: o.shape({
|
|
@@ -281,24 +282,13 @@ ee.propTypes = {
|
|
|
281
282
|
horizontal: o.oneOf(["start", "center", "end"]).isRequired
|
|
282
283
|
}),
|
|
283
284
|
positionMode: o.oneOf(["absolute", "fixed"]),
|
|
284
|
-
size: o.oneOf(["small", "medium", "large"]),
|
|
285
|
+
size: o.oneOf(["xsmall", "small", "medium", "large"]),
|
|
285
286
|
rounded: o.oneOf(["small", "medium", "large", "full", "none"]),
|
|
286
|
-
themeColor: o.oneOf([
|
|
287
|
-
"primary",
|
|
288
|
-
"secondary",
|
|
289
|
-
"tertiary",
|
|
290
|
-
"info",
|
|
291
|
-
"success",
|
|
292
|
-
"warning",
|
|
293
|
-
"error",
|
|
294
|
-
"dark",
|
|
295
|
-
"light",
|
|
296
|
-
"inverse"
|
|
297
|
-
]),
|
|
287
|
+
themeColor: o.oneOf(["base", "primary", "secondary", "tertiary"]),
|
|
298
288
|
modal: o.bool,
|
|
299
289
|
overlayStyle: o.object
|
|
300
290
|
};
|
|
301
|
-
const
|
|
291
|
+
const C = {
|
|
302
292
|
align: { vertical: "bottom", horizontal: "end" },
|
|
303
293
|
size: void 0,
|
|
304
294
|
rounded: void 0,
|
|
@@ -206,16 +206,10 @@ export interface FloatingActionButtonProps extends Omit<React.ButtonHTMLAttribut
|
|
|
206
206
|
* [see example](https://www.telerik.com/kendo-react-ui/components/buttons/floatingactionbutton/appearance).
|
|
207
207
|
*
|
|
208
208
|
* The possible values are:
|
|
209
|
+
* * `base`—Applies coloring based on the base theme color.
|
|
209
210
|
* * `primary`—Applies coloring based on the primary theme color.
|
|
210
211
|
* * `secondary`—Applies coloring based on the secondary theme color.
|
|
211
212
|
* * `tertiary`— Applies coloring based on the tertiary theme color.
|
|
212
|
-
* * `info`—Applies coloring based on the info theme color.
|
|
213
|
-
* * `success`— Applies coloring based on the success theme color.
|
|
214
|
-
* * `warning`— Applies coloring based on the warning theme color.
|
|
215
|
-
* * `error`— Applies coloring based on the error theme color.
|
|
216
|
-
* * `dark`— Applies coloring based on the dark theme color.
|
|
217
|
-
* * `light`— Applies coloring based on the light theme color.
|
|
218
|
-
* * `inverse`— Applies coloring based on the inverse theme color.
|
|
219
213
|
*
|
|
220
214
|
* @default undefined (theme-controlled)
|
|
221
215
|
* @example
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* Specifies the size of the FloatingActionButton.
|
|
10
10
|
*
|
|
11
11
|
* The possible values are:
|
|
12
|
+
* * `xsmall`—Applies the smallest available spacing and icon scale.
|
|
12
13
|
* * `small`—Applies half of the default padding, e.g. `8px`.
|
|
13
14
|
* * `medium` (Default)—Applies the default padding, e.g. `16px`.
|
|
14
15
|
* * `large`—Applies one and one half of the default padding, e.g. `24px`.
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
|
-
export type FloatingActionButtonSize = 'small' | 'medium' | 'large';
|
|
18
|
+
export type FloatingActionButtonSize = 'xsmall' | 'small' | 'medium' | 'large';
|
|
@@ -12,13 +12,7 @@
|
|
|
12
12
|
* * `primary` (Default)—Applies coloring based on the primary theme color.
|
|
13
13
|
* * `secondary`—Applies coloring based on the secondary theme color.
|
|
14
14
|
* * `tertiary`— Applies coloring based on the tertiary theme color.
|
|
15
|
-
* * `
|
|
16
|
-
* * `success`— Applies coloring based on the success theme color.
|
|
17
|
-
* * `warning`— Applies coloring based on the warning theme color.
|
|
18
|
-
* * `error`— Applies coloring based on the error theme color.
|
|
19
|
-
* * `dark`— Applies coloring based on the dark theme color.
|
|
20
|
-
* * `light`— Applies coloring based on the light theme color.
|
|
21
|
-
* * `inverse`— Applies coloring based on the inverse theme color.
|
|
15
|
+
* * `base`— Applies coloring based on the base theme color.
|
|
22
16
|
*
|
|
23
17
|
*/
|
|
24
|
-
export type FloatingActionButtonThemeColor = '
|
|
18
|
+
export type FloatingActionButtonThemeColor = 'base' | 'primary' | 'secondary' | 'tertiary';
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),o=require("prop-types"),M=require("../Button.js"),e=require("@progress/kendo-react-common"),R=require("./utils/navigation.js"),A=require("./DropDownButtonItem.js"),T=require("./ButtonItem.js"),q=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),f=require("../package-metadata.js");function z(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const u=z(N),L=12e3,j=2e3,h=class h extends u.Component{constructor(i){super(i),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.showLicenseWatermark=!1,this.buttonsData=[],this.onKeyDown=t=>{const{focusedIndex:s}=this.state;if(t.altKey){!this.opened&&t.keyCode===e.Keys.down?(t.preventDefault(),this.setOpen(!0,t),this.setState({focusedIndex:0})):this.opened&&t.keyCode===e.Keys.up&&(t.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,t));return}const n={...this.state};if(t.keyCode===e.Keys.enter||t.keyCode===e.Keys.space){t.preventDefault(),s>=0&&this.dispatchClickEvent(t,s);const a=!this.opened;this.setState({focused:!0,focusedIndex:a?0:-1}),this.setOpen(a,t);return}if(this.opened&&t.keyCode===e.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,t);return}if(this.opened){const a=R.navigate(s,t.keyCode,t.altKey,this.buttonsData.length);n.focusedIndex=a;const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),o=require("prop-types"),M=require("../Button.js"),e=require("@progress/kendo-react-common"),R=require("./utils/navigation.js"),A=require("./DropDownButtonItem.js"),T=require("./ButtonItem.js"),q=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),f=require("../package-metadata.js");function z(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const u=z(N),L=12e3,j=2e3,h=class h extends u.Component{constructor(i){super(i),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.showLicenseWatermark=!1,this.buttonsData=[],this.onKeyDown=t=>{const{focusedIndex:s}=this.state;if(t.altKey){!this.opened&&t.keyCode===e.Keys.down?(t.preventDefault(),this.setOpen(!0,t),this.setState({focusedIndex:0})):this.opened&&t.keyCode===e.Keys.up&&(t.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,t));return}const n={...this.state};if(t.keyCode===e.Keys.enter||t.keyCode===e.Keys.space){t.preventDefault(),s>=0&&this.dispatchClickEvent(t,s);const a=!this.opened;this.setState({focused:!0,focusedIndex:a?0:-1}),this.setOpen(a,t);return}if(this.opened&&t.keyCode===e.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,t);return}if(this.opened){const a=R.navigate(s,t.keyCode,t.altKey,this.buttonsData.length);n.focusedIndex=a;const p=t.keyCode===e.Keys.up||t.keyCode===e.Keys.down||t.keyCode===e.Keys.left||t.keyCode===e.Keys.right;!t.altKey&&(p||t.keyCode===e.Keys.home||t.keyCode===e.Keys.end)&&t.preventDefault()}this.setState(n)},this.switchFocus=t=>{this.skipFocus=!0,t(),window.setTimeout(()=>this.skipFocus=!1,0)},this.handleFocus=t=>{this.skipFocus||(this.setState({focused:!0,focusedIndex:this.opened?0:-1}),e.dispatchEvent(this.props.onFocus,t,this,void 0))},this.handleButtonBlur=t=>{this.opened||(this.setState({focused:!1}),e.dispatchEvent(this.props.onBlur,t,this,void 0))},this.handleMenuBlur=t=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),e.dispatchEvent(this.props.onBlur,t,this,void 0),setTimeout(()=>{this.setOpen(!1,t)},0))},this.setOpen=(t,s)=>{this.opened!==t&&(this.openedDuringOnChange=t,this.setState({opened:t}),s?this.dispatchPopupEvent(s,t):this.openedDuringOnChange=void 0)},this.onItemClick=(t,s)=>{this.setState({focusedIndex:-1}),this.dispatchClickEvent(t,s),this.setOpen(!1,t)},this.onItemDown=t=>{e.getActiveElement(document)===this.list&&t.preventDefault()},this.mouseDown=t=>{t.preventDefault();const s=e.getActiveElement(document);this.element&&s!==this.element&&s!==this.list&&this.element.focus()},this.onPopupClose=t=>{var n;const s=e.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||(n=this.list)!=null&&n.contains(s))&&this.switchFocus(()=>{this.element&&this.element.focus({preventScroll:!0})}),this.props.popupSettings&&this.props.popupSettings.onClose&&this.props.popupSettings.onClose.call(void 0,t)},this.listRef=t=>{this.list=t,t&&this.state.focused&&this.switchFocus(()=>{t.focus({preventScroll:!0}),this.element&&(this.element.tabIndex=-1)})},this.onClickMainButton=t=>{if(e.dispatchEvent(this.props.onClick,t,this,void 0),!this.buttonsData.length)return;const s=!this.opened;this.setState({focused:!0,focusedIndex:s?0:-1}),this.setOpen(s,t)},this.dispatchPopupEvent=(t,s)=>{e.dispatchEvent(s?this.props.onOpen:this.props.onClose,t,this,void 0),this.openedDuringOnChange=void 0},this.showLicenseWatermark=!e.validatePackage(f.packageMetadata,{component:"DropDownButton"}),this.licenseMessage=e.getLicenseMessage(f.packageMetadata)}get guid(){return this.props.id+"-accessibility-id"}get opened(){return this.openedDuringOnChange!==void 0?this.openedDuringOnChange:this.props.opened===void 0?this.state.opened:this.props.opened}render(){const i=this.isRtl(),t=this.props.unstyled&&this.props.unstyled.uDropDownButton,s=i?"rtl":void 0,{id:n,style:a,tabIndex:p,disabled:r,size:y,rounded:C,fillMode:k,themeColor:w,ariaLabel:I,title:b,accessKey:B,icon:O,svgIcon:v,iconClass:E,buttonClass:S,className:x,imageUrl:P,startIcon:K,endIcon:F}=this.props;return this.buttonsData=this.props.items||u.Children.toArray(this.props.children).filter(l=>l&&l.type===A.DropDownButtonItem).map(l=>l.props),u.createElement(u.Fragment,null,u.createElement(M.Button,{id:n,size:y,style:a,rounded:C,fillMode:k,themeColor:w,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":r?"true":void 0,tabIndex:p,accessKey:B,icon:O,svgIcon:v,iconClass:E,className:e.classNames(S,x,e.uDropDownButton.wrapper({c:t,focused:this.state.focused,disabled:r})),imageUrl:P,dir:s,ref:l=>{this.mainButton=(l==null?void 0:l.element)||null},type:"button","aria-expanded":this.opened?"true":"false","aria-label":I,"aria-controls":this.opened?this.guid:void 0,title:b,startIcon:K,endIcon:F},this.props.text),this.showLicenseWatermark&&u.createElement(e.WatermarkOverlay,{message:this.licenseMessage}),this.renderPopup(i))}componentDidMount(){(this.props.dir===void 0&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(i,t){this.isItemDisabled(t)||e.dispatchEvent(this.props.onItemClick,i,this,{item:this.buttonsData[t],itemIndex:t})}renderPopup(i){const{popupSettings:t={},_zIndex:s,unstyled:n}=this.props,a=s?s+j:L,p=n&&n.uDropDownButton,{focusedIndex:r}=this.state;return u.createElement(e.ZIndexContext.Provider,{value:a},u.createElement(q.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:e.classNames(e.uDropDownButton.popup({c:p}),t.popupClass),anchorAlign:t.anchorAlign||m.getAnchorAlign(i),popupAlign:t.popupAlign||m.getPopupAlign(i),style:i?{direction:"rtl"}:void 0,onClose:this.onPopupClose},u.createElement("ul",{role:"list",id:this.guid,tabIndex:-1,"aria-activedescendant":r>=0?`${this.guid}-${r}`:void 0,ref:this.listRef,onKeyDown:this.onKeyDown,onBlur:this.handleMenuBlur,className:e.classNames(e.uDropDownButton.ul({c:p,size:this.props.size}))},this.renderChildItems())))}renderChildItems(){const{item:i,itemRender:t,textField:s,unstyled:n}=this.props,a=n&&n.uDropDownButton;return this.buttonsData.length>0?this.buttonsData.map((p,r)=>u.createElement(T.ButtonItem,{className:e.classNames(e.uDropDownButton.item({c:a}),p.className,{"k-first":r===0},{"k-last":r===this.buttonsData.length-1}),dataItem:p,textField:s,focused:this.state.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:i,index:r,key:r,id:`${this.guid}-${r}`})):null}isItemDisabled(i){return this.buttonsData[i]?this.buttonsData[i].disabled:this.props.disabled}isRtl(){return this.props.dir!==void 0?this.props.dir==="rtl":!!this.mainButton&&getComputedStyle(this.mainButton).direction==="rtl"}};h.propTypes={accessKey:o.string,ariaLabel:o.string,title:o.string,onFocus:o.func,onBlur:o.func,onClick:o.func,onItemClick:o.func,onOpen:o.func,onClose:o.func,items:o.arrayOf(o.any),textField:o.string,tabIndex:o.number,disabled:o.bool,icon:o.string,svgIcon:e.svgIconPropType,iconClass:o.string,imageUrl:o.string,popupSettings:o.object,itemRender:o.func,item:o.func,className:o.string,buttonClass:o.string,dir:o.string,size:o.oneOf(["small","medium","large"]),rounded:o.oneOf(["small","medium","large","full","none"]),fillMode:o.oneOf(["flat","link","outline","solid","clear"]),themeColor:o.oneOf(["base","primary","secondary","tertiary","info","success","warning","error","inverse"])},h.defaultProps={size:void 0,rounded:void 0,fillMode:void 0,themeColor:void 0};let d=h;const g=e.createPropsContext(),D=e.withIdHOC(e.withPropsContext(g,e.withUnstyledHOC(e.withZIndexContext(d))));D.displayName="KendoReactDropDownButton";exports.DropDownButton=D;exports.DropDownButtonPropsContext=g;exports.DropDownButtonWithoutContext=d;
|