framework7-react 8.3.4 → 9.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/components/accordion-content.js +6 -9
  2. package/components/accordion-item.js +11 -9
  3. package/components/accordion-toggle.js +11 -9
  4. package/components/accordion.js +11 -9
  5. package/components/actions-button.js +11 -9
  6. package/components/actions-group.js +11 -9
  7. package/components/actions-label.js +11 -9
  8. package/components/actions.js +13 -10
  9. package/components/app.js +10 -8
  10. package/components/area-chart.js +27 -29
  11. package/components/badge.js +11 -9
  12. package/components/block-footer.js +11 -9
  13. package/components/block-header.js +11 -9
  14. package/components/block-title.js +11 -9
  15. package/components/block.js +11 -9
  16. package/components/breadcrumbs-collapsed.js +11 -9
  17. package/components/breadcrumbs-item.js +11 -9
  18. package/components/breadcrumbs-separator.js +11 -9
  19. package/components/breadcrumbs.js +11 -9
  20. package/components/button.js +15 -10
  21. package/components/card-content.js +11 -9
  22. package/components/card-footer.js +11 -9
  23. package/components/card-header.js +11 -9
  24. package/components/card.js +14 -11
  25. package/components/checkbox.js +13 -10
  26. package/components/chip.js +11 -9
  27. package/components/fab-backdrop.js +11 -9
  28. package/components/fab-button.js +11 -9
  29. package/components/fab-buttons.js +11 -9
  30. package/components/fab.js +11 -9
  31. package/components/gauge.js +11 -9
  32. package/components/icon.js +11 -9
  33. package/components/input.js +15 -25
  34. package/components/link.js +13 -10
  35. package/components/list-button.js +11 -9
  36. package/components/list-group.js +11 -9
  37. package/components/list-index.js +15 -12
  38. package/components/list-input.js +15 -25
  39. package/components/list-item-content.js +7 -2
  40. package/components/list-item.js +13 -10
  41. package/components/list.js +13 -10
  42. package/components/login-screen-title.js +11 -9
  43. package/components/login-screen.js +13 -10
  44. package/components/message.js +11 -9
  45. package/components/messagebar-attachment.js +11 -9
  46. package/components/messagebar-attachments.js +11 -9
  47. package/components/messagebar-sheet-image.js +11 -9
  48. package/components/messagebar-sheet-item.js +11 -9
  49. package/components/messagebar-sheet.js +11 -9
  50. package/components/messagebar.js +17 -13
  51. package/components/messages-title.js +11 -9
  52. package/components/messages.js +13 -10
  53. package/components/nav-left.d.ts +0 -1
  54. package/components/nav-left.js +12 -17
  55. package/components/nav-right.d.ts +0 -1
  56. package/components/nav-right.js +11 -13
  57. package/components/nav-title-large.js +11 -10
  58. package/components/nav-title.d.ts +0 -1
  59. package/components/nav-title.js +11 -13
  60. package/components/navbar.d.ts +0 -1
  61. package/components/navbar.js +15 -40
  62. package/components/page-content.js +11 -10
  63. package/components/page.js +10 -8
  64. package/components/panel.js +14 -15
  65. package/components/photo-browser.d.ts +0 -1
  66. package/components/photo-browser.js +14 -15
  67. package/components/pie-chart.js +16 -16
  68. package/components/popover.d.ts +0 -1
  69. package/components/popover.js +14 -16
  70. package/components/popup.js +13 -11
  71. package/components/preloader.js +11 -10
  72. package/components/progressbar.js +13 -11
  73. package/components/radio.js +11 -10
  74. package/components/range.js +14 -12
  75. package/components/routable-modals.js +17 -15
  76. package/components/searchbar.js +22 -18
  77. package/components/segmented.js +11 -10
  78. package/components/sheet.js +13 -11
  79. package/components/stepper.js +18 -16
  80. package/components/subnavbar.d.ts +0 -1
  81. package/components/subnavbar.js +11 -13
  82. package/components/swipeout-actions.js +11 -10
  83. package/components/swipeout-button.js +11 -10
  84. package/components/tab.js +11 -10
  85. package/components/tabs.js +19 -12
  86. package/components/text-editor.js +14 -12
  87. package/components/toggle.js +19 -18
  88. package/components/toolbar-pane.d.ts +16 -0
  89. package/components/toolbar-pane.js +29 -0
  90. package/components/toolbar.js +14 -12
  91. package/components/treeview-item.js +11 -10
  92. package/components/treeview.js +11 -10
  93. package/components/view.d.ts +0 -2
  94. package/components/view.js +28 -28
  95. package/components/views.js +11 -10
  96. package/framework7-react.d.ts +2 -1
  97. package/framework7-react.js +5 -4
  98. package/package.json +2 -2
  99. package/shared/components-router.js +20 -23
  100. package/shared/f7.js +1 -7
  101. package/shared/modal-state-classes.js +4 -5
  102. package/shared/plugin.js +1 -4
  103. package/shared/set-ref.js +11 -0
  104. package/shared/use-icon.js +1 -4
  105. package/shared/use-route-props.js +3 -4
  106. package/shared/use-store.js +5 -5
  107. package/shared/utils.js +6 -24
