@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.19.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.18.7...@tecsinapse/react-web-kit@1.19.0) (2022-08-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* change PressableSurface with Pressable on LabeledSwitch label ([5029a74](https://github.com/tecsinapse/design-system/commit/5029a74bfc272f5aecb3bdae9152f0920a36c8bb))
|
|
12
|
+
* LabeledSwitch disabled and react-core exports ([855f12f](https://github.com/tecsinapse/design-system/commit/855f12f0dff1ce4c5969eba723707340e60a3310))
|
|
13
|
+
* merge ([b32e31d](https://github.com/tecsinapse/design-system/commit/b32e31d0a73a0ec3d20d65aa672e198fd874997a))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* grid web responsive support ([4111063](https://github.com/tecsinapse/design-system/commit/411106311d37d62bae4736c07f71038d5564319c))
|
|
19
|
+
* grid web responsive support ([fd91539](https://github.com/tecsinapse/design-system/commit/fd91539dae6df151beeb48ce3749623e2bb4dedc))
|
|
20
|
+
* LabeledSwitch implementation. ([519fe87](https://github.com/tecsinapse/design-system/commit/519fe8769d687f15af09c9fb77fe98a727f9078b))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [1.18.7](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.18.6...@tecsinapse/react-web-kit@1.18.7) (2022-08-18)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @tecsinapse/react-web-kit
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [1.18.6](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.18.5...@tecsinapse/react-web-kit@1.18.6) (2022-08-09)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @tecsinapse/react-web-kit
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
6
42
|
## [1.18.5](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-web-kit@1.18.4...@tecsinapse/react-web-kit@1.18.5) (2022-08-08)
|
|
7
43
|
|
|
8
44
|
|
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _useMouseHover = require("./hooks/useMouseHover");
|
|
11
11
|
|
|
12
|
+
var _useMousePressed = require("./hooks/useMousePressed");
|
|
13
|
+
|
|
12
14
|
var _styled = require("./styled");
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -20,6 +22,11 @@ const Button = ({
|
|
|
20
22
|
disabled,
|
|
21
23
|
frozen,
|
|
22
24
|
state,
|
|
25
|
+
variant,
|
|
26
|
+
onMouseOut,
|
|
27
|
+
onMouseOver,
|
|
28
|
+
onPressIn,
|
|
29
|
+
onPressOut,
|
|
23
30
|
...rest
|
|
24
31
|
}) => {
|
|
25
32
|
const _frozen = frozen || state === 'loading';
|
|
@@ -28,14 +35,23 @@ const Button = ({
|
|
|
28
35
|
mouseOver,
|
|
29
36
|
handleMouseOut,
|
|
30
37
|
handleMouseOver
|
|
31
|
-
} = (0, _useMouseHover.useMouseHover)(!disabled && !_frozen);
|
|
38
|
+
} = (0, _useMouseHover.useMouseHover)(!disabled && !_frozen, onMouseOut, onMouseOver);
|
|
39
|
+
const {
|
|
40
|
+
pressed,
|
|
41
|
+
handlePressIn,
|
|
42
|
+
handlePressOut
|
|
43
|
+
} = (0, _useMousePressed.useMousePressed)(!disabled && !_frozen, onPressIn, onPressOut);
|
|
32
44
|
return _react.default.createElement(_styled.StyledWebButton, _extends({}, rest, {
|
|
33
45
|
disabled: disabled,
|
|
34
46
|
frozen: _frozen,
|
|
35
47
|
state: state,
|
|
36
48
|
onMouseOver: handleMouseOver,
|
|
37
49
|
onMouseOut: handleMouseOut,
|
|
38
|
-
mouseOver: mouseOver
|
|
50
|
+
mouseOver: mouseOver,
|
|
51
|
+
onPressIn: handlePressIn,
|
|
52
|
+
onPressOut: handlePressOut,
|
|
53
|
+
pressed: pressed,
|
|
54
|
+
variant: variant
|
|
39
55
|
}), children);
|
|
40
56
|
};
|
|
41
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Button/Button.tsx"],"names":["Button","children","disabled","frozen","state","rest","_frozen","mouseOver","handleMouseOut","handleMouseOver"],"mappings":";;;;;;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Button/Button.tsx"],"names":["Button","children","disabled","frozen","state","variant","onMouseOut","onMouseOver","onPressIn","onPressOut","rest","_frozen","mouseOver","handleMouseOut","handleMouseOver","pressed","handlePressIn","handlePressOut"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;AAaA,MAAMA,MAA0B,GAAG,CAAC;AAClCC,EAAAA,QADkC;AAElCC,EAAAA,QAFkC;AAGlCC,EAAAA,MAHkC;AAIlCC,EAAAA,KAJkC;AAKlCC,EAAAA,OALkC;AAMlCC,EAAAA,UANkC;AAOlCC,EAAAA,WAPkC;AAQlCC,EAAAA,SARkC;AASlCC,EAAAA,UATkC;AAUlC,KAAGC;AAV+B,CAAD,KAWhB;AACjB,QAAMC,OAAO,GAAGR,MAAM,IAAIC,KAAK,KAAK,SAApC;;AACA,QAAM;AAAEQ,IAAAA,SAAF;AAAaC,IAAAA,cAAb;AAA6BC,IAAAA;AAA7B,MAAiD,kCACrD,CAACZ,QAAD,IAAa,CAACS,OADuC,EAErDL,UAFqD,EAGrDC,WAHqD,CAAvD;AAKA,QAAM;AAAEQ,IAAAA,OAAF;AAAWC,IAAAA,aAAX;AAA0BC,IAAAA;AAA1B,MAA6C,sCACjD,CAACf,QAAD,IAAa,CAACS,OADmC,EAEjDH,SAFiD,EAGjDC,UAHiD,CAAnD;AAMA,SACE,6BAAC,uBAAD,eACMC,IADN;AAEE,IAAA,QAAQ,EAAER,QAFZ;AAGE,IAAA,MAAM,EAAES,OAHV;AAIE,IAAA,KAAK,EAAEP,KAJT;AAKE,IAAA,WAAW,EAAEU,eALf;AAME,IAAA,UAAU,EAAED,cANd;AAOE,IAAA,SAAS,EAAED,SAPb;AAQE,IAAA,SAAS,EAAEI,aARb;AASE,IAAA,UAAU,EAAEC,cATd;AAUE,IAAA,OAAO,EAAEF,OAVX;AAWE,IAAA,OAAO,EAAEV;AAXX,MAaGJ,QAbH,CADF;AAiBD,CAzCD;;eA2CeD,M","sourcesContent":["import { ButtonProps } from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { useMouseHover } from './hooks/useMouseHover';\nimport { useMousePressed } from './hooks/useMousePressed';\nimport { StyledWebButton } from './styled';\n\n/**\n * TODO: Add a property 'defaultElement' to render a default\n * component and provide some button's state to it.\n */\nexport type WebButtonProps = ButtonProps & {\n onMouseOver?: () => void;\n onMouseOut?: () => void;\n onPressIn?: () => void;\n onPressOut?: () => void;\n};\n\nconst Button: FC<WebButtonProps> = ({\n children,\n disabled,\n frozen,\n state,\n variant,\n onMouseOut,\n onMouseOver,\n onPressIn,\n onPressOut,\n ...rest\n}): JSX.Element => {\n const _frozen = frozen || state === 'loading';\n const { mouseOver, handleMouseOut, handleMouseOver } = useMouseHover(\n !disabled && !_frozen,\n onMouseOut,\n onMouseOver\n );\n const { pressed, handlePressIn, handlePressOut } = useMousePressed(\n !disabled && !_frozen,\n onPressIn,\n onPressOut\n );\n\n return (\n <StyledWebButton\n {...rest}\n disabled={disabled}\n frozen={_frozen}\n state={state}\n onMouseOver={handleMouseOver}\n onMouseOut={handleMouseOut}\n mouseOver={mouseOver}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n pressed={pressed}\n variant={variant}\n >\n {children}\n </StyledWebButton>\n );\n};\n\nexport default Button;\n"],"file":"Button.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const useMouseHover: (active: boolean) => {
|
|
1
|
+
export declare const useMouseHover: (active: boolean, onMouseOver?: (() => void) | undefined, onMouseOut?: (() => void) | undefined) => {
|
|
2
2
|
mouseOver: boolean;
|
|
3
|
-
handleMouseOver: () =>
|
|
4
|
-
handleMouseOut: () =>
|
|
3
|
+
handleMouseOver: () => void;
|
|
4
|
+
handleMouseOut: () => void;
|
|
5
5
|
};
|
|
@@ -7,10 +7,20 @@ exports.useMouseHover = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
const useMouseHover = active => {
|
|
10
|
+
const useMouseHover = (active, onMouseOver, onMouseOut) => {
|
|
11
11
|
const [mouseOver, setMouseOver] = (0, _react.useState)(false);
|
|
12
|
-
const handleMouseOver = (0, _react.useCallback)(() =>
|
|
13
|
-
|
|
12
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
13
|
+
if (active) {
|
|
14
|
+
setMouseOver(true);
|
|
15
|
+
onMouseOver === null || onMouseOver === void 0 ? void 0 : onMouseOver();
|
|
16
|
+
}
|
|
17
|
+
}, [active, setMouseOver]);
|
|
18
|
+
const handleMouseOut = (0, _react.useCallback)(() => {
|
|
19
|
+
if (active) {
|
|
20
|
+
setMouseOver(false);
|
|
21
|
+
onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut();
|
|
22
|
+
}
|
|
23
|
+
}, [active, setMouseOver]);
|
|
14
24
|
return {
|
|
15
25
|
mouseOver,
|
|
16
26
|
handleMouseOver,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Button/hooks/useMouseHover.ts"],"names":["useMouseHover","active","mouseOver","setMouseOver","handleMouseOver","handleMouseOut"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,aAAa,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Button/hooks/useMouseHover.ts"],"names":["useMouseHover","active","onMouseOver","onMouseOut","mouseOver","setMouseOver","handleMouseOver","handleMouseOut"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,aAAa,GAAG,CAC3BC,MAD2B,EAE3BC,WAF2B,EAG3BC,UAH2B,KAIxB;AACH,QAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4B,qBAAkB,KAAlB,CAAlC;AAEA,QAAMC,eAAe,GAAG,wBAAY,MAAM;AACxC,QAAIL,MAAJ,EAAY;AACVI,MAAAA,YAAY,CAAC,IAAD,CAAZ;AACAH,MAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW;AACZ;AACF,GALuB,EAKrB,CAACD,MAAD,EAASI,YAAT,CALqB,CAAxB;AAOA,QAAME,cAAc,GAAG,wBAAY,MAAM;AACvC,QAAIN,MAAJ,EAAY;AACVI,MAAAA,YAAY,CAAC,KAAD,CAAZ;AACAF,MAAAA,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU;AACX;AACF,GALsB,EAKpB,CAACF,MAAD,EAASI,YAAT,CALoB,CAAvB;AAOA,SAAO;AACLD,IAAAA,SADK;AAELE,IAAAA,eAFK;AAGLC,IAAAA;AAHK,GAAP;AAKD,CA1BM","sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const useMouseHover = (\n active: boolean,\n onMouseOver?: () => void,\n onMouseOut?: () => void\n) => {\n const [mouseOver, setMouseOver] = useState<boolean>(false);\n\n const handleMouseOver = useCallback(() => {\n if (active) {\n setMouseOver(true);\n onMouseOver?.();\n }\n }, [active, setMouseOver]);\n\n const handleMouseOut = useCallback(() => {\n if (active) {\n setMouseOver(false);\n onMouseOut?.();\n }\n }, [active, setMouseOver]);\n\n return {\n mouseOver,\n handleMouseOver,\n handleMouseOut,\n };\n};\n"],"file":"useMouseHover.js"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMousePressed = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
const useMousePressed = (active, onPressIn, onPressOut) => {
|
|
11
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
12
|
+
const handlePressIn = (0, _react.useCallback)(() => {
|
|
13
|
+
if (active) {
|
|
14
|
+
setPressed(true);
|
|
15
|
+
onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn();
|
|
16
|
+
}
|
|
17
|
+
}, [active, setPressed]);
|
|
18
|
+
const handlePressOut = (0, _react.useCallback)(() => {
|
|
19
|
+
if (active) {
|
|
20
|
+
setPressed(false);
|
|
21
|
+
onPressOut === null || onPressOut === void 0 ? void 0 : onPressOut();
|
|
22
|
+
}
|
|
23
|
+
}, [active, setPressed]);
|
|
24
|
+
return {
|
|
25
|
+
pressed,
|
|
26
|
+
handlePressIn,
|
|
27
|
+
handlePressOut
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.useMousePressed = useMousePressed;
|
|
32
|
+
//# sourceMappingURL=useMousePressed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Button/hooks/useMousePressed.ts"],"names":["useMousePressed","active","onPressIn","onPressOut","pressed","setPressed","handlePressIn","handlePressOut"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,eAAe,GAAG,CAC7BC,MAD6B,EAE7BC,SAF6B,EAG7BC,UAH6B,KAI1B;AACH,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,qBAAkB,KAAlB,CAA9B;AAEA,QAAMC,aAAa,GAAG,wBAAY,MAAM;AACtC,QAAIL,MAAJ,EAAY;AACVI,MAAAA,UAAU,CAAC,IAAD,CAAV;AACAH,MAAAA,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS;AACV;AACF,GALqB,EAKnB,CAACD,MAAD,EAASI,UAAT,CALmB,CAAtB;AAOA,QAAME,cAAc,GAAG,wBAAY,MAAM;AACvC,QAAIN,MAAJ,EAAY;AACVI,MAAAA,UAAU,CAAC,KAAD,CAAV;AACAF,MAAAA,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU;AACX;AACF,GALsB,EAKpB,CAACF,MAAD,EAASI,UAAT,CALoB,CAAvB;AAOA,SAAO;AACLD,IAAAA,OADK;AAELE,IAAAA,aAFK;AAGLC,IAAAA;AAHK,GAAP;AAKD,CA1BM","sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const useMousePressed = (\n active: boolean,\n onPressIn?: () => void,\n onPressOut?: () => void\n) => {\n const [pressed, setPressed] = useState<boolean>(false);\n\n const handlePressIn = useCallback(() => {\n if (active) {\n setPressed(true);\n onPressIn?.();\n }\n }, [active, setPressed]);\n\n const handlePressOut = useCallback(() => {\n if (active) {\n setPressed(false);\n onPressOut?.();\n }\n }, [active, setPressed]);\n\n return {\n pressed,\n handlePressIn,\n handlePressOut,\n };\n};\n"],"file":"useMousePressed.js"}
|
|
@@ -23,13 +23,18 @@ const webStyles = () => {
|
|
|
23
23
|
|
|
24
24
|
const hoverStyles = ({
|
|
25
25
|
mouseOver,
|
|
26
|
+
pressed,
|
|
26
27
|
theme,
|
|
27
|
-
|
|
28
|
+
variant = 'filled',
|
|
28
29
|
disabled
|
|
29
30
|
}) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const variantColor = _reactCore.colorVC[variant];
|
|
32
|
+
const variantColorGradation = _reactCore.colorGradationVC[variant];
|
|
33
|
+
const variantBorderColor = _reactCore.borderColorVC[variant];
|
|
34
|
+
const variantBorderColorGradation = _reactCore.borderColorGradationVC[variant];
|
|
35
|
+
return mouseOver && !disabled && !pressed && (0, _native.css)`
|
|
36
|
+
background-color: ${theme === null || theme === void 0 ? void 0 : theme.color[variantColor][variantColorGradation]};
|
|
37
|
+
border-color: ${theme === null || theme === void 0 ? void 0 : theme.color[variantBorderColor][variantBorderColorGradation]};
|
|
33
38
|
`;
|
|
34
39
|
};
|
|
35
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Button/styled.ts"],"names":["webStyles","hoverStyles","mouseOver","theme","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Button/styled.ts"],"names":["webStyles","hoverStyles","mouseOver","pressed","theme","variant","disabled","variantColor","colorVC","variantColorGradation","colorGradationVC","variantBorderColor","borderColorVC","variantBorderColorGradation","borderColorGradationVC","color","StyledWebButton","Button"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAUA,MAAMA,SAAS,GAAG,MAAM;AACtB,SAAO,gBAAI;AACb;AACA;AACA;AACA,GAJE;AAKD,CAND;;AAQA,MAAMC,WAAW,GAAG,CAAC;AACnBC,EAAAA,SADmB;AAEnBC,EAAAA,OAFmB;AAGnBC,EAAAA,KAHmB;AAInBC,EAAAA,OAAO,GAAG,QAJS;AAKnBC,EAAAA;AALmB,CAAD,KAOM;AACxB,QAAMC,YAAY,GAAGC,mBAAQH,OAAR,CAArB;AACA,QAAMI,qBAAqB,GAAGC,4BAAiBL,OAAjB,CAA9B;AACA,QAAMM,kBAAkB,GAAGC,yBAAcP,OAAd,CAA3B;AACA,QAAMQ,2BAA2B,GAAGC,kCAAuBT,OAAvB,CAApC;AACA,SACEH,SAAS,IACT,CAACI,QADD,IAEA,CAACH,OAFD,IAGA,gBAAI;AACR,0BAA0BC,KADnB,aACmBA,KADnB,uBACmBA,KAAK,CAAEW,KAAP,CAAaR,YAAb,EAA2BE,qBAA3B,CAAkD;AAC5E,sBAAsBL,KAFf,aAEeA,KAFf,uBAEeA,KAAK,CAAEW,KAAP,CAAaJ,kBAAb,EACdE,2BADc,CAEd;AACR,KATE;AAWD,CAvBD;;AAyBO,MAAMG,eAAe,GAAG,qBAAOC,iBAAP,EAG7BjB,SAH6B,EAGlBC,WAHkB,CAAxB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport {\n borderColorGradationVC,\n borderColorVC,\n Button,\n colorGradationVC,\n colorVC,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { WebButtonProps } from './Button';\n\nconst webStyles = () => {\n return css`\n & * {\n user-select: none;\n }\n `;\n};\n\nconst hoverStyles = ({\n mouseOver,\n pressed,\n theme,\n variant = 'filled',\n disabled,\n}: { mouseOver: boolean; pressed: boolean } & WebButtonProps &\n Partial<StyleProps>) => {\n const variantColor = colorVC[variant];\n const variantColorGradation = colorGradationVC[variant];\n const variantBorderColor = borderColorVC[variant];\n const variantBorderColorGradation = borderColorGradationVC[variant];\n return (\n mouseOver &&\n !disabled &&\n !pressed &&\n css`\n background-color: ${theme?.color[variantColor][variantColorGradation]};\n border-color: ${theme?.color[variantBorderColor][\n variantBorderColorGradation\n ]};\n `\n );\n};\n\nexport const StyledWebButton = styled(Button)<\n { mouseOver: boolean; pressed: boolean } & WebButtonProps &\n Partial<StyleProps>\n>(webStyles, hoverStyles);\n"],"file":"styled.js"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
layout?: number[][];
|
|
6
|
-
columns?: number;
|
|
7
|
-
spacing?: SpacingType | {
|
|
8
|
-
top?: SpacingType;
|
|
9
|
-
right?: SpacingType;
|
|
10
|
-
bottom?: SpacingType;
|
|
11
|
-
left?: SpacingType;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
declare const Grid: ({ children, columns, layout, style, spacing, ...rest }: IGrid) => JSX.Element;
|
|
2
|
+
import { IGrid } from '@tecsinapse/react-core';
|
|
3
|
+
export declare type IGridWeb = IGrid & Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
4
|
+
declare const Grid: ({ children, columns, layout, style, spacing, ...rest }: IGridWeb) => JSX.Element;
|
|
15
5
|
export default Grid;
|
|
@@ -30,6 +30,7 @@ const Grid = ({
|
|
|
30
30
|
flexWrap: 'wrap'
|
|
31
31
|
}
|
|
32
32
|
}, rest), _react.default.Children.map(children, (child, index) => _react.default.createElement(_Item.GridItem, {
|
|
33
|
+
key: `child-${index}`,
|
|
33
34
|
columns: columns,
|
|
34
35
|
span: flatLayout[index],
|
|
35
36
|
spacing: spacing
|
|
@@ -42,10 +43,11 @@ const Grid = ({
|
|
|
42
43
|
flexDirection: 'row',
|
|
43
44
|
flexWrap: 'wrap'
|
|
44
45
|
}
|
|
45
|
-
}, rest), _react.default.Children.map(children, child => {
|
|
46
|
+
}, rest), _react.default.Children.map(children, (child, index) => {
|
|
46
47
|
return _react.default.cloneElement(child, { ...(child === null || child === void 0 ? void 0 : child.props),
|
|
47
48
|
columns,
|
|
48
|
-
spacing: (child === null || child === void 0 ? void 0 : child.props.spacing) ?? spacing
|
|
49
|
+
spacing: (child === null || child === void 0 ? void 0 : child.props.spacing) ?? spacing,
|
|
50
|
+
key: `child-${index}`
|
|
49
51
|
});
|
|
50
52
|
}));
|
|
51
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Grid/Grid.tsx"],"names":["Grid","children","columns","layout","style","spacing","rest","flatLayout","flat","display","flexDirection","flexWrap","React","Children","map","child","index","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Grid/Grid.tsx"],"names":["Grid","children","columns","layout","style","spacing","rest","flatLayout","flat","display","flexDirection","flexWrap","React","Children","map","child","index","cloneElement","props","key"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAMA,MAAMA,IAAI,GAAG,CAAC;AACZC,EAAAA,QADY;AAEZC,EAAAA,OAAO,GAAG,EAFE;AAGZC,EAAAA,MAHY;AAIZC,EAAAA,KAJY;AAKZC,EAAAA,OALY;AAMZ,KAAGC;AANS,CAAD,KAOgB;AAC3B,MAAIH,MAAJ,EAAY;AACV,UAAMI,UAAU,GAAGJ,MAAM,CAACK,IAAP,EAAnB;AACA,WACE;AACE,MAAA,KAAK,EAAE,EACL,GAAGJ,KADE;AAELK,QAAAA,OAAO,EAAE,MAFJ;AAGLC,QAAAA,aAAa,EAAE,KAHV;AAILC,QAAAA,QAAQ,EAAE;AAJL;AADT,OAOML,IAPN,GASGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6B,CAACc,KAAD,EAAQC,KAAR,KAC5B,6BAAC,cAAD;AACE,MAAA,GAAG,EAAG,SAAQA,KAAM,EADtB;AAEE,MAAA,OAAO,EAAEd,OAFX;AAGE,MAAA,IAAI,EAAEK,UAAU,CAACS,KAAD,CAHlB;AAIE,MAAA,OAAO,EAAEX;AAJX,OAMGU,KANH,CADD,CATH,CADF;AAsBD;;AAED,SACE;AACE,IAAA,KAAK,EAAE,EACL,GAAGX,KADE;AAELK,MAAAA,OAAO,EAAE,MAFJ;AAGLC,MAAAA,aAAa,EAAE,KAHV;AAILC,MAAAA,QAAQ,EAAE;AAJL;AADT,KAOML,IAPN,GASGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6B,CAACc,KAAD,EAAQC,KAAR,KAAkB;AAC9C,WAAOJ,eAAMK,YAAN,CAAmBF,KAAnB,EAA0B,EAC/B,IAAGA,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEG,KAAV,CAD+B;AAE/BhB,MAAAA,OAF+B;AAG/BG,MAAAA,OAAO,EAAE,CAAAU,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEG,KAAP,CAAab,OAAb,KAAwBA,OAHF;AAI/Bc,MAAAA,GAAG,EAAG,SAAQH,KAAM;AAJW,KAA1B,CAAP;AAMD,GAPA,CATH,CADF;AAoBD,CAtDD;;eAwDehB,I","sourcesContent":["import React from 'react';\nimport { GridItem } from './Item';\nimport { IGrid } from '@tecsinapse/react-core';\n\nexport type IGridWeb = IGrid &\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst Grid = ({\n children,\n columns = 12,\n layout,\n style,\n spacing,\n ...rest\n}: IGridWeb): JSX.Element => {\n if (layout) {\n const flatLayout = layout.flat();\n return (\n <div\n style={{\n ...style,\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n }}\n {...rest}\n >\n {React.Children.map(children, (child, index) => (\n <GridItem\n key={`child-${index}`}\n columns={columns}\n span={flatLayout[index]}\n spacing={spacing}\n >\n {child}\n </GridItem>\n ))}\n </div>\n );\n }\n\n return (\n <div\n style={{\n ...style,\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n }}\n {...rest}\n >\n {React.Children.map(children, (child, index) => {\n return React.cloneElement(child, {\n ...child?.props,\n columns,\n spacing: child?.props.spacing ?? spacing,\n key: `child-${index}`,\n });\n })}\n </div>\n );\n};\n\nexport default Grid;\n"],"file":"Grid.js"}
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface IGridItem {
|
|
8
|
-
children: React.ReactElement;
|
|
9
|
-
span: number;
|
|
10
|
-
columns?: number;
|
|
11
|
-
loading?: boolean;
|
|
12
|
-
loadingComponent?: React.ReactElement;
|
|
13
|
-
alignContent?: FlexAlignBase | FlexSpacing;
|
|
14
|
-
alignItems?: FlexAlignType;
|
|
15
|
-
alignSelf?: 'auto' | FlexAlignType;
|
|
16
|
-
flex?: number;
|
|
17
|
-
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
18
|
-
flexGrow?: number;
|
|
19
|
-
flexShrink?: number;
|
|
20
|
-
justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';
|
|
21
|
-
spacing?: SpacingType | {
|
|
22
|
-
top?: SpacingType;
|
|
23
|
-
right?: SpacingType;
|
|
24
|
-
bottom?: SpacingType;
|
|
25
|
-
left?: SpacingType;
|
|
26
|
-
};
|
|
27
|
-
wrapper?: boolean;
|
|
2
|
+
import { IGridItem, Breakpoints } from '@tecsinapse/react-core';
|
|
3
|
+
export declare type Span = Pick<Breakpoints, 'sm'> & Partial<Omit<Breakpoints, 'sm'>>;
|
|
4
|
+
export interface IGridItemWeb extends Omit<IGridItem, 'span'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
5
|
+
span: number | Span;
|
|
6
|
+
flexBasis?: string | 'content' | 'auto' | 'max-content' | 'min-content' | 'fit-content';
|
|
28
7
|
}
|
|
29
|
-
declare const GridItem: ({ children, span, columns, loadingComponent, loading, spacing: _spacing, wrapper, ...rest }:
|
|
8
|
+
declare const GridItem: ({ children, span: _span, columns, loadingComponent, loading, spacing: _spacing, wrapper, alignContent, alignItems, alignSelf, flex, flexDirection, flexGrow, flexShrink, justifyContent, flexBasis, style, ...rest }: IGridItemWeb) => JSX.Element;
|
|
30
9
|
export default GridItem;
|
|
@@ -9,21 +9,42 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactCore = require("@tecsinapse/react-core");
|
|
11
11
|
|
|
12
|
+
var _reactWebKit = require("@tecsinapse/react-web-kit");
|
|
13
|
+
|
|
14
|
+
var _functions = require("./functions");
|
|
15
|
+
|
|
12
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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
|
+
|
|
14
20
|
const GridItem = ({
|
|
15
21
|
children,
|
|
16
|
-
span,
|
|
22
|
+
span: _span,
|
|
17
23
|
columns = 12,
|
|
18
24
|
loadingComponent,
|
|
19
25
|
loading = false,
|
|
20
26
|
spacing: _spacing,
|
|
21
27
|
wrapper = false,
|
|
28
|
+
alignContent,
|
|
29
|
+
alignItems,
|
|
30
|
+
alignSelf,
|
|
31
|
+
flex,
|
|
32
|
+
flexDirection,
|
|
33
|
+
flexGrow,
|
|
34
|
+
flexShrink,
|
|
35
|
+
justifyContent,
|
|
36
|
+
flexBasis,
|
|
37
|
+
style,
|
|
22
38
|
...rest
|
|
23
39
|
}) => {
|
|
24
40
|
const {
|
|
25
41
|
spacing
|
|
26
42
|
} = (0, _reactCore.useTheme)();
|
|
43
|
+
const {
|
|
44
|
+
sm,
|
|
45
|
+
md,
|
|
46
|
+
lg
|
|
47
|
+
} = (0, _reactWebKit.useBreakpoints)();
|
|
27
48
|
|
|
28
49
|
if (!_react.default.Children.only(children)) {
|
|
29
50
|
throw new Error('The number of children in GridItem should be one');
|
|
@@ -33,32 +54,33 @@ const GridItem = ({
|
|
|
33
54
|
return loadingComponent;
|
|
34
55
|
}
|
|
35
56
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const span = typeof _span === 'number' ? _span : (0, _functions.getSpan)(_span, sm, md, lg);
|
|
58
|
+
const _style = { ...style,
|
|
59
|
+
alignContent,
|
|
60
|
+
alignItems,
|
|
61
|
+
alignSelf,
|
|
62
|
+
flexDirection,
|
|
63
|
+
flexGrow,
|
|
64
|
+
flexShrink,
|
|
65
|
+
justifyContent,
|
|
66
|
+
flex,
|
|
45
67
|
boxSizing: 'border-box',
|
|
46
|
-
flexBasis: `${
|
|
47
|
-
paddingTop:
|
|
48
|
-
paddingBottom:
|
|
49
|
-
paddingRight:
|
|
50
|
-
paddingLeft:
|
|
68
|
+
flexBasis: flexBasis ?? `${(0, _reactCore.getGridItemColumSpan)(columns, span)}%`,
|
|
69
|
+
paddingTop: (0, _reactCore.getGridItemPadding)('top', _spacing, spacing),
|
|
70
|
+
paddingBottom: (0, _reactCore.getGridItemPadding)('bottom', _spacing, spacing),
|
|
71
|
+
paddingRight: (0, _reactCore.getGridItemPadding)('right', _spacing, spacing),
|
|
72
|
+
paddingLeft: (0, _reactCore.getGridItemPadding)('left', _spacing, spacing)
|
|
51
73
|
};
|
|
52
74
|
|
|
53
75
|
const clone = _react.default.cloneElement(children, { ...(children === null || children === void 0 ? void 0 : children.props),
|
|
54
|
-
style: wrapper ? children === null || children === void 0 ? void 0 : children.props.style : { ...
|
|
76
|
+
style: wrapper ? children === null || children === void 0 ? void 0 : children.props.style : { ..._style,
|
|
55
77
|
...(children === null || children === void 0 ? void 0 : children.props.style)
|
|
56
78
|
}
|
|
57
79
|
});
|
|
58
80
|
|
|
59
|
-
return wrapper ? _react.default.createElement("div", {
|
|
60
|
-
style:
|
|
61
|
-
}, clone) : clone;
|
|
81
|
+
return wrapper ? _react.default.createElement("div", _extends({}, rest, {
|
|
82
|
+
style: _style
|
|
83
|
+
}), clone) : clone;
|
|
62
84
|
};
|
|
63
85
|
|
|
64
86
|
var _default = GridItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","columns","loadingComponent","loading","spacing","_spacing","wrapper","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","_span","columns","loadingComponent","loading","spacing","_spacing","wrapper","alignContent","alignItems","alignSelf","flex","flexDirection","flexGrow","flexShrink","justifyContent","flexBasis","style","rest","sm","md","lg","React","Children","only","Error","_style","boxSizing","paddingTop","paddingBottom","paddingRight","paddingLeft","clone","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AACA;;;;;;AAmBA,MAAMA,QAAQ,GAAG,CAAC;AAChBC,EAAAA,QADgB;AAEhBC,EAAAA,IAAI,EAAEC,KAFU;AAGhBC,EAAAA,OAAO,GAAG,EAHM;AAIhBC,EAAAA,gBAJgB;AAKhBC,EAAAA,OAAO,GAAG,KALM;AAMhBC,EAAAA,OAAO,EAAEC,QANO;AAOhBC,EAAAA,OAAO,GAAG,KAPM;AAQhBC,EAAAA,YARgB;AAShBC,EAAAA,UATgB;AAUhBC,EAAAA,SAVgB;AAWhBC,EAAAA,IAXgB;AAYhBC,EAAAA,aAZgB;AAahBC,EAAAA,QAbgB;AAchBC,EAAAA,UAdgB;AAehBC,EAAAA,cAfgB;AAgBhBC,EAAAA,SAhBgB;AAiBhBC,EAAAA,KAjBgB;AAkBhB,KAAGC;AAlBa,CAAD,KAmBgB;AAC/B,QAAM;AAAEb,IAAAA;AAAF,MAAc,0BAApB;AACA,QAAM;AAAEc,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA;AAAV,MAAiB,kCAAvB;;AACA,MAAI,CAACC,eAAMC,QAAN,CAAeC,IAAf,CAAoBzB,QAApB,CAAL,EAAoC;AAClC,UAAM,IAAI0B,KAAJ,CAAU,kDAAV,CAAN;AACD;;AACD,MAAItB,gBAAgB,IAAIC,OAAxB,EAAiC;AAC/B,WAAOD,gBAAP;AACD;;AAED,QAAMH,IAAI,GAAG,OAAOC,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoC,wBAAQA,KAAR,EAAekB,EAAf,EAAmBC,EAAnB,EAAuBC,EAAvB,CAAjD;AAEA,QAAMK,MAA2B,GAAG,EAClC,GAAGT,KAD+B;AAElCT,IAAAA,YAFkC;AAGlCC,IAAAA,UAHkC;AAIlCC,IAAAA,SAJkC;AAKlCE,IAAAA,aALkC;AAMlCC,IAAAA,QANkC;AAOlCC,IAAAA,UAPkC;AAQlCC,IAAAA,cARkC;AASlCJ,IAAAA,IATkC;AAUlCgB,IAAAA,SAAS,EAAE,YAVuB;AAWlCX,IAAAA,SAAS,EAAEA,SAAS,IAAK,GAAE,qCAAqBd,OAArB,EAA8BF,IAA9B,CAAoC,GAX7B;AAYlC4B,IAAAA,UAAU,EAAE,mCAAmB,KAAnB,EAA0BtB,QAA1B,EAAoCD,OAApC,CAZsB;AAalCwB,IAAAA,aAAa,EAAE,mCAAmB,QAAnB,EAA6BvB,QAA7B,EAAuCD,OAAvC,CAbmB;AAclCyB,IAAAA,YAAY,EAAE,mCAAmB,OAAnB,EAA4BxB,QAA5B,EAAsCD,OAAtC,CAdoB;AAelC0B,IAAAA,WAAW,EAAE,mCAAmB,MAAnB,EAA2BzB,QAA3B,EAAqCD,OAArC;AAfqB,GAApC;;AAkBA,QAAM2B,KAAK,GAAGV,eAAMW,YAAN,CAAmBlC,QAAnB,EAA6B,EACzC,IAAGA,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEmC,KAAb,CADyC;AAEzCjB,IAAAA,KAAK,EAAEV,OAAO,GACVR,QADU,aACVA,QADU,uBACVA,QAAQ,CAAEmC,KAAV,CAAgBjB,KADN,GAEV,EAAE,GAAGS,MAAL;AAAa,UAAG3B,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEmC,KAAV,CAAgBjB,KAAnB;AAAb;AAJqC,GAA7B,CAAd;;AAOA,SAAOV,OAAO,GACZ,iDAASW,IAAT;AAAe,IAAA,KAAK,EAAEQ;AAAtB,MACGM,KADH,CADY,GAKZA,KALF;AAOD,CA/DD;;eAiEelC,Q","sourcesContent":["import React from 'react';\nimport {\n IGridItem,\n useTheme,\n Breakpoints,\n getGridItemColumSpan,\n getGridItemPadding,\n} from '@tecsinapse/react-core';\nimport { useBreakpoints } from '@tecsinapse/react-web-kit';\nimport { getSpan } from './functions';\n\nexport type Span = Pick<Breakpoints, 'sm'> & Partial<Omit<Breakpoints, 'sm'>>;\n\nexport interface IGridItemWeb\n extends Omit<IGridItem, 'span'>,\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** At least sm should exist */\n span: number | Span;\n /** Only specify this property if the GridItem will be 'dynamic', adjusting itself to content. Use this with `wrapper` for better result. */\n flexBasis?:\n | string\n | 'content'\n | 'auto'\n | 'max-content'\n | 'min-content'\n | 'fit-content';\n}\n\nconst GridItem = ({\n children,\n span: _span,\n columns = 12,\n loadingComponent,\n loading = false,\n spacing: _spacing,\n wrapper = false,\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n justifyContent,\n flexBasis,\n style,\n ...rest\n}: IGridItemWeb): JSX.Element => {\n const { spacing } = useTheme();\n const { sm, md, lg } = useBreakpoints();\n if (!React.Children.only(children)) {\n throw new Error('The number of children in GridItem should be one');\n }\n if (loadingComponent && loading) {\n return loadingComponent;\n }\n\n const span = typeof _span === 'number' ? _span : getSpan(_span, sm, md, lg);\n\n const _style: React.CSSProperties = {\n ...style,\n alignContent,\n alignItems,\n alignSelf,\n flexDirection,\n flexGrow,\n flexShrink,\n justifyContent,\n flex,\n boxSizing: 'border-box',\n flexBasis: flexBasis ?? `${getGridItemColumSpan(columns, span)}%`,\n paddingTop: getGridItemPadding('top', _spacing, spacing),\n paddingBottom: getGridItemPadding('bottom', _spacing, spacing),\n paddingRight: getGridItemPadding('right', _spacing, spacing),\n paddingLeft: getGridItemPadding('left', _spacing, spacing),\n };\n\n const clone = React.cloneElement(children, {\n ...children?.props,\n style: wrapper\n ? children?.props.style\n : { ..._style, ...children?.props.style },\n });\n\n return wrapper ? (\n <div {...rest} style={_style}>\n {clone}\n </div>\n ) : (\n clone\n );\n};\n\nexport default GridItem;\n"],"file":"Item.js"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSpan = void 0;
|
|
7
|
+
|
|
8
|
+
const getSpan = (value, sm, md, lg) => {
|
|
9
|
+
if (sm) return value.sm;
|
|
10
|
+
if (md) return value.md ?? value.sm;
|
|
11
|
+
if (lg) return value.lg ?? value.md ?? value.sm;
|
|
12
|
+
return 0;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.getSpan = getSpan;
|
|
16
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/functions.ts"],"names":["getSpan","value","sm","md","lg"],"mappings":";;;;;;;AAEO,MAAMA,OAAO,GAAG,CACrBC,KADqB,EAErBC,EAFqB,EAGrBC,EAHqB,EAIrBC,EAJqB,KAKV;AACX,MAAIF,EAAJ,EAAQ,OAAOD,KAAK,CAACC,EAAb;AACR,MAAIC,EAAJ,EAAQ,OAAOF,KAAK,CAACE,EAAN,IAAYF,KAAK,CAACC,EAAzB;AACR,MAAIE,EAAJ,EAAQ,OAAOH,KAAK,CAACG,EAAN,IAAYH,KAAK,CAACE,EAAlB,IAAwBF,KAAK,CAACC,EAArC;AACR,SAAO,CAAP;AACD,CAVM","sourcesContent":["import { Span } from './Item';\n\nexport const getSpan = (\n value: Span,\n sm: boolean,\n md: boolean,\n lg: boolean\n): number => {\n if (sm) return value.sm;\n if (md) return value.md ?? value.sm;\n if (lg) return value.lg ?? value.md ?? value.sm;\n return 0;\n};\n"],"file":"functions.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as GridItem } from './Item';
|
|
2
|
-
export type {
|
|
2
|
+
export type { IGridItemWeb } from './Item';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default as GridItem } from './Item';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default as GridItem } from './Item';\nexport type { IGridItemWeb } from './Item';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA","sourcesContent":["export { GridItem } from './Item';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA","sourcesContent":["export { GridItem } from './Item';\nexport type { IGridItemWeb } from './Item';\nexport { default as Grid } from './Grid';\nexport type { IGridWeb } from './Grid';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IconTextButtonProps } from '@tecsinapse/react-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { WebButtonProps } from '../../atoms/Button';
|
|
4
|
+
export declare type WebIconTextButtonProps = IconTextButtonProps & Omit<WebButtonProps, 'ButtonProps'>;
|
|
5
|
+
declare const IconTextButton: React.FC<WebIconTextButtonProps>;
|
|
6
|
+
export default IconTextButton;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 _useIconTextButton = _interopRequireDefault(require("./hooks/useIconTextButton"));
|
|
13
|
+
|
|
14
|
+
var _styled = require("./styled");
|
|
15
|
+
|
|
16
|
+
var _TextComponent = _interopRequireDefault(require("./TextComponent"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
const IconTextButton = ({
|
|
23
|
+
iconProps,
|
|
24
|
+
iconPosition = 'left',
|
|
25
|
+
textProps,
|
|
26
|
+
label,
|
|
27
|
+
variant = 'filled',
|
|
28
|
+
size = 'default',
|
|
29
|
+
...rest
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
handleHover,
|
|
33
|
+
handlePressed,
|
|
34
|
+
defaultFontColor
|
|
35
|
+
} = (0, _useIconTextButton.default)(variant);
|
|
36
|
+
return _react.default.createElement(_styled.StyledIconTextButton, _extends({
|
|
37
|
+
boxed: !label,
|
|
38
|
+
variant: variant,
|
|
39
|
+
size: size,
|
|
40
|
+
onMouseOut: () => handleHover(true),
|
|
41
|
+
onMouseOver: () => handleHover(false),
|
|
42
|
+
onPressIn: () => handlePressed(true),
|
|
43
|
+
onPressOut: () => handlePressed(false)
|
|
44
|
+
}, rest), iconPosition === 'left' ? _react.default.createElement(_reactCore.IconComponent, {
|
|
45
|
+
iconProps: iconProps,
|
|
46
|
+
size: size,
|
|
47
|
+
defaultFontColor: defaultFontColor
|
|
48
|
+
}) : _react.default.createElement(_react.default.Fragment, null), _react.default.createElement(_TextComponent.default, {
|
|
49
|
+
label: label,
|
|
50
|
+
defaultFontColor: defaultFontColor,
|
|
51
|
+
hasIcon: !!iconProps,
|
|
52
|
+
iconPosition: iconPosition,
|
|
53
|
+
textProps: textProps,
|
|
54
|
+
size: size
|
|
55
|
+
}), iconPosition === 'right' ? _react.default.createElement(_reactCore.IconComponent, {
|
|
56
|
+
iconProps: iconProps,
|
|
57
|
+
size: size,
|
|
58
|
+
defaultFontColor: defaultFontColor
|
|
59
|
+
}) : _react.default.createElement(_react.default.Fragment, null));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var _default = IconTextButton;
|
|
63
|
+
exports.default = _default;
|
|
64
|
+
//# sourceMappingURL=IconTextButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/IconTextButton/IconTextButton.tsx"],"names":["IconTextButton","iconProps","iconPosition","textProps","label","variant","size","rest","handleHover","handlePressed","defaultFontColor"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAKA,MAAMA,cAAgD,GAAG,CAAC;AACxDC,EAAAA,SADwD;AAExDC,EAAAA,YAAY,GAAG,MAFyC;AAGxDC,EAAAA,SAHwD;AAIxDC,EAAAA,KAJwD;AAKxDC,EAAAA,OAAO,GAAG,QAL8C;AAMxDC,EAAAA,IAAI,GAAG,SANiD;AAOxD,KAAGC;AAPqD,CAAD,KAQtC;AACjB,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,aAAf;AAA8BC,IAAAA;AAA9B,MAAmD,gCACvDL,OADuD,CAAzD;AAIA,SACE,6BAAC,4BAAD;AACE,IAAA,KAAK,EAAE,CAACD,KADV;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,IAAI,EAAEC,IAHR;AAIE,IAAA,UAAU,EAAE,MAAME,WAAW,CAAC,IAAD,CAJ/B;AAKE,IAAA,WAAW,EAAE,MAAMA,WAAW,CAAC,KAAD,CALhC;AAME,IAAA,SAAS,EAAE,MAAMC,aAAa,CAAC,IAAD,CANhC;AAOE,IAAA,UAAU,EAAE,MAAMA,aAAa,CAAC,KAAD;AAPjC,KAQMF,IARN,GAUGL,YAAY,KAAK,MAAjB,GACC,6BAAC,wBAAD;AACE,IAAA,SAAS,EAAED,SADb;AAEE,IAAA,IAAI,EAAEK,IAFR;AAGE,IAAA,gBAAgB,EAAEI;AAHpB,IADD,GAOC,2DAjBJ,EAmBE,6BAAC,sBAAD;AACE,IAAA,KAAK,EAAEN,KADT;AAEE,IAAA,gBAAgB,EAAEM,gBAFpB;AAGE,IAAA,OAAO,EAAE,CAAC,CAACT,SAHb;AAIE,IAAA,YAAY,EAAEC,YAJhB;AAKE,IAAA,SAAS,EAAEC,SALb;AAME,IAAA,IAAI,EAAEG;AANR,IAnBF,EA2BGJ,YAAY,KAAK,OAAjB,GACC,6BAAC,wBAAD;AACE,IAAA,SAAS,EAAED,SADb;AAEE,IAAA,IAAI,EAAEK,IAFR;AAGE,IAAA,gBAAgB,EAAEI;AAHpB,IADD,GAOC,2DAlCJ,CADF;AAuCD,CApDD;;eAsDeV,c","sourcesContent":["import { IconComponent, IconTextButtonProps } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { WebButtonProps } from '../../atoms/Button';\nimport useIconTextButton from './hooks/useIconTextButton';\nimport { StyledIconTextButton } from './styled';\nimport TextComponent from './TextComponent';\n\nexport type WebIconTextButtonProps = IconTextButtonProps &\n Omit<WebButtonProps, 'ButtonProps'>;\n\nconst IconTextButton: React.FC<WebIconTextButtonProps> = ({\n iconProps,\n iconPosition = 'left',\n textProps,\n label,\n variant = 'filled',\n size = 'default',\n ...rest\n}): JSX.Element => {\n const { handleHover, handlePressed, defaultFontColor } = useIconTextButton(\n variant\n );\n\n return (\n <StyledIconTextButton\n boxed={!label}\n variant={variant}\n size={size}\n onMouseOut={() => handleHover(true)}\n onMouseOver={() => handleHover(false)}\n onPressIn={() => handlePressed(true)}\n onPressOut={() => handlePressed(false)}\n {...rest}\n >\n {iconPosition === 'left' ? (\n <IconComponent\n iconProps={iconProps}\n size={size}\n defaultFontColor={defaultFontColor}\n />\n ) : (\n <></>\n )}\n <TextComponent\n label={label}\n defaultFontColor={defaultFontColor}\n hasIcon={!!iconProps}\n iconPosition={iconPosition}\n textProps={textProps}\n size={size}\n />\n {iconPosition === 'right' ? (\n <IconComponent\n iconProps={iconProps}\n size={size}\n defaultFontColor={defaultFontColor}\n />\n ) : (\n <></>\n )}\n </StyledIconTextButton>\n );\n};\n\nexport default IconTextButton;\n"],"file":"IconTextButton.js"}
|