@progress/kendo-react-buttons 6.1.1 → 7.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/{dist/es/Button.d.ts → Button.d.ts} +5 -1
- package/{dist/npm/ButtonGroup.d.ts → ButtonGroup.d.ts} +5 -1
- package/{dist/es/ButtonGroupInterface.d.ts → ButtonGroupInterface.d.ts} +4 -1
- package/{dist/npm/ButtonInterface.d.ts → ButtonInterface.d.ts} +4 -0
- package/{dist/npm/Chip → Chip}/Chip.d.ts +4 -0
- package/{dist/npm/Chip → Chip}/ChipList.d.ts +8 -12
- package/Chip/chip-list-contexts.d.ts +17 -0
- package/{dist/npm/Chip → Chip}/data-reducer.d.ts +5 -1
- package/{dist/es/Chip → Chip}/focus-reducer.d.ts +5 -2
- package/{dist/npm/Chip → Chip}/selection-reducer.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/FloatingActionButton.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/FloatingActionButtonItem.d.ts +4 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +17 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonPopupSettings.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/interfaces/FloatingActionButtonProps.d.ts +5 -2
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/align-offset.d.ts +4 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/align.d.ts +4 -0
- package/{dist/es/FloatingActionButton → FloatingActionButton}/models/events.d.ts +5 -1
- package/FloatingActionButton/models/position-mode.d.ts +13 -0
- package/FloatingActionButton/models/rounded.d.ts +16 -0
- package/FloatingActionButton/models/size.d.ts +15 -0
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/models/theme-color.d.ts +5 -1
- package/{dist/npm/FloatingActionButton → FloatingActionButton}/utils.d.ts +4 -0
- package/LICENSE.md +1 -1
- package/{dist/es/ListButton → ListButton}/ButtonItem.d.ts +4 -0
- package/{dist/es/ListButton → ListButton}/DropDownButton.d.ts +5 -1
- package/{dist/npm/ListButton → ListButton}/DropDownButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/SplitButton.d.ts +5 -1
- package/{dist/es/ListButton → ListButton}/SplitButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ButtonItem.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/ListButtonProps.d.ts +4 -1
- package/{dist/npm/ListButton → ListButton}/models/PopupSettings.d.ts +4 -0
- package/{dist/npm/ListButton → ListButton}/models/events.d.ts +4 -0
- package/ListButton/utils/navigation.d.ts +9 -0
- package/ListButton/utils/popup.d.ts +13 -0
- package/dist/cdn/js/kendo-react-buttons.js +5 -1
- package/index.d.ts +36 -0
- package/index.js +5 -0
- package/index.mjs +1886 -0
- package/{dist/npm/models → models}/index.d.ts +4 -1
- package/package-metadata.d.ts +9 -0
- package/package.json +28 -42
- package/{dist/es/toolbar → toolbar}/Toolbar.d.ts +5 -1
- package/{dist/es/toolbar → toolbar}/tools/ToolbarItem.d.ts +5 -1
- package/toolbar/tools/ToolbarSeparator.d.ts +20 -0
- package/{dist/es/toolbar → toolbar}/tools/ToolbarSpacer.d.ts +4 -0
- package/{dist/npm/util.d.ts → util.d.ts} +4 -0
- package/about.md +0 -3
- package/dist/es/Button.js +0 -171
- package/dist/es/ButtonGroup.d.ts +0 -32
- package/dist/es/ButtonGroup.js +0 -101
- package/dist/es/ButtonGroupInterface.js +0 -2
- package/dist/es/ButtonInterface.d.ts +0 -35
- package/dist/es/ButtonInterface.js +0 -3
- package/dist/es/Chip/Chip.d.ts +0 -234
- package/dist/es/Chip/Chip.js +0 -173
- package/dist/es/Chip/ChipList.d.ts +0 -123
- package/dist/es/Chip/ChipList.js +0 -177
- package/dist/es/Chip/data-reducer.d.ts +0 -22
- package/dist/es/Chip/data-reducer.js +0 -26
- package/dist/es/Chip/focus-reducer.js +0 -32
- package/dist/es/Chip/selection-reducer.d.ts +0 -30
- package/dist/es/Chip/selection-reducer.js +0 -75
- package/dist/es/FloatingActionButton/FloatingActionButton.d.ts +0 -17
- package/dist/es/FloatingActionButton/FloatingActionButton.js +0 -281
- package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +0 -82
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -1
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +0 -216
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -1
- package/dist/es/FloatingActionButton/models/align-offset.js +0 -1
- package/dist/es/FloatingActionButton/models/align.d.ts +0 -27
- package/dist/es/FloatingActionButton/models/align.js +0 -1
- package/dist/es/FloatingActionButton/models/events.js +0 -1
- package/dist/es/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/es/FloatingActionButton/models/position-mode.js +0 -1
- package/dist/es/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/es/FloatingActionButton/models/rounded.js +0 -1
- package/dist/es/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/es/FloatingActionButton/models/size.js +0 -1
- package/dist/es/FloatingActionButton/models/theme-color.d.ts +0 -18
- package/dist/es/FloatingActionButton/models/theme-color.js +0 -1
- package/dist/es/FloatingActionButton/utils.d.ts +0 -27
- package/dist/es/FloatingActionButton/utils.js +0 -93
- package/dist/es/ListButton/ButtonItem.js +0 -24
- package/dist/es/ListButton/DropDownButton.js +0 -325
- package/dist/es/ListButton/DropDownButtonItem.d.ts +0 -30
- package/dist/es/ListButton/DropDownButtonItem.js +0 -43
- package/dist/es/ListButton/SplitButton.d.ts +0 -120
- package/dist/es/ListButton/SplitButton.js +0 -334
- package/dist/es/ListButton/SplitButtonItem.js +0 -42
- package/dist/es/ListButton/models/ButtonItem.d.ts +0 -34
- package/dist/es/ListButton/models/ButtonItem.js +0 -3
- package/dist/es/ListButton/models/ListButtonProps.d.ts +0 -336
- package/dist/es/ListButton/models/ListButtonProps.js +0 -2
- package/dist/es/ListButton/models/PopupSettings.d.ts +0 -24
- package/dist/es/ListButton/models/PopupSettings.js +0 -1
- package/dist/es/ListButton/models/events.d.ts +0 -47
- package/dist/es/ListButton/models/events.js +0 -1
- package/dist/es/ListButton/utils/navigation.d.ts +0 -5
- package/dist/es/ListButton/utils/navigation.js +0 -29
- package/dist/es/ListButton/utils/popup.d.ts +0 -9
- package/dist/es/ListButton/utils/popup.js +0 -20
- package/dist/es/main.d.ts +0 -32
- package/dist/es/main.js +0 -17
- package/dist/es/models/index.d.ts +0 -89
- package/dist/es/models/index.js +0 -1
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/toolbar/Toolbar.js +0 -214
- package/dist/es/toolbar/tools/ToolbarItem.js +0 -56
- package/dist/es/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/es/toolbar/tools/ToolbarSeparator.js +0 -31
- package/dist/es/toolbar/tools/ToolbarSpacer.js +0 -20
- package/dist/es/util.d.ts +0 -27
- package/dist/es/util.js +0 -37
- package/dist/npm/Button.d.ts +0 -138
- package/dist/npm/Button.js +0 -174
- package/dist/npm/ButtonGroup.js +0 -104
- package/dist/npm/ButtonGroupInterface.d.ts +0 -33
- package/dist/npm/ButtonGroupInterface.js +0 -3
- package/dist/npm/ButtonInterface.js +0 -4
- package/dist/npm/Chip/Chip.js +0 -176
- package/dist/npm/Chip/ChipList.js +0 -180
- package/dist/npm/Chip/data-reducer.js +0 -30
- package/dist/npm/Chip/focus-reducer.d.ts +0 -25
- package/dist/npm/Chip/focus-reducer.js +0 -36
- package/dist/npm/Chip/selection-reducer.js +0 -79
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +0 -284
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.d.ts +0 -105
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +0 -85
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +0 -13
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +0 -24
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +0 -2
- package/dist/npm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +0 -2
- package/dist/npm/FloatingActionButton/models/align-offset.d.ts +0 -20
- package/dist/npm/FloatingActionButton/models/align-offset.js +0 -2
- package/dist/npm/FloatingActionButton/models/align.js +0 -2
- package/dist/npm/FloatingActionButton/models/events.d.ts +0 -21
- package/dist/npm/FloatingActionButton/models/events.js +0 -2
- package/dist/npm/FloatingActionButton/models/position-mode.d.ts +0 -9
- package/dist/npm/FloatingActionButton/models/position-mode.js +0 -2
- package/dist/npm/FloatingActionButton/models/rounded.d.ts +0 -12
- package/dist/npm/FloatingActionButton/models/rounded.js +0 -2
- package/dist/npm/FloatingActionButton/models/size.d.ts +0 -11
- package/dist/npm/FloatingActionButton/models/size.js +0 -2
- package/dist/npm/FloatingActionButton/models/theme-color.js +0 -2
- package/dist/npm/FloatingActionButton/utils.js +0 -101
- package/dist/npm/ListButton/ButtonItem.d.ts +0 -30
- package/dist/npm/ListButton/ButtonItem.js +0 -28
- package/dist/npm/ListButton/DropDownButton.d.ts +0 -118
- package/dist/npm/ListButton/DropDownButton.js +0 -328
- package/dist/npm/ListButton/DropDownButtonItem.js +0 -46
- package/dist/npm/ListButton/SplitButton.js +0 -337
- package/dist/npm/ListButton/SplitButtonItem.d.ts +0 -25
- package/dist/npm/ListButton/SplitButtonItem.js +0 -45
- package/dist/npm/ListButton/models/ButtonItem.js +0 -4
- package/dist/npm/ListButton/models/ListButtonProps.js +0 -3
- package/dist/npm/ListButton/models/PopupSettings.js +0 -2
- package/dist/npm/ListButton/models/events.js +0 -2
- package/dist/npm/ListButton/utils/navigation.d.ts +0 -5
- package/dist/npm/ListButton/utils/navigation.js +0 -32
- package/dist/npm/ListButton/utils/popup.d.ts +0 -9
- package/dist/npm/ListButton/utils/popup.js +0 -25
- package/dist/npm/main.d.ts +0 -32
- package/dist/npm/main.js +0 -48
- package/dist/npm/models/index.js +0 -2
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/toolbar/Toolbar.d.ts +0 -171
- package/dist/npm/toolbar/Toolbar.js +0 -217
- package/dist/npm/toolbar/tools/ToolbarItem.d.ts +0 -38
- package/dist/npm/toolbar/tools/ToolbarItem.js +0 -59
- package/dist/npm/toolbar/tools/ToolbarSeparator.d.ts +0 -16
- package/dist/npm/toolbar/tools/ToolbarSeparator.js +0 -34
- package/dist/npm/toolbar/tools/ToolbarSpacer.d.ts +0 -23
- package/dist/npm/toolbar/tools/ToolbarSpacer.js +0 -23
- package/dist/npm/util.js +0 -40
- package/dist/systemjs/kendo-react-buttons.js +0 -1
- package/e2e-next/button.basic.tests.ts +0 -24
- package/e2e-next/buttongroup.basic.tests.ts +0 -24
- package/e2e-next/chip.basic.tests.ts +0 -24
- package/e2e-next/chiplist.basic.tests.ts +0 -24
- package/e2e-next/dropdownbutton.basic.tests.ts +0 -24
- package/e2e-next/floatingactionbutton.basic.tests.ts +0 -24
- package/e2e-next/splitbutton.basic.tests.ts +0 -24
- package/e2e-next/toolbar.basic.tests.ts +0 -24
package/index.mjs
ADDED
|
@@ -0,0 +1,1886 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as n from "react";
|
|
6
|
+
import xe from "react";
|
|
7
|
+
import * as s from "prop-types";
|
|
8
|
+
import { svgIconPropType as M, validatePackage as R, classNames as f, kendoThemeMaps as B, IconWrap as A, Keys as r, guid as me, dispatchEvent as x, getActiveElement as se, useDir as De, useMouse as Oe, getTabIndex as fe, toIconName as Ce, getter as Be, useZIndexContext as lt, ZIndexContext as rt } from "@progress/kendo-react-common";
|
|
9
|
+
import { Popup as we } from "@progress/kendo-react-popup";
|
|
10
|
+
import { caretAltDownIcon as ct, xCircleIcon as dt } from "@progress/kendo-svg-icons";
|
|
11
|
+
const O = {
|
|
12
|
+
name: "@progress/kendo-react-buttons",
|
|
13
|
+
productName: "KendoReact",
|
|
14
|
+
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
15
|
+
publishDate: 1701439167,
|
|
16
|
+
version: "",
|
|
17
|
+
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
18
|
+
};
|
|
19
|
+
function ut({ imageUrl: e, name: o, iconClass: t, svgIcon: i, imageAlt: a }) {
|
|
20
|
+
return e ? /* @__PURE__ */ n.createElement("img", { role: "presentation", className: "k-button-icon", alt: a, src: e }) : o || i ? /* @__PURE__ */ n.createElement(A, { className: "k-button-icon", name: o, icon: i }) : t ? /* @__PURE__ */ n.createElement("span", { role: "presentation", className: f("k-button-icon", t) }) : null;
|
|
21
|
+
}
|
|
22
|
+
const ee = class extends n.Component {
|
|
23
|
+
constructor(e) {
|
|
24
|
+
super(e), this._element = null, this.handleClick = (o) => {
|
|
25
|
+
this.toggleIfApplicable(), this.props.onClick && this.props.onClick.call(void 0, o);
|
|
26
|
+
}, R(O), this.state = { selected: this.props.togglable === !0 && this.props.selected === !0 };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the DOM element of the Button component.
|
|
30
|
+
*/
|
|
31
|
+
get element() {
|
|
32
|
+
return this._element;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns `true` when the component is togglable and selected ([see example]({% slug toggleable_button %})).
|
|
36
|
+
* Otherwise, returns `false`.
|
|
37
|
+
*/
|
|
38
|
+
get selected() {
|
|
39
|
+
return this._selectedTemp !== void 0 ? this._selectedTemp : this.state.selected;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
static getDerivedStateFromProps(e, o) {
|
|
45
|
+
return e.togglable && e.selected !== void 0 && e.selected !== o.selected ? { selected: e.selected } : null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
render() {
|
|
51
|
+
const {
|
|
52
|
+
children: e,
|
|
53
|
+
togglable: o,
|
|
54
|
+
icon: t,
|
|
55
|
+
iconClass: i,
|
|
56
|
+
svgIcon: a,
|
|
57
|
+
imageUrl: l,
|
|
58
|
+
imageAlt: u,
|
|
59
|
+
className: c,
|
|
60
|
+
onClick: g,
|
|
61
|
+
size: v = ee.defaultProps.size,
|
|
62
|
+
rounded: h = ee.defaultProps.rounded,
|
|
63
|
+
fillMode: D = ee.defaultProps.fillMode,
|
|
64
|
+
themeColor: N = ee.defaultProps.themeColor,
|
|
65
|
+
...w
|
|
66
|
+
} = this.props, S = a !== void 0 || t !== void 0 || i !== void 0 || l !== void 0, F = e !== void 0, I = ut({
|
|
67
|
+
name: t,
|
|
68
|
+
svgIcon: a,
|
|
69
|
+
iconClass: i,
|
|
70
|
+
imageUrl: l,
|
|
71
|
+
imageAlt: u
|
|
72
|
+
});
|
|
73
|
+
return /* @__PURE__ */ n.createElement(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
ref: (E) => this._element = E,
|
|
77
|
+
"aria-pressed": o ? this.state.selected : void 0,
|
|
78
|
+
...w,
|
|
79
|
+
onClick: this.handleClick,
|
|
80
|
+
className: f(
|
|
81
|
+
"k-button",
|
|
82
|
+
{
|
|
83
|
+
[`k-button-${B.sizeMap[v] || v}`]: v,
|
|
84
|
+
[`k-button-${D}`]: D,
|
|
85
|
+
[`k-button-${D}-${N}`]: !!(D && N),
|
|
86
|
+
[`k-rounded-${B.roundedMap[h] || h}`]: h,
|
|
87
|
+
"k-icon-button": !F && S,
|
|
88
|
+
"k-disabled": this.props.disabled,
|
|
89
|
+
"k-selected": this.state.selected,
|
|
90
|
+
"k-rtl": this.props.dir === "rtl"
|
|
91
|
+
},
|
|
92
|
+
this.props.className
|
|
93
|
+
)
|
|
94
|
+
},
|
|
95
|
+
I,
|
|
96
|
+
e && /* @__PURE__ */ n.createElement("span", { className: "k-button-text" }, e)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
toggleIfApplicable() {
|
|
100
|
+
if (this.props.togglable && this.props.selected === void 0) {
|
|
101
|
+
const e = !this.state.selected;
|
|
102
|
+
this._selectedTemp = e, this.setState({ selected: e }, () => this._selectedTemp = void 0);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
let ne = ee;
|
|
107
|
+
ne.propTypes = {
|
|
108
|
+
children: s.node,
|
|
109
|
+
selected: s.bool,
|
|
110
|
+
togglable: s.bool,
|
|
111
|
+
icon: s.string,
|
|
112
|
+
svgIcon: M,
|
|
113
|
+
iconClass: s.string,
|
|
114
|
+
imageUrl: s.string,
|
|
115
|
+
imageAlt: s.string,
|
|
116
|
+
size: s.oneOf([null, "small", "medium", "large"]),
|
|
117
|
+
rounded: s.oneOf([null, "small", "medium", "large", "full"]),
|
|
118
|
+
fillMode: s.oneOf([null, "flat", "link", "outline", "solid"]),
|
|
119
|
+
// eslint-disable-next-line max-len
|
|
120
|
+
themeColor: s.oneOf([null, "base", "primary", "secondary", "tertiary", "info", "success", "warning", "error", "dark", "light", "inverse"])
|
|
121
|
+
};
|
|
122
|
+
ne.defaultProps = {
|
|
123
|
+
togglable: !1,
|
|
124
|
+
size: "medium",
|
|
125
|
+
rounded: "medium",
|
|
126
|
+
fillMode: "solid",
|
|
127
|
+
themeColor: "base"
|
|
128
|
+
};
|
|
129
|
+
const ht = {
|
|
130
|
+
button: "k-button",
|
|
131
|
+
flat: "k-flat",
|
|
132
|
+
outline: "k-outline",
|
|
133
|
+
clear: "k-button-clear",
|
|
134
|
+
primary: "k-primary",
|
|
135
|
+
"state-selected": "k-selected",
|
|
136
|
+
"button-icon": "k-button-icon",
|
|
137
|
+
"button-icontext": "k-button-icontext",
|
|
138
|
+
"state-disabled": "k-disabled",
|
|
139
|
+
"group-start": "k-group-start",
|
|
140
|
+
"group-end": "k-group-end",
|
|
141
|
+
"button-group": "k-button-group",
|
|
142
|
+
"button-group-stretched": "k-button-group-stretched",
|
|
143
|
+
ltr: "k-ltr",
|
|
144
|
+
rtl: "k-rtl"
|
|
145
|
+
}, Me = ":not(.k-dropdownlist button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)", pt = [
|
|
146
|
+
"button" + Me,
|
|
147
|
+
".k-button-group > button" + Me,
|
|
148
|
+
".k-colorpicker",
|
|
149
|
+
".k-dropdownlist"
|
|
150
|
+
], mt = {
|
|
151
|
+
styles: ht
|
|
152
|
+
}, ue = mt.styles;
|
|
153
|
+
class ft extends n.Component {
|
|
154
|
+
constructor(o) {
|
|
155
|
+
super(o), this._element = null, R(O);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @hidden
|
|
159
|
+
*/
|
|
160
|
+
render() {
|
|
161
|
+
const o = this.mapButtons(this.props.children), t = f(
|
|
162
|
+
[ue["button-group"]],
|
|
163
|
+
{
|
|
164
|
+
["k-disabled"]: this.props.disabled,
|
|
165
|
+
[ue["button-group-stretched"]]: !!this.props.width
|
|
166
|
+
},
|
|
167
|
+
this.props.className
|
|
168
|
+
), i = {
|
|
169
|
+
className: t,
|
|
170
|
+
style: { width: `${this.props.width}` },
|
|
171
|
+
dir: this.props.dir,
|
|
172
|
+
// Accessibility properties
|
|
173
|
+
role: "group",
|
|
174
|
+
"aria-disabled": this.props.disabled
|
|
175
|
+
};
|
|
176
|
+
return /* @__PURE__ */ n.createElement(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
ref: (a) => {
|
|
180
|
+
this._element = a;
|
|
181
|
+
},
|
|
182
|
+
...i,
|
|
183
|
+
className: t
|
|
184
|
+
},
|
|
185
|
+
o
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
mapButtons(o) {
|
|
189
|
+
const t = n.Children.count(o), i = this.props.dir !== void 0 ? this.props.dir === "rtl" : this._element && getComputedStyle(this._element).direction === "rtl" || !1;
|
|
190
|
+
return n.Children.map(o, (a, l) => n.isValidElement(a) ? this.renderButton(a, l, l === t - 1, i) : a);
|
|
191
|
+
}
|
|
192
|
+
renderButton(o, t, i, a) {
|
|
193
|
+
const l = f(o.props.className, {
|
|
194
|
+
[ue["group-start"]]: a ? i : t === 0,
|
|
195
|
+
[ue["group-end"]]: a ? t === 0 : i
|
|
196
|
+
}), u = { ...this.props.width ? { width: this.props.width } : {}, ...o.props.style || {} }, c = this.props.disabled || o.props.disabled, g = {
|
|
197
|
+
...o.props,
|
|
198
|
+
...l ? { className: l } : {},
|
|
199
|
+
...Object.keys(u).length ? { style: u } : {},
|
|
200
|
+
...c !== void 0 ? { disabled: c } : {}
|
|
201
|
+
};
|
|
202
|
+
return n.Children.count(o.props.children) > 0 ? n.cloneElement(o, g, o.props.children) : n.cloneElement(o, g);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
ft.propTypes = {
|
|
206
|
+
children: s.oneOfType([s.arrayOf(s.element), s.element]),
|
|
207
|
+
className: s.string,
|
|
208
|
+
disabled: s.bool,
|
|
209
|
+
width: s.string,
|
|
210
|
+
dir: s.string
|
|
211
|
+
};
|
|
212
|
+
const Ee = (e) => {
|
|
213
|
+
const o = n.useCallback(
|
|
214
|
+
(l) => {
|
|
215
|
+
e.onClick(l, e.index);
|
|
216
|
+
},
|
|
217
|
+
[e]
|
|
218
|
+
), t = e.dataItem.render || e.item || (e.item === void 0 ? e.render : null), i = e.dataItem.text !== void 0 ? e.dataItem.text : e.textField ? e.dataItem[e.textField] : e.dataItem, a = /* @__PURE__ */ n.createElement(
|
|
219
|
+
"li",
|
|
220
|
+
{
|
|
221
|
+
id: e.id,
|
|
222
|
+
className: f(
|
|
223
|
+
"k-item",
|
|
224
|
+
e.className,
|
|
225
|
+
{ "k-focus": e.focused }
|
|
226
|
+
),
|
|
227
|
+
tabIndex: -1,
|
|
228
|
+
onClick: o,
|
|
229
|
+
onMouseDown: e.onDown,
|
|
230
|
+
onPointerDown: e.onDown,
|
|
231
|
+
role: "menuitem",
|
|
232
|
+
"aria-disabled": e.dataItem.disabled || void 0
|
|
233
|
+
},
|
|
234
|
+
/* @__PURE__ */ n.createElement(
|
|
235
|
+
"span",
|
|
236
|
+
{
|
|
237
|
+
tabIndex: -1,
|
|
238
|
+
className: f(
|
|
239
|
+
"k-link k-menu-link",
|
|
240
|
+
{
|
|
241
|
+
"k-selected": e.dataItem.selected,
|
|
242
|
+
"k-disabled": e.dataItem.disabled
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
key: "icon"
|
|
246
|
+
},
|
|
247
|
+
t ? /* @__PURE__ */ n.createElement(t, { item: e.dataItem, itemIndex: e.index }) : /* @__PURE__ */ n.createElement(n.Fragment, null, (e.dataItem.icon || e.dataItem.iconClass) && /* @__PURE__ */ n.createElement(A, { className: e.dataItem.iconClass, name: e.dataItem.icon, icon: e.dataItem.svgIcon }), e.dataItem.imageUrl && /* @__PURE__ */ n.createElement(
|
|
248
|
+
"img",
|
|
249
|
+
{
|
|
250
|
+
role: "presentation",
|
|
251
|
+
alt: "",
|
|
252
|
+
src: e.dataItem.imageUrl,
|
|
253
|
+
className: "k-icon"
|
|
254
|
+
}
|
|
255
|
+
), i && /* @__PURE__ */ n.createElement("span", { className: "k-menu-link-text" }, i))
|
|
256
|
+
)
|
|
257
|
+
);
|
|
258
|
+
return e.item !== void 0 && /* to be removed in 5.0.0 */
|
|
259
|
+
e.render !== void 0 ? e.render.call(void 0, a, e) : a;
|
|
260
|
+
};
|
|
261
|
+
Ee.displayName = "KendoReactButtonItem";
|
|
262
|
+
class Ke extends n.Component {
|
|
263
|
+
/**
|
|
264
|
+
* @hidden
|
|
265
|
+
*/
|
|
266
|
+
render() {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
Ke.propTypes = {
|
|
271
|
+
text: s.string,
|
|
272
|
+
icon: s.string,
|
|
273
|
+
iconClass: s.string,
|
|
274
|
+
imageUrl: s.string,
|
|
275
|
+
disabled: s.bool,
|
|
276
|
+
render: s.any
|
|
277
|
+
};
|
|
278
|
+
const $e = (e, o, t, i) => {
|
|
279
|
+
if (t)
|
|
280
|
+
return e;
|
|
281
|
+
const a = Math.min(i - 1, Math.max(0, e));
|
|
282
|
+
switch (o) {
|
|
283
|
+
case r.enter:
|
|
284
|
+
case r.space:
|
|
285
|
+
case r.esc:
|
|
286
|
+
return -1;
|
|
287
|
+
case r.up:
|
|
288
|
+
case r.left:
|
|
289
|
+
return a - 1 < 0 ? i - 1 : a - 1;
|
|
290
|
+
case r.down:
|
|
291
|
+
case r.right:
|
|
292
|
+
return a + 1 >= i ? 0 : a + 1;
|
|
293
|
+
case r.home:
|
|
294
|
+
return 0;
|
|
295
|
+
case r.end:
|
|
296
|
+
return i - 1;
|
|
297
|
+
default:
|
|
298
|
+
return e;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
function Ae(e) {
|
|
302
|
+
let o = { horizontal: "left", vertical: "bottom" };
|
|
303
|
+
return e && (o.horizontal = "right"), o;
|
|
304
|
+
}
|
|
305
|
+
function Te(e) {
|
|
306
|
+
let o = { horizontal: "left", vertical: "top" };
|
|
307
|
+
return e && (o.horizontal = "right"), o;
|
|
308
|
+
}
|
|
309
|
+
class Le extends n.Component {
|
|
310
|
+
constructor(o) {
|
|
311
|
+
super(o), this.state = {
|
|
312
|
+
focused: !1,
|
|
313
|
+
focusedIndex: -1,
|
|
314
|
+
opened: !1
|
|
315
|
+
}, this.wrapper = null, this.mainButton = null, this.list = null, this.guid = me(), this.skipFocus = !1, this.buttonsData = [], this.onKeyDown = (t) => {
|
|
316
|
+
const { focusedIndex: i } = this.state;
|
|
317
|
+
if (t.altKey) {
|
|
318
|
+
!this.opened && t.keyCode === r.down ? (this.dispatchPopupEvent(t, !0), this.setState({ focusedIndex: 0 }), this.setOpen(!0)) : this.opened && t.keyCode === r.up && (this.setState({ focusedIndex: -1 }), this.setOpen(!1));
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
let a;
|
|
322
|
+
if (t.keyCode === r.enter || t.keyCode === r.space) {
|
|
323
|
+
if (t.preventDefault(), this.dispatchClickEvent(t, i), i >= 0) {
|
|
324
|
+
a = {
|
|
325
|
+
focusedIndex: this.opened ? -1 : 0
|
|
326
|
+
};
|
|
327
|
+
const l = !this.opened;
|
|
328
|
+
this.setOpen(l), l && this.dispatchPopupEvent(t, l);
|
|
329
|
+
}
|
|
330
|
+
} else if (this.opened && t.keyCode === r.esc) {
|
|
331
|
+
this.setState({ focusedIndex: -1 }), this.setOpen(!1);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (this.opened) {
|
|
335
|
+
const l = $e(
|
|
336
|
+
i,
|
|
337
|
+
t.keyCode,
|
|
338
|
+
t.altKey,
|
|
339
|
+
this.buttonsData.length
|
|
340
|
+
);
|
|
341
|
+
l !== i && (a = a || {}, a.focusedIndex = l);
|
|
342
|
+
const u = t.keyCode === r.up || t.keyCode === r.down || t.keyCode === r.left || t.keyCode === r.right;
|
|
343
|
+
!t.altKey && (u || t.keyCode === r.home || t.keyCode === r.end) && t.preventDefault();
|
|
344
|
+
}
|
|
345
|
+
a && this.setState(a);
|
|
346
|
+
}, this.switchFocus = (t) => {
|
|
347
|
+
this.skipFocus = !0, t(), window.setTimeout(() => this.skipFocus = !1, 0);
|
|
348
|
+
}, this.onFocus = (t) => {
|
|
349
|
+
this.skipFocus || (x(this.props.onFocus, t, this, void 0), this.setState({ focused: !0 }));
|
|
350
|
+
}, this.setOpen = (t) => {
|
|
351
|
+
this.openedDuringOnChange = t, this.setState({ opened: t });
|
|
352
|
+
}, this.onItemClick = (t, i) => {
|
|
353
|
+
this.opened && (this.setState({ focusedIndex: 0 }), this.setOpen(!1)), this.dispatchClickEvent(t, i);
|
|
354
|
+
}, this.onBlur = (t) => {
|
|
355
|
+
this.skipFocus || (this.setState({
|
|
356
|
+
focused: !1,
|
|
357
|
+
focusedIndex: -1
|
|
358
|
+
}), this.setOpen(!1), x(this.props.onBlur, t, this, void 0));
|
|
359
|
+
}, this.onPopupClose = () => {
|
|
360
|
+
this.state.focused && this.switchFocus(() => {
|
|
361
|
+
this.element && (this.element.removeAttribute("tabindex"), this.element.focus({ preventScroll: !0 }));
|
|
362
|
+
}), this.dispatchPopupEvent({}, !1);
|
|
363
|
+
}, this.listRef = (t) => {
|
|
364
|
+
this.list = t, t && this.state.focused && this.switchFocus(() => {
|
|
365
|
+
t.focus({ preventScroll: !0 }), this.element && (this.element.tabIndex = -1);
|
|
366
|
+
});
|
|
367
|
+
}, this.onSplitPartClick = (t) => {
|
|
368
|
+
if (this.buttonsData.length) {
|
|
369
|
+
const i = !this.opened;
|
|
370
|
+
i && this.dispatchPopupEvent(t, i), this.setState({
|
|
371
|
+
focusedIndex: i ? 0 : -1,
|
|
372
|
+
focused: !0
|
|
373
|
+
}), this.setOpen(i);
|
|
374
|
+
}
|
|
375
|
+
}, this.onDownSplitPart = (t) => {
|
|
376
|
+
t.preventDefault();
|
|
377
|
+
const i = se(document);
|
|
378
|
+
this.element && i !== this.element && i !== this.list && this.element.focus();
|
|
379
|
+
}, this.onItemDown = (t) => {
|
|
380
|
+
se(document) === this.list && t.preventDefault();
|
|
381
|
+
}, this.dispatchPopupEvent = (t, i) => {
|
|
382
|
+
x(i ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
|
|
383
|
+
}, R(O);
|
|
384
|
+
}
|
|
385
|
+
get opened() {
|
|
386
|
+
return this.openedDuringOnChange !== void 0 ? this.openedDuringOnChange : this.props.opened === void 0 ? this.state.opened : this.props.opened;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* @hidden
|
|
390
|
+
*/
|
|
391
|
+
render() {
|
|
392
|
+
this.buttonsData = this.props.items || n.Children.toArray(this.props.children).filter((c) => c && c.type === Ke).map((c) => c.props);
|
|
393
|
+
const o = this.isRtl(), t = o ? "rtl" : void 0, { id: i, style: a, tabIndex: l, disabled: u } = this.props;
|
|
394
|
+
return /* @__PURE__ */ n.createElement(
|
|
395
|
+
"div",
|
|
396
|
+
{
|
|
397
|
+
id: i,
|
|
398
|
+
style: a,
|
|
399
|
+
className: f(
|
|
400
|
+
"k-split-button",
|
|
401
|
+
"k-button-group",
|
|
402
|
+
{
|
|
403
|
+
"k-focus": this.state.focused
|
|
404
|
+
},
|
|
405
|
+
`k-rounded-${B.roundedMap[this.props.rounded || "medium"]}`,
|
|
406
|
+
this.props.className
|
|
407
|
+
),
|
|
408
|
+
onKeyDown: this.onKeyDown,
|
|
409
|
+
onFocus: this.onFocus,
|
|
410
|
+
onBlur: this.onBlur,
|
|
411
|
+
dir: t,
|
|
412
|
+
ref: (c) => this.wrapper = c
|
|
413
|
+
},
|
|
414
|
+
/* @__PURE__ */ n.createElement(
|
|
415
|
+
ne,
|
|
416
|
+
{
|
|
417
|
+
ref: (c) => this.mainButton = c && c.element,
|
|
418
|
+
type: "button",
|
|
419
|
+
size: this.props.size,
|
|
420
|
+
rounded: this.props.rounded,
|
|
421
|
+
fillMode: this.props.fillMode,
|
|
422
|
+
themeColor: this.props.themeColor,
|
|
423
|
+
onClick: (c) => this.onItemClick(c, -1),
|
|
424
|
+
disabled: u || void 0,
|
|
425
|
+
tabIndex: l,
|
|
426
|
+
accessKey: this.props.accessKey,
|
|
427
|
+
className: this.props.buttonClass,
|
|
428
|
+
icon: this.props.icon,
|
|
429
|
+
svgIcon: this.props.svgIcon,
|
|
430
|
+
iconClass: this.props.iconClass,
|
|
431
|
+
imageUrl: this.props.imageUrl,
|
|
432
|
+
dir: t,
|
|
433
|
+
"aria-disabled": u,
|
|
434
|
+
"aria-haspopup": !0,
|
|
435
|
+
"aria-expanded": this.opened || void 0,
|
|
436
|
+
"aria-label": this.props.ariaLabel,
|
|
437
|
+
"aria-controls": this.opened ? this.guid : void 0,
|
|
438
|
+
id: "button-" + this.guid,
|
|
439
|
+
title: this.props.title
|
|
440
|
+
},
|
|
441
|
+
this.props.text
|
|
442
|
+
),
|
|
443
|
+
/* @__PURE__ */ n.createElement(
|
|
444
|
+
ne,
|
|
445
|
+
{
|
|
446
|
+
type: "button",
|
|
447
|
+
size: this.props.size,
|
|
448
|
+
rounded: this.props.rounded,
|
|
449
|
+
fillMode: this.props.fillMode,
|
|
450
|
+
themeColor: this.props.themeColor,
|
|
451
|
+
icon: "caret-alt-down",
|
|
452
|
+
svgIcon: ct,
|
|
453
|
+
className: "k-split-button-arrow",
|
|
454
|
+
disabled: u || void 0,
|
|
455
|
+
tabIndex: -1,
|
|
456
|
+
onClick: this.onSplitPartClick,
|
|
457
|
+
onMouseDown: this.onDownSplitPart,
|
|
458
|
+
onPointerDown: this.onDownSplitPart,
|
|
459
|
+
dir: t,
|
|
460
|
+
"aria-label": "menu toggling button"
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
this.renderPopup(o)
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* @hidden
|
|
468
|
+
*/
|
|
469
|
+
componentDidMount() {
|
|
470
|
+
(this.props.dir === void 0 && this.isRtl() || this.opened) && this.forceUpdate();
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* The DOM element of main button.
|
|
474
|
+
*/
|
|
475
|
+
get element() {
|
|
476
|
+
return this.mainButton;
|
|
477
|
+
}
|
|
478
|
+
dispatchClickEvent(o, t) {
|
|
479
|
+
this.isItemDisabled(t) || (t === -1 ? x(this.props.onButtonClick, o, this, void 0) : x(
|
|
480
|
+
this.props.onItemClick,
|
|
481
|
+
o,
|
|
482
|
+
this,
|
|
483
|
+
{
|
|
484
|
+
item: this.buttonsData[t],
|
|
485
|
+
itemIndex: t
|
|
486
|
+
}
|
|
487
|
+
));
|
|
488
|
+
}
|
|
489
|
+
renderPopup(o) {
|
|
490
|
+
const { popupSettings: t = {} } = this.props, { focusedIndex: i } = this.state;
|
|
491
|
+
return /* @__PURE__ */ n.createElement(
|
|
492
|
+
we,
|
|
493
|
+
{
|
|
494
|
+
anchor: this.wrapper,
|
|
495
|
+
show: this.opened,
|
|
496
|
+
animate: t.animate,
|
|
497
|
+
popupClass: f("k-menu-popup", t.popupClass),
|
|
498
|
+
anchorAlign: t.anchorAlign || Ae(o),
|
|
499
|
+
popupAlign: t.popupAlign || Te(o),
|
|
500
|
+
style: o ? { direction: "rtl" } : void 0,
|
|
501
|
+
onClose: this.onPopupClose
|
|
502
|
+
},
|
|
503
|
+
/* @__PURE__ */ n.createElement(
|
|
504
|
+
"ul",
|
|
505
|
+
{
|
|
506
|
+
role: "menu",
|
|
507
|
+
id: this.guid,
|
|
508
|
+
"aria-labelledby": "button-" + this.guid,
|
|
509
|
+
tabIndex: -1,
|
|
510
|
+
ref: this.listRef,
|
|
511
|
+
"aria-activedescendant": i >= 0 ? `${this.guid}-${i}` : void 0,
|
|
512
|
+
className: f("k-group k-menu-group k-reset", {
|
|
513
|
+
[`k-menu-group-${B.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
514
|
+
})
|
|
515
|
+
},
|
|
516
|
+
this.renderChildItems()
|
|
517
|
+
)
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
renderChildItems() {
|
|
521
|
+
const { item: o, itemRender: t, textField: i } = this.props;
|
|
522
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map((a, l) => /* @__PURE__ */ n.createElement(
|
|
523
|
+
Ee,
|
|
524
|
+
{
|
|
525
|
+
className: "k-menu-item",
|
|
526
|
+
dataItem: a,
|
|
527
|
+
textField: i,
|
|
528
|
+
focused: this.state.focusedIndex === l,
|
|
529
|
+
onClick: this.onItemClick,
|
|
530
|
+
onDown: this.onItemDown,
|
|
531
|
+
render: t,
|
|
532
|
+
item: o,
|
|
533
|
+
key: l,
|
|
534
|
+
index: l,
|
|
535
|
+
id: `${this.guid}-${l}`
|
|
536
|
+
}
|
|
537
|
+
)) : null;
|
|
538
|
+
}
|
|
539
|
+
isItemDisabled(o) {
|
|
540
|
+
return this.buttonsData[o] ? this.buttonsData[o].disabled : this.props.disabled;
|
|
541
|
+
}
|
|
542
|
+
isRtl() {
|
|
543
|
+
return this.props.dir !== void 0 ? this.props.dir === "rtl" : !!this.wrapper && getComputedStyle(this.wrapper).direction === "rtl";
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
Le.propTypes = {
|
|
547
|
+
accessKey: s.string,
|
|
548
|
+
ariaLabel: s.string,
|
|
549
|
+
title: s.string,
|
|
550
|
+
onButtonClick: s.func,
|
|
551
|
+
onFocus: s.func,
|
|
552
|
+
onBlur: s.func,
|
|
553
|
+
onItemClick: s.func,
|
|
554
|
+
onOpen: s.func,
|
|
555
|
+
onClose: s.func,
|
|
556
|
+
text: s.string,
|
|
557
|
+
items: s.arrayOf(s.any),
|
|
558
|
+
textField: s.string,
|
|
559
|
+
tabIndex: s.number,
|
|
560
|
+
disabled: s.bool,
|
|
561
|
+
icon: s.string,
|
|
562
|
+
svgIcon: M,
|
|
563
|
+
iconClass: s.string,
|
|
564
|
+
imageUrl: s.string,
|
|
565
|
+
popupSettings: s.object,
|
|
566
|
+
itemRender: s.any,
|
|
567
|
+
item: s.func,
|
|
568
|
+
className: s.string,
|
|
569
|
+
buttonClass: s.string,
|
|
570
|
+
dir: s.string
|
|
571
|
+
};
|
|
572
|
+
Le.defaultProps = {
|
|
573
|
+
size: "medium",
|
|
574
|
+
rounded: "medium",
|
|
575
|
+
fillMode: "solid",
|
|
576
|
+
themeColor: "base"
|
|
577
|
+
};
|
|
578
|
+
class _e extends n.Component {
|
|
579
|
+
/**
|
|
580
|
+
* @hidden
|
|
581
|
+
*/
|
|
582
|
+
render() {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
_e.propTypes = {
|
|
587
|
+
text: s.string,
|
|
588
|
+
icon: s.string,
|
|
589
|
+
iconClass: s.string,
|
|
590
|
+
imageUrl: s.string,
|
|
591
|
+
selected: s.bool,
|
|
592
|
+
disabled: s.bool,
|
|
593
|
+
render: s.any
|
|
594
|
+
};
|
|
595
|
+
class He extends n.Component {
|
|
596
|
+
constructor(o) {
|
|
597
|
+
super(o), this.state = {
|
|
598
|
+
opened: !1,
|
|
599
|
+
focused: !1,
|
|
600
|
+
focusedIndex: -1
|
|
601
|
+
}, this.wrapper = null, this.mainButton = null, this.list = null, this.skipFocus = !1, this.guid = me(), this.buttonsData = [], this.onKeyDown = (t) => {
|
|
602
|
+
const { focusedIndex: i } = this.state;
|
|
603
|
+
if (t.altKey) {
|
|
604
|
+
!this.opened && t.keyCode === r.down ? (this.setOpen(!0), this.dispatchPopupEvent(t, !0), this.setState({ focusedIndex: 0 })) : this.opened && t.keyCode === r.up && (this.setState({ focusedIndex: -1 }), this.setOpen(!1));
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
const a = { ...this.state };
|
|
608
|
+
if (t.keyCode === r.enter || t.keyCode === r.space) {
|
|
609
|
+
i >= 0 && this.dispatchClickEvent(t, i), t.preventDefault();
|
|
610
|
+
const l = !this.opened;
|
|
611
|
+
this.setOpen(l), l && (this.dispatchPopupEvent(t, !0), this.setState({ focusedIndex: this.opened ? -1 : 0 }));
|
|
612
|
+
return;
|
|
613
|
+
} else if (this.opened && t.keyCode === r.esc) {
|
|
614
|
+
this.setState({ focusedIndex: -1 }), this.setOpen(!1);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (this.opened) {
|
|
618
|
+
const l = $e(
|
|
619
|
+
i,
|
|
620
|
+
t.keyCode,
|
|
621
|
+
t.altKey,
|
|
622
|
+
this.buttonsData.length
|
|
623
|
+
);
|
|
624
|
+
a.focusedIndex = l;
|
|
625
|
+
const u = t.keyCode === r.up || t.keyCode === r.down || t.keyCode === r.left || t.keyCode === r.right;
|
|
626
|
+
!t.altKey && (u || t.keyCode === r.home || t.keyCode === r.end) && t.preventDefault();
|
|
627
|
+
}
|
|
628
|
+
this.setState(a);
|
|
629
|
+
}, this.switchFocus = (t) => {
|
|
630
|
+
this.skipFocus = !0, t(), window.setTimeout(() => this.skipFocus = !1, 0);
|
|
631
|
+
}, this.handleFocus = (t) => {
|
|
632
|
+
this.skipFocus || (this.setState({ focused: !0, focusedIndex: this.opened ? 0 : -1 }), x(this.props.onFocus, t, this, void 0));
|
|
633
|
+
}, this.handleBlur = (t) => {
|
|
634
|
+
this.skipFocus || (this.setState({ focused: !1, focusedIndex: -1 }), this.setOpen(!1), x(this.props.onBlur, t, this, void 0));
|
|
635
|
+
}, this.setOpen = (t) => {
|
|
636
|
+
this.openedDuringOnChange = t, this.setState({ opened: t });
|
|
637
|
+
}, this.onItemClick = (t, i) => {
|
|
638
|
+
this.setState({ focusedIndex: -1 }), this.setOpen(!1), this.dispatchClickEvent(t, i);
|
|
639
|
+
}, this.onItemDown = (t) => {
|
|
640
|
+
se(document) === this.list && t.preventDefault();
|
|
641
|
+
}, this.mouseDown = (t) => {
|
|
642
|
+
t.preventDefault();
|
|
643
|
+
const i = se(document);
|
|
644
|
+
this.element && i !== this.element && i !== this.list && this.element.focus();
|
|
645
|
+
}, this.onPopupClose = () => {
|
|
646
|
+
this.state.focused && this.switchFocus(() => {
|
|
647
|
+
this.element && (this.element.removeAttribute("tabindex"), this.element.focus({ preventScroll: !0 }));
|
|
648
|
+
}), this.dispatchPopupEvent({}, !1);
|
|
649
|
+
}, this.listRef = (t) => {
|
|
650
|
+
this.list = t, t && this.state.focused && this.switchFocus(() => {
|
|
651
|
+
t.focus({ preventScroll: !0 }), this.element && (this.element.tabIndex = -1);
|
|
652
|
+
});
|
|
653
|
+
}, this.onClickMainButton = (t) => {
|
|
654
|
+
if (!this.buttonsData.length)
|
|
655
|
+
return;
|
|
656
|
+
const i = !this.opened;
|
|
657
|
+
this.setState({
|
|
658
|
+
focused: !0,
|
|
659
|
+
focusedIndex: i ? 0 : -1
|
|
660
|
+
}), this.setOpen(i), i && this.dispatchPopupEvent(t, i);
|
|
661
|
+
}, this.dispatchPopupEvent = (t, i) => {
|
|
662
|
+
x(i ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
|
|
663
|
+
}, R(O);
|
|
664
|
+
}
|
|
665
|
+
get opened() {
|
|
666
|
+
return this.openedDuringOnChange !== void 0 ? this.openedDuringOnChange : this.props.opened === void 0 ? this.state.opened : this.props.opened;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* @hidden
|
|
670
|
+
*/
|
|
671
|
+
render() {
|
|
672
|
+
const o = this.isRtl(), t = o ? "rtl" : void 0, { id: i, style: a, tabIndex: l, disabled: u } = this.props;
|
|
673
|
+
return this.buttonsData = this.props.items || n.Children.toArray(this.props.children).filter((c) => c && c.type === _e).map((c) => c.props), /* @__PURE__ */ n.createElement(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
id: i,
|
|
677
|
+
style: a,
|
|
678
|
+
className: f(
|
|
679
|
+
"k-dropdown-button",
|
|
680
|
+
{
|
|
681
|
+
"k-focus": this.state.focused
|
|
682
|
+
},
|
|
683
|
+
this.props.className
|
|
684
|
+
),
|
|
685
|
+
onKeyDown: this.onKeyDown,
|
|
686
|
+
onFocus: this.handleFocus,
|
|
687
|
+
onBlur: this.handleBlur,
|
|
688
|
+
dir: t,
|
|
689
|
+
ref: (c) => this.wrapper = c
|
|
690
|
+
},
|
|
691
|
+
/* @__PURE__ */ n.createElement(
|
|
692
|
+
ne,
|
|
693
|
+
{
|
|
694
|
+
size: this.props.size,
|
|
695
|
+
rounded: this.props.rounded,
|
|
696
|
+
fillMode: this.props.fillMode,
|
|
697
|
+
themeColor: this.props.themeColor,
|
|
698
|
+
onClick: this.onClickMainButton,
|
|
699
|
+
onMouseDown: this.mouseDown,
|
|
700
|
+
disabled: u || void 0,
|
|
701
|
+
tabIndex: l,
|
|
702
|
+
accessKey: this.props.accessKey,
|
|
703
|
+
icon: this.props.icon,
|
|
704
|
+
svgIcon: this.props.svgIcon,
|
|
705
|
+
iconClass: this.props.iconClass,
|
|
706
|
+
className: this.props.buttonClass,
|
|
707
|
+
imageUrl: this.props.imageUrl,
|
|
708
|
+
dir: t,
|
|
709
|
+
ref: (c) => this.mainButton = c && c.element,
|
|
710
|
+
type: "button",
|
|
711
|
+
"aria-haspopup": !0,
|
|
712
|
+
"aria-expanded": this.opened || void 0,
|
|
713
|
+
"aria-label": this.props.ariaLabel,
|
|
714
|
+
"aria-controls": this.opened ? this.guid : void 0,
|
|
715
|
+
id: "button-" + this.guid,
|
|
716
|
+
title: this.props.title
|
|
717
|
+
},
|
|
718
|
+
this.props.text
|
|
719
|
+
),
|
|
720
|
+
this.renderPopup(o)
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* @hidden
|
|
725
|
+
*/
|
|
726
|
+
componentDidMount() {
|
|
727
|
+
(this.props.dir === void 0 && this.isRtl() || this.opened) && this.forceUpdate();
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* The DOM element of main button.
|
|
731
|
+
*/
|
|
732
|
+
get element() {
|
|
733
|
+
return this.mainButton;
|
|
734
|
+
}
|
|
735
|
+
dispatchClickEvent(o, t) {
|
|
736
|
+
this.isItemDisabled(t) || x(
|
|
737
|
+
this.props.onItemClick,
|
|
738
|
+
o,
|
|
739
|
+
this,
|
|
740
|
+
{
|
|
741
|
+
item: this.buttonsData[t],
|
|
742
|
+
itemIndex: t
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
renderPopup(o) {
|
|
747
|
+
const { popupSettings: t = {} } = this.props, { focusedIndex: i } = this.state;
|
|
748
|
+
return /* @__PURE__ */ n.createElement(
|
|
749
|
+
we,
|
|
750
|
+
{
|
|
751
|
+
anchor: this.wrapper,
|
|
752
|
+
show: this.opened,
|
|
753
|
+
animate: t.animate,
|
|
754
|
+
popupClass: f("k-menu-popup", t.popupClass),
|
|
755
|
+
anchorAlign: t.anchorAlign || Ae(o),
|
|
756
|
+
popupAlign: t.popupAlign || Te(o),
|
|
757
|
+
style: o ? { direction: "rtl" } : void 0,
|
|
758
|
+
onClose: this.onPopupClose
|
|
759
|
+
},
|
|
760
|
+
/* @__PURE__ */ n.createElement(
|
|
761
|
+
"ul",
|
|
762
|
+
{
|
|
763
|
+
role: "menu",
|
|
764
|
+
id: this.guid,
|
|
765
|
+
"aria-labelledby": "button-" + this.guid,
|
|
766
|
+
tabIndex: -1,
|
|
767
|
+
"aria-activedescendant": i >= 0 ? `${this.guid}-${i}` : void 0,
|
|
768
|
+
ref: this.listRef,
|
|
769
|
+
className: f("k-group k-menu-group k-reset", {
|
|
770
|
+
[`k-menu-group-${B.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
771
|
+
})
|
|
772
|
+
},
|
|
773
|
+
this.renderChildItems()
|
|
774
|
+
)
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
renderChildItems() {
|
|
778
|
+
const { item: o, itemRender: t, textField: i } = this.props;
|
|
779
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map((a, l) => /* @__PURE__ */ n.createElement(
|
|
780
|
+
Ee,
|
|
781
|
+
{
|
|
782
|
+
className: "k-menu-item",
|
|
783
|
+
dataItem: a,
|
|
784
|
+
textField: i,
|
|
785
|
+
focused: this.state.focusedIndex === l,
|
|
786
|
+
onClick: this.onItemClick,
|
|
787
|
+
onDown: this.onItemDown,
|
|
788
|
+
render: t,
|
|
789
|
+
item: o,
|
|
790
|
+
index: l,
|
|
791
|
+
key: l,
|
|
792
|
+
id: `${this.guid}-${l}`
|
|
793
|
+
}
|
|
794
|
+
)) : null;
|
|
795
|
+
}
|
|
796
|
+
isItemDisabled(o) {
|
|
797
|
+
return this.buttonsData[o] ? this.buttonsData[o].disabled : this.props.disabled;
|
|
798
|
+
}
|
|
799
|
+
isRtl() {
|
|
800
|
+
return this.props.dir !== void 0 ? this.props.dir === "rtl" : !!this.wrapper && getComputedStyle(this.wrapper).direction === "rtl";
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
He.propTypes = {
|
|
804
|
+
accessKey: s.string,
|
|
805
|
+
ariaLabel: s.string,
|
|
806
|
+
title: s.string,
|
|
807
|
+
onFocus: s.func,
|
|
808
|
+
onBlur: s.func,
|
|
809
|
+
onItemClick: s.func,
|
|
810
|
+
onOpen: s.func,
|
|
811
|
+
onClose: s.func,
|
|
812
|
+
items: s.arrayOf(s.any),
|
|
813
|
+
textField: s.string,
|
|
814
|
+
tabIndex: s.number,
|
|
815
|
+
disabled: s.bool,
|
|
816
|
+
icon: s.string,
|
|
817
|
+
svgIcon: M,
|
|
818
|
+
iconClass: s.string,
|
|
819
|
+
imageUrl: s.string,
|
|
820
|
+
popupSettings: s.object,
|
|
821
|
+
itemRender: s.func,
|
|
822
|
+
item: s.func,
|
|
823
|
+
className: s.string,
|
|
824
|
+
buttonClass: s.string,
|
|
825
|
+
dir: s.string
|
|
826
|
+
};
|
|
827
|
+
He.defaultProps = {
|
|
828
|
+
size: "medium",
|
|
829
|
+
rounded: "medium",
|
|
830
|
+
fillMode: "solid",
|
|
831
|
+
themeColor: "base"
|
|
832
|
+
};
|
|
833
|
+
const Ie = class extends n.Component {
|
|
834
|
+
constructor(e) {
|
|
835
|
+
super(e), this._element = null, this.offsetHeight = 0, this.offsetWidth = 0, this.buttons = [], this.focusedSelector = this.selectors.map((o) => o + ":focus").join(","), this.setTabIndex = (o) => {
|
|
836
|
+
const { tabIndex: t = Ie.defaultProps.tabIndex } = this.props;
|
|
837
|
+
this.buttons.forEach((i, a) => {
|
|
838
|
+
i.tabIndex = a === o ? t : -1;
|
|
839
|
+
});
|
|
840
|
+
}, this.onKeyDown = (o) => {
|
|
841
|
+
const t = o.target;
|
|
842
|
+
if (!(o.keyCode === r.left || o.keyCode === r.right) || o.defaultPrevented || this.buttons.findIndex((l) => l === t) === -1)
|
|
843
|
+
return;
|
|
844
|
+
const a = this.focusedIndex;
|
|
845
|
+
o.keyCode === r.left ? this.focusButton(a, a - 1) : this.focusButton(a, a + 1);
|
|
846
|
+
}, this.onWindowResize = (o) => {
|
|
847
|
+
const t = this.element;
|
|
848
|
+
if (!t)
|
|
849
|
+
return;
|
|
850
|
+
const i = t.offsetWidth, a = t.offsetHeight;
|
|
851
|
+
if (this.offsetWidth !== i || this.offsetHeight !== a) {
|
|
852
|
+
this.offsetWidth = i, this.offsetHeight = a;
|
|
853
|
+
const l = { offsetWidth: this.offsetWidth, offsetHeight: this.offsetHeight };
|
|
854
|
+
this.props.onResize && this.props.onResize.call(void 0, { target: this, ...l, nativeEvent: o });
|
|
855
|
+
}
|
|
856
|
+
}, R(O);
|
|
857
|
+
}
|
|
858
|
+
get selectors() {
|
|
859
|
+
return this.props.buttons || pt;
|
|
860
|
+
}
|
|
861
|
+
get focusedIndex() {
|
|
862
|
+
const e = this.element && this.element.querySelector(this.focusedSelector);
|
|
863
|
+
return Math.max(0, this.buttons.findIndex((o) => o === e));
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Returns the HTML element of the Toolbar component.
|
|
867
|
+
*/
|
|
868
|
+
get element() {
|
|
869
|
+
return this._element;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* @hidden
|
|
873
|
+
*/
|
|
874
|
+
componentDidMount() {
|
|
875
|
+
window.addEventListener("resize", this.onWindowResize);
|
|
876
|
+
const e = this.element;
|
|
877
|
+
e && (this.offsetWidth = e.offsetWidth, this.offsetHeight = e.offsetHeight, this.props.keyboardNavigation !== !1 && (this.buttons = Array.from(e.querySelectorAll(this.selectors.join(","))), this.setTabIndex(0)));
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* @hidden
|
|
881
|
+
*/
|
|
882
|
+
componentDidUpdate() {
|
|
883
|
+
const e = this.element;
|
|
884
|
+
!e || this.props.keyboardNavigation === !1 || (this.buttons = Array.from(e.querySelectorAll(this.selectors.join(","))), this.setTabIndex(this.focusedIndex));
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* @hidden
|
|
888
|
+
*/
|
|
889
|
+
componentWillUnmount() {
|
|
890
|
+
window.removeEventListener("resize", this.onWindowResize), this.buttons.length = 0;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* @hidden
|
|
894
|
+
*/
|
|
895
|
+
render() {
|
|
896
|
+
return /* @__PURE__ */ n.createElement(
|
|
897
|
+
"div",
|
|
898
|
+
{
|
|
899
|
+
id: this.props.id,
|
|
900
|
+
"aria-label": this.props.ariaLabel,
|
|
901
|
+
className: f(
|
|
902
|
+
"k-toolbar",
|
|
903
|
+
{
|
|
904
|
+
[`k-toolbar-${B.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
905
|
+
},
|
|
906
|
+
this.props.className
|
|
907
|
+
),
|
|
908
|
+
style: this.props.style,
|
|
909
|
+
role: this.props.role !== void 0 ? this.props.role || void 0 : "toolbar",
|
|
910
|
+
dir: this.props.dir,
|
|
911
|
+
ref: (e) => this._element = e,
|
|
912
|
+
onKeyDown: this.props.keyboardNavigation !== !1 ? this.onKeyDown : void 0
|
|
913
|
+
},
|
|
914
|
+
this.props.children
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
focusButton(e, o) {
|
|
918
|
+
const { tabIndex: t = Ie.defaultProps.tabIndex } = this.props, i = this.buttons[o];
|
|
919
|
+
if (i) {
|
|
920
|
+
i.tabIndex = t, i.focus();
|
|
921
|
+
const a = this.buttons[e];
|
|
922
|
+
a && (a.tabIndex = -1);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
let Ue = Ie;
|
|
927
|
+
Ue.propTypes = {
|
|
928
|
+
tabIndex: s.number,
|
|
929
|
+
dir: s.string,
|
|
930
|
+
keyboardNavigation: s.bool,
|
|
931
|
+
style: s.object,
|
|
932
|
+
className: s.string,
|
|
933
|
+
role: s.string,
|
|
934
|
+
onResize: s.func,
|
|
935
|
+
buttons: s.arrayOf(s.string),
|
|
936
|
+
size: s.oneOf([null, "small", "medium", "large"])
|
|
937
|
+
};
|
|
938
|
+
Ue.defaultProps = {
|
|
939
|
+
tabIndex: 0,
|
|
940
|
+
size: "medium"
|
|
941
|
+
};
|
|
942
|
+
class bt extends n.PureComponent {
|
|
943
|
+
constructor() {
|
|
944
|
+
super(...arguments), this._element = null;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Returns the HTML element of the ToolbarItem component.
|
|
948
|
+
*/
|
|
949
|
+
get element() {
|
|
950
|
+
return this._element;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* @hidden
|
|
954
|
+
*/
|
|
955
|
+
render() {
|
|
956
|
+
return /* @__PURE__ */ n.createElement(
|
|
957
|
+
"div",
|
|
958
|
+
{
|
|
959
|
+
id: this.props.id,
|
|
960
|
+
className: f("k-toolbar-item", this.props.className),
|
|
961
|
+
style: this.props.style,
|
|
962
|
+
ref: (o) => this._element = o
|
|
963
|
+
},
|
|
964
|
+
this.props.children
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
bt.propTypes = {
|
|
969
|
+
className: s.string
|
|
970
|
+
};
|
|
971
|
+
class At extends n.PureComponent {
|
|
972
|
+
/**
|
|
973
|
+
* @hidden
|
|
974
|
+
*/
|
|
975
|
+
render() {
|
|
976
|
+
return /* @__PURE__ */ n.createElement("div", { className: f("k-separator", this.props.className) });
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
const We = n.forwardRef((e, o) => {
|
|
980
|
+
const t = n.useRef(null), i = n.useRef(null);
|
|
981
|
+
n.useImperativeHandle(i, () => ({ element: t.current })), n.useImperativeHandle(o, () => ({ element: t.current }));
|
|
982
|
+
const a = n.useMemo(
|
|
983
|
+
() => f(
|
|
984
|
+
"k-spacer",
|
|
985
|
+
e.className
|
|
986
|
+
),
|
|
987
|
+
[e.className]
|
|
988
|
+
);
|
|
989
|
+
return /* @__PURE__ */ n.createElement(
|
|
990
|
+
"span",
|
|
991
|
+
{
|
|
992
|
+
ref: t,
|
|
993
|
+
className: a
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
});
|
|
997
|
+
We.displayName = "KendoReactToolbarSpacer";
|
|
998
|
+
We.propTypes = {
|
|
999
|
+
className: s.string
|
|
1000
|
+
};
|
|
1001
|
+
const je = xe.createContext([null, (e) => {
|
|
1002
|
+
}]), Ve = xe.createContext([null, (e) => {
|
|
1003
|
+
}]), Ze = xe.createContext([null, (e) => {
|
|
1004
|
+
}]);
|
|
1005
|
+
var te = /* @__PURE__ */ ((e) => (e.next = "next", e.prev = "prev", e.current = "current", e.reset = "reset", e))(te || {});
|
|
1006
|
+
const gt = (e, o) => {
|
|
1007
|
+
const t = o.items.findIndex((i) => i === e);
|
|
1008
|
+
switch (o.type) {
|
|
1009
|
+
case "next":
|
|
1010
|
+
return t === o.items.length - 1 ? e : o.items[t + 1];
|
|
1011
|
+
case "prev":
|
|
1012
|
+
return t === 0 ? e : o.items[t - 1];
|
|
1013
|
+
case "current":
|
|
1014
|
+
return o.payload;
|
|
1015
|
+
case "reset":
|
|
1016
|
+
return null;
|
|
1017
|
+
default:
|
|
1018
|
+
return e;
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
var qe = /* @__PURE__ */ ((e) => (e.remove = "remove", e.add = "add", e.reorder = "reorder", e))(qe || {});
|
|
1022
|
+
const kt = (e, o) => {
|
|
1023
|
+
switch (o.type) {
|
|
1024
|
+
case "add":
|
|
1025
|
+
break;
|
|
1026
|
+
case "remove":
|
|
1027
|
+
return e.filter((t) => t[o.valueField] !== o.payload);
|
|
1028
|
+
case "reorder":
|
|
1029
|
+
break;
|
|
1030
|
+
default:
|
|
1031
|
+
return e;
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
var pe = /* @__PURE__ */ ((e) => (e.toggle = "toggle", e.remove = "remove", e))(pe || {});
|
|
1035
|
+
const yt = (e, o) => {
|
|
1036
|
+
switch (o.selection) {
|
|
1037
|
+
case "single":
|
|
1038
|
+
switch (o.type) {
|
|
1039
|
+
case "toggle": {
|
|
1040
|
+
if (!Array.isArray(e) || e === null)
|
|
1041
|
+
return o.payload === e ? null : o.payload;
|
|
1042
|
+
throw new Error("State cannot be an array in single selection");
|
|
1043
|
+
}
|
|
1044
|
+
case "remove":
|
|
1045
|
+
return o.payload === e ? null : e;
|
|
1046
|
+
default:
|
|
1047
|
+
return e;
|
|
1048
|
+
}
|
|
1049
|
+
case "multiple":
|
|
1050
|
+
switch (o.type) {
|
|
1051
|
+
case "toggle": {
|
|
1052
|
+
if (Array.isArray(e))
|
|
1053
|
+
return e.some((t) => t === o.payload) ? e.filter((t) => t !== o.payload) : [...e, o.payload];
|
|
1054
|
+
if (e === null)
|
|
1055
|
+
return [o.payload];
|
|
1056
|
+
throw new Error("State cannot be non-array in multiple selection");
|
|
1057
|
+
}
|
|
1058
|
+
case "remove":
|
|
1059
|
+
return Array.isArray(e) ? e.some((t) => t === o.payload) ? e.filter((t) => t !== o.payload) : [...e, o.payload] : e;
|
|
1060
|
+
default:
|
|
1061
|
+
return e;
|
|
1062
|
+
}
|
|
1063
|
+
case "none":
|
|
1064
|
+
return null;
|
|
1065
|
+
default:
|
|
1066
|
+
return e;
|
|
1067
|
+
}
|
|
1068
|
+
}, j = n.forwardRef((e, o) => {
|
|
1069
|
+
R(O);
|
|
1070
|
+
const t = n.useRef(null), i = n.useRef(null), a = De(i, e.dir);
|
|
1071
|
+
n.useImperativeHandle(t, () => ({
|
|
1072
|
+
element: i.current,
|
|
1073
|
+
props: e
|
|
1074
|
+
})), n.useImperativeHandle(o, () => t.current);
|
|
1075
|
+
const [l, u] = n.useContext(je), [c, g] = n.useContext(Ve), [, v] = n.useContext(Ze), h = n.useMemo(
|
|
1076
|
+
() => e.selected || (Array.isArray(l) ? l.some((p) => p === e.value) : l === e.value),
|
|
1077
|
+
[e.selected, e.value, l]
|
|
1078
|
+
), D = n.useMemo(
|
|
1079
|
+
() => c === e.value,
|
|
1080
|
+
[e.value, c]
|
|
1081
|
+
);
|
|
1082
|
+
n.useEffect(
|
|
1083
|
+
() => {
|
|
1084
|
+
D && i.current && i.current.focus();
|
|
1085
|
+
},
|
|
1086
|
+
[D]
|
|
1087
|
+
);
|
|
1088
|
+
const N = n.useCallback(
|
|
1089
|
+
(p) => {
|
|
1090
|
+
u({ type: pe.toggle, payload: e.value, event: p });
|
|
1091
|
+
},
|
|
1092
|
+
[u, e.value]
|
|
1093
|
+
), w = n.useCallback(
|
|
1094
|
+
(p) => {
|
|
1095
|
+
e.removable && (v({ type: qe.remove, payload: e.value, event: p }), g({ type: te.reset, payload: e.value, event: p }), u({ type: pe.remove, payload: e.value, event: p }), e.onRemove && e.onRemove.call(
|
|
1096
|
+
void 0,
|
|
1097
|
+
{
|
|
1098
|
+
target: t.current,
|
|
1099
|
+
syntheticEvent: p
|
|
1100
|
+
}
|
|
1101
|
+
));
|
|
1102
|
+
},
|
|
1103
|
+
[e.onRemove, e.value, e.removable, v, g, u]
|
|
1104
|
+
), S = n.useCallback(
|
|
1105
|
+
(p) => {
|
|
1106
|
+
switch (p.keyCode) {
|
|
1107
|
+
case r.left:
|
|
1108
|
+
g({ type: te.prev, payload: e.value, event: p });
|
|
1109
|
+
break;
|
|
1110
|
+
case r.right:
|
|
1111
|
+
g({ type: te.next, payload: e.value, event: p });
|
|
1112
|
+
break;
|
|
1113
|
+
case r.enter:
|
|
1114
|
+
u({ type: pe.toggle, payload: e.value, event: p });
|
|
1115
|
+
break;
|
|
1116
|
+
case r.delete:
|
|
1117
|
+
w(p);
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
e.onKeyDown && e.onKeyDown.call(
|
|
1121
|
+
void 0,
|
|
1122
|
+
{
|
|
1123
|
+
target: t.current,
|
|
1124
|
+
syntheticEvent: p
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
},
|
|
1128
|
+
[e.onKeyDown, e.value, g, u, w]
|
|
1129
|
+
), F = n.useCallback(
|
|
1130
|
+
(p) => {
|
|
1131
|
+
g({ payload: e.value, type: te.current, event: p }), e.onFocus && e.onFocus.call(
|
|
1132
|
+
void 0,
|
|
1133
|
+
{
|
|
1134
|
+
target: t.current,
|
|
1135
|
+
syntheticEvent: p
|
|
1136
|
+
}
|
|
1137
|
+
);
|
|
1138
|
+
},
|
|
1139
|
+
[e.onFocus, e.value, g]
|
|
1140
|
+
), I = n.useCallback(
|
|
1141
|
+
(p) => {
|
|
1142
|
+
e.onBlur && e.onBlur.call(
|
|
1143
|
+
void 0,
|
|
1144
|
+
{
|
|
1145
|
+
target: t.current,
|
|
1146
|
+
syntheticEvent: p
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
},
|
|
1150
|
+
[e.onBlur]
|
|
1151
|
+
), E = Oe(e, t, { onClick: N });
|
|
1152
|
+
return /* @__PURE__ */ n.createElement(
|
|
1153
|
+
"div",
|
|
1154
|
+
{
|
|
1155
|
+
...E,
|
|
1156
|
+
role: e.role || "button",
|
|
1157
|
+
id: e.value,
|
|
1158
|
+
style: e.style,
|
|
1159
|
+
ref: i,
|
|
1160
|
+
dir: a,
|
|
1161
|
+
tabIndex: fe(e.tabIndex, e.disabled, void 0),
|
|
1162
|
+
className: f(
|
|
1163
|
+
"k-chip",
|
|
1164
|
+
{
|
|
1165
|
+
"k-rtl": a === "rtl",
|
|
1166
|
+
"k-disabled": e.disabled,
|
|
1167
|
+
"k-selected": h,
|
|
1168
|
+
"k-focus": D,
|
|
1169
|
+
[`k-chip-${B.sizeMap[e.size] || e.size}`]: e.size,
|
|
1170
|
+
[`k-rounded-${B.roundedMap[e.rounded] || e.rounded}`]: e.rounded,
|
|
1171
|
+
[`k-chip-${e.fillMode}`]: e.fillMode,
|
|
1172
|
+
[`k-chip-${e.fillMode}-${e.themeColor}`]: !!(e.fillMode && e.themeColor)
|
|
1173
|
+
},
|
|
1174
|
+
e.className
|
|
1175
|
+
),
|
|
1176
|
+
"aria-pressed": e.role ? void 0 : h,
|
|
1177
|
+
"aria-disabled": e.disabled,
|
|
1178
|
+
"aria-describedby": e.ariaDescribedBy,
|
|
1179
|
+
"aria-keyshortcuts": e.removable ? "Enter Delete" : void 0,
|
|
1180
|
+
onFocus: F,
|
|
1181
|
+
onBlur: I,
|
|
1182
|
+
onKeyDown: S
|
|
1183
|
+
},
|
|
1184
|
+
h && (e.selectedIcon || e.selectedSvgIcon) && /* @__PURE__ */ n.createElement(
|
|
1185
|
+
A,
|
|
1186
|
+
{
|
|
1187
|
+
className: "k-chip-icon",
|
|
1188
|
+
name: e.selectedIcon ? Ce(e.selectedIcon) : void 0,
|
|
1189
|
+
icon: e.selectedSvgIcon,
|
|
1190
|
+
size: "small"
|
|
1191
|
+
}
|
|
1192
|
+
),
|
|
1193
|
+
(e.icon || e.svgIcon) && /* @__PURE__ */ n.createElement(
|
|
1194
|
+
A,
|
|
1195
|
+
{
|
|
1196
|
+
className: "k-chip-icon",
|
|
1197
|
+
name: e.icon ? Ce(e.icon) : void 0,
|
|
1198
|
+
icon: e.svgIcon,
|
|
1199
|
+
size: "small"
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
e.avatar && /* @__PURE__ */ n.createElement(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
className: `k-chip-avatar k-avatar k-rounded-${e.avatar.rounded} k-avatar-md k-avatar-solid k-avatar-solid-primary`,
|
|
1206
|
+
style: e.avatar.style
|
|
1207
|
+
},
|
|
1208
|
+
/* @__PURE__ */ n.createElement("span", { className: "k-avatar-image" }, /* @__PURE__ */ n.createElement(
|
|
1209
|
+
"img",
|
|
1210
|
+
{
|
|
1211
|
+
src: e.avatar.image,
|
|
1212
|
+
alt: e.avatar.imageAlt
|
|
1213
|
+
}
|
|
1214
|
+
))
|
|
1215
|
+
),
|
|
1216
|
+
/* @__PURE__ */ n.createElement("span", { className: "k-chip-content" }, e.children !== void 0 ? e.children : e.text && /* @__PURE__ */ n.createElement(
|
|
1217
|
+
"span",
|
|
1218
|
+
{
|
|
1219
|
+
"aria-label": e.ariaLabel || e.text,
|
|
1220
|
+
className: "k-chip-label"
|
|
1221
|
+
},
|
|
1222
|
+
e.text
|
|
1223
|
+
)),
|
|
1224
|
+
e.removable && /* @__PURE__ */ n.createElement("span", { className: "k-chip-actions" }, /* @__PURE__ */ n.createElement("span", { className: f("k-chip-action", "k-chip-remove-action"), onClick: w }, /* @__PURE__ */ n.createElement(
|
|
1225
|
+
A,
|
|
1226
|
+
{
|
|
1227
|
+
name: e.removeIcon ? Ce(e.removeIcon) : void 0,
|
|
1228
|
+
icon: e.removeSvgIcon || dt,
|
|
1229
|
+
size: "small"
|
|
1230
|
+
}
|
|
1231
|
+
)))
|
|
1232
|
+
);
|
|
1233
|
+
}), vt = {
|
|
1234
|
+
id: s.string,
|
|
1235
|
+
text: s.string,
|
|
1236
|
+
value: s.any,
|
|
1237
|
+
dir: s.oneOf(["ltr", "rtl"]),
|
|
1238
|
+
removable: s.bool,
|
|
1239
|
+
removeIcon: s.string,
|
|
1240
|
+
removeIconSvg: M,
|
|
1241
|
+
disabled: s.bool,
|
|
1242
|
+
icon: s.string,
|
|
1243
|
+
svgIcon: M,
|
|
1244
|
+
selectedIcon: s.string,
|
|
1245
|
+
selectedIconSvg: M,
|
|
1246
|
+
onRemove: s.func,
|
|
1247
|
+
dataItem: s.any,
|
|
1248
|
+
selected: s.bool,
|
|
1249
|
+
ariaDescribedBy: s.string,
|
|
1250
|
+
size: s.oneOf([null, "small", "medium", "large"]),
|
|
1251
|
+
rounded: s.oneOf([null, "small", "medium", "large", "full"]),
|
|
1252
|
+
fillMode: s.oneOf([null, "outline", "solid"]),
|
|
1253
|
+
// eslint-disable-next-line max-len
|
|
1254
|
+
themeColor: s.oneOf([null, "base", "info", "success", "warning", "error"])
|
|
1255
|
+
}, Ct = {
|
|
1256
|
+
disabled: !1,
|
|
1257
|
+
removable: !1,
|
|
1258
|
+
removeIcon: "k-i-x-circle",
|
|
1259
|
+
dir: "ltr",
|
|
1260
|
+
size: "medium",
|
|
1261
|
+
rounded: "medium",
|
|
1262
|
+
fillMode: "solid",
|
|
1263
|
+
themeColor: "base"
|
|
1264
|
+
};
|
|
1265
|
+
j.displayName = "KendoReactChip";
|
|
1266
|
+
j.propTypes = vt;
|
|
1267
|
+
j.defaultProps = Ct;
|
|
1268
|
+
const It = (e, o, t) => {
|
|
1269
|
+
const [i, a] = n.useState(e);
|
|
1270
|
+
return [i, (u) => {
|
|
1271
|
+
const c = yt(o.state || i, { ...u, ...o });
|
|
1272
|
+
t && t(c, u.event), a(c);
|
|
1273
|
+
}];
|
|
1274
|
+
}, xt = (e) => {
|
|
1275
|
+
const [o, t] = n.useState(null);
|
|
1276
|
+
return [o, (a) => {
|
|
1277
|
+
const l = gt(a.payload, { ...a, ...e });
|
|
1278
|
+
t(l);
|
|
1279
|
+
}];
|
|
1280
|
+
}, Dt = (e, o, t) => {
|
|
1281
|
+
const [i, a] = n.useState(e);
|
|
1282
|
+
return [i, (u) => {
|
|
1283
|
+
const c = kt(o.state || i, { ...u, ...o });
|
|
1284
|
+
t && t(c, u.event), a(c);
|
|
1285
|
+
}];
|
|
1286
|
+
}, Ne = n.forwardRef((e, o) => {
|
|
1287
|
+
R(O);
|
|
1288
|
+
const t = n.useRef(null), i = n.useRef(null), a = De(i, e.dir), {
|
|
1289
|
+
chip: l,
|
|
1290
|
+
id: u,
|
|
1291
|
+
style: c,
|
|
1292
|
+
tabIndex: g,
|
|
1293
|
+
disabled: v,
|
|
1294
|
+
size: h,
|
|
1295
|
+
className: D,
|
|
1296
|
+
ariaDescribedBy: N,
|
|
1297
|
+
ariaLabelledBy: w,
|
|
1298
|
+
ariaLabel: S,
|
|
1299
|
+
selection: F = W.selection,
|
|
1300
|
+
value: I = W.defaultValue,
|
|
1301
|
+
defaultData: E = W.defaultData,
|
|
1302
|
+
valueField: p = W.valueField,
|
|
1303
|
+
textField: T = W.textField,
|
|
1304
|
+
onChange: K,
|
|
1305
|
+
onDataChange: P
|
|
1306
|
+
} = e, L = n.useMemo(
|
|
1307
|
+
() => l || j,
|
|
1308
|
+
[l, j]
|
|
1309
|
+
);
|
|
1310
|
+
n.useImperativeHandle(t, () => ({
|
|
1311
|
+
element: i.current,
|
|
1312
|
+
props: e
|
|
1313
|
+
})), n.useImperativeHandle(o, () => t.current);
|
|
1314
|
+
const $ = n.useCallback(
|
|
1315
|
+
(m, k) => {
|
|
1316
|
+
K && t.current && K.call(void 0, {
|
|
1317
|
+
value: m,
|
|
1318
|
+
target: t.current,
|
|
1319
|
+
syntheticEvent: k
|
|
1320
|
+
});
|
|
1321
|
+
},
|
|
1322
|
+
[K]
|
|
1323
|
+
), [V, Z] = It(
|
|
1324
|
+
I,
|
|
1325
|
+
{
|
|
1326
|
+
selection: F,
|
|
1327
|
+
state: I
|
|
1328
|
+
},
|
|
1329
|
+
$
|
|
1330
|
+
), oe = n.useCallback(
|
|
1331
|
+
(m, k) => {
|
|
1332
|
+
P && t.current && P.call(void 0, {
|
|
1333
|
+
value: m,
|
|
1334
|
+
target: t.current,
|
|
1335
|
+
syntheticEvent: k
|
|
1336
|
+
});
|
|
1337
|
+
},
|
|
1338
|
+
[P]
|
|
1339
|
+
), [q, ie] = Dt(
|
|
1340
|
+
e.data || E,
|
|
1341
|
+
{
|
|
1342
|
+
state: e.data,
|
|
1343
|
+
valueField: p
|
|
1344
|
+
},
|
|
1345
|
+
oe
|
|
1346
|
+
), G = n.useCallback(
|
|
1347
|
+
(m, k) => (m.push(k[p]), m),
|
|
1348
|
+
[p]
|
|
1349
|
+
), _ = n.useMemo(
|
|
1350
|
+
() => e.data || q,
|
|
1351
|
+
[e.data, q]
|
|
1352
|
+
), ae = n.useMemo(
|
|
1353
|
+
() => I || V,
|
|
1354
|
+
[I, V]
|
|
1355
|
+
), le = n.useMemo(
|
|
1356
|
+
() => _.reduce(G, []),
|
|
1357
|
+
[_, G]
|
|
1358
|
+
), X = n.useCallback(
|
|
1359
|
+
(m) => Be(p)(m),
|
|
1360
|
+
[p]
|
|
1361
|
+
), y = n.useCallback(
|
|
1362
|
+
(m) => Be(T)(m),
|
|
1363
|
+
[T]
|
|
1364
|
+
), [be, ge] = xt({ items: le }), re = Oe(e, t);
|
|
1365
|
+
return /* @__PURE__ */ n.createElement(je.Provider, { value: [ae, Z] }, /* @__PURE__ */ n.createElement(Ve.Provider, { value: [be, ge] }, /* @__PURE__ */ n.createElement(Ze.Provider, { value: [_, ie] }, /* @__PURE__ */ n.createElement(
|
|
1366
|
+
"div",
|
|
1367
|
+
{
|
|
1368
|
+
ref: i,
|
|
1369
|
+
...re,
|
|
1370
|
+
role: v ? void 0 : "listbox",
|
|
1371
|
+
id: u,
|
|
1372
|
+
dir: a,
|
|
1373
|
+
style: c,
|
|
1374
|
+
tabIndex: fe(g, v, void 0),
|
|
1375
|
+
className: f(
|
|
1376
|
+
"k-chip-list",
|
|
1377
|
+
{
|
|
1378
|
+
"k-rtl": a === "rtl",
|
|
1379
|
+
"k-disabled": v,
|
|
1380
|
+
[`k-chip-list-${B.sizeMap[h] || h}`]: h
|
|
1381
|
+
},
|
|
1382
|
+
D
|
|
1383
|
+
),
|
|
1384
|
+
"aria-label": S,
|
|
1385
|
+
"aria-labelledby": w,
|
|
1386
|
+
"aria-describedby": N,
|
|
1387
|
+
"aria-orientation": "horizontal",
|
|
1388
|
+
"aria-multiselectable": F === "multiple"
|
|
1389
|
+
},
|
|
1390
|
+
_.map((m, k) => /* @__PURE__ */ n.createElement(
|
|
1391
|
+
L,
|
|
1392
|
+
{
|
|
1393
|
+
role: "option",
|
|
1394
|
+
dataItem: m,
|
|
1395
|
+
size: h,
|
|
1396
|
+
key: [X(m), k].join("-"),
|
|
1397
|
+
text: y(m),
|
|
1398
|
+
value: X(m),
|
|
1399
|
+
ariaLabel: m.ariaLabel,
|
|
1400
|
+
svgIcon: m.svgIcon || void 0
|
|
1401
|
+
}
|
|
1402
|
+
))
|
|
1403
|
+
))));
|
|
1404
|
+
}), wt = {
|
|
1405
|
+
id: s.string,
|
|
1406
|
+
className: s.string,
|
|
1407
|
+
tabIndex: s.number,
|
|
1408
|
+
data: s.any,
|
|
1409
|
+
defaultData: s.arrayOf(s.any),
|
|
1410
|
+
onDataChange: s.func,
|
|
1411
|
+
value: s.oneOfType([s.any, s.arrayOf(s.any)]),
|
|
1412
|
+
defaultValue: s.oneOfType([s.any, s.arrayOf(s.any)]),
|
|
1413
|
+
onChange: s.func,
|
|
1414
|
+
selection: s.oneOf(["single", "none", "multiple"]),
|
|
1415
|
+
textField: s.string,
|
|
1416
|
+
valueField: s.string,
|
|
1417
|
+
disabled: s.bool,
|
|
1418
|
+
dir: s.oneOf(["ltr", "rtl"]),
|
|
1419
|
+
ariaLabelledBy: s.string,
|
|
1420
|
+
ariaDescribedBy: s.string,
|
|
1421
|
+
size: s.oneOf([null, "small", "medium", "large"])
|
|
1422
|
+
}, W = {
|
|
1423
|
+
chip: j,
|
|
1424
|
+
size: "medium",
|
|
1425
|
+
disabled: !1,
|
|
1426
|
+
defaultValue: null,
|
|
1427
|
+
defaultData: [],
|
|
1428
|
+
dir: "ltr",
|
|
1429
|
+
selection: "none",
|
|
1430
|
+
textField: "text",
|
|
1431
|
+
valueField: "value",
|
|
1432
|
+
removable: "removable"
|
|
1433
|
+
};
|
|
1434
|
+
Ne.displayName = "KendoReactChipList";
|
|
1435
|
+
Ne.propTypes = wt;
|
|
1436
|
+
Ne.defaultProps = W;
|
|
1437
|
+
const Se = n.forwardRef((e, o) => {
|
|
1438
|
+
const {
|
|
1439
|
+
className: t,
|
|
1440
|
+
disabled: i,
|
|
1441
|
+
text: a,
|
|
1442
|
+
icon: l,
|
|
1443
|
+
style: u,
|
|
1444
|
+
id: c,
|
|
1445
|
+
focused: g,
|
|
1446
|
+
tabIndex: v,
|
|
1447
|
+
index: h,
|
|
1448
|
+
dataItem: D,
|
|
1449
|
+
item: N,
|
|
1450
|
+
svgIcon: w,
|
|
1451
|
+
onDown: S,
|
|
1452
|
+
onClick: F,
|
|
1453
|
+
...I
|
|
1454
|
+
} = e, E = n.useRef(null), p = n.useCallback(
|
|
1455
|
+
() => {
|
|
1456
|
+
E.current && E.current.focus();
|
|
1457
|
+
},
|
|
1458
|
+
[]
|
|
1459
|
+
), T = n.useCallback(
|
|
1460
|
+
() => ({
|
|
1461
|
+
element: E.current,
|
|
1462
|
+
focus: p
|
|
1463
|
+
}),
|
|
1464
|
+
[p]
|
|
1465
|
+
);
|
|
1466
|
+
n.useImperativeHandle(o, T);
|
|
1467
|
+
const K = n.useCallback(
|
|
1468
|
+
($) => {
|
|
1469
|
+
F && h !== void 0 && !i && F($, h);
|
|
1470
|
+
},
|
|
1471
|
+
[F, h]
|
|
1472
|
+
), P = n.useMemo(
|
|
1473
|
+
() => f(
|
|
1474
|
+
"k-fab-item",
|
|
1475
|
+
{
|
|
1476
|
+
"k-focus": g,
|
|
1477
|
+
"k-disabled": i
|
|
1478
|
+
},
|
|
1479
|
+
t
|
|
1480
|
+
),
|
|
1481
|
+
[t, i, g]
|
|
1482
|
+
), L = N;
|
|
1483
|
+
return /* @__PURE__ */ n.createElement(
|
|
1484
|
+
"li",
|
|
1485
|
+
{
|
|
1486
|
+
ref: E,
|
|
1487
|
+
id: c,
|
|
1488
|
+
className: P,
|
|
1489
|
+
style: u,
|
|
1490
|
+
role: "menuitem",
|
|
1491
|
+
tabIndex: fe(v, i),
|
|
1492
|
+
"aria-disabled": i,
|
|
1493
|
+
"aria-label": `${a || ""} floatingactionbutton item`,
|
|
1494
|
+
onClick: K,
|
|
1495
|
+
onMouseDown: S,
|
|
1496
|
+
onPointerDown: S,
|
|
1497
|
+
...I
|
|
1498
|
+
},
|
|
1499
|
+
L ? /* @__PURE__ */ n.createElement(L, { itemIndex: h, item: D }) : /* @__PURE__ */ n.createElement(n.Fragment, null, a && /* @__PURE__ */ n.createElement("span", { className: "k-fab-item-text" }, a), l || w ? /* @__PURE__ */ n.createElement(A, { className: "k-fab-item-icon", name: l, icon: w }) : null)
|
|
1500
|
+
);
|
|
1501
|
+
});
|
|
1502
|
+
Se.propTypes = {
|
|
1503
|
+
className: s.string,
|
|
1504
|
+
style: s.object,
|
|
1505
|
+
children: s.any,
|
|
1506
|
+
disabled: s.bool,
|
|
1507
|
+
focused: s.bool,
|
|
1508
|
+
index: s.number,
|
|
1509
|
+
icon: s.string,
|
|
1510
|
+
svgIcon: M,
|
|
1511
|
+
text: s.string,
|
|
1512
|
+
tabIndex: s.number,
|
|
1513
|
+
customProp: s.any
|
|
1514
|
+
};
|
|
1515
|
+
Se.displayName = "KendoFloatingActionButtonItem";
|
|
1516
|
+
const Re = "16px", he = (e) => typeof e == "number" ? e + "px" : e, Et = (e, o) => {
|
|
1517
|
+
const t = { horizontal: o ? "right" : "left", vertical: "bottom" };
|
|
1518
|
+
return e.horizontal === "end" && (t.horizontal = o ? "left" : "right"), t;
|
|
1519
|
+
}, Nt = (e, o) => {
|
|
1520
|
+
const t = { horizontal: o ? "right" : "left", vertical: "top" };
|
|
1521
|
+
return e.horizontal === "end" && (t.horizontal = o ? "left" : "right"), t;
|
|
1522
|
+
}, St = (e, o) => {
|
|
1523
|
+
const t = o === "end" ? "end" : "start";
|
|
1524
|
+
return {
|
|
1525
|
+
rtl: { end: "k-text-left", start: "k-text-right" },
|
|
1526
|
+
ltr: { start: "k-text-left", end: "k-text-right" }
|
|
1527
|
+
}[e][t];
|
|
1528
|
+
}, Ft = (e, o, t, i) => {
|
|
1529
|
+
const a = o.horizontal, l = o.vertical;
|
|
1530
|
+
if (e.current) {
|
|
1531
|
+
const u = t && t.x !== void 0 ? he(t.x) : Re, c = t && t.x !== void 0 ? `calc(50% + ${he(t.x)})` : "50%", g = t && t.y !== void 0 ? he(t.y) : Re, v = t && t.y !== void 0 ? `calc(50% + ${he(t.y)})` : "50%";
|
|
1532
|
+
e.current.style.setProperty(zt(o, i), a === "center" ? c : u), e.current.style.setProperty(Pt(o), l === "middle" ? v : g), i && ((l === "top" || l === "bottom") && a === "start" && e.current.style.setProperty("left", "unset"), l === "middle" && a === "end" && e.current.style.setProperty("right", "unset"), l === "middle" && a === "start" && e.current.style.setProperty("left", "unset"));
|
|
1533
|
+
}
|
|
1534
|
+
}, zt = (e, o) => {
|
|
1535
|
+
const { horizontal: t } = e;
|
|
1536
|
+
return {
|
|
1537
|
+
end: o ? "left" : "right",
|
|
1538
|
+
center: "left",
|
|
1539
|
+
start: o ? "right" : "left"
|
|
1540
|
+
}[t || "end"];
|
|
1541
|
+
}, Pt = (e) => ({
|
|
1542
|
+
top: "top",
|
|
1543
|
+
middle: "top",
|
|
1544
|
+
bottom: "bottom"
|
|
1545
|
+
})[e.vertical || "bottom"], Bt = 2, Mt = 100, Ge = n.forwardRef((e, o) => {
|
|
1546
|
+
R(O);
|
|
1547
|
+
const {
|
|
1548
|
+
align: t = Y.align,
|
|
1549
|
+
alignOffset: i,
|
|
1550
|
+
className: a,
|
|
1551
|
+
disabled: l,
|
|
1552
|
+
icon: u,
|
|
1553
|
+
svgIcon: c,
|
|
1554
|
+
iconClass: g,
|
|
1555
|
+
id: v,
|
|
1556
|
+
items: h,
|
|
1557
|
+
item: D,
|
|
1558
|
+
text: N,
|
|
1559
|
+
positionMode: w = Y.positionMode,
|
|
1560
|
+
size: S = Y.size,
|
|
1561
|
+
style: F,
|
|
1562
|
+
rounded: I = Y.rounded,
|
|
1563
|
+
themeColor: E = Y.themeColor,
|
|
1564
|
+
overlayStyle: p,
|
|
1565
|
+
tabIndex: T,
|
|
1566
|
+
accessKey: K,
|
|
1567
|
+
popupSettings: P = {},
|
|
1568
|
+
modal: L,
|
|
1569
|
+
onClick: $,
|
|
1570
|
+
onItemClick: V,
|
|
1571
|
+
onFocus: Z,
|
|
1572
|
+
onBlur: oe,
|
|
1573
|
+
onKeyDown: q,
|
|
1574
|
+
onOpen: ie,
|
|
1575
|
+
onClose: G,
|
|
1576
|
+
..._
|
|
1577
|
+
} = e, ae = lt(), le = ae ? ae + Bt : Mt, X = n.useRef(null), y = n.useRef(null), be = n.useRef(null), ge = n.useRef(null), re = n.useCallback(
|
|
1578
|
+
() => {
|
|
1579
|
+
y.current && y.current.focus();
|
|
1580
|
+
},
|
|
1581
|
+
[]
|
|
1582
|
+
), m = n.useCallback(
|
|
1583
|
+
() => ({
|
|
1584
|
+
element: y.current,
|
|
1585
|
+
focus: re
|
|
1586
|
+
}),
|
|
1587
|
+
[re]
|
|
1588
|
+
);
|
|
1589
|
+
n.useImperativeHandle(X, m), n.useImperativeHandle(o, () => X.current);
|
|
1590
|
+
const [k, z] = n.useState(!1), [ce, H] = n.useState(!1), [J, C] = n.useState(-1), Xe = n.useMemo(() => me(), []), ke = De(y, e.dir), Q = ke === "rtl", de = n.useMemo(() => me(), []);
|
|
1591
|
+
n.useEffect(
|
|
1592
|
+
() => {
|
|
1593
|
+
Ft(y, t, i, Q);
|
|
1594
|
+
},
|
|
1595
|
+
[y, t, i, Q]
|
|
1596
|
+
), n.useEffect(
|
|
1597
|
+
() => {
|
|
1598
|
+
ce && y && y.current && y.current.focus();
|
|
1599
|
+
},
|
|
1600
|
+
[ce, y]
|
|
1601
|
+
);
|
|
1602
|
+
const U = n.useCallback(
|
|
1603
|
+
(d, b) => {
|
|
1604
|
+
h && x(
|
|
1605
|
+
b ? ie : G,
|
|
1606
|
+
d,
|
|
1607
|
+
m(),
|
|
1608
|
+
void 0
|
|
1609
|
+
);
|
|
1610
|
+
},
|
|
1611
|
+
[ie, G, h]
|
|
1612
|
+
), Fe = n.useCallback(
|
|
1613
|
+
(d) => {
|
|
1614
|
+
!d.target || l || (!h && $ ? x(
|
|
1615
|
+
$,
|
|
1616
|
+
d,
|
|
1617
|
+
m(),
|
|
1618
|
+
void 0
|
|
1619
|
+
) : (z(!k), H(!0), C(k ? -1 : 0), U(d, !k)));
|
|
1620
|
+
},
|
|
1621
|
+
[
|
|
1622
|
+
z,
|
|
1623
|
+
H,
|
|
1624
|
+
C,
|
|
1625
|
+
$,
|
|
1626
|
+
U,
|
|
1627
|
+
k,
|
|
1628
|
+
h,
|
|
1629
|
+
l
|
|
1630
|
+
]
|
|
1631
|
+
), Je = n.useCallback(
|
|
1632
|
+
(d) => {
|
|
1633
|
+
H(!0), C(k ? 0 : -1), Z && x(
|
|
1634
|
+
Z,
|
|
1635
|
+
d,
|
|
1636
|
+
m(),
|
|
1637
|
+
void 0
|
|
1638
|
+
);
|
|
1639
|
+
},
|
|
1640
|
+
[Z, H, C]
|
|
1641
|
+
), Qe = n.useCallback(
|
|
1642
|
+
(d) => {
|
|
1643
|
+
H(!1), z(!1), C(-1), x(
|
|
1644
|
+
oe,
|
|
1645
|
+
d,
|
|
1646
|
+
m(),
|
|
1647
|
+
void 0
|
|
1648
|
+
), k && U(d, !1);
|
|
1649
|
+
},
|
|
1650
|
+
[oe, H, z, C, U]
|
|
1651
|
+
), Ye = n.useCallback(
|
|
1652
|
+
(d) => {
|
|
1653
|
+
d.preventDefault();
|
|
1654
|
+
},
|
|
1655
|
+
[]
|
|
1656
|
+
), ye = n.useCallback(
|
|
1657
|
+
(d, b) => {
|
|
1658
|
+
h && (h[b].disabled || x(
|
|
1659
|
+
V,
|
|
1660
|
+
d,
|
|
1661
|
+
m(),
|
|
1662
|
+
{
|
|
1663
|
+
itemProps: h[b],
|
|
1664
|
+
itemIndex: b
|
|
1665
|
+
}
|
|
1666
|
+
));
|
|
1667
|
+
},
|
|
1668
|
+
[V]
|
|
1669
|
+
), et = n.useCallback(
|
|
1670
|
+
(d, b) => {
|
|
1671
|
+
!d.target || !h || (C(b), z(!1), ye(d, b), U(d, !1));
|
|
1672
|
+
},
|
|
1673
|
+
[C, z, ye, U]
|
|
1674
|
+
), tt = n.useCallback(
|
|
1675
|
+
(d) => {
|
|
1676
|
+
se(document) === y.current && d.preventDefault();
|
|
1677
|
+
},
|
|
1678
|
+
[y]
|
|
1679
|
+
), st = n.useCallback(
|
|
1680
|
+
(d) => {
|
|
1681
|
+
const b = J, ve = h ? h.length : -1;
|
|
1682
|
+
if (d.altKey) {
|
|
1683
|
+
!k && d.keyCode === r.down && (d.preventDefault(), z(!0), C(0)), k && d.keyCode === r.up && (d.preventDefault(), z(!1), C(-1));
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
switch (d.keyCode) {
|
|
1687
|
+
case r.enter:
|
|
1688
|
+
case r.space:
|
|
1689
|
+
b >= 0 && ye(d, b), h || Fe(d), d.preventDefault(), z(!k), C(k ? -1 : 0);
|
|
1690
|
+
break;
|
|
1691
|
+
case r.esc:
|
|
1692
|
+
d.preventDefault(), z(!1), C(-1);
|
|
1693
|
+
break;
|
|
1694
|
+
case r.home:
|
|
1695
|
+
d.preventDefault(), C(0);
|
|
1696
|
+
break;
|
|
1697
|
+
case r.end:
|
|
1698
|
+
d.preventDefault(), C(ve - 1);
|
|
1699
|
+
break;
|
|
1700
|
+
case r.down:
|
|
1701
|
+
case r.right:
|
|
1702
|
+
d.preventDefault(), C(b + 1 >= ve ? 0 : b + 1);
|
|
1703
|
+
break;
|
|
1704
|
+
case r.up:
|
|
1705
|
+
case r.left:
|
|
1706
|
+
d.preventDefault(), C(b - 1 < 0 ? ve - 1 : b - 1);
|
|
1707
|
+
break;
|
|
1708
|
+
}
|
|
1709
|
+
x(
|
|
1710
|
+
q,
|
|
1711
|
+
d,
|
|
1712
|
+
m(),
|
|
1713
|
+
void 0
|
|
1714
|
+
);
|
|
1715
|
+
},
|
|
1716
|
+
[q, J, C, Q, z]
|
|
1717
|
+
), nt = n.useMemo(
|
|
1718
|
+
() => f(
|
|
1719
|
+
"k-fab k-fab-solid",
|
|
1720
|
+
{
|
|
1721
|
+
"k-fab-sm": S === "small",
|
|
1722
|
+
"k-fab-md": S === "medium",
|
|
1723
|
+
"k-fab-lg": S === "large",
|
|
1724
|
+
"k-disabled": l,
|
|
1725
|
+
"k-pos-absolute": w === "absolute",
|
|
1726
|
+
"k-pos-fixed": w === "fixed",
|
|
1727
|
+
"k-focus": ce,
|
|
1728
|
+
[`k-rounded-${B.roundedMap[I] || I}`]: I,
|
|
1729
|
+
[`k-fab-solid-${E}`]: E
|
|
1730
|
+
},
|
|
1731
|
+
`k-${t.vertical}-${t.horizontal}`,
|
|
1732
|
+
a
|
|
1733
|
+
),
|
|
1734
|
+
[E, S, I, l, w, t, ce, a]
|
|
1735
|
+
), ot = h && h.map((d, b) => /* @__PURE__ */ n.createElement(
|
|
1736
|
+
Se,
|
|
1737
|
+
{
|
|
1738
|
+
...d,
|
|
1739
|
+
key: b,
|
|
1740
|
+
index: b,
|
|
1741
|
+
id: `${de}-${b}`,
|
|
1742
|
+
disabled: l || d.disabled,
|
|
1743
|
+
focused: J === b,
|
|
1744
|
+
dataItem: d,
|
|
1745
|
+
item: D,
|
|
1746
|
+
className: f(
|
|
1747
|
+
d.className,
|
|
1748
|
+
St(ke || "ltr", t.horizontal)
|
|
1749
|
+
),
|
|
1750
|
+
onClick: et,
|
|
1751
|
+
onDown: tt
|
|
1752
|
+
}
|
|
1753
|
+
)), ze = !!((u || c) && !N), it = y.current ? y.current.offsetWidth : 0, at = 32, Pe = it / 2 - at / 2;
|
|
1754
|
+
return /* @__PURE__ */ n.createElement(rt.Provider, { value: le }, /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1755
|
+
"button",
|
|
1756
|
+
{
|
|
1757
|
+
ref: y,
|
|
1758
|
+
id: v || Xe,
|
|
1759
|
+
role: "button",
|
|
1760
|
+
type: "button",
|
|
1761
|
+
"aria-disabled": l,
|
|
1762
|
+
"aria-expanded": h ? k : void 0,
|
|
1763
|
+
"aria-haspopup": !!h,
|
|
1764
|
+
"aria-label": `${N || ""} floatingactionbutton`,
|
|
1765
|
+
"aria-owns": h ? de : void 0,
|
|
1766
|
+
"aria-activedescendant": J >= 0 && h ? `${de}-${J}` : void 0,
|
|
1767
|
+
tabIndex: fe(T, l),
|
|
1768
|
+
accessKey: K,
|
|
1769
|
+
dir: ke,
|
|
1770
|
+
disabled: l,
|
|
1771
|
+
className: nt,
|
|
1772
|
+
style: F,
|
|
1773
|
+
onClick: Fe,
|
|
1774
|
+
onMouseDown: Ye,
|
|
1775
|
+
onFocus: Je,
|
|
1776
|
+
onBlur: Qe,
|
|
1777
|
+
onKeyDown: st,
|
|
1778
|
+
..._
|
|
1779
|
+
},
|
|
1780
|
+
u || c ? /* @__PURE__ */ n.createElement(A, { className: "k-fab-icon", name: u, icon: c }) : g ? /* @__PURE__ */ n.createElement("span", { role: "presentation", className: g }) : null,
|
|
1781
|
+
N && /* @__PURE__ */ n.createElement("span", { className: "k-fab-text" }, N)
|
|
1782
|
+
), L && k && /* @__PURE__ */ n.createElement(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
className: "k-overlay",
|
|
1786
|
+
style: {
|
|
1787
|
+
zIndex: le,
|
|
1788
|
+
...p
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
), /* @__PURE__ */ n.createElement(
|
|
1792
|
+
we,
|
|
1793
|
+
{
|
|
1794
|
+
ref: ge,
|
|
1795
|
+
anchor: y.current,
|
|
1796
|
+
show: k,
|
|
1797
|
+
animate: P.animate,
|
|
1798
|
+
popupClass: f("k-popup-transparent k-fab-popup", P.popupClass),
|
|
1799
|
+
anchorAlign: P.anchorAlign || Et(t, Q),
|
|
1800
|
+
popupAlign: P.popupAlign || Nt(t, Q),
|
|
1801
|
+
style: { boxShadow: "none" }
|
|
1802
|
+
},
|
|
1803
|
+
/* @__PURE__ */ n.createElement(
|
|
1804
|
+
"ul",
|
|
1805
|
+
{
|
|
1806
|
+
ref: be,
|
|
1807
|
+
role: "menu",
|
|
1808
|
+
"aria-labelledby": v,
|
|
1809
|
+
id: de,
|
|
1810
|
+
className: f("k-fab-items", {
|
|
1811
|
+
"k-fab-items-bottom": t.vertical !== "bottom",
|
|
1812
|
+
"k-fab-items-top": t.vertical === "bottom"
|
|
1813
|
+
}),
|
|
1814
|
+
style: {
|
|
1815
|
+
paddingLeft: ze ? Pe : void 0,
|
|
1816
|
+
paddingRight: ze ? Pe : void 0
|
|
1817
|
+
}
|
|
1818
|
+
},
|
|
1819
|
+
ot
|
|
1820
|
+
)
|
|
1821
|
+
)));
|
|
1822
|
+
});
|
|
1823
|
+
Ge.propTypes = {
|
|
1824
|
+
className: s.string,
|
|
1825
|
+
style: s.object,
|
|
1826
|
+
id: s.string,
|
|
1827
|
+
dir: s.string,
|
|
1828
|
+
tabIndex: s.number,
|
|
1829
|
+
accessKey: s.string,
|
|
1830
|
+
disabled: s.bool,
|
|
1831
|
+
icon: s.string,
|
|
1832
|
+
svgIcon: M,
|
|
1833
|
+
iconClass: s.string,
|
|
1834
|
+
text: s.string,
|
|
1835
|
+
alignOffset: s.shape({
|
|
1836
|
+
x: s.oneOfType([s.number, s.string]),
|
|
1837
|
+
y: s.oneOfType([s.number, s.string])
|
|
1838
|
+
}),
|
|
1839
|
+
align: s.shape({
|
|
1840
|
+
vertical: s.oneOf(["top", "middle", "bottom"]),
|
|
1841
|
+
horizontal: s.oneOf(["start", "center", "end"])
|
|
1842
|
+
}),
|
|
1843
|
+
positionMode: s.oneOf(["absolute", "fixed"]),
|
|
1844
|
+
size: s.oneOf([null, "small", "medium", "large"]),
|
|
1845
|
+
rounded: s.oneOf([null, "small", "medium", "large", "full"]),
|
|
1846
|
+
themeColor: s.oneOf([
|
|
1847
|
+
null,
|
|
1848
|
+
"primary",
|
|
1849
|
+
"secondary",
|
|
1850
|
+
"tertiary",
|
|
1851
|
+
"info",
|
|
1852
|
+
"success",
|
|
1853
|
+
"warning",
|
|
1854
|
+
"error",
|
|
1855
|
+
"dark",
|
|
1856
|
+
"light",
|
|
1857
|
+
"inverse"
|
|
1858
|
+
]),
|
|
1859
|
+
modal: s.bool,
|
|
1860
|
+
overlayStyle: s.object
|
|
1861
|
+
};
|
|
1862
|
+
const Y = {
|
|
1863
|
+
align: { vertical: "bottom", horizontal: "end" },
|
|
1864
|
+
size: "medium",
|
|
1865
|
+
rounded: "full",
|
|
1866
|
+
themeColor: "primary",
|
|
1867
|
+
positionMode: "fixed"
|
|
1868
|
+
};
|
|
1869
|
+
Ge.displayName = "KendoFloatingActionButton";
|
|
1870
|
+
export {
|
|
1871
|
+
ne as Button,
|
|
1872
|
+
ft as ButtonGroup,
|
|
1873
|
+
j as Chip,
|
|
1874
|
+
Ne as ChipList,
|
|
1875
|
+
He as DropDownButton,
|
|
1876
|
+
_e as DropDownButtonItem,
|
|
1877
|
+
Ge as FloatingActionButton,
|
|
1878
|
+
Se as FloatingActionButtonItem,
|
|
1879
|
+
Le as SplitButton,
|
|
1880
|
+
Ke as SplitButtonItem,
|
|
1881
|
+
Ue as Toolbar,
|
|
1882
|
+
bt as ToolbarItem,
|
|
1883
|
+
At as ToolbarSeparator,
|
|
1884
|
+
We as ToolbarSpacer,
|
|
1885
|
+
pt as toolbarButtons
|
|
1886
|
+
};
|