@progress/kendo-react-buttons 13.3.0 → 13.4.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button.d.ts +114 -0
- package/Button.js +1 -1
- package/Button.mjs +42 -44
- package/ButtonGroup.d.ts +47 -0
- package/ButtonGroupInterface.d.ts +39 -0
- package/ButtonInterface.d.ts +49 -0
- package/Chip/Chip.d.ts +425 -0
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +43 -39
- package/Chip/ChipList.d.ts +221 -0
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +40 -41
- package/Chip/chip-list-contexts.d.ts +20 -0
- package/Chip/data-reducer.d.ts +29 -0
- package/Chip/focus-reducer.d.ts +31 -0
- package/Chip/selection-reducer.d.ts +37 -0
- package/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +85 -85
- package/FloatingActionButton/FloatingActionButtonItem.d.ts +132 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +20 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +31 -0
- package/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +354 -0
- package/FloatingActionButton/models/align-offset.d.ts +27 -0
- package/FloatingActionButton/models/align.d.ts +34 -0
- package/FloatingActionButton/models/events.d.ts +28 -0
- package/FloatingActionButton/models/position-mode.d.ts +16 -0
- package/FloatingActionButton/models/rounded.d.ts +19 -0
- package/FloatingActionButton/models/size.d.ts +18 -0
- package/FloatingActionButton/models/theme-color.d.ts +25 -0
- package/FloatingActionButton/utils.d.ts +34 -0
- package/ListButton/ButtonItem.d.ts +72 -0
- package/ListButton/DropDownButton.d.ts +153 -0
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +62 -46
- package/ListButton/DropDownButtonItem.d.ts +37 -0
- package/ListButton/SplitButton.d.ts +142 -0
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +29 -13
- package/ListButton/SplitButtonItem.d.ts +32 -0
- package/ListButton/models/ButtonItem.d.ts +41 -0
- package/ListButton/models/ListButtonProps.d.ts +411 -0
- package/ListButton/models/PopupSettings.d.ts +35 -0
- package/ListButton/models/events.d.ts +59 -0
- package/ListButton/utils/navigation.d.ts +12 -0
- package/ListButton/utils/popup.d.ts +16 -0
- package/SpeechToTextButton/SpeechToTextButton.d.ts +36 -0
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +24 -24
- package/SpeechToTextButton/interfaces/SpeechToTextButtonHandle.d.ts +28 -0
- package/SpeechToTextButton/interfaces/SpeechToTextButtonProps.d.ts +117 -0
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/index.d.mts +43 -2928
- package/index.d.ts +43 -2928
- package/messages/index.d.ts +22 -0
- package/models/index.d.ts +95 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +5 -5
- package/toolbar/Toolbar.d.ts +38 -0
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +15 -15
- package/toolbar/events/ToolbarResizeEvent.d.ts +29 -0
- package/toolbar/interfaces/ToolbarHandle.d.ts +21 -0
- package/toolbar/interfaces/ToolbarOverflowProps.d.ts +50 -0
- package/toolbar/interfaces/ToolbarProps.d.ts +128 -0
- package/toolbar/messages/index.d.ts +27 -0
- package/toolbar/tools/ToolbarItem.d.ts +47 -0
- package/toolbar/tools/ToolbarOverflowSection.d.ts +21 -0
- package/toolbar/tools/ToolbarScrollButton.d.ts +23 -0
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +11 -20
- package/toolbar/tools/ToolbarScrollable.d.ts +28 -0
- package/toolbar/tools/ToolbarSeparator.d.ts +22 -0
- package/toolbar/tools/ToolbarSpacer.d.ts +30 -0
- package/util.d.ts +31 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { DropDownButtonProps } from './models/ListButtonProps.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export interface DropDownButtonState {
|
|
15
|
+
focusedIndex?: number;
|
|
16
|
+
focused?: boolean;
|
|
17
|
+
opened: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export declare class DropDownButtonWithoutContext extends React.Component<DropDownButtonProps, DropDownButtonState> {
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
static propTypes: {
|
|
27
|
+
accessKey: PropTypes.Requireable<string>;
|
|
28
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
29
|
+
title: PropTypes.Requireable<string>;
|
|
30
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
+
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
+
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
+
items: PropTypes.Requireable<any[]>;
|
|
37
|
+
textField: PropTypes.Requireable<string>;
|
|
38
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
39
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
40
|
+
icon: PropTypes.Requireable<string>;
|
|
41
|
+
svgIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
42
|
+
name: PropTypes.Validator<string>;
|
|
43
|
+
content: PropTypes.Validator<string>;
|
|
44
|
+
viewBox: PropTypes.Validator<string>;
|
|
45
|
+
}>>;
|
|
46
|
+
iconClass: PropTypes.Requireable<string>;
|
|
47
|
+
imageUrl: PropTypes.Requireable<string>;
|
|
48
|
+
popupSettings: PropTypes.Requireable<object>;
|
|
49
|
+
itemRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
50
|
+
item: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
+
className: PropTypes.Requireable<string>;
|
|
52
|
+
buttonClass: PropTypes.Requireable<string>;
|
|
53
|
+
dir: PropTypes.Requireable<string>;
|
|
54
|
+
size: PropTypes.Requireable<string>;
|
|
55
|
+
rounded: PropTypes.Requireable<string>;
|
|
56
|
+
fillMode: PropTypes.Requireable<string>;
|
|
57
|
+
themeColor: PropTypes.Requireable<string>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @hidden
|
|
61
|
+
*/
|
|
62
|
+
static defaultProps: {
|
|
63
|
+
size: undefined;
|
|
64
|
+
rounded: undefined;
|
|
65
|
+
fillMode: undefined;
|
|
66
|
+
themeColor: undefined;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
readonly state: {
|
|
72
|
+
opened: boolean;
|
|
73
|
+
focused: boolean;
|
|
74
|
+
focusedIndex: number;
|
|
75
|
+
};
|
|
76
|
+
private mainButton;
|
|
77
|
+
private list;
|
|
78
|
+
private skipFocus;
|
|
79
|
+
private get guid();
|
|
80
|
+
private readonly showLicenseWatermark;
|
|
81
|
+
private readonly licenseMessage?;
|
|
82
|
+
private buttonsData;
|
|
83
|
+
private openedDuringOnChange?;
|
|
84
|
+
private get opened();
|
|
85
|
+
constructor(props: DropDownButtonProps);
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
render(): React.JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
componentDidMount(): void;
|
|
94
|
+
/**
|
|
95
|
+
* The DOM element of main button.
|
|
96
|
+
*/
|
|
97
|
+
get element(): HTMLButtonElement | null;
|
|
98
|
+
private onKeyDown;
|
|
99
|
+
private switchFocus;
|
|
100
|
+
private handleFocus;
|
|
101
|
+
private handleButtonBlur;
|
|
102
|
+
private handleMenuBlur;
|
|
103
|
+
private setOpen;
|
|
104
|
+
private onItemClick;
|
|
105
|
+
private onItemDown;
|
|
106
|
+
private mouseDown;
|
|
107
|
+
private dispatchClickEvent;
|
|
108
|
+
private renderPopup;
|
|
109
|
+
private onPopupClose;
|
|
110
|
+
private listRef;
|
|
111
|
+
private renderChildItems;
|
|
112
|
+
private onClickMainButton;
|
|
113
|
+
private dispatchPopupEvent;
|
|
114
|
+
private isItemDisabled;
|
|
115
|
+
private isRtl;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Represents the PropsContext of the `DropDownButton` component.
|
|
119
|
+
* Used for global configuration of all `DropDownButton` instances.
|
|
120
|
+
*/
|
|
121
|
+
export declare const DropDownButtonPropsContext: React.Context<(p: DropDownButtonProps) => DropDownButtonProps>;
|
|
122
|
+
/**
|
|
123
|
+
* Represent the `ref` of the DropDownButton component.
|
|
124
|
+
*/
|
|
125
|
+
export interface DropDownButtonHandle extends Pick<DropDownButtonWithoutContext, keyof DropDownButtonWithoutContext> {
|
|
126
|
+
/**
|
|
127
|
+
* The DOM element of main button.
|
|
128
|
+
*/
|
|
129
|
+
element: HTMLButtonElement | null;
|
|
130
|
+
/**
|
|
131
|
+
* The props of the DropDownButtonHandle component.
|
|
132
|
+
*/
|
|
133
|
+
props: Readonly<DropDownButtonProps>;
|
|
134
|
+
}
|
|
135
|
+
/** @hidden */
|
|
136
|
+
export type DropDownButton = DropDownButtonHandle;
|
|
137
|
+
/**
|
|
138
|
+
* Represents the [KendoReact DropDownButton component](https://www.telerik.com/kendo-react-ui/components/buttons/dropdownbutton).
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```jsx
|
|
142
|
+
* const App = () => {
|
|
143
|
+
* return (
|
|
144
|
+
* <DropDownButton text="Act">
|
|
145
|
+
* <DropDownButtonItem text="Item1" />
|
|
146
|
+
* <DropDownButtonItem text="Item2" />
|
|
147
|
+
* <DropDownButtonItem text="Item3" />
|
|
148
|
+
* </DropDownButton>
|
|
149
|
+
* );
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export declare const DropDownButton: React.ForwardRefExoticComponent<DropDownButtonProps & React.RefAttributes<any>>;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),i=require("prop-types"),M=require("../Button.js"),e=require("@progress/kendo-react-common"),R=require("./utils/navigation.js"),A=require("./DropDownButtonItem.js"),T=require("./ButtonItem.js"),q=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),f=require("../package-metadata.js");function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),i=require("prop-types"),M=require("../Button.js"),e=require("@progress/kendo-react-common"),R=require("./utils/navigation.js"),A=require("./DropDownButtonItem.js"),T=require("./ButtonItem.js"),q=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),f=require("../package-metadata.js");function z(c){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(o,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return o.default=c,Object.freeze(o)}const u=z(N),L=12e3,j=2e3,h=class h extends u.Component{constructor(o){super(o),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.showLicenseWatermark=!1,this.buttonsData=[],this.onKeyDown=t=>{const{focusedIndex:s}=this.state;if(t.altKey){!this.opened&&t.keyCode===e.Keys.down?(t.preventDefault(),this.setOpen(!0,t),this.setState({focusedIndex:0})):this.opened&&t.keyCode===e.Keys.up&&(t.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,t));return}const n={...this.state};if(t.keyCode===e.Keys.enter||t.keyCode===e.Keys.space){t.preventDefault(),s>=0&&this.dispatchClickEvent(t,s);const a=!this.opened;this.setState({focused:!0,focusedIndex:a?0:-1}),this.setOpen(a,t);return}if(this.opened&&t.keyCode===e.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,t);return}if(this.opened){const a=R.navigate(s,t.keyCode,t.altKey,this.buttonsData.length);n.focusedIndex=a;const l=t.keyCode===e.Keys.up||t.keyCode===e.Keys.down||t.keyCode===e.Keys.left||t.keyCode===e.Keys.right;!t.altKey&&(l||t.keyCode===e.Keys.home||t.keyCode===e.Keys.end)&&t.preventDefault()}this.setState(n)},this.switchFocus=t=>{this.skipFocus=!0,t(),window.setTimeout(()=>this.skipFocus=!1,0)},this.handleFocus=t=>{this.skipFocus||(this.setState({focused:!0,focusedIndex:this.opened?0:-1}),e.dispatchEvent(this.props.onFocus,t,this,void 0))},this.handleButtonBlur=t=>{this.opened||(this.setState({focused:!1}),e.dispatchEvent(this.props.onBlur,t,this,void 0))},this.handleMenuBlur=t=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),e.dispatchEvent(this.props.onBlur,t,this,void 0),setTimeout(()=>{this.setOpen(!1,t)},0))},this.setOpen=(t,s)=>{this.opened!==t&&(this.openedDuringOnChange=t,this.setState({opened:t}),s?this.dispatchPopupEvent(s,t):this.openedDuringOnChange=void 0)},this.onItemClick=(t,s)=>{this.setState({focusedIndex:-1}),this.dispatchClickEvent(t,s),this.setOpen(!1,t)},this.onItemDown=t=>{e.getActiveElement(document)===this.list&&t.preventDefault()},this.mouseDown=t=>{t.preventDefault();const s=e.getActiveElement(document);this.element&&s!==this.element&&s!==this.list&&this.element.focus()},this.onPopupClose=t=>{var n;const s=e.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||(n=this.list)!=null&&n.contains(s))&&this.switchFocus(()=>{this.element&&this.element.focus({preventScroll:!0})}),this.props.popupSettings&&this.props.popupSettings.onClose&&this.props.popupSettings.onClose.call(void 0,t)},this.listRef=t=>{this.list=t,t&&this.state.focused&&this.switchFocus(()=>{t.focus({preventScroll:!0}),this.element&&(this.element.tabIndex=-1)})},this.onClickMainButton=t=>{if(e.dispatchEvent(this.props.onClick,t,this,void 0),!this.buttonsData.length)return;const s=!this.opened;this.setState({focused:!0,focusedIndex:s?0:-1}),this.setOpen(s,t)},this.dispatchPopupEvent=(t,s)=>{e.dispatchEvent(s?this.props.onOpen:this.props.onClose,t,this,void 0),this.openedDuringOnChange=void 0},this.showLicenseWatermark=!e.validatePackage(f.packageMetadata,{component:"DropDownButton"}),this.licenseMessage=e.getLicenseMessage(f.packageMetadata)}get guid(){return this.props.id+"-accessibility-id"}get opened(){return this.openedDuringOnChange!==void 0?this.openedDuringOnChange:this.props.opened===void 0?this.state.opened:this.props.opened}render(){const o=this.isRtl(),t=this.props.unstyled&&this.props.unstyled.uDropDownButton,s=o?"rtl":void 0,{id:n,style:a,tabIndex:l,disabled:r,size:y,rounded:C,fillMode:k,themeColor:w,ariaLabel:I,title:b,accessKey:B,icon:O,svgIcon:v,iconClass:E,buttonClass:S,className:x,imageUrl:P,startIcon:K,endIcon:F}=this.props;return this.buttonsData=this.props.items||u.Children.toArray(this.props.children).filter(p=>p&&p.type===A.DropDownButtonItem).map(p=>p.props),u.createElement(u.Fragment,null,u.createElement(M.Button,{id:n,size:y,style:a,rounded:C,fillMode:k,themeColor:w,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":r?"true":void 0,tabIndex:l,accessKey:B,icon:O,svgIcon:v,iconClass:E,className:e.classNames(S,x,e.uDropDownButton.wrapper({c:t,focused:this.state.focused,disabled:r})),imageUrl:P,dir:s,ref:p=>{this.mainButton=(p==null?void 0:p.element)||null},type:"button","aria-expanded":this.opened?"true":"false","aria-label":I,"aria-controls":this.opened?this.guid:void 0,title:b,startIcon:K,endIcon:F},this.props.text),this.showLicenseWatermark&&u.createElement(e.WatermarkOverlay,{message:this.licenseMessage}),this.renderPopup(o))}componentDidMount(){(this.props.dir===void 0&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(o,t){this.isItemDisabled(t)||e.dispatchEvent(this.props.onItemClick,o,this,{item:this.buttonsData[t],itemIndex:t})}renderPopup(o){const{popupSettings:t={},_zIndex:s,unstyled:n}=this.props,a=s?s+j:L,l=n&&n.uDropDownButton,{focusedIndex:r}=this.state;return u.createElement(e.ZIndexContext.Provider,{value:a},u.createElement(q.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:e.classNames(e.uDropDownButton.popup({c:l}),t.popupClass),anchorAlign:t.anchorAlign||m.getAnchorAlign(o),popupAlign:t.popupAlign||m.getPopupAlign(o),style:o?{direction:"rtl"}:void 0,onClose:this.onPopupClose},u.createElement("ul",{role:"list",id:this.guid,tabIndex:-1,"aria-activedescendant":r>=0?`${this.guid}-${r}`:void 0,ref:this.listRef,onKeyDown:this.onKeyDown,onBlur:this.handleMenuBlur,className:e.classNames(e.uDropDownButton.ul({c:l,size:this.props.size}))},this.renderChildItems())))}renderChildItems(){const{item:o,itemRender:t,textField:s,unstyled:n}=this.props,a=n&&n.uDropDownButton;return this.buttonsData.length>0?this.buttonsData.map((l,r)=>u.createElement(T.ButtonItem,{className:e.classNames(e.uDropDownButton.item({c:a}),l.className,{"k-first":r===0},{"k-last":r===this.buttonsData.length-1}),dataItem:l,textField:s,focused:this.state.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:o,index:r,key:r,id:`${this.guid}-${r}`})):null}isItemDisabled(o){return this.buttonsData[o]?this.buttonsData[o].disabled:this.props.disabled}isRtl(){return this.props.dir!==void 0?this.props.dir==="rtl":!!this.mainButton&&getComputedStyle(this.mainButton).direction==="rtl"}};h.propTypes={accessKey:i.string,ariaLabel:i.string,title:i.string,onFocus:i.func,onBlur:i.func,onClick:i.func,onItemClick:i.func,onOpen:i.func,onClose:i.func,items:i.arrayOf(i.any),textField:i.string,tabIndex:i.number,disabled:i.bool,icon:i.string,svgIcon:e.svgIconPropType,iconClass:i.string,imageUrl:i.string,popupSettings:i.object,itemRender:i.func,item:i.func,className:i.string,buttonClass:i.string,dir:i.string,size:i.oneOf(["small","medium","large"]),rounded:i.oneOf(["small","medium","large","full"]),fillMode:i.oneOf(["flat","link","outline","solid","clear"]),themeColor:i.oneOf(["base","primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"])},h.defaultProps={size:void 0,rounded:void 0,fillMode:void 0,themeColor:void 0};let d=h;const g=e.createPropsContext(),D=e.withIdHOC(e.withPropsContext(g,e.withUnstyledHOC(e.withZIndexContext(d))));D.displayName="KendoReactDropDownButton";exports.DropDownButton=D;exports.DropDownButtonPropsContext=g;exports.DropDownButtonWithoutContext=d;
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
import * as p from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
10
|
import { Button as K } from "../Button.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { withIdHOC as M, withPropsContext as A, createPropsContext as R, withUnstyledHOC as T, withZIndexContext as L, Keys as r, dispatchEvent as d, getActiveElement as f, validatePackage as z, getLicenseMessage as U, svgIconPropType as Z, classNames as u, uDropDownButton as c, WatermarkOverlay as $, ZIndexContext as W } from "@progress/kendo-react-common";
|
|
12
12
|
import { navigate as _ } from "./utils/navigation.mjs";
|
|
13
13
|
import { DropDownButtonItem as H } from "./DropDownButtonItem.mjs";
|
|
14
14
|
import { ButtonItem as X } from "./ButtonItem.mjs";
|
|
15
15
|
import { Popup as j } from "@progress/kendo-react-popup";
|
|
16
|
-
import {
|
|
16
|
+
import { getPopupAlign as q, getAnchorAlign as G } from "./utils/popup.mjs";
|
|
17
17
|
import { packageMetadata as C } from "../package-metadata.mjs";
|
|
18
18
|
const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
19
19
|
constructor(i) {
|
|
@@ -44,18 +44,18 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
44
44
|
if (this.opened) {
|
|
45
45
|
const a = _(e, t.keyCode, t.altKey, this.buttonsData.length);
|
|
46
46
|
o.focusedIndex = a;
|
|
47
|
-
const
|
|
48
|
-
!t.altKey && (
|
|
47
|
+
const l = t.keyCode === r.up || t.keyCode === r.down || t.keyCode === r.left || t.keyCode === r.right;
|
|
48
|
+
!t.altKey && (l || t.keyCode === r.home || t.keyCode === r.end) && t.preventDefault();
|
|
49
49
|
}
|
|
50
50
|
this.setState(o);
|
|
51
51
|
}, this.switchFocus = (t) => {
|
|
52
52
|
this.skipFocus = !0, t(), window.setTimeout(() => this.skipFocus = !1, 0);
|
|
53
53
|
}, this.handleFocus = (t) => {
|
|
54
|
-
this.skipFocus || (this.setState({ focused: !0, focusedIndex: this.opened ? 0 : -1 }),
|
|
54
|
+
this.skipFocus || (this.setState({ focused: !0, focusedIndex: this.opened ? 0 : -1 }), d(this.props.onFocus, t, this, void 0));
|
|
55
55
|
}, this.handleButtonBlur = (t) => {
|
|
56
|
-
this.opened || (this.setState({ focused: !1 }),
|
|
56
|
+
this.opened || (this.setState({ focused: !1 }), d(this.props.onBlur, t, this, void 0));
|
|
57
57
|
}, this.handleMenuBlur = (t) => {
|
|
58
|
-
this.skipFocus || (this.setState({ focused: !1, focusedIndex: -1 }),
|
|
58
|
+
this.skipFocus || (this.setState({ focused: !1, focusedIndex: -1 }), d(this.props.onBlur, t, this, void 0), setTimeout(() => {
|
|
59
59
|
this.setOpen(!1, t);
|
|
60
60
|
}, 0));
|
|
61
61
|
}, this.setOpen = (t, e) => {
|
|
@@ -79,7 +79,7 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
79
79
|
t.focus({ preventScroll: !0 }), this.element && (this.element.tabIndex = -1);
|
|
80
80
|
});
|
|
81
81
|
}, this.onClickMainButton = (t) => {
|
|
82
|
-
if (
|
|
82
|
+
if (d(this.props.onClick, t, this, void 0), !this.buttonsData.length)
|
|
83
83
|
return;
|
|
84
84
|
const e = !this.opened;
|
|
85
85
|
this.setState({
|
|
@@ -87,8 +87,8 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
87
87
|
focusedIndex: e ? 0 : -1
|
|
88
88
|
}), this.setOpen(e, t);
|
|
89
89
|
}, this.dispatchPopupEvent = (t, e) => {
|
|
90
|
-
|
|
91
|
-
}, this.showLicenseWatermark = !
|
|
90
|
+
d(e ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
|
|
91
|
+
}, this.showLicenseWatermark = !z(C, { component: "DropDownButton" }), this.licenseMessage = U(C);
|
|
92
92
|
}
|
|
93
93
|
get guid() {
|
|
94
94
|
return this.props.id + "-accessibility-id";
|
|
@@ -103,68 +103,68 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
103
103
|
const i = this.isRtl(), t = this.props.unstyled && this.props.unstyled.uDropDownButton, e = i ? "rtl" : void 0, {
|
|
104
104
|
id: o,
|
|
105
105
|
style: a,
|
|
106
|
-
tabIndex:
|
|
106
|
+
tabIndex: l,
|
|
107
107
|
disabled: n,
|
|
108
108
|
size: D,
|
|
109
109
|
rounded: y,
|
|
110
|
-
fillMode:
|
|
111
|
-
themeColor:
|
|
110
|
+
fillMode: k,
|
|
111
|
+
themeColor: I,
|
|
112
112
|
ariaLabel: w,
|
|
113
113
|
title: b,
|
|
114
114
|
accessKey: B,
|
|
115
115
|
icon: O,
|
|
116
116
|
svgIcon: x,
|
|
117
117
|
iconClass: E,
|
|
118
|
-
buttonClass:
|
|
119
|
-
className:
|
|
120
|
-
imageUrl:
|
|
121
|
-
startIcon:
|
|
118
|
+
buttonClass: v,
|
|
119
|
+
className: S,
|
|
120
|
+
imageUrl: P,
|
|
121
|
+
startIcon: F,
|
|
122
122
|
endIcon: N
|
|
123
123
|
} = this.props;
|
|
124
|
-
return this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((
|
|
124
|
+
return this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((h) => h && h.type === H).map((h) => h.props), /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
|
|
125
125
|
K,
|
|
126
126
|
{
|
|
127
127
|
id: o,
|
|
128
128
|
size: D,
|
|
129
129
|
style: a,
|
|
130
130
|
rounded: y,
|
|
131
|
-
fillMode:
|
|
132
|
-
themeColor:
|
|
131
|
+
fillMode: k,
|
|
132
|
+
themeColor: I,
|
|
133
133
|
onClick: this.onClickMainButton,
|
|
134
134
|
onMouseDown: this.mouseDown,
|
|
135
135
|
onKeyDown: this.onKeyDown,
|
|
136
136
|
onFocus: this.handleFocus,
|
|
137
137
|
onBlur: this.handleButtonBlur,
|
|
138
138
|
"aria-disabled": n ? "true" : void 0,
|
|
139
|
-
tabIndex:
|
|
139
|
+
tabIndex: l,
|
|
140
140
|
accessKey: B,
|
|
141
141
|
icon: O,
|
|
142
142
|
svgIcon: x,
|
|
143
143
|
iconClass: E,
|
|
144
144
|
className: u(
|
|
145
|
+
v,
|
|
145
146
|
S,
|
|
146
|
-
P,
|
|
147
147
|
c.wrapper({
|
|
148
148
|
c: t,
|
|
149
149
|
focused: this.state.focused,
|
|
150
150
|
disabled: n
|
|
151
151
|
})
|
|
152
152
|
),
|
|
153
|
-
imageUrl:
|
|
153
|
+
imageUrl: P,
|
|
154
154
|
dir: e,
|
|
155
|
-
ref: (
|
|
156
|
-
this.mainButton = (
|
|
155
|
+
ref: (h) => {
|
|
156
|
+
this.mainButton = (h == null ? void 0 : h.element) || null;
|
|
157
157
|
},
|
|
158
158
|
type: "button",
|
|
159
159
|
"aria-expanded": this.opened ? "true" : "false",
|
|
160
160
|
"aria-label": w,
|
|
161
161
|
"aria-controls": this.opened ? this.guid : void 0,
|
|
162
162
|
title: b,
|
|
163
|
-
startIcon:
|
|
163
|
+
startIcon: F,
|
|
164
164
|
endIcon: N
|
|
165
165
|
},
|
|
166
166
|
this.props.text
|
|
167
|
-
), this.showLicenseWatermark && /* @__PURE__ */ p.createElement(
|
|
167
|
+
), this.showLicenseWatermark && /* @__PURE__ */ p.createElement($, { message: this.licenseMessage }), this.renderPopup(i));
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* @hidden
|
|
@@ -179,22 +179,22 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
179
179
|
return this.mainButton;
|
|
180
180
|
}
|
|
181
181
|
dispatchClickEvent(i, t) {
|
|
182
|
-
this.isItemDisabled(t) ||
|
|
182
|
+
this.isItemDisabled(t) || d(this.props.onItemClick, i, this, {
|
|
183
183
|
item: this.buttonsData[t],
|
|
184
184
|
itemIndex: t
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
renderPopup(i) {
|
|
188
|
-
const { popupSettings: t = {}, _zIndex: e, unstyled: o } = this.props, a = e ? e + Q : J,
|
|
189
|
-
return /* @__PURE__ */ p.createElement(
|
|
188
|
+
const { popupSettings: t = {}, _zIndex: e, unstyled: o } = this.props, a = e ? e + Q : J, l = o && o.uDropDownButton, { focusedIndex: n } = this.state;
|
|
189
|
+
return /* @__PURE__ */ p.createElement(W.Provider, { value: a }, /* @__PURE__ */ p.createElement(
|
|
190
190
|
j,
|
|
191
191
|
{
|
|
192
192
|
anchor: this.mainButton,
|
|
193
193
|
show: this.opened,
|
|
194
194
|
animate: t.animate,
|
|
195
|
-
popupClass: u(c.popup({ c:
|
|
196
|
-
anchorAlign: t.anchorAlign ||
|
|
197
|
-
popupAlign: t.popupAlign ||
|
|
195
|
+
popupClass: u(c.popup({ c: l }), t.popupClass),
|
|
196
|
+
anchorAlign: t.anchorAlign || G(i),
|
|
197
|
+
popupAlign: t.popupAlign || q(i),
|
|
198
198
|
style: i ? { direction: "rtl" } : void 0,
|
|
199
199
|
onClose: this.onPopupClose
|
|
200
200
|
},
|
|
@@ -210,7 +210,7 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
210
210
|
onBlur: this.handleMenuBlur,
|
|
211
211
|
className: u(
|
|
212
212
|
c.ul({
|
|
213
|
-
c:
|
|
213
|
+
c: l,
|
|
214
214
|
size: this.props.size
|
|
215
215
|
})
|
|
216
216
|
)
|
|
@@ -221,18 +221,18 @@ const J = 12e3, Q = 2e3, m = class m extends p.Component {
|
|
|
221
221
|
}
|
|
222
222
|
renderChildItems() {
|
|
223
223
|
const { item: i, itemRender: t, textField: e, unstyled: o } = this.props, a = o && o.uDropDownButton;
|
|
224
|
-
return this.buttonsData.length > 0 ? this.buttonsData.map((
|
|
224
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map((l, n) => /* @__PURE__ */ p.createElement(
|
|
225
225
|
X,
|
|
226
226
|
{
|
|
227
227
|
className: u(
|
|
228
228
|
c.item({
|
|
229
229
|
c: a
|
|
230
230
|
}),
|
|
231
|
-
|
|
231
|
+
l.className,
|
|
232
232
|
{ "k-first": n === 0 },
|
|
233
233
|
{ "k-last": n === this.buttonsData.length - 1 }
|
|
234
234
|
),
|
|
235
|
-
dataItem:
|
|
235
|
+
dataItem: l,
|
|
236
236
|
textField: e,
|
|
237
237
|
focused: this.state.focusedIndex === n,
|
|
238
238
|
onClick: this.onItemClick,
|
|
@@ -267,7 +267,7 @@ m.propTypes = {
|
|
|
267
267
|
tabIndex: s.number,
|
|
268
268
|
disabled: s.bool,
|
|
269
269
|
icon: s.string,
|
|
270
|
-
svgIcon:
|
|
270
|
+
svgIcon: Z,
|
|
271
271
|
iconClass: s.string,
|
|
272
272
|
imageUrl: s.string,
|
|
273
273
|
popupSettings: s.object,
|
|
@@ -275,18 +275,34 @@ m.propTypes = {
|
|
|
275
275
|
item: s.func,
|
|
276
276
|
className: s.string,
|
|
277
277
|
buttonClass: s.string,
|
|
278
|
-
dir: s.string
|
|
278
|
+
dir: s.string,
|
|
279
|
+
size: s.oneOf(["small", "medium", "large"]),
|
|
280
|
+
rounded: s.oneOf(["small", "medium", "large", "full"]),
|
|
281
|
+
fillMode: s.oneOf(["flat", "link", "outline", "solid", "clear"]),
|
|
282
|
+
themeColor: s.oneOf([
|
|
283
|
+
"base",
|
|
284
|
+
"primary",
|
|
285
|
+
"secondary",
|
|
286
|
+
"tertiary",
|
|
287
|
+
"info",
|
|
288
|
+
"success",
|
|
289
|
+
"warning",
|
|
290
|
+
"error",
|
|
291
|
+
"dark",
|
|
292
|
+
"light",
|
|
293
|
+
"inverse"
|
|
294
|
+
])
|
|
279
295
|
}, m.defaultProps = {
|
|
280
|
-
size:
|
|
281
|
-
rounded:
|
|
282
|
-
fillMode:
|
|
283
|
-
themeColor:
|
|
296
|
+
size: void 0,
|
|
297
|
+
rounded: void 0,
|
|
298
|
+
fillMode: void 0,
|
|
299
|
+
themeColor: void 0
|
|
284
300
|
};
|
|
285
301
|
let g = m;
|
|
286
|
-
const V =
|
|
287
|
-
|
|
302
|
+
const V = R(), Y = M(
|
|
303
|
+
A(
|
|
288
304
|
V,
|
|
289
|
-
|
|
305
|
+
T(L(g))
|
|
290
306
|
)
|
|
291
307
|
);
|
|
292
308
|
Y.displayName = "KendoReactDropDownButton";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { ButtonItem } from './models/ButtonItem.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* The properties of the KendoReact DropDownButtonItem component.
|
|
13
|
+
*/
|
|
14
|
+
export interface DropDownButtonItemProps extends ButtonItem {
|
|
15
|
+
/**
|
|
16
|
+
* Determines the selected state of the ButtonItem component.
|
|
17
|
+
*/
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class DropDownButtonItem extends React.Component<DropDownButtonItemProps, {}> {
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
static propTypes: {
|
|
25
|
+
text: PropTypes.Requireable<string>;
|
|
26
|
+
icon: PropTypes.Requireable<string>;
|
|
27
|
+
iconClass: PropTypes.Requireable<string>;
|
|
28
|
+
imageUrl: PropTypes.Requireable<string>;
|
|
29
|
+
selected: PropTypes.Requireable<boolean>;
|
|
30
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
31
|
+
render: PropTypes.Requireable<any>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
render(): null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { SplitButtonProps } from './models/ListButtonProps.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export interface SplitButtonState {
|
|
15
|
+
focusedIndex?: number;
|
|
16
|
+
focused?: boolean;
|
|
17
|
+
opened?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents the [KendoReact SplitButton component](https://www.telerik.com/kendo-react-ui/components/buttons/splitbutton).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```jsx
|
|
24
|
+
* const App = () => {
|
|
25
|
+
* return (
|
|
26
|
+
* <SplitButton text="Act">
|
|
27
|
+
* <SplitButtonItem text="Item1" />
|
|
28
|
+
* <SplitButtonItem text="Item2" />
|
|
29
|
+
* <SplitButtonItem text="Item3" />
|
|
30
|
+
* </SplitButton>
|
|
31
|
+
* );
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class SplitButton extends React.Component<SplitButtonProps, SplitButtonState> {
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
static propTypes: {
|
|
40
|
+
accessKey: PropTypes.Requireable<string>;
|
|
41
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
42
|
+
title: PropTypes.Requireable<string>;
|
|
43
|
+
onButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
|
+
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
49
|
+
text: PropTypes.Requireable<string>;
|
|
50
|
+
items: PropTypes.Requireable<any[]>;
|
|
51
|
+
textField: PropTypes.Requireable<string>;
|
|
52
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
53
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
54
|
+
icon: PropTypes.Requireable<string>;
|
|
55
|
+
svgIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
56
|
+
name: PropTypes.Validator<string>;
|
|
57
|
+
content: PropTypes.Validator<string>;
|
|
58
|
+
viewBox: PropTypes.Validator<string>;
|
|
59
|
+
}>>;
|
|
60
|
+
imageUrl: PropTypes.Requireable<string>;
|
|
61
|
+
popupSettings: PropTypes.Requireable<object>;
|
|
62
|
+
itemRender: PropTypes.Requireable<any>;
|
|
63
|
+
item: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
|
+
className: PropTypes.Requireable<string>;
|
|
65
|
+
buttonClass: PropTypes.Requireable<string>;
|
|
66
|
+
dir: PropTypes.Requireable<string>;
|
|
67
|
+
size: PropTypes.Requireable<string>;
|
|
68
|
+
rounded: PropTypes.Requireable<string>;
|
|
69
|
+
fillMode: PropTypes.Requireable<string>;
|
|
70
|
+
themeColor: PropTypes.Requireable<string>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @hidden
|
|
74
|
+
*/
|
|
75
|
+
static defaultProps: {
|
|
76
|
+
size: undefined;
|
|
77
|
+
rounded: undefined;
|
|
78
|
+
fillMode: undefined;
|
|
79
|
+
themeColor: undefined;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @hidden
|
|
83
|
+
*/
|
|
84
|
+
readonly state: {
|
|
85
|
+
focused: boolean;
|
|
86
|
+
focusedIndex: number;
|
|
87
|
+
opened: boolean;
|
|
88
|
+
};
|
|
89
|
+
private wrapper;
|
|
90
|
+
private mainButton;
|
|
91
|
+
private list;
|
|
92
|
+
private get guid();
|
|
93
|
+
private skipFocus;
|
|
94
|
+
private buttonsData;
|
|
95
|
+
private openedDuringOnChange?;
|
|
96
|
+
private readonly showLicenseWatermark;
|
|
97
|
+
private readonly licenseMessage?;
|
|
98
|
+
constructor(props: SplitButtonProps);
|
|
99
|
+
private get opened();
|
|
100
|
+
/**
|
|
101
|
+
* @hidden
|
|
102
|
+
*/
|
|
103
|
+
render(): React.JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* @hidden
|
|
106
|
+
*/
|
|
107
|
+
componentDidMount(): void;
|
|
108
|
+
/**
|
|
109
|
+
* The DOM element of main button.
|
|
110
|
+
*/
|
|
111
|
+
get element(): HTMLButtonElement | null;
|
|
112
|
+
private onKeyDown;
|
|
113
|
+
private switchFocus;
|
|
114
|
+
private onFocus;
|
|
115
|
+
private setOpen;
|
|
116
|
+
private onItemClick;
|
|
117
|
+
private onBlur;
|
|
118
|
+
private dispatchClickEvent;
|
|
119
|
+
private renderPopup;
|
|
120
|
+
private onPopupClose;
|
|
121
|
+
private listRef;
|
|
122
|
+
private renderChildItems;
|
|
123
|
+
private onSplitPartClick;
|
|
124
|
+
private onDownSplitPart;
|
|
125
|
+
private onItemDown;
|
|
126
|
+
private dispatchPopupEvent;
|
|
127
|
+
private isItemDisabled;
|
|
128
|
+
private isRtl;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Represent the `ref` of the SplitButton component.
|
|
132
|
+
*/
|
|
133
|
+
export interface SplitButtonHandle extends Pick<SplitButton, keyof SplitButton> {
|
|
134
|
+
/**
|
|
135
|
+
* The DOM element of main button.
|
|
136
|
+
*/
|
|
137
|
+
element: HTMLButtonElement | null;
|
|
138
|
+
/**
|
|
139
|
+
* The props of the SplitButtonHandle component.
|
|
140
|
+
*/
|
|
141
|
+
props: Readonly<SplitButtonProps>;
|
|
142
|
+
}
|