@progress/kendo-react-layout 5.11.1-dev.202302171102 → 5.12.0-dev.202302211105

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.
@@ -25,6 +25,15 @@ var __assign = (this && this.__assign) || function () {
25
25
  };
26
26
  return __assign.apply(this, arguments);
27
27
  };
28
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
28
37
  Object.defineProperty(exports, "__esModule", { value: true });
29
38
  exports.ActionSheet = void 0;
30
39
  var React = require("react");
@@ -48,6 +57,68 @@ var ActionSheet = /** @class */ (function (_super) {
48
57
  _this.actionSheetAnimationRef = React.createRef();
49
58
  _this.actionSheetTitleClass = 'k-actionsheet-title';
50
59
  _this.ariaLabeledBy = _this.actionSheetTitleClass + 1;
60
+ _this.handleKeyDown = function (e) {
61
+ if (_this.props.navigatable) {
62
+ _this.navigation.triggerKeyboardEvent(e);
63
+ }
64
+ };
65
+ _this.onTab = function (target, nav, ev) {
66
+ ev.preventDefault();
67
+ if (ev.shiftKey) {
68
+ nav.focusPrevious(target);
69
+ }
70
+ else {
71
+ nav.focusNext(target);
72
+ }
73
+ };
74
+ _this.handleOverlayClick = function (ev) {
75
+ if (_this.props.onOverlayClick) {
76
+ _this.props.onOverlayClick.call(undefined, ev);
77
+ }
78
+ if (_this.props.onClose) {
79
+ _this.props.onClose.call(undefined, ev);
80
+ }
81
+ };
82
+ _this.handleItemClick = function (ev) {
83
+ if (_this.props.onItemClick) {
84
+ _this.props.onItemClick.call(undefined, ev);
85
+ }
86
+ if (_this.props.onItemSelect) {
87
+ _this.props.onItemSelect.call(undefined, ev);
88
+ }
89
+ };
90
+ _this.onEnter = function (target, nav, ev) {
91
+ var isItem = target.className && target.className.indexOf('k-actionsheet-item') !== -1;
92
+ var allItems = nav.elements.filter(function (e) { return e.className.indexOf('k-actionsheet-item') !== -1; });
93
+ if (isItem && _this.props.onItemClick) {
94
+ ev.preventDefault();
95
+ var item = _this.props.items[allItems.indexOf(target)];
96
+ _this.props.onItemClick.call(undefined, {
97
+ syntheticEvent: ev,
98
+ item: item,
99
+ title: item && item.title
100
+ });
101
+ }
102
+ if (isItem && _this.props.onItemSelect) {
103
+ ev.preventDefault();
104
+ var item = _this.props.items[allItems.indexOf(target)];
105
+ _this.props.onItemSelect.call(undefined, {
106
+ syntheticEvent: ev,
107
+ item: item,
108
+ title: item && item.title
109
+ });
110
+ }
111
+ };
112
+ _this.onEscape = function (_target, _nav, ev) {
113
+ if (_this.props.onOverlayClick) {
114
+ ev.preventDefault();
115
+ _this.props.onOverlayClick.call(undefined, ev);
116
+ }
117
+ if (_this.props.onClose) {
118
+ ev.preventDefault();
119
+ _this.props.onClose.call(undefined, ev);
120
+ }
121
+ };
51
122
  (0, kendo_react_common_1.validatePackage)(package_metadata_1.packageMetadata);
52
123
  return _this;
53
124
  }
@@ -55,9 +126,34 @@ var ActionSheet = /** @class */ (function (_super) {
55
126
  * @hidden
56
127
  */
57
128
  ActionSheet.prototype.componentDidMount = function () {
129
+ var _this = this;
58
130
  if (this.actionSheetAnimationRef.current) {
59
131
  this.actionSheetAnimationRef.current.style.setProperty('--kendo-actionsheet-height', 'auto');
60
132
  this.actionSheetAnimationRef.current.style.setProperty('--kendo-actionsheet-max-height', 'none');
133
+ if (this.props.navigatable) {
134
+ this.navigation = new kendo_react_common_1.Navigation({
135
+ tabIndex: this.props.tabIndex || 0,
136
+ root: this.actionSheetAnimationRef,
137
+ rovingTabIndex: false,
138
+ selectors: __spreadArray([
139
+ '.k-actionsheet-item'
140
+ ], [
141
+ '.k-actionsheet-footer',
142
+ '.k-actionsheet-content',
143
+ '.k-actionsheet-header'
144
+ ].map(function (selector) {
145
+ return kendo_react_common_1.FOCUSABLE_ELEMENTS.concat(_this.props.navigatableElements).map(function (focusableSelector) { return "".concat(selector, " ").concat(focusableSelector); });
146
+ }).flat(), true),
147
+ keyboardEvents: {
148
+ keydown: {
149
+ 'Tab': this.onTab,
150
+ 'Enter': this.onEnter,
151
+ 'Escape': this.onEscape
152
+ }
153
+ }
154
+ });
155
+ this.navigation.focusElement(this.navigation.first, null);
156
+ }
61
157
  }
62
158
  };
63
159
  /**
@@ -71,25 +167,24 @@ var ActionSheet = /** @class */ (function (_super) {
71
167
  var shouldRenderSeparator = (topGroupItems && topGroupItems.length > 0) && (bottomGroupItems && bottomGroupItems.length > 0);
72
168
  var children = this.children(this.props.children);
73
169
  return (React.createElement("div", { className: "k-actionsheet-container" },
74
- React.createElement("div", { className: "k-overlay", onClick: this.props.onOverlayClick }),
170
+ React.createElement("div", { className: "k-overlay", onClick: this.handleOverlayClick }),
75
171
  React.createElement("div", { className: "k-animation-container" },
76
172
  React.createElement("div", { className: "k-child-animation-container", style: { bottom: '0px', width: '100%' } },
77
- React.createElement("div", { className: "k-actionsheet k-actionsheet-bottom", role: "dialog", "aria-modal": "true", "aria-hidden": false, "aria-labelledby": this.ariaLabeledBy, ref: this.actionSheetAnimationRef },
173
+ React.createElement("div", { className: "k-actionsheet k-actionsheet-bottom", role: "dialog", "aria-modal": "true", "aria-hidden": false, "aria-labelledby": this.ariaLabeledBy, ref: this.actionSheetAnimationRef, onKeyDown: this.handleKeyDown },
78
174
  (children[ActionSheetHeader_1.headerDisplayName] || this.props.title || this.props.subTitle) && (React.createElement("div", { className: "k-actionsheet-titlebar" },
79
175
  React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
80
176
  React.createElement("div", { className: this.actionSheetTitleClass, id: this.ariaLabeledBy }, children[ActionSheetHeader_1.headerDisplayName] ||
81
177
  React.createElement(React.Fragment, null,
82
178
  React.createElement("div", { className: "k-text-center" }, this.props.title),
83
179
  this.props.subTitle && React.createElement("div", { className: "k-actionsheet-subtitle k-text-center" }, this.props.subTitle)))))),
84
- React.createElement("div", { className: "k-actionsheet-content" }, children[ActionSheetContent_1.contentDisplayName] ||
85
- React.createElement(React.Fragment, null,
86
- React.createElement("div", { className: "k-list-ul", role: "group" }, topGroupItems && topGroupItems.map(function (props, idx) {
87
- return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, props, { key: idx, focused: idx === 0, onClick: _this.props.onItemClick })));
88
- })),
89
- shouldRenderSeparator && React.createElement("hr", { className: "k-hr" }),
90
- React.createElement("div", { className: "k-list-ul", role: "group" }, bottomGroupItems && bottomGroupItems.map(function (props, idx) {
91
- return React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({ key: idx }, props, { onClick: _this.props.onItemClick }));
92
- })))),
180
+ children[ActionSheetContent_1.contentDisplayName] || React.createElement("div", { className: "k-actionsheet-content" },
181
+ React.createElement("div", { className: "k-list-ul", role: "group" }, topGroupItems && topGroupItems.map(function (item, idx) {
182
+ return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx, key: idx, item: item, tabIndex: _this.props.tabIndex || 0, onClick: _this.handleItemClick })));
183
+ })),
184
+ shouldRenderSeparator && React.createElement("hr", { className: "k-hr" }),
185
+ React.createElement("div", { className: "k-list-ul", role: "group" }, bottomGroupItems && bottomGroupItems.map(function (item, idx) {
186
+ return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx + ((topGroupItems === null || topGroupItems === void 0 ? void 0 : topGroupItems.length) || 0), key: idx, item: item, tabIndex: _this.props.tabIndex || 0, onClick: _this.handleItemClick })));
187
+ }))),
93
188
  children[ActionSheetFooter_1.footerDisplayName])))));
