@progress/kendo-react-buttons 14.5.0-develop.8 → 15.0.0-develop.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/Button.d.ts +7 -3
- package/Button.js +1 -1
- package/Button.mjs +80 -78
- package/Chip/Chip.d.ts +6 -0
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +67 -63
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +1 -1
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +100 -111
- 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 +44 -46
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +58 -56
- package/ListButton/models/ListButtonProps.d.ts +2 -2
- package/README.md +4 -4
- package/SegmentedControl/SegmentedControl.js +1 -1
- package/SegmentedControl/SegmentedControl.mjs +28 -27
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +27 -27
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +8 -6
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -6
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +68 -62
- package/toolbar/tools/ToolbarOverflowSection.js +1 -1
- package/toolbar/tools/ToolbarOverflowSection.mjs +66 -40
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +14 -16
|
@@ -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"),w=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,q=t.forwardRef((d,g)=>{const{align:r=C.align,alignOffset:k,className:$,disabled:f,icon:I,svgIcon:E,iconClass:F,id:j,items:n,item:ee,text:x,positionMode:D=C.positionMode,size:y=C.size,style:te,rounded:N=C.rounded,themeColor:P=C.themeColor,overlayStyle:oe,tabIndex:se,accessKey:ae,popupSettings:K={},modal:ne,onClick:S,onItemClick:_,onFocus:T,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),[O,m]=t.useState(!1),[h,l]=t.useState(-1),ce=o.useId()+"-button-id",z=o.useDir(i,d.dir),v=z==="rtl",R=o.useId()+"-list-id";t.useEffect(()=>{w.position(i,r,k,v)},[i,r,k,v]),t.useEffect(()=>{O&&i&&i.current&&i.current.focus()},[O,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&&S?o.dispatchEvent(S,e,p(),void 0):(u(!c),m(!0),l(c?-1:0),b(e,!c)))},[u,m,l,S,b,c,n,f]),ue=t.useCallback(e=>{m(!0),l(c?0:-1),T&&o.dispatchEvent(T,e,p(),void 0)},[T,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()},[]),B=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),B(e,a),b(e,!1))},[l,u,B,b]),me=t.useCallback(e=>{o.getActiveElement(document)===i.current&&e.preventDefault()},[i]),be=t.useCallback(e=>{const a=h,M=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&&B(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(M-1);break;case o.Keys.down:case o.Keys.right:e.preventDefault(),l(a+1>=M?0:a+1);break;case o.Keys.up:case o.Keys.left:e.preventDefault(),l(a-1<0?M-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":D==="absolute","k-pos-fixed":D==="fixed","k-focus":O,[`k-rounded-${o.kendoThemeMaps.roundedMap[N]||N}`]:N,[`k-fab-${P}`]:P},D&&`k-${r.vertical}-${r.horizontal}`,$),[P,y,N,f,D,r,O,$]),ke=n&&n.map((e,a)=>t.createElement(he.FloatingActionButtonItem,{...e,key:a,index:a,id:`${R}-${a}`,disabled:f||e.disabled,focused:h===a,dataItem:e,item:ee,className:o.classNames(e.className,w.getTextDirectionClass(z||"ltr",r.horizontal)),onClick:pe,onDown:me})),V=!!((I||E)&&!x),Y=(i.current?i.current.offsetWidth:0)/2-32/2;let A;return I||E?A=t.createElement(o.IconWrap,{className:"k-fab-icon",name:I,icon:E}):F?A=t.createElement("span",{role:"presentation",className:F}):A=null,t.createElement(o.ZIndexContext.Provider,{value:U},t.createElement(t.Fragment,null,t.createElement("button",{ref:i,id:j||ce,type:"button","aria-disabled":f,"aria-expanded":n?c:void 0,"aria-haspopup":n?!0:void 0,"aria-label":!x&&(I||E||F)?"Action":void 0,"aria-owns":n?R:void 0,"aria-activedescendant":h>=0&&n?`${R}-${h}`:void 0,tabIndex:o.getTabIndex(se,f),accessKey:ae,dir:z,disabled:f,className:ge,style:te,onClick:Q,onMouseDown:fe,onFocus:ue,onBlur:de,onKeyDown:be,...le},A,x&&t.createElement("span",{className:"k-fab-text"},x)),ne&&c&&t.createElement("div",{className:"k-overlay",style:{zIndex:U,...oe}}),t.createElement(ve.Popup,{ref:re,anchor:i.current,show:c,animate:K.animate,popupClass:o.classNames("k-popup-transparent k-fab-popup",K.popupClass),anchorAlign:K.anchorAlign||w.getAnchorAlign(r,v),popupAlign:K.popupAlign||w.getPopupAlign(r,v),style:{boxShadow:"none"}},t.createElement("ul",{ref:ie,role:"menu","aria-labelledby":j,id:R,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))))});q.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"};q.displayName="KendoFloatingActionButton";exports.FloatingActionButton=q;
|
|
@@ -7,43 +7,43 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import { useZIndexContext as
|
|
10
|
+
import { useZIndexContext as ve, useId as Y, useDir as ye, dispatchEvent as b, getActiveElement as Ie, Keys as c, classNames as w, kendoThemeMaps as xe, ZIndexContext as Ee, getTabIndex as De, IconWrap as Ne, svgIconPropType as Ae } from "@progress/kendo-react-common";
|
|
11
11
|
import { FloatingActionButtonItem as Re } from "./FloatingActionButtonItem.mjs";
|
|
12
|
-
import { position as
|
|
12
|
+
import { position as we, 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
|
+
(K, te) => {
|
|
16
16
|
const {
|
|
17
|
-
align:
|
|
18
|
-
alignOffset:
|
|
19
|
-
className:
|
|
20
|
-
disabled:
|
|
21
|
-
icon:
|
|
22
|
-
svgIcon:
|
|
23
|
-
iconClass:
|
|
17
|
+
align: d = C.align,
|
|
18
|
+
alignOffset: S,
|
|
19
|
+
className: $,
|
|
20
|
+
disabled: u,
|
|
21
|
+
icon: v,
|
|
22
|
+
svgIcon: y,
|
|
23
|
+
iconClass: F,
|
|
24
24
|
id: W,
|
|
25
|
-
items:
|
|
25
|
+
items: s,
|
|
26
26
|
item: oe,
|
|
27
|
-
text:
|
|
28
|
-
positionMode:
|
|
29
|
-
size:
|
|
27
|
+
text: I,
|
|
28
|
+
positionMode: x = C.positionMode,
|
|
29
|
+
size: g = C.size,
|
|
30
30
|
style: ae,
|
|
31
|
-
rounded:
|
|
32
|
-
themeColor:
|
|
33
|
-
overlayStyle:
|
|
34
|
-
tabIndex:
|
|
31
|
+
rounded: E = C.rounded,
|
|
32
|
+
themeColor: O = C.themeColor,
|
|
33
|
+
overlayStyle: se,
|
|
34
|
+
tabIndex: ne,
|
|
35
35
|
accessKey: le,
|
|
36
|
-
popupSettings:
|
|
36
|
+
popupSettings: D = {},
|
|
37
37
|
modal: ie,
|
|
38
|
-
onClick:
|
|
38
|
+
onClick: z,
|
|
39
39
|
onItemClick: Z,
|
|
40
|
-
onFocus:
|
|
40
|
+
onFocus: T,
|
|
41
41
|
onBlur: q,
|
|
42
42
|
onKeyDown: _,
|
|
43
43
|
onOpen: H,
|
|
44
44
|
onClose: j,
|
|
45
45
|
...re
|
|
46
|
-
} =
|
|
46
|
+
} = K, L = ve(), X = L ? L + Be : Me, U = t.useRef(null), l = t.useRef(null), ce = t.useRef(null), de = t.useRef(null), G = t.useCallback(() => {
|
|
47
47
|
l.current && l.current.focus();
|
|
48
48
|
}, []), f = t.useCallback(
|
|
49
49
|
() => ({
|
|
@@ -56,62 +56,62 @@ 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), [N, p] = t.useState(!1), [k, n] = t.useState(-1), ue = Y() + "-button-id", B = ye(l, K.dir), h = B === "rtl", A = Y() + "-list-id";
|
|
60
60
|
t.useEffect(() => {
|
|
61
|
-
|
|
62
|
-
}, [l,
|
|
63
|
-
|
|
64
|
-
}, [
|
|
61
|
+
we(l, d, S, h);
|
|
62
|
+
}, [l, d, S, h]), t.useEffect(() => {
|
|
63
|
+
N && l && l.current && l.current.focus();
|
|
64
|
+
}, [N, 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 ||
|
|
73
|
-
|
|
72
|
+
!e.target || u || (!s && z ? b(
|
|
73
|
+
z,
|
|
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, z, m, i, s, u]
|
|
80
80
|
), fe = t.useCallback(
|
|
81
81
|
(e) => {
|
|
82
|
-
p(!0),
|
|
83
|
-
|
|
82
|
+
p(!0), n(i ? 0 : -1), T && b(
|
|
83
|
+
T,
|
|
84
84
|
e,
|
|
85
85
|
f(),
|
|
86
86
|
void 0
|
|
87
87
|
);
|
|
88
88
|
},
|
|
89
|
-
[
|
|
89
|
+
[T, 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
|
+
}, []), M = 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), M(e, a), m(e, !1));
|
|
113
113
|
},
|
|
114
|
-
[
|
|
114
|
+
[n, r, M, m]
|
|
115
115
|
), ge = t.useCallback(
|
|
116
116
|
(e) => {
|
|
117
117
|
Ie(document) === l.current && e.preventDefault();
|
|
@@ -119,32 +119,32 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
119
119
|
[l]
|
|
120
120
|
), ke = t.useCallback(
|
|
121
121
|
(e) => {
|
|
122
|
-
const a =
|
|
122
|
+
const a = k, P = 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 &&
|
|
130
|
+
a >= 0 && M(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(P - 1);
|
|
140
140
|
break;
|
|
141
141
|
case c.down:
|
|
142
142
|
case c.right:
|
|
143
|
-
e.preventDefault(),
|
|
143
|
+
e.preventDefault(), n(a + 1 >= P ? 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 ? P - 1 : a - 1);
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
b(
|
|
@@ -154,59 +154,59 @@ 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
|
+
() => w(
|
|
160
160
|
"k-fab",
|
|
161
161
|
{
|
|
162
|
-
"k-fab-
|
|
163
|
-
"k-fab-
|
|
164
|
-
"k-fab-
|
|
165
|
-
"k-
|
|
166
|
-
"k-
|
|
167
|
-
"k-pos-
|
|
168
|
-
"k-
|
|
169
|
-
|
|
170
|
-
[`k-
|
|
162
|
+
"k-fab-xs": g === "xsmall",
|
|
163
|
+
"k-fab-sm": g === "small",
|
|
164
|
+
"k-fab-md": g === "medium",
|
|
165
|
+
"k-fab-lg": g === "large",
|
|
166
|
+
"k-disabled": u,
|
|
167
|
+
"k-pos-absolute": x === "absolute",
|
|
168
|
+
"k-pos-fixed": x === "fixed",
|
|
169
|
+
"k-focus": N,
|
|
170
|
+
[`k-rounded-${xe.roundedMap[E] || E}`]: E,
|
|
171
|
+
[`k-fab-${O}`]: O
|
|
171
172
|
},
|
|
172
|
-
`k-${
|
|
173
|
-
|
|
173
|
+
x && `k-${d.vertical}-${d.horizontal}`,
|
|
174
|
+
$
|
|
174
175
|
),
|
|
175
|
-
[
|
|
176
|
-
), Ce =
|
|
176
|
+
[O, g, E, u, x, d, N, $]
|
|
177
|
+
), Ce = s && s.map((e, a) => /* @__PURE__ */ t.createElement(
|
|
177
178
|
Re,
|
|
178
179
|
{
|
|
179
180
|
...e,
|
|
180
181
|
key: a,
|
|
181
182
|
index: a,
|
|
182
|
-
id: `${
|
|
183
|
-
disabled:
|
|
184
|
-
focused:
|
|
183
|
+
id: `${A}-${a}`,
|
|
184
|
+
disabled: u || e.disabled,
|
|
185
|
+
focused: k === a,
|
|
185
186
|
dataItem: e,
|
|
186
187
|
item: oe,
|
|
187
|
-
className:
|
|
188
|
+
className: w(e.className, Fe(B || "ltr", d.horizontal)),
|
|
188
189
|
onClick: be,
|
|
189
190
|
onDown: ge
|
|
190
191
|
}
|
|
191
|
-
)), Q = !!((
|
|
192
|
-
let
|
|
193
|
-
return
|
|
192
|
+
)), Q = !!((v || y) && !I), V = (l.current ? l.current.offsetWidth : 0) / 2 - 32 / 2;
|
|
193
|
+
let R;
|
|
194
|
+
return v || y ? R = /* @__PURE__ */ t.createElement(Ne, { className: "k-fab-icon", name: v, icon: y }) : F ? R = /* @__PURE__ */ t.createElement("span", { role: "presentation", className: F }) : R = 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,
|
|
197
|
-
id: W ||
|
|
198
|
-
role: "button",
|
|
198
|
+
id: W || ue,
|
|
199
199
|
type: "button",
|
|
200
|
-
"aria-disabled":
|
|
201
|
-
"aria-expanded":
|
|
202
|
-
"aria-haspopup":
|
|
203
|
-
"aria-label":
|
|
204
|
-
"aria-owns":
|
|
205
|
-
"aria-activedescendant":
|
|
206
|
-
tabIndex: De(
|
|
200
|
+
"aria-disabled": u,
|
|
201
|
+
"aria-expanded": s ? i : void 0,
|
|
202
|
+
"aria-haspopup": s ? !0 : void 0,
|
|
203
|
+
"aria-label": !I && (v || y || F) ? "Action" : void 0,
|
|
204
|
+
"aria-owns": s ? A : void 0,
|
|
205
|
+
"aria-activedescendant": k >= 0 && s ? `${A}-${k}` : void 0,
|
|
206
|
+
tabIndex: De(ne, u),
|
|
207
207
|
accessKey: le,
|
|
208
|
-
dir:
|
|
209
|
-
disabled:
|
|
208
|
+
dir: B,
|
|
209
|
+
disabled: u,
|
|
210
210
|
className: he,
|
|
211
211
|
style: ae,
|
|
212
212
|
onClick: J,
|
|
@@ -216,27 +216,27 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
216
216
|
onKeyDown: ke,
|
|
217
217
|
...re
|
|
218
218
|
},
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
R,
|
|
220
|
+
I && /* @__PURE__ */ t.createElement("span", { className: "k-fab-text" }, I)
|
|
221
221
|
), ie && i && /* @__PURE__ */ t.createElement(
|
|
222
222
|
"div",
|
|
223
223
|
{
|
|
224
224
|
className: "k-overlay",
|
|
225
225
|
style: {
|
|
226
226
|
zIndex: X,
|
|
227
|
-
...
|
|
227
|
+
...se
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
), /* @__PURE__ */ t.createElement(
|
|
231
231
|
Te,
|
|
232
232
|
{
|
|
233
|
-
ref:
|
|
233
|
+
ref: de,
|
|
234
234
|
anchor: l.current,
|
|
235
235
|
show: i,
|
|
236
|
-
animate:
|
|
237
|
-
popupClass:
|
|
238
|
-
anchorAlign:
|
|
239
|
-
popupAlign:
|
|
236
|
+
animate: D.animate,
|
|
237
|
+
popupClass: w("k-popup-transparent k-fab-popup", D.popupClass),
|
|
238
|
+
anchorAlign: D.anchorAlign || ze(d, h),
|
|
239
|
+
popupAlign: D.popupAlign || Oe(d, h),
|
|
240
240
|
style: { boxShadow: "none" }
|
|
241
241
|
},
|
|
242
242
|
/* @__PURE__ */ t.createElement(
|
|
@@ -245,10 +245,10 @@ const Be = 2, Me = 100, ee = t.forwardRef(
|
|
|
245
245
|
ref: ce,
|
|
246
246
|
role: "menu",
|
|
247
247
|
"aria-labelledby": W,
|
|
248
|
-
id:
|
|
249
|
-
className:
|
|
250
|
-
"k-fab-items-bottom":
|
|
251
|
-
"k-fab-items-top":
|
|
248
|
+
id: A,
|
|
249
|
+
className: w("k-fab-items", {
|
|
250
|
+
"k-fab-items-bottom": d.vertical !== "bottom",
|
|
251
|
+
"k-fab-items-top": d.vertical === "bottom"
|
|
252
252
|
}),
|
|
253
253
|
style: {
|
|
254
254
|
paddingLeft: Q ? V : void 0,
|
|
@@ -269,7 +269,7 @@ ee.propTypes = {
|
|
|
269
269
|
accessKey: o.string,
|
|
270
270
|
disabled: o.bool,
|
|
271
271
|
icon: o.string,
|
|
272
|
-
svgIcon:
|
|
272
|
+
svgIcon: Ae,
|
|
273
273
|
iconClass: o.string,
|
|
274
274
|
text: o.string,
|
|
275
275
|
alignOffset: o.shape({
|
|
@@ -281,24 +281,13 @@ ee.propTypes = {
|
|
|
281
281
|
horizontal: o.oneOf(["start", "center", "end"]).isRequired
|
|
282
282
|
}),
|
|
283
283
|
positionMode: o.oneOf(["absolute", "fixed"]),
|
|
284
|
-
size: o.oneOf(["small", "medium", "large"]),
|
|
284
|
+
size: o.oneOf(["xsmall", "small", "medium", "large"]),
|
|
285
285
|
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
|
-
]),
|
|
286
|
+
themeColor: o.oneOf(["base", "primary", "secondary", "tertiary"]),
|
|
298
287
|
modal: o.bool,
|
|
299
288
|
overlayStyle: o.object
|
|
300
289
|
};
|
|
301
|
-
const
|
|
290
|
+
const C = {
|
|
302
291
|
align: { vertical: "bottom", horizontal: "end" },
|
|
303
292
|
size: void 0,
|
|
304
293
|
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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),o=require("prop-types"),N=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"),D=require("./utils/popup.js"),y=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(M),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(y.packageMetadata,{component:"DropDownButton"}),this.licenseMessage=e.getLicenseMessage(y.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:w,rounded:I,fillMode:b,themeColor:B,ariaLabel:O,title:v,accessKey:E,icon:m,svgIcon:f,iconClass:g,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(N.Button,{id:n,size:w,style:a,rounded:I,fillMode:b,themeColor:B,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":r?"true":void 0,tabIndex:p,accessKey:E,icon:m,svgIcon:f,iconClass:g,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":O||(f||m||g?"Menu":void 0),"aria-controls":this.opened?this.guid:void 0,title:v,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||D.getAnchorAlign(i),popupAlign:t.popupAlign||D.getPopupAlign(i),style:i?{direction:"rtl"}:void 0,onClose:this.onPopupClose},u.createElement("ul",{role:"menu",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 C=e.createPropsContext(),k=e.withIdHOC(e.withPropsContext(C,e.withUnstyledHOC(e.withZIndexContext(d))));k.displayName="KendoReactDropDownButton";exports.DropDownButton=k;exports.DropDownButtonPropsContext=C;exports.DropDownButtonWithoutContext=d;
|