@tecsinapse/react-web-kit 1.18.7 → 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 +20 -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/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/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,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"}
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
export * from '@tecsinapse/react-core';
|
|
2
|
-
export {
|
|
2
|
+
export { Accordion, AccordionProps } from './components/atoms/Accordion';
|
|
3
|
+
export { BadgeWebProps, default as Badge, } from './components/atoms/Badge/Badge';
|
|
3
4
|
export { Button, useMouseHover, WebButtonProps, } from './components/atoms/Button';
|
|
4
5
|
export { Input, InputWebProps } from './components/atoms/Input';
|
|
5
|
-
export { Tag, TagProps } from './components/atoms/Tag';
|
|
6
|
-
export { InputPassword, InputPasswordWebProps, } from './components/molecules/InputPassword';
|
|
7
6
|
export { InputMask, InputMaskWebProps } from './components/atoms/InputMask';
|
|
8
|
-
export {
|
|
7
|
+
export { Modal, ModalProps } from './components/atoms/Modal';
|
|
8
|
+
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|
|
9
|
+
export { Tag, TagProps } from './components/atoms/Tag';
|
|
10
|
+
export { ITooltip, Tooltip } from './components/atoms/Tooltip';
|
|
11
|
+
export { Breadcrumbs, BreadcrumbsProps, BreadcrumbType, } from './components/molecules/Breadcrumbs';
|
|
12
|
+
export { DatePicker, WebDatePickerProps, } from './components/molecules/DatePicker';
|
|
13
|
+
export { DateTimePicker, WebDateTimePickerProps, } from './components/molecules/DateTimePicker';
|
|
9
14
|
export { Drawer, DrawerProps } from './components/molecules/Drawer';
|
|
15
|
+
export { Grid, GridItem, IGridWeb, IGridItemWeb, } from './components/molecules/Grid';
|
|
16
|
+
export { InputPassword, InputPasswordWebProps, } from './components/molecules/InputPassword';
|
|
17
|
+
export { LabeledSwitch, LabeledSwitchWebProps, } from './components/molecules/LabeledSwitch';
|
|
18
|
+
export { Menubar, MenubarItemsOptions, MenubarMostUsedType, MenubarOptionsType, MenubarProps, } from './components/molecules/Menubar';
|
|
10
19
|
export { Select, SelectProps } from './components/molecules/Select';
|
|
11
20
|
export { Snackbar, SnackbarWebProps } from './components/molecules/Snackbar';
|
|
12
|
-
export { Breadcrumbs, BreadcrumbsProps, BreadcrumbType, } from './components/molecules/Breadcrumbs';
|
|
13
|
-
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|
|
14
|
-
export { Accordion, AccordionProps } from './components/atoms/Accordion';
|
|
15
|
-
export { DataGrid, DataGridProps, HeadersType, } from './components/organisms/DataGrid';
|
|
16
|
-
export { Modal, ModalProps } from './components/atoms/Modal';
|
|
17
21
|
export { TextArea, TextAreaProps } from './components/molecules/TextArea';
|
|
18
|
-
export {
|
|
22
|
+
export { DataGrid, DataGridProps, HeadersType, } from './components/organisms/DataGrid';
|
|
19
23
|
export * from './hooks';
|
|
20
|
-
export { DatePicker, WebDatePickerProps, } from './components/molecules/DatePicker';
|
|
21
|
-
export { DateTimePicker, WebDateTimePickerProps, } from './components/molecules/DateTimePicker';
|
|
22
|
-
export { Grid, GridItem, IGrid, IGridItem } from './components/molecules/Grid';
|