94
189
  };
95
190
  ;
@@ -111,7 +206,16 @@ var ActionSheet = /** @class */ (function (_super) {
111
206
  ActionSheet.propTypes = {
112
207
  items: PropTypes.array,
113
208
  subTitle: PropTypes.string,
114
- title: PropTypes.string
209
+ title: PropTypes.string,
210
+ navigatable: PropTypes.bool,
211
+ navigatableElements: PropTypes.array
212
+ };
213
+ /**
214
+ * @hidden
215
+ */
216
+ ActionSheet.defaultProps = {
217
+ navigatable: true,
218
+ navigatableElements: []
115
219
  };
116
220
  return ActionSheet;
117
221
  }(React.Component));
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionSheetContent = exports.contentDisplayName = void 0;
4
+ var React = require("react");
4
5
  var PropTypes = require("prop-types");
6
+ var kendo_react_common_1 = require("@progress/kendo-react-common");
5
7
  /**
6
8
  * @hidden
7
9
  */
@@ -9,8 +11,13 @@ exports.contentDisplayName = 'ActionSheetContent';
9
11
  /**
10
12
  * The KendoReact ActionSheetContent component.
11
13
  */
12
- var ActionSheetContent = function (props) { return props.children; };
14
+ var ActionSheetContent = function (props) {
15
+ return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet-content', props.className) }, props.children));
16
+ };
13
17
  exports.ActionSheetContent = ActionSheetContent;
