framework7-react 7.1.5 → 8.0.0-beta.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/components/accordion-content.js +2 -2
- package/components/accordion-item.js +2 -11
- package/components/accordion-toggle.js +2 -2
- package/components/accordion.js +2 -2
- package/components/actions-button.d.ts +1 -1
- package/components/actions-button.js +4 -8
- package/components/actions-group.js +2 -2
- package/components/actions-label.js +4 -6
- package/components/actions.js +4 -14
- package/components/app.js +4 -8
- package/components/area-chart.js +6 -45
- package/components/badge.js +2 -2
- package/components/block-footer.js +2 -2
- package/components/block-header.js +2 -2
- package/components/block-title.js +2 -2
- package/components/block.d.ts +17 -4
- package/components/block.js +37 -11
- package/components/breadcrumbs-collapsed.js +2 -4
- package/components/breadcrumbs-item.js +2 -4
- package/components/breadcrumbs-separator.js +2 -2
- package/components/breadcrumbs.js +2 -2
- package/components/button.d.ts +3 -7
- package/components/button.js +8 -24
- package/components/card-content.js +2 -2
- package/components/card-footer.js +2 -2
- package/components/card-header.js +2 -2
- package/components/card.d.ts +5 -2
- package/components/card.js +14 -23
- package/components/checkbox.js +2 -4
- package/components/chip.d.ts +0 -1
- package/components/chip.js +2 -9
- package/components/fab-backdrop.js +2 -2
- package/components/fab-button.js +2 -6
- package/components/fab-buttons.js +2 -2
- package/components/fab.js +2 -10
- package/components/gauge.js +2 -2
- package/components/icon.d.ts +0 -1
- package/components/icon.js +3 -17
- package/components/input.js +1 -57
- package/components/link.d.ts +0 -1
- package/components/link.js +5 -12
- package/components/list-button.js +2 -4
- package/components/list-group.js +2 -2
- package/components/list-index.d.ts +0 -1
- package/components/list-index.js +3 -13
- package/components/list-input.d.ts +0 -1
- package/components/list-input.js +1 -55
- package/components/list-item-content.js +9 -20
- package/components/list-item.d.ts +1 -1
- package/components/list-item.js +6 -35
- package/components/list.d.ts +21 -9
- package/components/list.js +43 -37
- package/components/login-screen-title.js +2 -2
- package/components/login-screen.js +3 -15
- package/components/message.js +2 -10
- package/components/messagebar-attachment.js +2 -5
- package/components/messagebar-attachments.js +2 -2
- package/components/messagebar-sheet-image.js +4 -5
- package/components/messagebar-sheet-item.js +2 -2
- package/components/messagebar-sheet.js +2 -2
- package/components/messagebar.js +1 -19
- package/components/messages-title.js +2 -2
- package/components/messages.js +2 -15
- package/components/nav-left.js +2 -6
- package/components/nav-right.js +2 -2
- package/components/nav-title-large.js +2 -2
- package/components/nav-title.js +2 -4
- package/components/navbar.d.ts +1 -2
- package/components/navbar.js +5 -31
- package/components/page-content.js +2 -16
- package/components/page.d.ts +0 -1
- package/components/page.js +4 -62
- package/components/panel.d.ts +1 -0
- package/components/panel.js +6 -26
- package/components/photo-browser.js +1 -17
- package/components/pie-chart.js +6 -18
- package/components/popover.d.ts +1 -0
- package/components/popover.js +4 -14
- package/components/popup.js +3 -19
- package/components/preloader.js +5 -14
- package/components/progressbar.js +2 -4
- package/components/radio.js +2 -4
- package/components/range.js +2 -9
- package/components/routable-modals.js +2 -7
- package/components/searchbar.d.ts +1 -2
- package/components/searchbar.js +5 -30
- package/components/segmented.d.ts +0 -3
- package/components/segmented.js +4 -10
- package/components/sheet.js +2 -22
- package/components/stepper.d.ts +0 -5
- package/components/stepper.js +3 -33
- package/components/subnavbar.js +2 -2
- package/components/swipeout-actions.js +2 -4
- package/components/swipeout-button.js +2 -4
- package/components/tab.js +4 -15
- package/components/tabs.js +1 -4
- package/components/text-editor.js +1 -18
- package/components/toggle.js +1 -13
- package/components/toolbar.d.ts +2 -6
- package/components/toolbar.js +9 -20
- package/components/treeview-item.d.ts +0 -1
- package/components/treeview-item.js +2 -11
- package/components/treeview.js +2 -2
- package/components/view.d.ts +0 -6
- package/components/view.js +3 -30
- package/components/views.js +2 -2
- package/framework7-react.d.ts +2 -14
- package/framework7-react.js +3 -14
- package/package.json +1 -1
- package/shared/components-router.js +0 -32
- package/shared/f7.js +5 -19
- package/shared/get-router-initial-component.js +0 -4
- package/shared/mixins.js +2 -8
- package/shared/plugin.js +2 -8
- package/shared/router-open-in.js +4 -15
- package/shared/tabbar-context.js +1 -1
- package/shared/use-icon.js +1 -6
- package/shared/use-isomorphic-layout-effect.js +0 -2
- package/shared/use-route-props.js +0 -1
- package/shared/use-smart-select.js +0 -3
- package/shared/use-store.js +4 -8
- package/shared/use-tab.js +0 -4
- package/shared/use-theme.js +0 -2
- package/shared/use-tooltip.js +0 -5
- package/shared/utils.js +0 -18
- package/shared/watch-prop.js +0 -1
- package/components/appbar.d.ts +0 -28
- package/components/appbar.js +0 -45
- package/components/col.d.ts +0 -36
- package/components/col.js +0 -75
- package/components/list-item-cell.d.ts +0 -23
- package/components/list-item-cell.js +0 -28
- package/components/list-item-row.d.ts +0 -23
- package/components/list-item-row.js +0 -28
- package/components/menu-dropdown-item.d.ts +0 -68
- package/components/menu-dropdown-item.js +0 -59
- package/components/menu-dropdown.d.ts +0 -28
- package/components/menu-dropdown.js +0 -42
- package/components/menu-item.d.ts +0 -81
- package/components/menu-item.js +0 -101
- package/components/menu.d.ts +0 -23
- package/components/menu.js +0 -30
- package/components/row.d.ts +0 -31
- package/components/row.js +0 -64
- package/components/swiper-slide.d.ts +0 -4
- package/components/swiper-slide.js +0 -3
- package/components/swiper.d.ts +0 -4
- package/components/swiper.js +0 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const AccordionContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
|
|
5
4
|
import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
|
|
6
5
|
import { colorClasses } from '../shared/mixins.js';
|
|
7
6
|
import { f7, f7ready } from '../shared/f7.js';
|
|
8
7
|
|
|
8
|
+
|
|
9
9
|
const AccordionItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
10
|
const {
|
|
11
11
|
className,
|
|
@@ -18,37 +18,30 @@ const AccordionItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
18
18
|
useImperativeHandle(ref, () => ({
|
|
19
19
|
el: elRef.current
|
|
20
20
|
}));
|
|
21
|
-
|
|
22
21
|
const onBeforeOpen = (el, prevent) => {
|
|
23
22
|
if (elRef.current !== el) return;
|
|
24
23
|
emit(props, 'accordionBeforeOpen', prevent);
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
const onOpen = el => {
|
|
28
26
|
if (elRef.current !== el) return;
|
|
29
27
|
emit(props, 'accordionOpen');
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
const onOpened = el => {
|
|
33
30
|
if (elRef.current !== el) return;
|
|
34
31
|
emit(props, 'accordionOpened');
|
|
35
32
|
};
|
|
36
|
-
|
|
37
33
|
const onBeforeClose = (el, prevent) => {
|
|
38
34
|
if (elRef.current !== el) return;
|
|
39
35
|
emit(props, 'accordionBeforeClose', prevent);
|
|
40
36
|
};
|
|
41
|
-
|
|
42
37
|
const onClose = el => {
|
|
43
38
|
if (elRef.current !== el) return;
|
|
44
39
|
emit(props, 'accordionClose');
|
|
45
40
|
};
|
|
46
|
-
|
|
47
41
|
const onClosed = el => {
|
|
48
42
|
if (elRef.current !== el) return;
|
|
49
43
|
emit(props, 'accordionClosed');
|
|
50
44
|
};
|
|
51
|
-
|
|
52
45
|
const attachEvents = () => {
|
|
53
46
|
f7ready(() => {
|
|
54
47
|
f7.on('accordionBeforeOpen', onBeforeOpen);
|
|
@@ -59,7 +52,6 @@ const AccordionItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
59
52
|
f7.on('accordionClosed', onClosed);
|
|
60
53
|
});
|
|
61
54
|
};
|
|
62
|
-
|
|
63
55
|
const detachEvents = () => {
|
|
64
56
|
f7.off('accordionBeforeOpen', onBeforeOpen);
|
|
65
57
|
f7.off('accordionOpen', onOpen);
|
|
@@ -68,7 +60,6 @@ const AccordionItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
68
60
|
f7.off('accordionClose', onClose);
|
|
69
61
|
f7.off('accordionClosed', onClosed);
|
|
70
62
|
};
|
|
71
|
-
|
|
72
63
|
useIsomorphicLayoutEffect(() => {
|
|
73
64
|
attachEvents();
|
|
74
65
|
return detachEvents;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const AccordionToggle = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
package/components/accordion.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const Accordion = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -7,7 +7,7 @@ export interface ActionsButtonProps {
|
|
|
7
7
|
id?: string | number;
|
|
8
8
|
className?: string;
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
|
-
|
|
10
|
+
strong?: boolean;
|
|
11
11
|
close?: boolean;
|
|
12
12
|
onClick ?: (event?: any) => void;
|
|
13
13
|
ref?: React.MutableRefObject<{el: HTMLElement | null}>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs, getSlots, emit } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
import { f7 } from '../shared/f7.js';
|
|
7
6
|
|
|
7
|
+
|
|
8
8
|
const ComponentName = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
10
10
|
className,
|
|
11
11
|
id,
|
|
12
12
|
style,
|
|
13
|
-
|
|
13
|
+
strong,
|
|
14
14
|
close = true
|
|
15
15
|
} = props;
|
|
16
16
|
const extraAttrs = getExtraAttrs(props);
|
|
@@ -20,25 +20,21 @@ const ComponentName = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
20
20
|
}));
|
|
21
21
|
const classes = classNames(className, {
|
|
22
22
|
'actions-button': true,
|
|
23
|
-
'actions-button-
|
|
23
|
+
'actions-button-strong': strong
|
|
24
24
|
}, colorClasses(props));
|
|
25
25
|
let mediaEl;
|
|
26
26
|
const slots = getSlots(props);
|
|
27
|
-
|
|
28
27
|
if (slots.media && slots.media.length) {
|
|
29
28
|
mediaEl = /*#__PURE__*/React.createElement("div", {
|
|
30
29
|
className: "actions-button-media"
|
|
31
30
|
}, slots.media);
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
const onClick = e => {
|
|
35
33
|
if (elRef.current && close && f7) {
|
|
36
34
|
f7.actions.close(f7.$(elRef.current).parents('.actions-modal'));
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
emit(props, 'click', e);
|
|
40
37
|
};
|
|
41
|
-
|
|
42
38
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
43
39
|
id: id,
|
|
44
40
|
style: style,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const ActionsGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const ActionsLabel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
10
10
|
id,
|
|
11
11
|
style,
|
|
12
12
|
children,
|
|
13
|
-
|
|
13
|
+
strong
|
|
14
14
|
} = props;
|
|
15
15
|
const extraAttrs = getExtraAttrs(props);
|
|
16
16
|
const elRef = useRef(null);
|
|
@@ -18,13 +18,11 @@ const ActionsLabel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
18
18
|
el: elRef.current
|
|
19
19
|
}));
|
|
20
20
|
const classes = classNames(className, 'actions-label', {
|
|
21
|
-
'actions-button-
|
|
21
|
+
'actions-button-strong': strong
|
|
22
22
|
}, colorClasses(props));
|
|
23
|
-
|
|
24
23
|
const onClick = e => {
|
|
25
24
|
emit(props, 'click', e);
|
|
26
25
|
};
|
|
27
|
-
|
|
28
26
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
29
27
|
id: id,
|
|
30
28
|
style: style,
|
package/components/actions.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
|
|
5
4
|
import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
|
|
@@ -9,6 +8,7 @@ import { watchProp } from '../shared/watch-prop.js';
|
|
|
9
8
|
import { modalStateClasses } from '../shared/modal-state-classes.js';
|
|
10
9
|
|
|
11
10
|
|
|
11
|
+
|
|
12
12
|
const Actions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
13
13
|
const {
|
|
14
14
|
className,
|
|
@@ -24,43 +24,37 @@ const Actions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24
24
|
const isOpened = useRef(opened);
|
|
25
25
|
const isClosing = useRef(false);
|
|
26
26
|
const f7Actions = useRef(null);
|
|
27
|
-
|
|
28
27
|
const onOpen = instance => {
|
|
29
28
|
isOpened.current = true;
|
|
30
29
|
isClosing.current = false;
|
|
31
30
|
emit(props, 'actionsOpen', instance);
|
|
32
31
|
};
|
|
33
|
-
|
|
34
32
|
const onOpened = instance => {
|
|
35
33
|
emit(props, 'actionsOpened', instance);
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
const onClose = instance => {
|
|
39
36
|
isOpened.current = false;
|
|
40
37
|
isClosing.current = true;
|
|
41
38
|
emit(props, 'actionsClose', instance);
|
|
42
39
|
};
|
|
43
|
-
|
|
44
40
|
const onClosed = instance => {
|
|
45
41
|
isClosing.current = false;
|
|
46
42
|
emit(props, 'actionsClosed', instance);
|
|
47
43
|
};
|
|
48
|
-
|
|
49
44
|
useImperativeHandle(ref, () => ({
|
|
50
45
|
el: elRef.current,
|
|
51
46
|
f7Actions: () => f7Actions.current
|
|
52
|
-
}));
|
|
47
|
+
}));
|
|
53
48
|
|
|
49
|
+
// watch opened changes
|
|
54
50
|
watchProp(opened, value => {
|
|
55
51
|
if (!f7Actions.current) return;
|
|
56
|
-
|
|
57
52
|
if (value) {
|
|
58
53
|
f7Actions.current.open();
|
|
59
54
|
} else {
|
|
60
55
|
f7Actions.current.close();
|
|
61
56
|
}
|
|
62
57
|
});
|
|
63
|
-
|
|
64
58
|
const modalEvents = method => {
|
|
65
59
|
if (!f7Actions.current) return;
|
|
66
60
|
f7Actions.current[method]('open', onOpen);
|
|
@@ -68,7 +62,6 @@ const Actions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
68
62
|
f7Actions.current[method]('close', onClose);
|
|
69
63
|
f7Actions.current[method]('closed', onClosed);
|
|
70
64
|
};
|
|
71
|
-
|
|
72
65
|
const onMount = () => {
|
|
73
66
|
if (!elRef.current) return;
|
|
74
67
|
const {
|
|
@@ -99,18 +92,15 @@ const Actions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
99
92
|
f7ready(() => {
|
|
100
93
|
f7Actions.current = f7.actions.create(params);
|
|
101
94
|
modalEvents('on');
|
|
102
|
-
|
|
103
95
|
if (opened) {
|
|
104
96
|
f7Actions.current.open(false);
|
|
105
97
|
}
|
|
106
98
|
});
|
|
107
99
|
};
|
|
108
|
-
|
|
109
100
|
const onDestroy = () => {
|
|
110
101
|
if (f7Actions.current) f7Actions.current.destroy();
|
|
111
102
|
f7Actions.current = null;
|
|
112
103
|
};
|
|
113
|
-
|
|
114
104
|
useIsomorphicLayoutEffect(() => {
|
|
115
105
|
modalEvents('on');
|
|
116
106
|
return () => {
|
package/components/app.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
|
|
5
4
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
@@ -9,6 +8,7 @@ import { f7init, f7 } from '../shared/f7.js';
|
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
11
|
+
|
|
12
12
|
const App = /*#__PURE__*/forwardRef((props, ref) => {
|
|
13
13
|
const {
|
|
14
14
|
className,
|
|
@@ -22,27 +22,23 @@ const App = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22
22
|
useImperativeHandle(ref, () => ({
|
|
23
23
|
el: elRef.current
|
|
24
24
|
}));
|
|
25
|
-
const classes = classNames(className, 'framework7-root', colorClasses(props));
|
|
25
|
+
const classes = classNames(className, 'framework7-root', colorClasses(props));
|
|
26
26
|
|
|
27
|
+
// eslint-disable-next-line
|
|
27
28
|
if (!f7 || typeof window === 'undefined') {
|
|
28
29
|
f7init(elRef.current, params, false);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
31
|
useIsomorphicLayoutEffect(() => {
|
|
32
32
|
const parentEl = elRef.current && elRef.current.parentNode;
|
|
33
33
|
/* eslint-disable no-restricted-globals */
|
|
34
|
-
|
|
35
34
|
if (typeof document !== 'undefined' && parentEl && parentEl !== document.body && parentEl.parentNode === document.body) {
|
|
36
35
|
parentEl.style.height = '100%';
|
|
37
36
|
}
|
|
38
37
|
/* eslint-enable no-restricted-globals */
|
|
39
|
-
|
|
40
|
-
|
|
41
38
|
if (f7) {
|
|
42
39
|
f7.init(elRef.current);
|
|
43
40
|
return;
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
f7init(elRef.current, params, true);
|
|
47
43
|
}, []);
|
|
48
44
|
return /*#__PURE__*/React.createElement("div", _extends({
|
package/components/area-chart.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle, useState, useEffect } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
|
|
5
4
|
import { f7 } from '../shared/f7.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -38,14 +38,12 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
38
38
|
useImperativeHandle(ref, () => ({
|
|
39
39
|
el: elRef.current
|
|
40
40
|
}));
|
|
41
|
-
|
|
42
41
|
const getVisibleLegends = () => {
|
|
43
42
|
if (!maxAxisLabels || axisLabels.length <= maxAxisLabels) return axisLabels;
|
|
44
43
|
const skipStep = Math.ceil(axisLabels.length / maxAxisLabels);
|
|
45
44
|
const filtered = axisLabels.filter((label, index) => index % skipStep === 0);
|
|
46
45
|
return filtered;
|
|
47
46
|
};
|
|
48
|
-
|
|
49
47
|
const getSummValues = () => {
|
|
50
48
|
const summValues = [];
|
|
51
49
|
datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref => {
|
|
@@ -59,17 +57,13 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
59
57
|
});
|
|
60
58
|
return summValues;
|
|
61
59
|
};
|
|
62
|
-
|
|
63
60
|
const getChartData = () => {
|
|
64
61
|
const data = [];
|
|
65
|
-
|
|
66
62
|
if (!datasets.length) {
|
|
67
63
|
return data;
|
|
68
64
|
}
|
|
69
|
-
|
|
70
65
|
const lastValues = datasets[0].values.map(() => 0);
|
|
71
66
|
let maxValue = 0;
|
|
72
|
-
|
|
73
67
|
if (lineChart) {
|
|
74
68
|
datasets.forEach(_ref2 => {
|
|
75
69
|
let {
|
|
@@ -81,7 +75,6 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
81
75
|
} else {
|
|
82
76
|
maxValue = Math.max(...getSummValues());
|
|
83
77
|
}
|
|
84
|
-
|
|
85
78
|
datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref3 => {
|
|
86
79
|
let {
|
|
87
80
|
label,
|
|
@@ -93,18 +86,14 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
93
86
|
const value = lineChart ? originalValue : lastValues[valueIndex];
|
|
94
87
|
const x = valueIndex / (values.length - 1) * width;
|
|
95
88
|
const y = height - value / maxValue * height;
|
|
96
|
-
|
|
97
89
|
if (lineChart) {
|
|
98
90
|
return `${valueIndex === 0 ? 'M' : 'L'}${x},${y}`;
|
|
99
91
|
}
|
|
100
|
-
|
|
101
92
|
return `${x} ${y}`;
|
|
102
93
|
});
|
|
103
|
-
|
|
104
94
|
if (!lineChart) {
|
|
105
95
|
points.push(`${width} ${height} 0 ${height}`);
|
|
106
96
|
}
|
|
107
|
-
|
|
108
97
|
data.push({
|
|
109
98
|
label,
|
|
110
99
|
points: points.join(' '),
|
|
@@ -113,14 +102,11 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
113
102
|
});
|
|
114
103
|
return data.reverse();
|
|
115
104
|
};
|
|
116
|
-
|
|
117
105
|
const getVerticalLines = () => {
|
|
118
106
|
const lines = [];
|
|
119
|
-
|
|
120
107
|
if (!datasets.length) {
|
|
121
108
|
return lines;
|
|
122
109
|
}
|
|
123
|
-
|
|
124
110
|
const values = datasets[0].values;
|
|
125
111
|
values.forEach((value, valueIndex) => {
|
|
126
112
|
const x = valueIndex / (values.length - 1) * width;
|
|
@@ -128,38 +114,30 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
128
114
|
});
|
|
129
115
|
return lines;
|
|
130
116
|
};
|
|
131
|
-
|
|
132
117
|
const toggleDataset = index => {
|
|
133
118
|
if (!toggleDatasets) return;
|
|
134
|
-
|
|
135
119
|
if (hiddenDatasets.includes(index)) {
|
|
136
120
|
hiddenDatasets.splice(hiddenDatasets.indexOf(index), 1);
|
|
137
121
|
} else {
|
|
138
122
|
hiddenDatasets.push(index);
|
|
139
123
|
}
|
|
140
|
-
|
|
141
124
|
setHiddenDatasets([...hiddenDatasets]);
|
|
142
125
|
};
|
|
143
|
-
|
|
144
126
|
const formatAxisLabel = label => {
|
|
145
127
|
if (formatAxisLabelProp) return formatAxisLabelProp(label);
|
|
146
128
|
return label;
|
|
147
129
|
};
|
|
148
|
-
|
|
149
130
|
const formatLegendLabel = label => {
|
|
150
131
|
if (formatLegendLabelProp) return formatLegendLabelProp(label);
|
|
151
132
|
return label;
|
|
152
133
|
};
|
|
153
|
-
|
|
154
134
|
const calcLinesOffsets = () => {
|
|
155
135
|
const lines = svgElRef.current.querySelectorAll('line');
|
|
156
136
|
linesOffsets.current = [];
|
|
157
|
-
|
|
158
137
|
for (let i = 0; i < lines.length; i += 1) {
|
|
159
138
|
linesOffsets.current.push(lines[i].getBoundingClientRect().left);
|
|
160
139
|
}
|
|
161
140
|
};
|
|
162
|
-
|
|
163
141
|
const formatTooltip = () => {
|
|
164
142
|
if (currentIndex === null) return '';
|
|
165
143
|
let total = 0;
|
|
@@ -171,7 +149,6 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
171
149
|
currentValues.forEach(dataset => {
|
|
172
150
|
total += dataset.value;
|
|
173
151
|
});
|
|
174
|
-
|
|
175
152
|
if (formatTooltipProp) {
|
|
176
153
|
return formatTooltipProp({
|
|
177
154
|
index: currentIndex,
|
|
@@ -179,11 +156,10 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
179
156
|
datasets: currentValues
|
|
180
157
|
});
|
|
181
158
|
}
|
|
182
|
-
|
|
183
159
|
let labelText = formatTooltipAxisLabel ? formatTooltipAxisLabel(axisLabels[currentIndex]) : formatAxisLabel(axisLabels[currentIndex]);
|
|
184
160
|
if (!labelText) labelText = '';
|
|
185
|
-
const totalText = formatTooltipTotal ? formatTooltipTotal(total) : total;
|
|
186
|
-
|
|
161
|
+
const totalText = formatTooltipTotal ? formatTooltipTotal(total) : total;
|
|
162
|
+
// prettier-ignore
|
|
187
163
|
const datasetsText = currentValues.length > 0 ? `
|
|
188
164
|
<ul class="area-chart-tooltip-list">
|
|
189
165
|
${currentValues.map(_ref4 => {
|
|
@@ -197,24 +173,21 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
197
173
|
<li><span style="background-color: ${color};"></span>${valueText}</li>
|
|
198
174
|
`;
|
|
199
175
|
}).join('')}
|
|
200
|
-
</ul>` : '';
|
|
201
|
-
|
|
176
|
+
</ul>` : '';
|
|
177
|
+
// prettier-ignore
|
|
202
178
|
return `
|
|
203
179
|
<div class="area-chart-tooltip-label">${labelText}</div>
|
|
204
180
|
<div class="area-chart-tooltip-total">${totalText}</div>
|
|
205
181
|
${datasetsText}
|
|
206
182
|
`;
|
|
207
183
|
};
|
|
208
|
-
|
|
209
184
|
const setTooltip = () => {
|
|
210
185
|
if (!tooltip) return;
|
|
211
186
|
const hasVisibleDataSets = datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).length > 0;
|
|
212
|
-
|
|
213
187
|
if (!hasVisibleDataSets) {
|
|
214
188
|
if (f7Tooltip.current && f7Tooltip.current.hide) f7Tooltip.current.hide();
|
|
215
189
|
return;
|
|
216
190
|
}
|
|
217
|
-
|
|
218
191
|
if (currentIndex !== null && !f7Tooltip.current) {
|
|
219
192
|
f7Tooltip.current = f7.tooltip.create({
|
|
220
193
|
trigger: 'manual',
|
|
@@ -223,18 +196,14 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
223
196
|
text: formatTooltip(),
|
|
224
197
|
cssClass: 'area-chart-tooltip'
|
|
225
198
|
});
|
|
226
|
-
|
|
227
199
|
if (f7Tooltip.current && f7Tooltip.current.show) {
|
|
228
200
|
f7Tooltip.current.show();
|
|
229
201
|
}
|
|
230
|
-
|
|
231
202
|
return;
|
|
232
203
|
}
|
|
233
|
-
|
|
234
204
|
if (!f7Tooltip.current || !f7Tooltip.current.hide || !f7Tooltip.current.show) {
|
|
235
205
|
return;
|
|
236
206
|
}
|
|
237
|
-
|
|
238
207
|
if (currentIndex !== null) {
|
|
239
208
|
f7Tooltip.current.setText(formatTooltip());
|
|
240
209
|
f7Tooltip.current.setTargetEl(svgElRef.current.querySelector(`line[data-index="${currentIndex}"]`));
|
|
@@ -243,16 +212,13 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
243
212
|
f7Tooltip.current.hide();
|
|
244
213
|
}
|
|
245
214
|
};
|
|
246
|
-
|
|
247
215
|
const onMouseEnter = () => {
|
|
248
216
|
calcLinesOffsets();
|
|
249
217
|
};
|
|
250
|
-
|
|
251
218
|
const onMouseMove = e => {
|
|
252
219
|
if (!linesOffsets.current) {
|
|
253
220
|
calcLinesOffsets();
|
|
254
221
|
}
|
|
255
|
-
|
|
256
222
|
let currentLeft = e.pageX;
|
|
257
223
|
if (typeof currentLeft === 'undefined') currentLeft = 0;
|
|
258
224
|
const distances = linesOffsets.current.map(left => Math.abs(currentLeft - left));
|
|
@@ -260,25 +226,21 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
260
226
|
const closestIndex = distances.indexOf(minDistance);
|
|
261
227
|
setCurrentIndex(closestIndex);
|
|
262
228
|
};
|
|
263
|
-
|
|
264
229
|
const onMouseLeave = () => {
|
|
265
230
|
setCurrentIndex(null);
|
|
266
231
|
};
|
|
267
|
-
|
|
268
232
|
const attachEvents = () => {
|
|
269
233
|
if (!svgElRef.current) return;
|
|
270
234
|
svgElRef.current.addEventListener('mouseenter', onMouseEnter);
|
|
271
235
|
svgElRef.current.addEventListener('mousemove', onMouseMove);
|
|
272
236
|
svgElRef.current.addEventListener('mouseleave', onMouseLeave);
|
|
273
237
|
};
|
|
274
|
-
|
|
275
238
|
const detachEvents = () => {
|
|
276
239
|
if (!svgElRef.current) return;
|
|
277
240
|
svgElRef.current.removeEventListener('mouseenter', onMouseEnter);
|
|
278
241
|
svgElRef.current.removeEventListener('mousemove', onMouseMove);
|
|
279
242
|
svgElRef.current.removeEventListener('mouseleave', onMouseLeave);
|
|
280
243
|
};
|
|
281
|
-
|
|
282
244
|
useEffect(() => {
|
|
283
245
|
if (previousIndex.current === currentIndex) return;
|
|
284
246
|
previousIndex.current = currentIndex;
|
|
@@ -294,7 +256,6 @@ const AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
294
256
|
if (f7Tooltip.current && f7Tooltip.current.destroy) {
|
|
295
257
|
f7Tooltip.current.destroy();
|
|
296
258
|
}
|
|
297
|
-
|
|
298
259
|
f7Tooltip.current = null;
|
|
299
260
|
};
|
|
300
261
|
}, []);
|
package/components/badge.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
import { useTooltip } from '../shared/use-tooltip.js';
|
|
7
6
|
|
|
7
|
+
|
|
8
8
|
/* dts-instance
|
|
9
9
|
f7Tooltip: Tooltip.Tooltip
|
|
10
10
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const BlockFooter = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const BlockHeader = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs } from '../shared/utils.js';
|
|
5
4
|
import { colorClasses } from '../shared/mixins.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const BlockTitle = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|