@@ -1,13 +1,13 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs, getSlots, noUndefinedProps, emit } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
6
6
  import { f7ready, f7 } from '../shared/f7.js';
7
+ import { setRef } from '../shared/set-ref.js';
7
8
 
8
9
 
9
-
10
- const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
10
+ const Searchbar = props => {
11
11
  const f7Searchbar = useRef(null);
12
12
  const {
13
13
  className,
@@ -18,7 +18,7 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
18
18
  placeholder = 'Search',
19
19
  spellcheck,
20
20
  disableButton = true,
21
- disableButtonText = 'Cancel',
21
+ disableButtonText = '',
22
22
  clearButton = true,
23
23
  // Input Value
24
24
  value,
@@ -42,7 +42,8 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
42
42
  removeDiacritics = false,
43
43
  hideGroupTitles = true,
44
44
  hideGroups = true,
45
- init = true
45
+ init = true,
46
+ ref
46
47
  } = props;
47
48
  const extraAttrs = getExtraAttrs(props);
48
49
  const elRef = useRef(null);
@@ -87,15 +88,6 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
87
88
  const onDisableButtonClick = event => {
88
89
  emit(props, 'click:disable clickDisable', event);
89
90
  };
90
- useImperativeHandle(ref, () => ({
91
- el: elRef.current,
92
- f7Searchbar: () => f7Searchbar.current,
93
- search,
94
- enable,
95
- disable,
96
- toggle,
97
- clear
98
- }));
99
91
  const onMount = () => {
100
92
  if (!init) return;
101
93
  f7ready(() => {
@@ -164,7 +156,9 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
164
156
  disableEl = /*#__PURE__*/React.createElement("span", {
165
157
  className: "searchbar-disable-button",
166
158
  onClick: onDisableButtonClick
167
- }, disableButtonText);
159
+ }, /*#__PURE__*/React.createElement("i", {
160
+ className: "icon icon-close"
161
+ }), disableButtonText && /*#__PURE__*/React.createElement("span", null, disableButtonText));
168
162
  }
169
163
  const SearchbarTag = form ? 'form' : 'div';
170
164
  const classes = classNames(className, 'searchbar', {
@@ -174,7 +168,17 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
174
168
  }, colorClasses(props));
175
169
  const slots = getSlots(props);
176
170
  return /*#__PURE__*/React.createElement(SearchbarTag, _extends({
177
- ref: elRef,
171
+ ref: el => {
172
+ elRef.current = el;
173
+ setRef(ref, el, {
174
+ f7Searchbar: () => f7Searchbar.current,
175
+ search,
176
+ enable,
177
+ disable,
178
+ toggle,
179
+ clear
180
+ });
181
+ },
178
182
  id: id,
179
183
  style: style,
180
184
  className: classes
@@ -196,6 +200,6 @@ const Searchbar = /*#__PURE__*/forwardRef((props, ref) => {
196
200
  }), /*#__PURE__*/React.createElement("i", {
197
201
  className: "searchbar-icon"
198
202
  }), clearEl, slots['input-wrap-end']), disableEl, slots['inner-end'], slots.default), slots['after-inner']);
199
- });
203
+ };
200
204
  Searchbar.displayName = 'f7-searchbar';