18
+ exports.ActionSheetContent.propTypes = {
19
+ className: PropTypes.string
20
+ };
14
21
  /**
15
22
  * @hidden
16
23
  */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionSheetFooter = exports.footerDisplayName = void 0;
4
+ var React = require("react");
4
5
  var PropTypes = require("prop-types");
6
+ var kendo_react_common_1 = require("@progress/kendo-react-common");
5
7
  /**
6
8
  * @hidden
7
9
  */
@@ -9,8 +11,13 @@ exports.footerDisplayName = 'ActionSheetFooter';
9
11
  /**
10
12
  * The KendoReact ActionSheetFooter component.
11
13
  */
12
- var ActionSheetFooter = function (props) { return props.children; };
14
+ var ActionSheetFooter = function (props) {
15
+ return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet-footer', props.className) }, props.children));
16
+ };
13
17
  exports.ActionSheetFooter = ActionSheetFooter;
18
+ exports.ActionSheetFooter.propTypes = {
19
+ className: PropTypes.string
20
+ };
14
21
  /**
15
22
  * @hidden
16
23
  */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionSheetHeader = exports.headerDisplayName = void 0;
4
+ var React = require("react");
4
5
  var PropTypes = require("prop-types");
6
+ var kendo_react_common_1 = require("@progress/kendo-react-common");
5
7
  /**
6
8
  * @hidden
7
9
  */
@@ -9,8 +11,13 @@ exports.headerDisplayName = 'ActionSheetHeader';
9
11
  /**
10
12
  * The KendoReact ActionSheetHeader component.
11
13
  */
12
- var ActionSheetHeader = function (props) { return props.children; };
14
+ var ActionSheetHeader = function (props) {
15
+ return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet-header', props.className) }, props.children));
16
+ };
13
17
  exports.ActionSheetHeader = ActionSheetHeader;
