@progress/kendo-react-buttons 8.6.0-develop.1 → 9.0.0-develop.10
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.js +1 -1
- package/Button.mjs +91 -108
- package/ButtonGroup.js +1 -1
- package/ButtonGroup.mjs +47 -67
- package/Chip/Chip.mjs +22 -56
- package/Chip/ChipList.mjs +2 -20
- package/Chip/chip-list-contexts.mjs +13 -4
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +243 -272
- package/FloatingActionButton/FloatingActionButtonItem.mjs +3 -6
- package/ListButton/ButtonItem.js +1 -1
- package/ListButton/ButtonItem.mjs +30 -27
- package/ListButton/utils/popup.js +1 -1
- package/ListButton/utils/popup.mjs +8 -8
- package/README.md +60 -58
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/index.d.mts +56 -168
- package/index.d.ts +56 -168
- package/index.mjs +6 -2
- package/package-metadata.mjs +1 -1
- package/package.json +3 -3
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +100 -110
- package/toolbar/tools/ToolbarItem.js +1 -1
- package/toolbar/tools/ToolbarItem.mjs +15 -32
- package/toolbar/tools/ToolbarSeparator.js +1 -1
- package/toolbar/tools/ToolbarSeparator.mjs +1 -8
- package/toolbar/tools/ToolbarSpacer.mjs +8 -18
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react"),s=require("prop-types"),e=require("@progress/kendo-react-common"),H=require("./package-metadata.js");function K(n){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(c,o,l.get?l:{enumerable:!0,get:()=>n[o]})}}return c.default=n,Object.freeze(c)}const t=K(D);function W({imageUrl:n,name:c,iconClass:o,svgIcon:l,imageAlt:u,buttonClasses:a}){return n?t.createElement("img",{role:"presentation",className:e.classNames(e.uButton.icon({c:a})),alt:u,src:n}):c||l?t.createElement(e.IconWrap,{className:e.classNames(e.uButton.icon({c:a})),name:c,icon:l}):o?t.createElement("span",{role:"presentation",className:e.classNames(e.uButton.icon({c:a}),o)}):null}const p=t.forwardRef((n,c)=>{e.validatePackage(H.packageMetadata);const{children:o,togglable:l,dir:u,disabled:a,selected:i,icon:b,iconClass:v,svgIcon:y,imageUrl:N,imageAlt:M,className:I,startIcon:h,endIcon:B,onClick:C,size:P=f.size,rounded:S=f.rounded,fillMode:T=f.fillMode,themeColor:j=f.themeColor,...z}=n,q=()=>{l&&i===void 0&&(d.current=!r,E(!r))},w=g=>{q(),C&&C.call(void 0,g)},d=t.useRef(),k=t.useRef(null),[r,E]=t.useState(l===!0&&i===!0),A=y!==void 0||b!==void 0||v!==void 0||N!==void 0,U=o!==void 0,_=e.useUnstyled(),O=n.unstyled||_,m=O&&O.uButton;t.useImperativeHandle(c,()=>({element:k.current,selected:d.current!==void 0?d.current:r})),t.useMemo(()=>{l&&i!==void 0&&i!==r&&E(i)},[l,i]),t.useEffect(()=>{d.current=void 0},[r]);const x=W({name:b,svgIcon:y,iconClass:v,imageUrl:N,imageAlt:M,buttonClasses:m}),R=g=>t.cloneElement(g,{className:e.classNames(e.uButton.icon({c:m}))});return t.createElement("button",{ref:k,"aria-pressed":l?r:void 0,...z,dir:u,disabled:a,onClick:w,className:e.classNames(e.uButton.wrapper({c:m,isRtl:u==="rtl",selected:r,disabled:a,size:P,fillMode:T,rounded:S,themeColor:j,iconButton:!U&&A}),I)},h&&R(h),x,o&&t.createElement("span",{className:e.classNames(e.uButton.text({c:m}))},o),B&&R(B))}),f={togglable:!1,size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};p.displayName="KendoReactButton";p.propTypes={children:s.node,selected:s.bool,togglable:s.bool,icon:s.string,svgIcon:e.svgIconPropType,iconClass:s.string,imageUrl:s.string,imageAlt:s.string,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"flat","link","outline","solid","clear"]),themeColor:s.oneOf([null,"base","primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"])};exports.Button=p;
|
package/Button.mjs
CHANGED
|
@@ -6,116 +6,107 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as e from "react";
|
|
10
10
|
import t from "prop-types";
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
function
|
|
14
|
-
return
|
|
11
|
+
import { validatePackage as q, useUnstyled as D, classNames as c, uButton as i, svgIconPropType as F, IconWrap as G } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as J } from "./package-metadata.mjs";
|
|
13
|
+
function L({ imageUrl: a, name: d, iconClass: o, svgIcon: n, imageAlt: u, buttonClasses: s }) {
|
|
14
|
+
return a ? /* @__PURE__ */ e.createElement(
|
|
15
15
|
"img",
|
|
16
16
|
{
|
|
17
17
|
role: "presentation",
|
|
18
|
-
className:
|
|
19
|
-
alt:
|
|
20
|
-
src:
|
|
18
|
+
className: c(i.icon({ c: s })),
|
|
19
|
+
alt: u,
|
|
20
|
+
src: a
|
|
21
21
|
}
|
|
22
|
-
) :
|
|
22
|
+
) : d || n ? /* @__PURE__ */ e.createElement(G, { className: c(i.icon({ c: s })), name: d, icon: n }) : o ? /* @__PURE__ */ e.createElement("span", { role: "presentation", className: c(i.icon({ c: s }), o) }) : null;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
e && /* @__PURE__ */ i.createElement("span", { className: n(r.text({ c: d })) }, e),
|
|
103
|
-
f && v(f)
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
toggleIfApplicable() {
|
|
107
|
-
if (this.props.togglable && this.props.selected === void 0) {
|
|
108
|
-
const e = !this.state.selected;
|
|
109
|
-
this._selectedTemp = e, this.setState({ selected: e }, () => this._selectedTemp = void 0);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
24
|
+
const B = e.forwardRef((a, d) => {
|
|
25
|
+
q(J);
|
|
26
|
+
const {
|
|
27
|
+
children: o,
|
|
28
|
+
togglable: n,
|
|
29
|
+
dir: u,
|
|
30
|
+
disabled: s,
|
|
31
|
+
selected: r,
|
|
32
|
+
icon: v,
|
|
33
|
+
iconClass: h,
|
|
34
|
+
svgIcon: y,
|
|
35
|
+
imageUrl: b,
|
|
36
|
+
imageAlt: z,
|
|
37
|
+
className: A,
|
|
38
|
+
startIcon: C,
|
|
39
|
+
endIcon: E,
|
|
40
|
+
onClick: N,
|
|
41
|
+
size: O = p.size,
|
|
42
|
+
rounded: P = p.rounded,
|
|
43
|
+
fillMode: T = p.fillMode,
|
|
44
|
+
themeColor: w = p.themeColor,
|
|
45
|
+
...x
|
|
46
|
+
} = a, S = () => {
|
|
47
|
+
n && r === void 0 && (m.current = !l, R(!l));
|
|
48
|
+
}, U = (g) => {
|
|
49
|
+
S(), N && N.call(void 0, g);
|
|
50
|
+
}, m = e.useRef(), I = e.useRef(null), [l, R] = e.useState(n === !0 && r === !0), H = y !== void 0 || v !== void 0 || h !== void 0 || b !== void 0, K = o !== void 0, W = D(), k = a.unstyled || W, f = k && k.uButton;
|
|
51
|
+
e.useImperativeHandle(d, () => ({
|
|
52
|
+
element: I.current,
|
|
53
|
+
selected: m.current !== void 0 ? m.current : l
|
|
54
|
+
})), e.useMemo(() => {
|
|
55
|
+
n && r !== void 0 && r !== l && R(r);
|
|
56
|
+
}, [n, r]), e.useEffect(() => {
|
|
57
|
+
m.current = void 0;
|
|
58
|
+
}, [l]);
|
|
59
|
+
const j = L({
|
|
60
|
+
name: v,
|
|
61
|
+
svgIcon: y,
|
|
62
|
+
iconClass: h,
|
|
63
|
+
imageUrl: b,
|
|
64
|
+
imageAlt: z,
|
|
65
|
+
buttonClasses: f
|
|
66
|
+
}), M = (g) => e.cloneElement(g, { className: c(i.icon({ c: f })) });
|
|
67
|
+
return /* @__PURE__ */ e.createElement(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
ref: I,
|
|
71
|
+
"aria-pressed": n ? l : void 0,
|
|
72
|
+
...x,
|
|
73
|
+
dir: u,
|
|
74
|
+
disabled: s,
|
|
75
|
+
onClick: U,
|
|
76
|
+
className: c(
|
|
77
|
+
i.wrapper({
|
|
78
|
+
c: f,
|
|
79
|
+
isRtl: u === "rtl",
|
|
80
|
+
selected: l,
|
|
81
|
+
disabled: s,
|
|
82
|
+
size: O,
|
|
83
|
+
fillMode: T,
|
|
84
|
+
rounded: P,
|
|
85
|
+
themeColor: w,
|
|
86
|
+
iconButton: !K && H
|
|
87
|
+
}),
|
|
88
|
+
A
|
|
89
|
+
)
|
|
90
|
+
},
|
|
91
|
+
C && M(C),
|
|
92
|
+
j,
|
|
93
|
+
o && /* @__PURE__ */ e.createElement("span", { className: c(i.text({ c: f })) }, o),
|
|
94
|
+
E && M(E)
|
|
95
|
+
);
|
|
96
|
+
}), p = {
|
|
97
|
+
togglable: !1,
|
|
98
|
+
size: "medium",
|
|
99
|
+
rounded: "medium",
|
|
100
|
+
fillMode: "solid",
|
|
101
|
+
themeColor: "base"
|
|
112
102
|
};
|
|
113
|
-
|
|
103
|
+
B.displayName = "KendoReactButton";
|
|
104
|
+
B.propTypes = {
|
|
114
105
|
children: t.node,
|
|
115
106
|
selected: t.bool,
|
|
116
107
|
togglable: t.bool,
|
|
117
108
|
icon: t.string,
|
|
118
|
-
svgIcon:
|
|
109
|
+
svgIcon: F,
|
|
119
110
|
iconClass: t.string,
|
|
120
111
|
imageUrl: t.string,
|
|
121
112
|
imageAlt: t.string,
|
|
@@ -137,15 +128,7 @@ l.propTypes = {
|
|
|
137
128
|
"light",
|
|
138
129
|
"inverse"
|
|
139
130
|
])
|
|
140
|
-
}, l.defaultProps = {
|
|
141
|
-
togglable: !1,
|
|
142
|
-
size: "medium",
|
|
143
|
-
rounded: "medium",
|
|
144
|
-
fillMode: "solid",
|
|
145
|
-
themeColor: "base"
|
|
146
131
|
};
|
|
147
|
-
let p = l;
|
|
148
|
-
p.contextType = z;
|
|
149
132
|
export {
|
|
150
|
-
|
|
133
|
+
B as Button
|
|
151
134
|
};
|
package/ButtonGroup.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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),s=require("prop-types"),u=require("@progress/kendo-react-common"),w=require("./package-metadata.js");function S(t){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(l,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return l.default=t,Object.freeze(l)}const n=S(R),B=t=>{u.validatePackage(w.packageMetadata);const{children:l,className:r,dir:a,disabled:m,width:p}=t,P=u.useUnstyled(),g=t.unstyled||P,y=g&&g.uButtonGroup,j=e=>{const i=n.Children.count(e),d=a!==void 0?a==="rtl":b.current&&getComputedStyle(b.current).direction==="rtl"||!1;return n.Children.map(e,(o,c)=>{if(n.isValidElement(o)){const N=c===i-1,O=d,G=u.classNames(o.props.className,u.uButtonGroup.position({c:y,start:O?N:c===0,end:O?c===0:N}));return k(o,G)}return o})},k=(e,i)=>{const d={...p?{width:p}:{},...e.props.style||{}},o=m||e.props.disabled,c={...e.props,...i?{className:i}:{},...Object.keys(d).length?{style:d}:{},...o!==void 0?{disabled:o}:{}};return n.Children.count(e.props.children)>0?n.cloneElement(e,c,e.props.children):n.cloneElement(e,c)},b=n.useRef(null),v=j(l),f=u.classNames(u.uButtonGroup.wrapper({c:y,stretched:!!p,disabled:m}),r),C={className:f,style:{width:`${p}`},dir:a,role:"group","aria-disabled":m};return n.createElement("div",{ref:b,...C,className:f},v)};B.propTypes={children:s.oneOfType([s.arrayOf(s.element),s.element]),className:s.string,disabled:s.bool,width:s.string,dir:s.string};exports.ButtonGroup=B;
|
package/ButtonGroup.mjs
CHANGED
|
@@ -6,80 +6,60 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
disabled: s
|
|
26
|
-
}),
|
|
27
|
-
n
|
|
28
|
-
), d = {
|
|
29
|
-
className: i,
|
|
30
|
-
style: { width: `${a}` },
|
|
31
|
-
dir: p,
|
|
32
|
-
// Accessibility properties
|
|
33
|
-
role: "group",
|
|
34
|
-
"aria-disabled": s
|
|
35
|
-
};
|
|
36
|
-
return /* @__PURE__ */ r.createElement(
|
|
37
|
-
"div",
|
|
38
|
-
{
|
|
39
|
-
ref: (y) => {
|
|
40
|
-
this._element = y;
|
|
41
|
-
},
|
|
42
|
-
...d,
|
|
43
|
-
className: i
|
|
44
|
-
},
|
|
45
|
-
l
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
mapButtons(t) {
|
|
49
|
-
const n = r.Children.count(t), p = this.props.dir !== void 0 ? this.props.dir === "rtl" : this._element && getComputedStyle(this._element).direction === "rtl" || !1;
|
|
50
|
-
return r.Children.map(t, (s, e) => {
|
|
51
|
-
if (r.isValidElement(s)) {
|
|
52
|
-
const { unstyled: a } = this.props, c = a && a.uButtonGroup, l = e === n - 1, i = p, d = m(
|
|
53
|
-
s.props.className,
|
|
54
|
-
h.position({
|
|
55
|
-
c,
|
|
56
|
-
start: i ? l : e === 0,
|
|
57
|
-
end: i ? e === 0 : l
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import s from "prop-types";
|
|
11
|
+
import { validatePackage as k, useUnstyled as O, classNames as g, uButtonGroup as N } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as T } from "./package-metadata.mjs";
|
|
13
|
+
const h = (i) => {
|
|
14
|
+
k(T);
|
|
15
|
+
const { children: B, className: C, dir: c, disabled: p, width: r } = i, v = O(), d = i.unstyled || v, m = d && d.uButtonGroup, w = (t) => {
|
|
16
|
+
const a = e.Children.count(t), l = c !== void 0 ? c === "rtl" : u.current && getComputedStyle(u.current).direction === "rtl" || !1;
|
|
17
|
+
return e.Children.map(t, (o, n) => {
|
|
18
|
+
if (e.isValidElement(o)) {
|
|
19
|
+
const b = n === a - 1, f = l, R = g(
|
|
20
|
+
o.props.className,
|
|
21
|
+
N.position({
|
|
22
|
+
c: m,
|
|
23
|
+
start: f ? b : n === 0,
|
|
24
|
+
end: f ? n === 0 : b
|
|
58
25
|
})
|
|
59
26
|
);
|
|
60
|
-
return
|
|
27
|
+
return E(o, R);
|
|
61
28
|
}
|
|
62
|
-
return
|
|
29
|
+
return o;
|
|
63
30
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const p = { ...this.props.width ? { width: this.props.width } : {}, ...t.props.style || {} }, s = this.props.disabled || t.props.disabled, e = {
|
|
31
|
+
}, E = (t, a) => {
|
|
32
|
+
const l = { ...r ? { width: r } : {}, ...t.props.style || {} }, o = p || t.props.disabled, n = {
|
|
67
33
|
...t.props,
|
|
68
|
-
...
|
|
69
|
-
...Object.keys(
|
|
70
|
-
...
|
|
34
|
+
...a ? { className: a } : {},
|
|
35
|
+
...Object.keys(l).length ? { style: l } : {},
|
|
36
|
+
...o !== void 0 ? { disabled: o } : {}
|
|
71
37
|
};
|
|
72
|
-
return
|
|
73
|
-
}
|
|
38
|
+
return e.Children.count(t.props.children) > 0 ? e.cloneElement(t, n, t.props.children) : e.cloneElement(t, n);
|
|
39
|
+
}, u = e.useRef(null), G = w(B), y = g(
|
|
40
|
+
N.wrapper({
|
|
41
|
+
c: m,
|
|
42
|
+
stretched: !!r,
|
|
43
|
+
disabled: p
|
|
44
|
+
}),
|
|
45
|
+
C
|
|
46
|
+
), P = {
|
|
47
|
+
className: y,
|
|
48
|
+
style: { width: `${r}` },
|
|
49
|
+
dir: c,
|
|
50
|
+
// Accessibility properties
|
|
51
|
+
role: "group",
|
|
52
|
+
"aria-disabled": p
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ e.createElement("div", { ref: u, ...P, className: y }, G);
|
|
74
55
|
};
|
|
75
|
-
|
|
76
|
-
children:
|
|
77
|
-
className:
|
|
78
|
-
disabled:
|
|
79
|
-
width:
|
|
80
|
-
dir:
|
|
56
|
+
h.propTypes = {
|
|
57
|
+
children: s.oneOfType([s.arrayOf(s.element), s.element]),
|
|
58
|
+
className: s.string,
|
|
59
|
+
disabled: s.bool,
|
|
60
|
+
width: s.string,
|
|
61
|
+
dir: s.string
|
|
81
62
|
};
|
|
82
|
-
let b = u;
|
|
83
63
|
export {
|
|
84
|
-
|
|
64
|
+
h as ButtonGroup
|
|
85
65
|
};
|
package/Chip/Chip.mjs
CHANGED
|
@@ -32,19 +32,10 @@ const z = a.forwardRef((e, A) => {
|
|
|
32
32
|
element: d.current,
|
|
33
33
|
props: e
|
|
34
34
|
})), a.useImperativeHandle(A, () => c.current);
|
|
35
|
-
const [m, i] = a.useContext(H), [R, o] = a.useContext(U), [, S] = a.useContext(W), h = a.useMemo(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
() => R === e.value,
|
|
40
|
-
[e.value, R]
|
|
41
|
-
);
|
|
42
|
-
a.useEffect(
|
|
43
|
-
() => {
|
|
44
|
-
g && d.current && d.current.focus();
|
|
45
|
-
},
|
|
46
|
-
[g]
|
|
47
|
-
);
|
|
35
|
+
const [m, i] = a.useContext(H), [R, o] = a.useContext(U), [, S] = a.useContext(W), h = a.useMemo(() => e.selected || (Array.isArray(m) ? m.some((t) => t === e.value) : m === e.value), [e.selected, e.value, m]), g = a.useMemo(() => R === e.value, [e.value, R]);
|
|
36
|
+
a.useEffect(() => {
|
|
37
|
+
g && d.current && d.current.focus();
|
|
38
|
+
}, [g]);
|
|
48
39
|
const K = a.useCallback(
|
|
49
40
|
(t) => {
|
|
50
41
|
i({ type: x.toggle, payload: e.value, event: t });
|
|
@@ -52,13 +43,10 @@ const z = a.forwardRef((e, A) => {
|
|
|
52
43
|
[i, e.value]
|
|
53
44
|
), b = a.useCallback(
|
|
54
45
|
(t) => {
|
|
55
|
-
s && (S({ type: Q.remove, payload: e.value, event: t }), o({ type: v.reset, payload: e.value, event: t }), i({ type: x.remove, payload: e.value, event: t }), e.onRemove && e.onRemove.call(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
syntheticEvent: t
|
|
60
|
-
}
|
|
61
|
-
));
|
|
46
|
+
s && (S({ type: Q.remove, payload: e.value, event: t }), o({ type: v.reset, payload: e.value, event: t }), i({ type: x.remove, payload: e.value, event: t }), e.onRemove && e.onRemove.call(void 0, {
|
|
47
|
+
target: c.current,
|
|
48
|
+
syntheticEvent: t
|
|
49
|
+
}));
|
|
62
50
|
},
|
|
63
51
|
[e.onRemove, e.value, s, S, o, i]
|
|
64
52
|
), P = a.useCallback(
|
|
@@ -77,35 +65,26 @@ const z = a.forwardRef((e, A) => {
|
|
|
77
65
|
b(t);
|
|
78
66
|
break;
|
|
79
67
|
}
|
|
80
|
-
e.onKeyDown && e.onKeyDown.call(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
syntheticEvent: t
|
|
85
|
-
}
|
|
86
|
-
);
|
|
68
|
+
e.onKeyDown && e.onKeyDown.call(void 0, {
|
|
69
|
+
target: c.current,
|
|
70
|
+
syntheticEvent: t
|
|
71
|
+
});
|
|
87
72
|
},
|
|
88
73
|
[e.onKeyDown, e.value, o, i, b]
|
|
89
74
|
), $ = a.useCallback(
|
|
90
75
|
(t) => {
|
|
91
|
-
o({ payload: e.value, type: v.current, event: t }), e.onFocus && e.onFocus.call(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
syntheticEvent: t
|
|
96
|
-
}
|
|
97
|
-
);
|
|
76
|
+
o({ payload: e.value, type: v.current, event: t }), e.onFocus && e.onFocus.call(void 0, {
|
|
77
|
+
target: c.current,
|
|
78
|
+
syntheticEvent: t
|
|
79
|
+
});
|
|
98
80
|
},
|
|
99
81
|
[e.onFocus, e.value, o]
|
|
100
82
|
), L = a.useCallback(
|
|
101
83
|
(t) => {
|
|
102
|
-
e.onBlur && e.onBlur.call(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
syntheticEvent: t
|
|
107
|
-
}
|
|
108
|
-
);
|
|
84
|
+
e.onBlur && e.onBlur.call(void 0, {
|
|
85
|
+
target: c.current,
|
|
86
|
+
syntheticEvent: t
|
|
87
|
+
});
|
|
109
88
|
},
|
|
110
89
|
[e.onBlur]
|
|
111
90
|
), _ = G(e, c, { onClick: K });
|
|
@@ -165,22 +144,9 @@ const z = a.forwardRef((e, A) => {
|
|
|
165
144
|
className: `k-chip-avatar k-avatar k-rounded-${e.avatar.rounded} k-avatar-md k-avatar-solid k-avatar-solid-primary`,
|
|
166
145
|
style: e.avatar.style
|
|
167
146
|
},
|
|
168
|
-
/* @__PURE__ */ a.createElement("span", { className: "k-avatar-image" }, /* @__PURE__ */ a.createElement(
|
|
169
|
-
"img",
|
|
170
|
-
{
|
|
171
|
-
src: e.avatar.image,
|
|
172
|
-
alt: e.avatar.imageAlt
|
|
173
|
-
}
|
|
174
|
-
))
|
|
147
|
+
/* @__PURE__ */ a.createElement("span", { className: "k-avatar-image" }, /* @__PURE__ */ a.createElement("img", { src: e.avatar.image, alt: e.avatar.imageAlt }))
|
|
175
148
|
),
|
|
176
|
-
/* @__PURE__ */ a.createElement("span", { className: "k-chip-content" }, e.children !== void 0 ? e.children : e.text && /* @__PURE__ */ a.createElement(
|
|
177
|
-
"span",
|
|
178
|
-
{
|
|
179
|
-
"aria-label": e.ariaLabel || e.text,
|
|
180
|
-
className: "k-chip-label"
|
|
181
|
-
},
|
|
182
|
-
e.text
|
|
183
|
-
)),
|
|
149
|
+
/* @__PURE__ */ a.createElement("span", { className: "k-chip-content" }, e.children !== void 0 ? e.children : e.text && /* @__PURE__ */ a.createElement("span", { "aria-label": e.ariaLabel || e.text, className: "k-chip-label" }, e.text)),
|
|
184
150
|
s && /* @__PURE__ */ a.createElement("span", { className: "k-chip-actions" }, /* @__PURE__ */ a.createElement("span", { className: T("k-chip-action", "k-chip-remove-action"), onClick: b }, /* @__PURE__ */ a.createElement(
|
|
185
151
|
I,
|
|
186
152
|
{
|
package/Chip/ChipList.mjs
CHANGED
|
@@ -56,10 +56,7 @@ const re = (a, i, s) => {
|
|
|
56
56
|
dir: w = r.dir,
|
|
57
57
|
onChange: y,
|
|
58
58
|
onDataChange: C
|
|
59
|
-
} = a, F = X(l, w), A = t.useMemo(
|
|
60
|
-
() => g || D,
|
|
61
|
-
[g, D]
|
|
62
|
-
);
|
|
59
|
+
} = a, F = X(l, w), A = t.useMemo(() => g || D, [g, D]);
|
|
63
60
|
t.useImperativeHandle(s, () => ({
|
|
64
61
|
element: l.current,
|
|
65
62
|
props: a
|
|
@@ -99,22 +96,7 @@ const re = (a, i, s) => {
|
|
|
99
96
|
), I = t.useCallback(
|
|
100
97
|
(n, u) => (n.push(u[p]), n),
|
|
101
98
|
[p]
|
|
102
|
-
), v = t.useMemo(
|
|
103
|
-
() => a.data || L,
|
|
104
|
-
[a.data, L]
|
|
105
|
-
), K = t.useMemo(
|
|
106
|
-
() => h || k,
|
|
107
|
-
[h, k]
|
|
108
|
-
), $ = t.useMemo(
|
|
109
|
-
() => v.reduce(I, []),
|
|
110
|
-
[v, I]
|
|
111
|
-
), R = t.useCallback(
|
|
112
|
-
(n) => M(p)(n),
|
|
113
|
-
[p]
|
|
114
|
-
), q = t.useCallback(
|
|
115
|
-
(n) => M(S)(n),
|
|
116
|
-
[S]
|
|
117
|
-
), [J, Q] = oe({ items: $ }), U = Y(a, s);
|
|
99
|
+
), v = t.useMemo(() => a.data || L, [a.data, L]), K = t.useMemo(() => h || k, [h, k]), $ = t.useMemo(() => v.reduce(I, []), [v, I]), R = t.useCallback((n) => M(p)(n), [p]), q = t.useCallback((n) => M(S)(n), [S]), [J, Q] = oe({ items: $ }), U = Y(a, s);
|
|
118
100
|
return /* @__PURE__ */ t.createElement(ne.Provider, { value: [K, j] }, /* @__PURE__ */ t.createElement(se.Provider, { value: [J, Q] }, /* @__PURE__ */ t.createElement(ie.Provider, { value: [v, H] }, /* @__PURE__ */ t.createElement(
|
|
119
101
|
"div",
|
|
120
102
|
{
|
|
@@ -7,10 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import t from "react";
|
|
10
|
-
const o = t.createContext([
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
10
|
+
const o = t.createContext([
|
|
11
|
+
null,
|
|
12
|
+
(e) => {
|
|
13
|
+
}
|
|
14
|
+
]), s = t.createContext([
|
|
15
|
+
null,
|
|
16
|
+
(e) => {
|
|
17
|
+
}
|
|
18
|
+
]), a = t.createContext([
|
|
19
|
+
null,
|
|
20
|
+
(e) => {
|
|
21
|
+
}
|
|
22
|
+
]);
|
|
14
23
|
export {
|
|
15
24
|
a as ChipListDataContext,
|
|
16
25
|
s as ChipListFocusContext,
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),n=require("prop-types"),a=require("@progress/kendo-react-common"),ye=require("./FloatingActionButtonItem.js"),he=require("../package-metadata.js"),K=require("./utils.js"),Ce=require("@progress/kendo-react-popup");function ve(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=ve(ke),Ie=2,Ee=100,
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),n=require("prop-types"),a=require("@progress/kendo-react-common"),ye=require("./FloatingActionButtonItem.js"),he=require("../package-metadata.js"),K=require("./utils.js"),Ce=require("@progress/kendo-react-popup");function ve(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=ve(ke),Ie=2,Ee=100,q=t.forwardRef((d,g)=>{a.validatePackage(he.packageMetadata);const{align:r=C.align,alignOffset:k,className:z,disabled:f,icon:O,svgIcon:R,iconClass:B,id:$,items:s,item:Y,text:v,positionMode:w=C.positionMode,size:I=C.size,style:ee,rounded:E=C.rounded,themeColor:A=C.themeColor,overlayStyle:te,tabIndex:ae,accessKey:ne,popupSettings:D={},modal:oe,onClick:F,onItemClick:j,onFocus:P,onBlur:_,onKeyDown:W,onOpen:Z,onClose:H,...se}=d,L=a.useZIndexContext(),X=L?L+Ie:Ee,U=t.useRef(null),i=t.useRef(null),le=t.useRef(null),ie=t.useRef(null),G=t.useCallback(()=>{i.current&&i.current.focus()},[]),p=t.useCallback(()=>({element:i.current,focus:G}),[G]);t.useImperativeHandle(U,p),t.useImperativeHandle(g,()=>U.current);const[c,u]=t.useState(!1),[x,m]=t.useState(!1),[y,l]=t.useState(-1),re=a.useId()+"-button-id",M=a.useDir(i,d.dir),h=M==="rtl",N=a.useId()+"-list-id";t.useEffect(()=>{K.position(i,r,k,h)},[i,r,k,h]),t.useEffect(()=>{x&&i&&i.current&&i.current.focus()},[x,i]);const b=t.useCallback((e,o)=>{s&&a.dispatchEvent(o?Z:H,e,p(),void 0)},[Z,H,s]),J=t.useCallback(e=>{!e.target||f||(!s&&F?a.dispatchEvent(F,e,p(),void 0):(u(!c),m(!0),l(c?-1:0),b(e,!c)))},[u,m,l,F,b,c,s,f]),ce=t.useCallback(e=>{m(!0),l(c?0:-1),P&&a.dispatchEvent(P,e,p(),void 0)},[P,m,l]),ue=t.useCallback(e=>{m(!1),u(!1),l(-1),a.dispatchEvent(_,e,p(),void 0),c&&b(e,!1)},[_,m,u,l,b]),de=t.useCallback(e=>{e.preventDefault()},[]),S=t.useCallback((e,o)=>{s&&(s[o].disabled||a.dispatchEvent(j,e,p(),{itemProps:s[o],itemIndex:o}))},[j]),fe=t.useCallback((e,o)=>{!e.target||!s||(l(o),u(!1),S(e,o),b(e,!1))},[l,u,S,b]),pe=t.useCallback(e=>{a.getActiveElement(document)===i.current&&e.preventDefault()},[i]),me=t.useCallback(e=>{const o=y,T=s?s.length:-1;if(e.altKey){!c&&e.keyCode===a.Keys.down&&(e.preventDefault(),u(!0),l(0)),c&&e.keyCode===a.Keys.up&&(e.preventDefault(),u(!1),l(-1));return}switch(e.keyCode){case a.Keys.enter:case a.Keys.space:o>=0&&S(e,o),s||J(e),e.preventDefault(),u(!c),l(c?-1:0);break;case a.Keys.esc:e.preventDefault(),u(!1),l(-1);break;case a.Keys.home:e.preventDefault(),l(0);break;case a.Keys.end:e.preventDefault(),l(T-1);break;case a.Keys.down:case a.Keys.right:e.preventDefault(),l(o+1>=T?0:o+1);break;case a.Keys.up:case a.Keys.left:e.preventDefault(),l(o-1<0?T-1:o-1);break}a.dispatchEvent(W,e,p(),void 0)},[W,y,l,h,u]),be=t.useMemo(()=>a.classNames("k-fab k-fab-solid",{"k-fab-sm":I==="small","k-fab-md":I==="medium","k-fab-lg":I==="large","k-disabled":f,"k-pos-absolute":w==="absolute","k-pos-fixed":w==="fixed","k-focus":x,[`k-rounded-${a.kendoThemeMaps.roundedMap[E]||E}`]:E,[`k-fab-solid-${A}`]:A},`k-${r.vertical}-${r.horizontal}`,z),[A,I,E,f,w,r,x,z]),ge=s&&s.map((e,o)=>t.createElement(ye.FloatingActionButtonItem,{...e,key:o,index:o,id:`${N}-${o}`,disabled:f||e.disabled,focused:y===o,dataItem:e,item:Y,className:a.classNames(e.className,K.getTextDirectionClass(M||"ltr",r.horizontal)),onClick:fe,onDown:pe})),Q=!!((O||R)&&!v),V=(i.current?i.current.offsetWidth:0)/2-32/2;return t.createElement(a.ZIndexContext.Provider,{value:X},t.createElement(t.Fragment,null,t.createElement("button",{ref:i,id:$||re,role:"button",type:"button","aria-disabled":f,"aria-expanded":s?c:void 0,"aria-haspopup":!!s,"aria-label":`${v||""} floatingactionbutton`,"aria-owns":s?N:void 0,"aria-activedescendant":y>=0&&s?`${N}-${y}`:void 0,tabIndex:a.getTabIndex(ae,f),accessKey:ne,dir:M,disabled:f,className:be,style:ee,onClick:J,onMouseDown:de,onFocus:ce,onBlur:ue,onKeyDown:me,...se},O||R?t.createElement(a.IconWrap,{className:"k-fab-icon",name:O,icon:R}):B?t.createElement("span",{role:"presentation",className:B}):null,v&&t.createElement("span",{className:"k-fab-text"},v)),oe&&c&&t.createElement("div",{className:"k-overlay",style:{zIndex:X,...te}}),t.createElement(Ce.Popup,{ref:ie,anchor:i.current,show:c,animate:D.animate,popupClass:a.classNames("k-popup-transparent k-fab-popup",D.popupClass),anchorAlign:D.anchorAlign||K.getAnchorAlign(r,h),popupAlign:D.popupAlign||K.getPopupAlign(r,h),style:{boxShadow:"none"}},t.createElement("ul",{ref:le,role:"menu","aria-labelledby":$,id:N,className:a.classNames("k-fab-items",{"k-fab-items-bottom":r.vertical!=="bottom","k-fab-items-top":r.vertical==="bottom"}),style:{paddingLeft:Q?V:void 0,paddingRight:Q?V:void 0}},ge))))});q.propTypes={className:n.string,style:n.object,id:n.string,dir:n.string,tabIndex:n.number,accessKey:n.string,disabled:n.bool,icon:n.string,svgIcon:a.svgIconPropType,iconClass:n.string,text:n.string,alignOffset:n.shape({x:n.oneOfType([n.number,n.string]).isRequired,y:n.oneOfType([n.number,n.string]).isRequired}),align:n.shape({vertical:n.oneOf(["top","middle","bottom"]).isRequired,horizontal:n.oneOf(["start","center","end"]).isRequired}),positionMode:n.oneOf(["absolute","fixed"]),size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),themeColor:n.oneOf([null,"primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"]),modal:n.bool,overlayStyle:n.object};const C={align:{vertical:"bottom",horizontal:"end"},size:"medium",rounded:"full",themeColor:"primary",positionMode:"fixed"};q.displayName="KendoFloatingActionButton";exports.FloatingActionButton=q;
|