@tecsinapse/react-web-kit 1.18.5 → 1.19.0
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/CHANGELOG.md +36 -0
- package/dist/components/atoms/Button/Button.d.ts +2 -0
- package/dist/components/atoms/Button/Button.js +18 -2
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/hooks/useMouseHover.d.ts +3 -3
- package/dist/components/atoms/Button/hooks/useMouseHover.js +13 -3
- package/dist/components/atoms/Button/hooks/useMouseHover.js.map +1 -1
- package/dist/components/atoms/Button/hooks/useMousePressed.d.ts +5 -0
- package/dist/components/atoms/Button/hooks/useMousePressed.js +32 -0
- package/dist/components/atoms/Button/hooks/useMousePressed.js.map +1 -0
- package/dist/components/atoms/Button/styled.js +9 -4
- package/dist/components/atoms/Button/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Grid.d.ts +3 -13
- package/dist/components/molecules/Grid/Grid.js +4 -2
- package/dist/components/molecules/Grid/Grid.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +6 -27
- package/dist/components/molecules/Grid/Item/Item.js +41 -19
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/Grid/Item/functions.d.ts +2 -0
- package/dist/components/molecules/Grid/Item/functions.js +16 -0
- package/dist/components/molecules/Grid/Item/functions.js.map +1 -0
- package/dist/components/molecules/Grid/Item/index.d.ts +1 -1
- package/dist/components/molecules/Grid/Item/index.js.map +1 -1
- package/dist/components/molecules/Grid/index.d.ts +2 -2
- package/dist/components/molecules/Grid/index.js.map +1 -1
- package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +6 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js +64 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/TextComponent.d.ts +12 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js +32 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js.map +1 -0
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.d.ts +6 -0
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.js +31 -0
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/index.d.ts +1 -0
- package/dist/components/molecules/IconTextButton/index.js +24 -0
- package/dist/components/molecules/IconTextButton/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/styled.d.ts +1 -0
- package/dist/components/molecules/IconTextButton/styled.js +33 -0
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.d.ts +12 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js +38 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +7 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +55 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
- package/dist/components/molecules/LabeledSwitch/index.js +24 -0
- package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/styled.d.ts +8 -0
- package/dist/components/molecules/LabeledSwitch/styled.js +39 -0
- package/dist/components/molecules/LabeledSwitch/styled.js.map +1 -0
- package/dist/components/organisms/DataGrid/Footer/Footer.js +3 -2
- package/dist/components/organisms/DataGrid/Footer/Footer.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useBreakpoints.d.ts +6 -0
- package/dist/hooks/useBreakpoints.js +27 -0
- package/dist/hooks/useBreakpoints.js.map +1 -0
- package/dist/hooks/useWindowSize.d.ts +6 -0
- package/dist/hooks/useWindowSize.js +35 -0
- package/dist/hooks/useWindowSize.js.map +1 -0
- package/dist/index.d.ts +14 -13
- package/dist/index.js +147 -131
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/atoms/Button/Button.tsx +20 -1
- package/src/components/atoms/Button/hooks/useMouseHover.ts +17 -9
- package/src/components/atoms/Button/hooks/useMousePressed.ts +29 -0
- package/src/components/atoms/Button/styled.ts +23 -6
- package/src/components/molecules/Grid/Grid.stories.tsx +198 -0
- package/src/components/molecules/Grid/Grid.tsx +7 -25
- package/src/components/molecules/Grid/Item/Item.tsx +57 -57
- package/src/components/molecules/Grid/Item/functions.ts +13 -0
- package/src/components/molecules/Grid/Item/index.ts +1 -1
- package/src/components/molecules/Grid/index.ts +2 -2
- package/src/components/molecules/IconTextButton/IconTextButton.stories.tsx +51 -0
- package/src/components/molecules/IconTextButton/IconTextButton.tsx +65 -0
- package/src/components/molecules/IconTextButton/TextComponent.tsx +39 -0
- package/src/components/molecules/IconTextButton/hooks/useIconTextButton.ts +31 -0
- package/src/components/molecules/IconTextButton/index.ts +4 -0
- package/src/components/molecules/IconTextButton/styled.ts +18 -0
- package/src/components/molecules/LabeledSwitch/LabelComponent.tsx +46 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.stories.tsx +41 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +58 -0
- package/src/components/molecules/LabeledSwitch/index.ts +4 -0
- package/src/components/molecules/LabeledSwitch/styled.ts +26 -0
- package/src/components/organisms/DataGrid/Footer/Footer.tsx +4 -4
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBreakpoints.ts +18 -0
- package/src/hooks/useWindowSize.ts +25 -0
- package/src/index.ts +33 -24
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonSizeType, FontColor, IconPositionOptions, TextProps } from '@tecsinapse/react-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface TextComponentProps {
|
|
4
|
+
textProps?: TextProps;
|
|
5
|
+
size?: ButtonSizeType;
|
|
6
|
+
defaultFontColor: keyof FontColor;
|
|
7
|
+
label?: string;
|
|
8
|
+
iconPosition?: IconPositionOptions;
|
|
9
|
+
hasIcon?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.NamedExoticComponent<TextComponentProps>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
15
|
+
|
|
16
|
+
const TextComponent = ({
|
|
17
|
+
textProps,
|
|
18
|
+
size = 'default',
|
|
19
|
+
defaultFontColor,
|
|
20
|
+
label
|
|
21
|
+
}) => {
|
|
22
|
+
return label ? _react.default.createElement(_reactCore.Text, _extends({
|
|
23
|
+
typography: (textProps === null || textProps === void 0 ? void 0 : textProps.typography) ?? size === 'small' ? 'sub' : 'base',
|
|
24
|
+
fontWeight: (textProps === null || textProps === void 0 ? void 0 : textProps.fontWeight) ?? 'bold',
|
|
25
|
+
fontColor: (textProps === null || textProps === void 0 ? void 0 : textProps.fontColor) ?? defaultFontColor
|
|
26
|
+
}, textProps), label) : _react.default.createElement(_react.default.Fragment, null);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var _default = _react.default.memo(TextComponent);
|
|
30
|
+
|
|
31
|
+
exports.default = _default;
|
|
32
|
+
//# sourceMappingURL=TextComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/IconTextButton/TextComponent.tsx"],"names":["TextComponent","textProps","size","defaultFontColor","label","typography","fontWeight","fontColor","React","memo"],"mappings":";;;;;;;AAAA;;AAOA;;;;;;AAWA,MAAMA,aAAqC,GAAG,CAAC;AAC7CC,EAAAA,SAD6C;AAE7CC,EAAAA,IAAI,GAAG,SAFsC;AAG7CC,EAAAA,gBAH6C;AAI7CC,EAAAA;AAJ6C,CAAD,KAKxC;AACJ,SAAOA,KAAK,GACV,6BAAC,eAAD;AACE,IAAA,UAAU,EAAE,CAAAH,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEI,UAAX,KAAyBH,IAAI,KAAK,OAAlC,GAA4C,KAA5C,GAAoD,MADlE;AAEE,IAAA,UAAU,EAAE,CAAAD,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEK,UAAX,KAAyB,MAFvC;AAGE,IAAA,SAAS,EAAE,CAAAL,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEM,SAAX,KAAwBJ;AAHrC,KAIMF,SAJN,GAMGG,KANH,CADU,GAUV,2DAVF;AAYD,CAlBD;;eAoBeI,eAAMC,IAAN,CAAWT,aAAX,C","sourcesContent":["import {\n ButtonSizeType,\n FontColor,\n IconPositionOptions,\n Text,\n TextProps,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\n\ninterface TextComponentProps {\n textProps?: TextProps;\n size?: ButtonSizeType;\n defaultFontColor: keyof FontColor;\n label?: string;\n iconPosition?: IconPositionOptions;\n hasIcon?: boolean;\n}\n\nconst TextComponent: FC<TextComponentProps> = ({\n textProps,\n size = 'default',\n defaultFontColor,\n label,\n}) => {\n return label ? (\n <Text\n typography={textProps?.typography ?? size === 'small' ? 'sub' : 'base'}\n fontWeight={textProps?.fontWeight ?? 'bold'}\n fontColor={textProps?.fontColor ?? defaultFontColor}\n {...textProps}\n >\n {label}\n </Text>\n ) : (\n <></>\n );\n};\n\nexport default React.memo(TextComponent);\n"],"file":"TextComponent.js"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
const useIconTextButton = variant => {
|
|
13
|
+
const [hover, setHover] = (0, _react.useState)(false);
|
|
14
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
15
|
+
const defaultFontColor = !pressed && hover ? 'light' : _reactCore.fontColorVC[variant];
|
|
16
|
+
const handleHover = (0, _react.useCallback)(value => {
|
|
17
|
+
setHover(value);
|
|
18
|
+
}, [setHover]);
|
|
19
|
+
const handlePressed = (0, _react.useCallback)(value => {
|
|
20
|
+
setPressed(value);
|
|
21
|
+
}, [setPressed]);
|
|
22
|
+
return {
|
|
23
|
+
handleHover,
|
|
24
|
+
handlePressed,
|
|
25
|
+
defaultFontColor
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var _default = useIconTextButton;
|
|
30
|
+
exports.default = _default;
|
|
31
|
+
//# sourceMappingURL=useIconTextButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/IconTextButton/hooks/useIconTextButton.ts"],"names":["useIconTextButton","variant","hover","setHover","pressed","setPressed","defaultFontColor","fontColorVC","handleHover","value","handlePressed"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAMA,iBAAiB,GAAIC,OAAD,IAA0B;AAClD,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAkB,KAAlB,CAA1B;AACA,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,qBAAkB,KAAlB,CAA9B;AAEA,QAAMC,gBAAgB,GAAG,CAACF,OAAD,IAAYF,KAAZ,GAAoB,OAApB,GAA8BK,uBAAYN,OAAZ,CAAvD;AAEA,QAAMO,WAAW,GAAG,wBACjBC,KAAD,IAAoB;AAClBN,IAAAA,QAAQ,CAACM,KAAD,CAAR;AACD,GAHiB,EAIlB,CAACN,QAAD,CAJkB,CAApB;AAOA,QAAMO,aAAa,GAAG,wBACnBD,KAAD,IAAoB;AAClBJ,IAAAA,UAAU,CAACI,KAAD,CAAV;AACD,GAHmB,EAIpB,CAACJ,UAAD,CAJoB,CAAtB;AAOA,SAAO;AACLG,IAAAA,WADK;AAELE,IAAAA,aAFK;AAGLJ,IAAAA;AAHK,GAAP;AAKD,CAzBD;;eA2BeN,iB","sourcesContent":["import { fontColorVC, VariantType } from '@tecsinapse/react-core';\nimport { useCallback, useState } from 'react';\n\nconst useIconTextButton = (variant: VariantType) => {\n const [hover, setHover] = useState<boolean>(false);\n const [pressed, setPressed] = useState<boolean>(false);\n\n const defaultFontColor = !pressed && hover ? 'light' : fontColorVC[variant];\n\n const handleHover = useCallback(\n (value: boolean) => {\n setHover(value);\n },\n [setHover]\n );\n\n const handlePressed = useCallback(\n (value: boolean) => {\n setPressed(value);\n },\n [setPressed]\n );\n\n return {\n handleHover,\n handlePressed,\n defaultFontColor,\n };\n};\n\nexport default useIconTextButton;\n"],"file":"useIconTextButton.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IconTextButton, WebIconTextButtonProps, } from './IconTextButton';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "IconTextButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _IconTextButton.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "WebIconTextButtonProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _IconTextButton.WebIconTextButtonProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _IconTextButton = _interopRequireWildcard(require("./IconTextButton"));
|
|
20
|
+
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/IconTextButton/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n default as IconTextButton,\n WebIconTextButtonProps,\n} from './IconTextButton';\n"],"file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StyledIconTextButton: import("@emotion/native").StyledComponent<any, {}, {}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledIconTextButton = void 0;
|
|
7
|
+
|
|
8
|
+
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
9
|
+
|
|
10
|
+
var _Button = require("../../atoms/Button");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const boxedStyle = ({
|
|
15
|
+
theme
|
|
16
|
+
}) => `
|
|
17
|
+
padding: ${theme === null || theme === void 0 ? void 0 : theme.spacing.centi};
|
|
18
|
+
aspect-ratio: 1;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const StyledIconTextButton = (0, _native.default)(_Button.Button)`
|
|
22
|
+
gap: ${({
|
|
23
|
+
theme
|
|
24
|
+
}) => theme === null || theme === void 0 ? void 0 : theme.spacing.mili};
|
|
25
|
+
${({
|
|
26
|
+
boxed,
|
|
27
|
+
theme
|
|
28
|
+
}) => boxed && boxedStyle({
|
|
29
|
+
theme
|
|
30
|
+
})};
|
|
31
|
+
`;
|
|
32
|
+
exports.StyledIconTextButton = StyledIconTextButton;
|
|
33
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/IconTextButton/styled.ts"],"names":["boxedStyle","theme","spacing","centi","StyledIconTextButton","Button","mili","boxed"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAChB;AACH,eAAeA,KADb,aACaA,KADb,uBACaA,KAAK,CAAEC,OAAP,CAAeC,KAAM;AACpC;AACA,GAJA;;AAMO,MAAMC,oBAAoB,GAAG,qBAAOC,cAAP,CAIlC;AACF,SAAS,CAAC;AAAEJ,EAAAA;AAAF,CAAD,KAAeA,KAAf,aAAeA,KAAf,uBAAeA,KAAK,CAAEC,OAAP,CAAeI,IAAK;AAC5C,IAAI,CAAC;AAAEC,EAAAA,KAAF;AAASN,EAAAA;AAAT,CAAD,KAAsBM,KAAK,IAAIP,UAAU,CAAC;AAAEC,EAAAA;AAAF,CAAD,CAAY;AACzD,CAPO","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\nimport { Button } from '../../atoms/Button';\n\nconst boxedStyle = ({ theme }: Partial<StyleProps>) =>\n `\n padding: ${theme?.spacing.centi};\n aspect-ratio: 1;\n `;\n\nexport const StyledIconTextButton = styled(Button)<\n Partial<StyleProps> & {\n boxed: boolean;\n }\n>`\n gap: ${({ theme }) => theme?.spacing.mili};\n ${({ boxed, theme }) => boxed && boxedStyle({ theme })};\n`;\n"],"file":"styled.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LabelPositionOptions, TextProps } from '@tecsinapse/react-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps } from 'react-native';
|
|
4
|
+
export interface LabelComponentProps extends PressableProps {
|
|
5
|
+
label: string;
|
|
6
|
+
labelPosition: LabelPositionOptions;
|
|
7
|
+
labelProps?: TextProps;
|
|
8
|
+
active: boolean;
|
|
9
|
+
switchDisabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.NamedExoticComponent<LabelComponentProps>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNativeWeb = require("react-native-web");
|
|
11
|
+
|
|
12
|
+
var _styled = require("./styled");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
17
|
+
|
|
18
|
+
const LabelComponent = ({
|
|
19
|
+
label,
|
|
20
|
+
labelPosition,
|
|
21
|
+
labelProps,
|
|
22
|
+
active,
|
|
23
|
+
switchDisabled = false,
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
const defaultFontColor = active && !switchDisabled ? 'dark' : 'medium';
|
|
27
|
+
const defaultFontWeight = active && !switchDisabled ? 'bold' : 'regular';
|
|
28
|
+
return _react.default.createElement(_reactNativeWeb.Pressable, rest, _react.default.createElement(_styled.StyledLabel, _extends({
|
|
29
|
+
labelPosition: labelPosition,
|
|
30
|
+
fontColor: (labelProps === null || labelProps === void 0 ? void 0 : labelProps.fontColor) ?? defaultFontColor,
|
|
31
|
+
fontWeight: (labelProps === null || labelProps === void 0 ? void 0 : labelProps.fontWeight) ?? defaultFontWeight
|
|
32
|
+
}, labelProps), label));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _default = _react.default.memo(LabelComponent);
|
|
36
|
+
|
|
37
|
+
exports.default = _default;
|
|
38
|
+
//# sourceMappingURL=LabelComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/LabelComponent.tsx"],"names":["LabelComponent","label","labelPosition","labelProps","active","switchDisabled","rest","defaultFontColor","defaultFontWeight","fontColor","fontWeight","React","memo"],"mappings":";;;;;;;AAMA;;AACA;;AACA;;;;;;AAUA,MAAMA,cAAuC,GAAG,CAAC;AAC/CC,EAAAA,KAD+C;AAE/CC,EAAAA,aAF+C;AAG/CC,EAAAA,UAH+C;AAI/CC,EAAAA,MAJ+C;AAK/CC,EAAAA,cAAc,GAAG,KAL8B;AAM/C,KAAGC;AAN4C,CAAD,KAO1C;AACJ,QAAMC,gBAAiC,GACrCH,MAAM,IAAI,CAACC,cAAX,GAA4B,MAA5B,GAAqC,QADvC;AAEA,QAAMG,iBAAmC,GACvCJ,MAAM,IAAI,CAACC,cAAX,GAA4B,MAA5B,GAAqC,SADvC;AAGA,SACE,6BAAC,yBAAD,EAAeC,IAAf,EACE,6BAAC,mBAAD;AACE,IAAA,aAAa,EAAEJ,aADjB;AAEE,IAAA,SAAS,EAAE,CAAAC,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEM,SAAZ,KAAyBF,gBAFtC;AAGE,IAAA,UAAU,EAAE,CAAAJ,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEO,UAAZ,KAA0BF;AAHxC,KAIML,UAJN,GAMGF,KANH,CADF,CADF;AAYD,CAzBD;;eA2BeU,eAAMC,IAAN,CAAWZ,cAAX,C","sourcesContent":["import {\n FontColor,\n FontWeight,\n LabelPositionOptions,\n TextProps,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { Pressable, PressableProps } from 'react-native';\nimport { StyledLabel } from './styled';\n\nexport interface LabelComponentProps extends PressableProps {\n label: string;\n labelPosition: LabelPositionOptions;\n labelProps?: TextProps;\n active: boolean;\n switchDisabled?: boolean;\n}\n\nconst LabelComponent: FC<LabelComponentProps> = ({\n label,\n labelPosition,\n labelProps,\n active,\n switchDisabled = false,\n ...rest\n}) => {\n const defaultFontColor: keyof FontColor =\n active && !switchDisabled ? 'dark' : 'medium';\n const defaultFontWeight: keyof FontWeight =\n active && !switchDisabled ? 'bold' : 'regular';\n\n return (\n <Pressable {...rest}>\n <StyledLabel\n labelPosition={labelPosition}\n fontColor={labelProps?.fontColor ?? defaultFontColor}\n fontWeight={labelProps?.fontWeight ?? defaultFontWeight}\n {...labelProps}\n >\n {label}\n </StyledLabel>\n </Pressable>\n );\n};\n\nexport default React.memo(LabelComponent);\n"],"file":"LabelComponent.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LabeledSwitchProps, TextProps } from '@tecsinapse/react-core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export declare type LabeledSwitchWebProps = LabeledSwitchProps & {
|
|
4
|
+
labelProps?: TextProps;
|
|
5
|
+
};
|
|
6
|
+
declare const LabeledSwitch: FC<LabeledSwitchWebProps>;
|
|
7
|
+
export default LabeledSwitch;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _LabelComponent = _interopRequireDefault(require("./LabelComponent"));
|
|
13
|
+
|
|
14
|
+
var _styled = require("./styled");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
19
|
+
|
|
20
|
+
const LabeledSwitch = ({
|
|
21
|
+
label,
|
|
22
|
+
labelPosition = 'right',
|
|
23
|
+
labelProps,
|
|
24
|
+
pressableLabel = false,
|
|
25
|
+
disabled,
|
|
26
|
+
active,
|
|
27
|
+
onChange,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
return _react.default.createElement(_styled.StyledDiv, null, labelPosition === 'left' ? _react.default.createElement(_LabelComponent.default, {
|
|
31
|
+
active: active,
|
|
32
|
+
label: label,
|
|
33
|
+
labelPosition: 'left',
|
|
34
|
+
labelProps: labelProps,
|
|
35
|
+
disabled: !pressableLabel || disabled,
|
|
36
|
+
switchDisabled: disabled,
|
|
37
|
+
onPress: () => onChange(!active)
|
|
38
|
+
}) : _react.default.createElement(_react.default.Fragment, null), _react.default.createElement(_reactCore.Switch, _extends({
|
|
39
|
+
active: active,
|
|
40
|
+
disabled: disabled,
|
|
41
|
+
onChange: onChange
|
|
42
|
+
}, rest)), labelPosition === 'right' ? _react.default.createElement(_LabelComponent.default, {
|
|
43
|
+
active: active,
|
|
44
|
+
label: label,
|
|
45
|
+
labelPosition: 'right',
|
|
46
|
+
labelProps: labelProps,
|
|
47
|
+
disabled: !pressableLabel || disabled,
|
|
48
|
+
switchDisabled: disabled,
|
|
49
|
+
onPress: () => onChange(!active)
|
|
50
|
+
}) : _react.default.createElement(_react.default.Fragment, null));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var _default = LabeledSwitch;
|
|
54
|
+
exports.default = _default;
|
|
55
|
+
//# sourceMappingURL=LabeledSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/LabeledSwitch.tsx"],"names":["LabeledSwitch","label","labelPosition","labelProps","pressableLabel","disabled","active","onChange","rest"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAMA,MAAMA,aAAwC,GAAG,CAAC;AAChDC,EAAAA,KADgD;AAEhDC,EAAAA,aAAa,GAAG,OAFgC;AAGhDC,EAAAA,UAHgD;AAIhDC,EAAAA,cAAc,GAAG,KAJ+B;AAKhDC,EAAAA,QALgD;AAMhDC,EAAAA,MANgD;AAOhDC,EAAAA,QAPgD;AAQhD,KAAGC;AAR6C,CAAD,KAS3C;AACJ,SACE,6BAAC,iBAAD,QACGN,aAAa,KAAK,MAAlB,GACC,6BAAC,uBAAD;AACE,IAAA,MAAM,EAAEI,MADV;AAEE,IAAA,KAAK,EAAEL,KAFT;AAGE,IAAA,aAAa,EAAE,MAHjB;AAIE,IAAA,UAAU,EAAEE,UAJd;AAKE,IAAA,QAAQ,EAAE,CAACC,cAAD,IAAmBC,QAL/B;AAME,IAAA,cAAc,EAAEA,QANlB;AAOE,IAAA,OAAO,EAAE,MAAME,QAAQ,CAAC,CAACD,MAAF;AAPzB,IADD,GAWC,2DAZJ,EAcE,6BAAC,iBAAD;AACE,IAAA,MAAM,EAAEA,MADV;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,QAAQ,EAAEE;AAHZ,KAIMC,IAJN,EAdF,EAoBGN,aAAa,KAAK,OAAlB,GACC,6BAAC,uBAAD;AACE,IAAA,MAAM,EAAEI,MADV;AAEE,IAAA,KAAK,EAAEL,KAFT;AAGE,IAAA,aAAa,EAAE,OAHjB;AAIE,IAAA,UAAU,EAAEE,UAJd;AAKE,IAAA,QAAQ,EAAE,CAACC,cAAD,IAAmBC,QAL/B;AAME,IAAA,cAAc,EAAEA,QANlB;AAOE,IAAA,OAAO,EAAE,MAAME,QAAQ,CAAC,CAACD,MAAF;AAPzB,IADD,GAWC,2DA/BJ,CADF;AAoCD,CA9CD;;eAgDeN,a","sourcesContent":["import { LabeledSwitchProps, Switch, TextProps } from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport LabelComponent from './LabelComponent';\nimport { StyledDiv } from './styled';\n\nexport type LabeledSwitchWebProps = LabeledSwitchProps & {\n labelProps?: TextProps;\n};\n\nconst LabeledSwitch: FC<LabeledSwitchWebProps> = ({\n label,\n labelPosition = 'right',\n labelProps,\n pressableLabel = false,\n disabled,\n active,\n onChange,\n ...rest\n}) => {\n return (\n <StyledDiv>\n {labelPosition === 'left' ? (\n <LabelComponent\n active={active}\n label={label}\n labelPosition={'left'}\n labelProps={labelProps}\n disabled={!pressableLabel || disabled}\n switchDisabled={disabled}\n onPress={() => onChange(!active)}\n />\n ) : (\n <></>\n )}\n <Switch\n active={active}\n disabled={disabled}\n onChange={onChange}\n {...rest}\n />\n {labelPosition === 'right' ? (\n <LabelComponent\n active={active}\n label={label}\n labelPosition={'right'}\n labelProps={labelProps}\n disabled={!pressableLabel || disabled}\n switchDisabled={disabled}\n onPress={() => onChange(!active)}\n />\n ) : (\n <></>\n )}\n </StyledDiv>\n );\n};\n\nexport default LabeledSwitch;\n"],"file":"LabeledSwitch.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LabeledSwitch, LabeledSwitchWebProps, } from './LabeledSwitch';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LabeledSwitch", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LabeledSwitch.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "LabeledSwitchWebProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _LabeledSwitch.LabeledSwitchWebProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _LabeledSwitch = _interopRequireWildcard(require("./LabeledSwitch"));
|
|
20
|
+
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n default as LabeledSwitch,\n LabeledSwitchWebProps,\n} from './LabeledSwitch';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledDiv: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const StyledLabel: import("@emotion/native").StyledComponent<any, {}, {
|
|
7
|
+
ref?: import("react").Ref<any> | undefined;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledLabel = exports.StyledDiv = void 0;
|
|
7
|
+
|
|
8
|
+
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
9
|
+
|
|
10
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
+
|
|
12
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
const StyledDiv = (0, _styled.default)('div')`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
align-items: center;
|
|
24
|
+
`;
|
|
25
|
+
exports.StyledDiv = StyledDiv;
|
|
26
|
+
const StyledLabel = (0, _native.default)(_reactCore.Text)`
|
|
27
|
+
${({
|
|
28
|
+
theme,
|
|
29
|
+
labelPosition
|
|
30
|
+
}) => {
|
|
31
|
+
if (labelPosition === 'right') return (0, _native.css)`
|
|
32
|
+
margin-left: ${theme === null || theme === void 0 ? void 0 : theme.spacing.centi};
|
|
33
|
+
`;else if (labelPosition === 'left') return (0, _native.css)`
|
|
34
|
+
margin-right: ${theme === null || theme === void 0 ? void 0 : theme.spacing.centi};
|
|
35
|
+
`;
|
|
36
|
+
}}
|
|
37
|
+
`;
|
|
38
|
+
exports.StyledLabel = StyledLabel;
|
|
39
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/styled.ts"],"names":["StyledDiv","StyledLabel","Text","theme","labelPosition","spacing","centi"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAEO,MAAMA,SAAS,GAAG,qBAAU,KAAV,CAAiB;AAC1C;AACA;AACA;AACA,CAJO;;AAMA,MAAMC,WAAW,GAAG,qBAAaC,eAAb,CAIzB;AACF,IAAI,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAA8B;AAC9B,MAAIA,aAAa,KAAK,OAAtB,EACE,OAAO,gBAAI;AACjB,uBAAuBD,KADP,aACOA,KADP,uBACOA,KAAK,CAAEE,OAAP,CAAeC,KAAM;AAC5C,OAFM,CADF,KAIK,IAAIF,aAAa,KAAK,MAAtB,EACH,OAAO,gBAAI;AACjB,wBAAwBD,KADR,aACQA,KADR,uBACQA,KAAK,CAAEE,OAAP,CAAeC,KAAM;AAC7C,OAFM;AAGH,CAAC;AACJ,CAfO","sourcesContent":["import { css, default as nativeStyled } from '@emotion/native';\nimport { default as webStyled } from '@emotion/styled';\nimport { LabelPositionOptions, StyleProps, Text } from '@tecsinapse/react-core';\n\nexport const StyledDiv = webStyled('div')`\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledLabel = nativeStyled(Text)<\n Partial<StyleProps> & {\n labelPosition: LabelPositionOptions;\n }\n>`\n ${({ theme, labelPosition }) => {\n if (labelPosition === 'right')\n return css`\n margin-left: ${theme?.spacing.centi};\n `;\n else if (labelPosition === 'left')\n return css`\n margin-right: ${theme?.spacing.centi};\n `;\n }}\n`;\n"],"file":"styled.js"}
|
|
@@ -67,7 +67,8 @@ const Footer = ({
|
|
|
67
67
|
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(0);
|
|
68
68
|
}, [onPageChange, onRowsPerPageChange]);
|
|
69
69
|
|
|
70
|
-
const
|
|
70
|
+
const currentInitItem = page * rowsPerPage + 1;
|
|
71
|
+
const currentFinalItem = (page + 1) * rowsPerPage > rowsCount ? rowsCount : (page + 1) * rowsPerPage;
|
|
71
72
|
return _react.default.createElement(_Table.TFoot, null, _react.default.createElement(_Table.Tr, null, _react.default.createElement(_styled.TdFooterStyled, {
|
|
72
73
|
colSpan: 99
|
|
73
74
|
}, _react.default.createElement(_styled.FooterContainer, null, _react.default.createElement(_styled.FooterContainerStart, null, pagination && _react.default.createElement(_styled.SelectContainer, null, _react.default.createElement(_reactWebKit.Select, {
|
|
@@ -87,7 +88,7 @@ const Footer = ({
|
|
|
87
88
|
}, exportLabel)))), pagination && _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_styled.TextPagination, {
|
|
88
89
|
fontWeight: 'bold',
|
|
89
90
|
fontColor: 'medium'
|
|
90
|
-
}, `Exibindo ${
|
|
91
|
+
}, `Exibindo ${currentInitItem} a ${currentFinalItem} de ${rowsCount} registros`), _react.default.createElement(_styled.FooterContainerEnd, null, _react.default.createElement(_styled.NavigationButton, {
|
|
91
92
|
onPress: () => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page - 1),
|
|
92
93
|
disabled: page === 0
|
|
93
94
|
}, _react.default.createElement(_reactWebKit.Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Footer/Footer.tsx"],"names":["Footer","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","rowsPerPageLabel","exportFunction","exportLabel","rowsCount","page","onPageChange","pagination","exportComponent","Error","getPaginationSlice","totalPages","Math","ceil","start","end","handleRowsPerPage","React","useCallback","value","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/organisms/DataGrid/Footer/Footer.tsx"],"names":["Footer","rowsPerPage","onRowsPerPageChange","rowsPerPageOptions","rowsPerPageLabel","exportFunction","exportLabel","rowsCount","page","onPageChange","pagination","exportComponent","Error","getPaginationSlice","totalPages","Math","ceil","start","end","handleRowsPerPage","React","useCallback","value","currentInitItem","currentFinalItem","String","Array","keys","slice","map","memo"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AA4BA,MAAMA,MAAqC,GA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IAAA,SAAS,EAAE;AAHb,IAJF,CA9BF,CALF,CA3BJ,CADF,CADF,CADF,CADF;AAoFD,CAhID;;eAkIemB,eAAMU,IAAN,CAAW9B,MAAX,C","sourcesContent":["import React from 'react';\nimport { Button, Icon, Select, Text } from '@tecsinapse/react-web-kit';\nimport { TFoot, Tr } from '../../../atoms/Table';\nimport {\n FooterContainer,\n FooterContainerEnd,\n FooterContainerStart,\n HoveredText,\n NavigationButton,\n PageButton,\n PagesContainer,\n SelectContainer,\n TdFooterStyled,\n TextPagination,\n} from './styled';\n\ninterface DataGridFooterProps {\n rowsPerPage: number;\n onRowsPerPageChange?: (value: number) => void;\n rowsPerPageOptions: number[];\n rowsPerPageLabel: (value: number) => string;\n exportLabel?: string;\n exportFunction?: () => void;\n /** Total data elements */\n rowsCount: number;\n page: number;\n onPageChange?: (page: number) => void;\n pagination: boolean;\n exportComponent?: React.ReactNode;\n}\n\nconst Footer: React.FC<DataGridFooterProps> = ({\n rowsPerPage,\n onRowsPerPageChange,\n rowsPerPageOptions,\n rowsPerPageLabel,\n exportFunction,\n exportLabel,\n rowsCount,\n page,\n onPageChange,\n pagination,\n exportComponent,\n}) => {\n if (pagination && (!onPageChange || !onRowsPerPageChange)) {\n throw new Error(\n '[DataGrid] You should specify pagination handlers (onPageChange, onRowsPerPageChange)'\n );\n }\n\n const getPaginationSlice = (): { start: number; end: number } => {\n const totalPages = Math.ceil(rowsCount / rowsPerPage);\n if (totalPages < 4) {\n return { start: 0, end: totalPages };\n }\n if (page === 0) {\n return { start: page, end: page + 3 };\n }\n if (page === totalPages - 1) {\n return { start: page - 2, end: page + 1 };\n }\n return { start: page - 1, end: page + 2 };\n };\n\n const handleRowsPerPage = React.useCallback(\n value => {\n onRowsPerPageChange?.(value as number);\n onPageChange?.(0);\n },\n [onPageChange, onRowsPerPageChange]\n );\n const currentInitItem = page * rowsPerPage + 1;\n const currentFinalItem =\n (page + 1) * rowsPerPage > rowsCount ? rowsCount : (page + 1) * rowsPerPage;\n\n return (\n <TFoot>\n <Tr>\n <TdFooterStyled colSpan={99}>\n <FooterContainer>\n <FooterContainerStart>\n {pagination && (\n <SelectContainer>\n <Select\n options={rowsPerPageOptions}\n onSelect={handleRowsPerPage}\n value={rowsPerPage}\n type={'single'}\n keyExtractor={value => String(value)}\n labelExtractor={rowsPerPageLabel}\n anchor=\"top\"\n />\n </SelectContainer>\n )}\n {exportComponent && !exportFunction && <>{exportComponent}</>}\n {exportFunction && (\n <HoveredText>\n <Button variant=\"outlined\" onPress={() => exportFunction()}>\n <Text fontColor=\"orange\" fontWeight=\"bold\">\n {exportLabel}\n </Text>\n </Button>\n </HoveredText>\n )}\n </FooterContainerStart>\n {pagination && (\n <>\n <TextPagination\n fontWeight={'bold'}\n fontColor={'medium'}\n >{`Exibindo ${currentInitItem} a ${currentFinalItem} de ${rowsCount} registros`}</TextPagination>\n <FooterContainerEnd>\n <NavigationButton\n onPress={() => onPageChange?.(page - 1)}\n disabled={page === 0}\n >\n <Icon\n name={'chevron-left'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n <PagesContainer>\n {[...Array(Math.ceil(rowsCount / rowsPerPage)).keys()]\n .slice(\n getPaginationSlice().start,\n getPaginationSlice().end\n )\n .map(value => (\n <HoveredText key={`page-${value}`}>\n <PageButton\n variant={page === value ? 'outlined' : 'text'}\n onPress={() => onPageChange?.(value)}\n >\n <Text fontColor=\"medium\" fontWeight=\"bold\">\n {value + 1}\n </Text>\n </PageButton>\n </HoveredText>\n ))}\n </PagesContainer>\n <NavigationButton\n onPress={() => onPageChange?.(page + 1)}\n disabled={page === Math.ceil(rowsCount / rowsPerPage) - 1}\n >\n <Icon\n name={'chevron-right'}\n type={'material-community'}\n fontColor={'light'}\n />\n </NavigationButton>\n </FooterContainerEnd>\n </>\n )}\n </FooterContainer>\n </TdFooterStyled>\n </Tr>\n </TFoot>\n );\n};\n\nexport default React.memo(Footer);\n"],"file":"Footer.js"}
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -3,12 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "useBreakpoints", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useBreakpoints.useBreakpoints;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "useClickAwayListener", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
9
15
|
return _useClickAwayListener.useClickAwayListener;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "useWindowSize", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useWindowSize.useWindowSize;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _useBreakpoints = require("./useBreakpoints");
|
|
12
26
|
|
|
13
27
|
var _useClickAwayListener = require("./useClickAwayListener");
|
|
28
|
+
|
|
29
|
+
var _useWindowSize = require("./useWindowSize");
|
|
14
30
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["export { useBreakpoints } from './useBreakpoints';\nexport { useClickAwayListener } from './useClickAwayListener';\nexport { useWindowSize } from './useWindowSize';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBreakpoints = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _useWindowSize = require("./useWindowSize");
|
|
11
|
+
|
|
12
|
+
const useBreakpoints = () => {
|
|
13
|
+
const {
|
|
14
|
+
width
|
|
15
|
+
} = (0, _useWindowSize.useWindowSize)();
|
|
16
|
+
const {
|
|
17
|
+
breakpoints
|
|
18
|
+
} = (0, _reactCore.useTheme)();
|
|
19
|
+
return {
|
|
20
|
+
sm: Number(width) >= 0 && Number(width) <= breakpoints.sm,
|
|
21
|
+
md: Number(width) > breakpoints.sm && Number(width) <= breakpoints.md,
|
|
22
|
+
lg: Number(width) > breakpoints.md
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.useBreakpoints = useBreakpoints;
|
|
27
|
+
//# sourceMappingURL=useBreakpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useBreakpoints.ts"],"names":["useBreakpoints","width","breakpoints","sm","Number","md","lg"],"mappings":";;;;;;;AAAA;;AACA;;AAQO,MAAMA,cAAc,GAAG,MAA4B;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAY,mCAAlB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAkB,0BAAxB;AACA,SAAO;AACLC,IAAAA,EAAE,EAAEC,MAAM,CAACH,KAAD,CAAN,IAAiB,CAAjB,IAAsBG,MAAM,CAACH,KAAD,CAAN,IAAiBC,WAAW,CAACC,EADlD;AAELE,IAAAA,EAAE,EAAED,MAAM,CAACH,KAAD,CAAN,GAAgBC,WAAW,CAACC,EAA5B,IAAkCC,MAAM,CAACH,KAAD,CAAN,IAAiBC,WAAW,CAACG,EAF9D;AAGLC,IAAAA,EAAE,EAAEF,MAAM,CAACH,KAAD,CAAN,GAAgBC,WAAW,CAACG;AAH3B,GAAP;AAKD,CARM","sourcesContent":["import { useTheme } from '@tecsinapse/react-core';\nimport { useWindowSize } from './useWindowSize';\n\nexport type UseBreakpointsReturn = {\n sm: boolean;\n md: boolean;\n lg: boolean;\n};\n\nexport const useBreakpoints = (): UseBreakpointsReturn => {\n const { width } = useWindowSize();\n const { breakpoints } = useTheme();\n return {\n sm: Number(width) >= 0 && Number(width) <= breakpoints.sm,\n md: Number(width) > breakpoints.sm && Number(width) <= breakpoints.md,\n lg: Number(width) > breakpoints.md,\n };\n};\n"],"file":"useBreakpoints.js"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWindowSize = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const useWindowSize = () => {
|
|
13
|
+
const [windowSize, setWindowSize] = _react.default.useState({
|
|
14
|
+
width: undefined,
|
|
15
|
+
height: undefined
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
_react.default.useEffect(() => {
|
|
19
|
+
const handleResize = () => {
|
|
20
|
+
setWindowSize({
|
|
21
|
+
width: window.innerWidth,
|
|
22
|
+
height: window.innerHeight
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
window.addEventListener('resize', handleResize);
|
|
27
|
+
handleResize();
|
|
28
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return windowSize;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useWindowSize = useWindowSize;
|
|
35
|
+
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useWindowSize.ts"],"names":["useWindowSize","windowSize","setWindowSize","React","useState","width","undefined","height","useEffect","handleResize","window","innerWidth","innerHeight","addEventListener","removeEventListener"],"mappings":";;;;;;;AAAA;;;;AAOO,MAAMA,aAAa,GAAG,MAAkB;AAC7C,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BC,eAAMC,QAAN,CAA2B;AAC7DC,IAAAA,KAAK,EAAEC,SADsD;AAE7DC,IAAAA,MAAM,EAAED;AAFqD,GAA3B,CAApC;;AAIAH,iBAAMK,SAAN,CAAgB,MAAM;AACpB,UAAMC,YAAY,GAAG,MAAM;AACzBP,MAAAA,aAAa,CAAC;AACZG,QAAAA,KAAK,EAAEK,MAAM,CAACC,UADF;AAEZJ,QAAAA,MAAM,EAAEG,MAAM,CAACE;AAFH,OAAD,CAAb;AAID,KALD;;AAMAF,IAAAA,MAAM,CAACG,gBAAP,CAAwB,QAAxB,EAAkCJ,YAAlC;AACAA,IAAAA,YAAY;AACZ,WAAO,MAAMC,MAAM,CAACI,mBAAP,CAA2B,QAA3B,EAAqCL,YAArC,CAAb;AACD,GAVD,EAUG,EAVH;;AAWA,SAAOR,UAAP;AACD,CAjBM","sourcesContent":["import React from 'react';\n\ntype WindowSize = {\n width: number | undefined;\n height: number | undefined;\n};\n\nexport const useWindowSize = (): WindowSize => {\n const [windowSize, setWindowSize] = React.useState<WindowSize>({\n width: undefined,\n height: undefined,\n });\n React.useEffect(() => {\n const handleResize = () => {\n setWindowSize({\n width: window.innerWidth,\n height: window.innerHeight,\n });\n };\n window.addEventListener('resize', handleResize);\n handleResize();\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n return windowSize;\n};\n"],"file":"useWindowSize.js"}
|