18
+ exports.ActionSheetHeader.propTypes = {
19
+ className: PropTypes.string
20
+ };
14
21
  /**
15
22
  * @hidden
16
23
  */
@@ -8,19 +8,22 @@ var kendo_react_common_1 = require("@progress/kendo-react-common");
8
8
  * The KendoReact ActionSheetItem component.
9
9
  */
10
10
  var ActionSheetItem = function (props) {
11
- var defaultTabIndex = 0;
12
11
  var itemRef = React.useRef(null);
13
12
  var onClick = React.useCallback(function (event) {
14
13
  if (props.onClick) {
15
- props.onClick.call(undefined, { syntheticEvent: event, title: props.title });
14
+ props.onClick.call(undefined, {
15
+ syntheticEvent: event,
16
+ item: props.item,
17
+ title: props.title
18
+ });
16
19
  }
17
- }, [props.title, props.onClick]);
20
+ }, [props.item, props.title, props.onClick]);
18
21
  React.useEffect(function () {
19
22
  if (itemRef.current && props.focused) {
20
23
  itemRef.current.focus();
21
24
  }
22
25
  }, [props.focused]);
23
- return (React.createElement("span", { style: props.style, className: (0, kendo_react_common_1.classNames)('k-actionsheet-item', 'k-cursor-pointer', props.disabled && 'k-disabled', props.className), role: "button", ref: itemRef, "aria-disabled": props.disabled, tabIndex: props.tabIndex || defaultTabIndex, onClick: onClick },
26
+ return (React.createElement("span", { style: props.style, tabIndex: props.tabIndex, className: (0, kendo_react_common_1.classNames)('k-actionsheet-item', 'k-cursor-pointer', props.disabled && 'k-disabled', props.className), ref: itemRef, role: "button", "aria-disabled": props.disabled, onClick: onClick },
24
27
  React.createElement("span", { className: "k-actionsheet-action" },
25
28
  props.icon && React.createElement("span", { className: "k-icon-wrap" }, props.icon),
26
29
  (props.title || props.description) && (React.createElement("span", { className: "k-actionsheet-item-text" },
@@ -2,6 +2,10 @@
2
2
  * @hidden
3
3
  */
4
4
  export interface ActionSheetChildrenProps {
5
+ /**
6
+ * ClassName of the rendered element.
7
+ */
8
+ className?: any;
5
9
  /**
6
10
  * Represents the children that are passed to the ActionSheet.
7
11
  */
@@ -12,7 +12,12 @@ export interface ActionSheetItemProps {
12
12
  */
13
13
  style?: React.CSSProperties;
14
14
  /**
15
- * Specifies the `tabIndex` of the ActionSheet.
15
+ * **Deprecated**. Specifies the `tabIndex` of the ActionSheetItem.
16
+ *
17
+ * Set the tabIndex to the ActionSheet component instead.
18
+ *
19
+ * @deprecated
20
+ *
16
21
  */
17
22
  tabIndex?: number;
18
23
  /**
@@ -36,15 +41,27 @@ export interface ActionSheetItemProps {
36
41
  * Specifies the text content of the ActionSheet item.
37
42
  */
38
43
  title?: string;
44
+ /**
45
+ * Specifies the ActionSheet item.
46
+ */
47
+ item?: any;
39
48
  /**
40
49
  * @hidden
41
50
  */
42
51
  onClick?: (event: {
43
- syntheticEvent: React.MouseEvent<HTMLSpanElement>;
52
+ syntheticEvent: React.SyntheticEvent;
44
53
  title?: string;
45
54
  }) => void;
55
+ /**
56
+ * @hidden
57
+ */
58
+ onKeyDown?: (event: React.SyntheticEvent, title: string | undefined, id: number | undefined) => void;
46
59
  /**
47
60
  * @hidden
48
61
  */
49
62
  focused?: boolean;
63
+ /**
64
+ * @hidden
65
+ */
66
+ id?: number;
50
67
  }
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-layout',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1676630656,
11
+ publishDate: 1676976502,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
14
14
  };