201
205
  export default Searchbar;
@@ -1,10 +1,10 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { classNames, getExtraAttrs } from '../shared/utils.js';
4
4
  import { colorClasses } from '../shared/mixins.js';
5
+ import { setRef } from '../shared/set-ref.js';
5
6
 
6
-
7
- const Segmented = /*#__PURE__*/forwardRef((props, ref) => {
7
+ const Segmented = props => {
8
8
  const {
9
9
  className,
10
10
  id,
@@ -19,13 +19,11 @@ const Segmented = /*#__PURE__*/forwardRef((props, ref) => {
19
19
  strong,
20
20
  strongIos,
21
21
  strongMd,
22
- tag = 'div'
22
+ tag = 'div',
23
+ ref
23
24
  } = props;
24
25
  const extraAttrs = getExtraAttrs(props);
25
26
  const elRef = useRef(null);
26
- useImperativeHandle(ref, () => ({
27
- el: elRef.current
28
- }));
29
27
  const classes = classNames(className, {
30
28
  segmented: true,
31
29
  'segmented-raised': raised,
@@ -43,10 +41,13 @@ const Segmented = /*#__PURE__*/forwardRef((props, ref) => {
43
41
  id: id,
44
42
  style: style,
45
43
  className: classes,
46
- ref: elRef
44
+ ref: el => {
45
+ elRef.current = el;
46
+ setRef(ref, el);
47
+ }
47
48
  }, extraAttrs), children, (strong || strongIos || strongMd) && /*#__PURE__*/React.createElement("span", {
48
49
  className: "segmented-highlight"
49
50
  }));
50
- });
51
+ };
51
52
  Segmented.displayName = 'f7-segmented';
52
53
  export default Segmented;
@@ -1,15 +1,15 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs, emit, getSlots } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
6
6
  import { f7ready, f7 } from '../shared/f7.js';
7
7
  import { watchProp } from '../shared/watch-prop.js';
8
8
  import { modalStateClasses } from '../shared/modal-state-classes.js';
9
+ import { setRef } from '../shared/set-ref.js';
9
10
 
10
11
 
11
-
12
- const Sheet = /*#__PURE__*/forwardRef((props, ref) => {
12
+ const Sheet = props => {
13
13
  const f7Sheet = useRef(null);
14
14
  const {
15
15
  className,
@@ -32,7 +32,8 @@ const Sheet = /*#__PURE__*/forwardRef((props, ref) => {
32
32
  containerEl,
33
33
  breakpoints,
34
34
  backdropBreakpoint,
35
- pushBreakpoint
35
+ pushBreakpoint,
36
+ ref
36
37
  } = props;
37
38
  const extraAttrs = getExtraAttrs(props);
38
39
  const elRef = useRef(null);
@@ -67,10 +68,6 @@ const Sheet = /*#__PURE__*/forwardRef((props, ref) => {
67
68
  isClosing.current = false;
68
69
  emit(props, 'sheetClosed', instance);
69
70
  };
70
- useImperativeHandle(ref, () => ({
71
- el: elRef.current,
72
- f7Sheet: () => f7Sheet.current
73
- }));
74
71
  const modalEvents = method => {
75
72
  if (!f7Sheet.current) return;
76
73
  f7Sheet.current[method]('open', onOpen);
@@ -170,8 +167,13 @@ const Sheet = /*#__PURE__*/forwardRef((props, ref) => {
170
167
  id: id,
171
168
  style: style,
172
169
  className: classes,
173
- ref: elRef
170
+ ref: el => {
171
+ elRef.current = el;
172
+ setRef(ref, el, {
173
+ f7Sheet: () => f7Sheet.current
174
+ });
175
+ }
174
176
  }, extraAttrs), fixedList, slots.fixed, innerEl);
175
- });
177
+ };
176
178
  Sheet.displayName = 'f7-sheet';
177
179
  export default Sheet;
@@ -1,13 +1,13 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs, emit, noUndefinedProps } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
6
6
  import { f7ready, f7 } from '../shared/f7.js';
7
7
  import { watchProp } from '../shared/watch-prop.js';
8
+ import { setRef } from '../shared/set-ref.js';
8
9
 
9
-
10
- const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
10
+ const Stepper = props => {
11
11
  const f7Stepper = useRef(null);
12
12
  const {
13
13
  className,
@@ -46,7 +46,8 @@ const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
46
46
  smallIos,
47
47
  raised,
48
48
  raisedMd,
49
- raisedIos
49
+ raisedIos,
50
+ ref
50
51
  } = props;
51
52
  const extraAttrs = getExtraAttrs(props);
52
53
  const elRef = useRef(null);
@@ -79,14 +80,6 @@ const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
79
80
  const onPlusClick = event => {
80
81
  emit(props, 'stepperPlusClick', event, f7Stepper.current);
81
82
  };
82
- useImperativeHandle(ref, () => ({
83
- el: elRef.current,
84
- f7Stepper: () => f7Stepper.current,
85
- increment,
86
- decrement,
87
- setValue,
88
- getValue
89
- }));
90
83
  watchProp(value, newValue => {
91
84
  if (!f7Stepper.current) return;
92
85
  f7Stepper.current.setValue(newValue);
@@ -177,10 +170,19 @@ const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
177
170
  'stepper-raised-md': raisedMd
178
171
  }, colorClasses(props));
179
172
  return /*#__PURE__*/React.createElement("div", _extends({
180
- ref: elRef,
181
173
  id: id,
182
174
  style: style,
183
- className: classes
175
+ className: classes,
176
+ ref: el => {
177
+ elRef.current = el;
178
+ setRef(ref, el, {
179
+ f7Stepper: () => f7Stepper.current,
180
+ increment,
181
+ decrement,
182
+ setValue,
183
+ getValue
184
+ });
185
+ }
184
186
  }, extraAttrs), /*#__PURE__*/React.createElement("div", {
185
187
  className: "stepper-button-minus",
186
188
  onClick: onMinusClick
@@ -188,6 +190,6 @@ const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
188
190
  className: "stepper-button-plus",
189
191
  onClick: onPlusClick
190
192
  }));
191
- });
193
+ };
192
194
  Stepper.displayName = 'f7-stepper';
193
195
  export default Stepper;
@@ -7,7 +7,6 @@ export interface SubnavbarProps {
7
7
  id?: string | number;
8
8
  className?: string;
9
9
  style?: React.CSSProperties;
10
- sliding ?: boolean;
11
10
  title ?: string;
12
11
  inner ?: boolean;
13
12
  ref?: React.MutableRefObject<{el: HTMLElement | null}>;
@@ -1,10 +1,10 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { classNames, getExtraAttrs } from '../shared/utils.js';
4
4
  import { colorClasses } from '../shared/mixins.js';
5
+ import { setRef } from '../shared/set-ref.js';
5
6
 
6
-
7
- const Subnavbar = /*#__PURE__*/forwardRef((props, ref) => {
7
+ const Subnavbar = props => {
8
8
  const {
9
9
  className,
10
10
  id,
@@ -12,26 +12,24 @@ const Subnavbar = /*#__PURE__*/forwardRef((props, ref) => {
12
12
  children,
13
13
  inner = true,
14
14
  title,
15
- sliding
15
+ ref
16
16
  } = props;
17
17
  const extraAttrs = getExtraAttrs(props);
18
18
  const elRef = useRef(null);
19
- useImperativeHandle(ref, () => ({
20
- el: elRef.current
21
- }));
22
- const classes = classNames(className, 'subnavbar', {
23
- sliding
24
- }, colorClasses(props));
19
+ const classes = classNames(className, 'subnavbar', {}, colorClasses(props));
25
20
  return /*#__PURE__*/React.createElement("div", _extends({
26
21
  className: classes,
27
22
  id: id,
28
23
  style: style,
29
- ref: elRef
24
+ ref: el => {
25
+ elRef.current = el;
26
+ setRef(ref, el);
27
+ }
30
28
  }, extraAttrs), inner ? /*#__PURE__*/React.createElement("div", {
31
29
  className: "subnavbar-inner"
32
30
  }, title && /*#__PURE__*/React.createElement("div", {
33
31
  className: "subnavbar-title"
34
32
  }, title), children) : children);
35
- });
33
+ };
36
34
  Subnavbar.displayName = 'f7-subnavbar';
37
35
  export default Subnavbar;
@@ -1,10 +1,10 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { classNames, getExtraAttrs } from '../shared/utils.js';
4
4
  import { colorClasses } from '../shared/mixins.js';
5
+ import { setRef } from '../shared/set-ref.js';
5
6
 
6
-
7
- const SwipeoutActions = /*#__PURE__*/forwardRef((props, ref) => {
7
+ const SwipeoutActions = props => {
8
8
  const {
9
9
  className,
10
10
  id,
@@ -12,13 +12,11 @@ const SwipeoutActions = /*#__PURE__*/forwardRef((props, ref) => {
12
12
  children,
13
13
  left,
14
14
  right,
15
- side
15
+ side,
16
+ ref
16
17
  } = props;
17
18
  const extraAttrs = getExtraAttrs(props);
18
19
  const elRef = useRef(null);
19
- useImperativeHandle(ref, () => ({
20
- el: elRef.current
21
- }));
22
20
  let sideComputed = side;
23
21
  if (!sideComputed) {
24
22
  if (left) sideComputed = 'left';
@@ -29,8 +27,11 @@ const SwipeoutActions = /*#__PURE__*/forwardRef((props, ref) => {
29
27
  id: id,
30
28
  style: style,
31
29
  className: classes,
32
- ref: elRef
30
+ ref: el => {
31
+ elRef.current = el;
32
+ setRef(ref, el);
33
+ }
33
34
  }, extraAttrs), children);
34
- });
35
+ };
35
36
  SwipeoutActions.displayName = 'f7-swipeout-actions';
36
37
  export default SwipeoutActions;
@@ -1,10 +1,10 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
4
4
  import { colorClasses } from '../shared/mixins.js';
5
+ import { setRef } from '../shared/set-ref.js';
5
6
 
6
-
7
- const SwipeoutButton = /*#__PURE__*/forwardRef((props, ref) => {
7
+ const SwipeoutButton = props => {
8
8
  const {
9
9
  className,
10
10
  id,
@@ -16,23 +16,24 @@ const SwipeoutButton = /*#__PURE__*/forwardRef((props, ref) => {
16
16
  overswipe,
17
17
  close,
18
18
  delete: deleteProp,
19
- href
19
+ href,
20
+ ref
20
21
  } = props;
21
22
  const extraAttrs = getExtraAttrs(props);
22
23
  const elRef = useRef(null);
23
24
  const onClick = e => {
24
25
  emit(props, 'click', e);
25
26
  };
26
- useImperativeHandle(ref, () => ({
27
- el: elRef.current
28
- }));
29
27
  const classes = classNames(className, {
30
28
  'swipeout-overswipe': overswipe,
31
29
  'swipeout-delete': deleteProp,
32
30
  'swipeout-close': close
33
31
  }, colorClasses(props));
34
32
  return /*#__PURE__*/React.createElement("a", _extends({
35
- ref: elRef,
33
+ ref: el => {
34
+ elRef.current = el;
35
+ setRef(ref, el);
36
+ },
36
37
  href: href || '#',
37
38
  id: id,
38
39
  style: style,
@@ -42,6 +43,6 @@ const SwipeoutButton = /*#__PURE__*/forwardRef((props, ref) => {
42
43
  }, extraAttrs, {
43
44
  onClick: onClick
44
45
  }), children, text);
45
- });
46
+ };
46
47
  SwipeoutButton.displayName = 'f7-swipeout-button';
47
48
  export default SwipeoutButton;
package/components/tab.js CHANGED
@@ -1,5 +1,5 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle, useState, useContext } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef, useState, useContext } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs, getComponentId } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
@@ -8,15 +8,16 @@ import { useTab } from '../shared/use-tab.js';
8
8
  import { RouterContext } from '../shared/router-context.js';
9
9
  import { useAsyncComponent } from '../shared/use-async-component.js';
10
10
  import { TabsSwipeableContext } from '../shared/tabs-swipeable-context.js';
11
+ import { setRef } from '../shared/set-ref.js';
11
12
 
12
-
13
- const Tab = /*#__PURE__*/forwardRef((props, ref) => {
13
+ const Tab = props => {
14
14
  const {
15
15
  className,
16
16
  id,
17
17
  style,
18
18
  children,
19
- tabActive
19
+ tabActive,
20
+ ref
20
21
  } = props;
21
22
  const extraAttrs = getExtraAttrs(props);
22
23
  const elRef = useRef(null);
@@ -47,9 +48,6 @@ const Tab = /*#__PURE__*/forwardRef((props, ref) => {
47
48
  }
48
49
  }
49
50
  const [tabContent, setTabContent] = useState(initialTabContent || null);
50
- useImperativeHandle(ref, () => ({
51
- el: elRef.current
52
- }));
53
51
  if (f7 && !routerData.current) {
54
52
  routerData.current = {
55
53
  setTabContent
@@ -108,8 +106,11 @@ const Tab = /*#__PURE__*/forwardRef((props, ref) => {
108
106
  return /*#__PURE__*/React.createElement(Component, _extends({
109
107
  id: id,
110
108
  style: style,
111
- ref: elRef
109
+ ref: el => {
110
+ elRef.current = el;
111
+ setRef(ref, el);
112
+ }
112
113
  }, extraAttrs, classAttrs), renderChildren());
113
- });
114
+ };
114
115
  Tab.displayName = 'f7-tab';
115
116
  export default Tab;
@@ -1,12 +1,12 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
6
6
  import { TabsSwipeableContext } from '../shared/tabs-swipeable-context.js';
7
+ import { setRef } from '../shared/set-ref.js';
7
8
 
8
-
9
- const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
9
+ const Tabs = props => {
10
10
  const {
11
11
  className,
12
12
  id,
@@ -15,13 +15,11 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
15
15
  animated,
16
16
  swipeable,
17
17
  routable,
18
- swiperParams
18
+ swiperParams,
19
+ ref
19
20
  } = props;
20
21
  const extraAttrs = getExtraAttrs(props);
21
22
  const elRef = useRef(null);
22
- useImperativeHandle(ref, () => ({
23
- el: elRef.current
24
- }));
25
23
  useIsomorphicLayoutEffect(() => {
26
24
  if (!swipeable || !swiperParams) return;
27
25
  if (!elRef.current) return;
@@ -38,7 +36,10 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
38
36
  id: id,
39
37
  style: style,
40
38
  className: classNames('tabs-animated-wrap', classes),
41
- ref: elRef
39
+ ref: el => {
40
+ elRef.current = el;
41
+ setRef(ref, el);
42
+ }
42
43
  }, extraAttrs), /*#__PURE__*/React.createElement("div", {
43
44
  className: tabsClasses
44
45
  }, children));
@@ -48,7 +49,10 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
48
49
  id: id,
49
50
  style: style,
50
51
  class: classNames(tabsClasses, classes),
51
- ref: elRef,
52
+ ref: el => {
53
+ elRef.current = el;
54
+ setRef(ref, el);
55
+ },
52
56
  init: swiperParams ? 'false' : 'true'
53
57
  }, extraAttrs), /*#__PURE__*/React.createElement(TabsSwipeableContext.Provider, {
54
58
  value: true
@@ -58,8 +62,11 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
58
62
  id: id,
59
63
  style: style,
60
64
  className: classNames(tabsClasses, classes),
61
- ref: elRef
65
+ ref: el => {
66
+ elRef.current = el;
67
+ setRef(ref, el);
68
+ }
62
69
  }, extraAttrs), children);
63
- });
70
+ };
64
71
  Tabs.displayName = 'f7-tabs';
65
72
  export default Tabs;
@@ -1,13 +1,13 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef } from 'react';
3
3
  import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
4
4
  import { classNames, getExtraAttrs, getSlots, noUndefinedProps, emit } from '../shared/utils.js';
5
5
  import { colorClasses } from '../shared/mixins.js';
6
6
  import { f7ready, f7 } from '../shared/f7.js';
7
7
  import { watchProp } from '../shared/watch-prop.js';
8
+ import { setRef } from '../shared/set-ref.js';
8
9
 
9
-
10
- const TextEditor = /*#__PURE__*/forwardRef((props, ref) => {
10
+ const TextEditor = props => {
11
11
  const f7TextEditor = useRef(null);
12
12
  const {
13
13
  className,
@@ -22,7 +22,8 @@ const TextEditor = /*#__PURE__*/forwardRef((props, ref) => {
22
22
  linkUrlText,
23
23
  placeholder,
24
24
  clearFormattingOnPaste,
25
- resizable = false
25
+ resizable = false,
26
+ ref
26
27
  } = props;
27
28
  const extraAttrs = getExtraAttrs(props);
28
29
  const elRef = useRef(null);
@@ -59,10 +60,6 @@ const TextEditor = /*#__PURE__*/forwardRef((props, ref) => {
59
60
  const onInsertImage = (editor, url) => {
60
61
  emit(props, 'textEditorInsertImage', url);
61
62
  };
62
- useImperativeHandle(ref, () => ({
63
- el: elRef.current,
64
- f7TextEditor: () => f7TextEditor.current
65
- }));
66
63
  watchProp(value, newValue => {
67
64
  if (f7TextEditor.current) {
68
65
  f7TextEditor.current.setValue(newValue);
@@ -111,14 +108,19 @@ const TextEditor = /*#__PURE__*/forwardRef((props, ref) => {
111
108
  const slots = getSlots(props);
112
109
  const classes = classNames(className, 'text-editor', resizable && 'text-editor-resizable', colorClasses(props));
113
110
  return /*#__PURE__*/React.createElement("div", _extends({
114
- ref: elRef,
115
111
  id: id,
116
112
  style: style,
117
- className: classes
113
+ className: classes,
114
+ ref: el => {
115
+ elRef.current = el;
116
+ setRef(ref, el, {
117
+ f7TextEditor: () => f7TextEditor.current
118
+ });
119
+ }
118
120
  }, extraAttrs), slots['root-start'], /*#__PURE__*/React.createElement("div", {
119
121
  className: "text-editor-content",
120
122
  contentEditable: true
121
123
  }, slots.default), slots['root-end'], slots.root);
122
- });
124
+ };
123
125
  TextEditor.displayName = 'f7-text-editor';
124
126
  export default TextEditor;