@tecsinapse/react-web-kit 1.22.0-beta.11 → 1.22.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 +31 -0
- package/dist/components/atoms/Accordion/animations.d.ts +4 -4
- package/dist/components/atoms/Button/hooks/useMouseHover.d.ts +1 -1
- package/dist/components/atoms/Button/hooks/useMousePressed.d.ts +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/molecules/DatePicker/Modal.d.ts +1 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +1 -1
- package/dist/components/molecules/IconTextButton/IconTextButton.js +85 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js +42 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js.map +1 -0
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.d.ts +1 -1
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.js +30 -0
- package/dist/components/molecules/IconTextButton/hooks/useIconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/styled.js +23 -0
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/Select/Select.js +4 -9
- package/dist/components/molecules/Select/Select.js.map +1 -1
- package/dist/components/molecules/Select/functions.d.ts +1 -1
- package/dist/components/organisms/DataGrid/DataGrid.d.ts +1 -1
- package/dist/components/organisms/DataGrid/Row/Row.d.ts +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/esm/components/atoms/Accordion/animations.d.ts +4 -4
- package/esm/components/atoms/Button/hooks/useMouseHover.d.ts +1 -1
- package/esm/components/atoms/Button/hooks/useMousePressed.d.ts +1 -1
- package/esm/components/molecules/DatePicker/DatePicker.d.ts +1 -1
- package/esm/components/molecules/DatePicker/Modal.d.ts +1 -1
- package/esm/components/molecules/Grid/Item/Item.d.ts +1 -1
- package/esm/components/molecules/IconTextButton/IconTextButton.js +65 -37
- package/esm/components/molecules/IconTextButton/IconTextButton.js.map +1 -1
- package/esm/components/molecules/IconTextButton/TextComponent.js +31 -18
- package/esm/components/molecules/IconTextButton/TextComponent.js.map +1 -1
- package/esm/components/molecules/IconTextButton/hooks/useIconTextButton.d.ts +1 -1
- package/esm/components/molecules/IconTextButton/hooks/useIconTextButton.js +17 -11
- package/esm/components/molecules/IconTextButton/hooks/useIconTextButton.js.map +1 -1
- package/esm/components/molecules/IconTextButton/styled.js +15 -29
- package/esm/components/molecules/IconTextButton/styled.js.map +1 -1
- package/esm/components/molecules/Select/Select.js +4 -9
- package/esm/components/molecules/Select/Select.js.map +1 -1
- package/esm/components/molecules/Select/functions.d.ts +1 -1
- package/esm/components/organisms/DataGrid/DataGrid.d.ts +1 -1
- package/esm/components/organisms/DataGrid/Row/Row.d.ts +1 -1
- package/esm/index.d.ts +5 -4
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/molecules/Select/Select.tsx +4 -10
- package/src/index.ts +6 -4
- package/esm/components/atoms/Accordion/index.js +0 -2
- package/esm/components/atoms/Accordion/index.js.map +0 -1
- package/esm/components/atoms/Badge/index.js +0 -2
- package/esm/components/atoms/Badge/index.js.map +0 -1
- package/esm/components/atoms/Button/index.js +0 -3
- package/esm/components/atoms/Button/index.js.map +0 -1
- package/esm/components/atoms/Input/index.js +0 -2
- package/esm/components/atoms/Input/index.js.map +0 -1
- package/esm/components/atoms/InputMask/index.js +0 -2
- package/esm/components/atoms/InputMask/index.js.map +0 -1
- package/esm/components/atoms/Modal/index.js +0 -2
- package/esm/components/atoms/Modal/index.js.map +0 -1
- package/esm/components/atoms/Overlay/index.js +0 -2
- package/esm/components/atoms/Overlay/index.js.map +0 -1
- package/esm/components/atoms/Skeleton/index.js +0 -2
- package/esm/components/atoms/Skeleton/index.js.map +0 -1
- package/esm/components/atoms/Table/Body/index.js +0 -2
- package/esm/components/atoms/Table/Body/index.js.map +0 -1
- package/esm/components/atoms/Table/Cell/index.js +0 -2
- package/esm/components/atoms/Table/Cell/index.js.map +0 -1
- package/esm/components/atoms/Table/Container/index.js +0 -2
- package/esm/components/atoms/Table/Container/index.js.map +0 -1
- package/esm/components/atoms/Table/Footer/index.js +0 -2
- package/esm/components/atoms/Table/Footer/index.js.map +0 -1
- package/esm/components/atoms/Table/Header/index.js +0 -3
- package/esm/components/atoms/Table/Header/index.js.map +0 -1
- package/esm/components/atoms/Table/Row/index.js +0 -2
- package/esm/components/atoms/Table/Row/index.js.map +0 -1
- package/esm/components/atoms/Table/Toolbar/index.js +0 -2
- package/esm/components/atoms/Table/Toolbar/index.js.map +0 -1
- package/esm/components/atoms/Table/index.js +0 -9
- package/esm/components/atoms/Table/index.js.map +0 -1
- package/esm/components/atoms/Tag/index.js +0 -2
- package/esm/components/atoms/Tag/index.js.map +0 -1
- package/esm/components/atoms/Tooltip/index.js +0 -2
- package/esm/components/atoms/Tooltip/index.js.map +0 -1
- package/esm/components/molecules/Breadcrumbs/BreadcrumbItem/index.js +0 -3
- package/esm/components/molecules/Breadcrumbs/BreadcrumbItem/index.js.map +0 -1
- package/esm/components/molecules/Breadcrumbs/index.js +0 -2
- package/esm/components/molecules/Breadcrumbs/index.js.map +0 -1
- package/esm/components/molecules/DatePicker/Modal.js +0 -27
- package/esm/components/molecules/DatePicker/Modal.js.map +0 -1
- package/esm/components/molecules/DatePicker/index.js +0 -2
- package/esm/components/molecules/DatePicker/index.js.map +0 -1
- package/esm/components/molecules/DatePicker/styled.js +0 -23
- package/esm/components/molecules/DatePicker/styled.js.map +0 -1
- package/esm/components/molecules/DateTimePicker/Modal.js +0 -26
- package/esm/components/molecules/DateTimePicker/Modal.js.map +0 -1
- package/esm/components/molecules/DateTimePicker/index.js +0 -2
- package/esm/components/molecules/DateTimePicker/index.js.map +0 -1
- package/esm/components/molecules/DateTimePicker/styled.js +0 -18
- package/esm/components/molecules/DateTimePicker/styled.js.map +0 -1
- package/esm/components/molecules/Drawer/index.js +0 -2
- package/esm/components/molecules/Drawer/index.js.map +0 -1
- package/esm/components/molecules/Grid/Item/index.js +0 -2
- package/esm/components/molecules/Grid/Item/index.js.map +0 -1
- package/esm/components/molecules/Grid/index.js +0 -3
- package/esm/components/molecules/Grid/index.js.map +0 -1
- package/esm/components/molecules/IconTextButton/index.js +0 -2
- package/esm/components/molecules/IconTextButton/index.js.map +0 -1
- package/esm/components/molecules/InputPassword/index.js +0 -2
- package/esm/components/molecules/InputPassword/index.js.map +0 -1
- package/esm/components/molecules/LabeledSwitch/index.js +0 -2
- package/esm/components/molecules/LabeledSwitch/index.js.map +0 -1
- package/esm/components/molecules/Masonry/index.js +0 -2
- package/esm/components/molecules/Masonry/index.js.map +0 -1
- package/esm/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/index.js +0 -2
- package/esm/components/molecules/Menubar/MenuBlock/MenuItem/SubMenuBlock/index.js.map +0 -1
- package/esm/components/molecules/Menubar/MenuBlock/MenuItem/index.js +0 -2
- package/esm/components/molecules/Menubar/MenuBlock/MenuItem/index.js.map +0 -1
- package/esm/components/molecules/Menubar/MenuBlock/index.js +0 -2
- package/esm/components/molecules/Menubar/MenuBlock/index.js.map +0 -1
- package/esm/components/molecules/Menubar/MostUsed/index.js +0 -2
- package/esm/components/molecules/Menubar/MostUsed/index.js.map +0 -1
- package/esm/components/molecules/Menubar/SearchResultItem/index.js +0 -2
- package/esm/components/molecules/Menubar/SearchResultItem/index.js.map +0 -1
- package/esm/components/molecules/Menubar/index.js +0 -3
- package/esm/components/molecules/Menubar/index.js.map +0 -1
- package/esm/components/molecules/Menubar/types.js +0 -2
- package/esm/components/molecules/Menubar/types.js.map +0 -1
- package/esm/components/molecules/Select/Dropdown/components/index.js +0 -2
- package/esm/components/molecules/Select/Dropdown/components/index.js.map +0 -1
- package/esm/components/molecules/Select/Dropdown/index.js +0 -2
- package/esm/components/molecules/Select/Dropdown/index.js.map +0 -1
- package/esm/components/molecules/Select/SelectItem/index.js +0 -2
- package/esm/components/molecules/Select/SelectItem/index.js.map +0 -1
- package/esm/components/molecules/Select/index.js +0 -2
- package/esm/components/molecules/Select/index.js.map +0 -1
- package/esm/components/molecules/Snackbar/index.js +0 -2
- package/esm/components/molecules/Snackbar/index.js.map +0 -1
- package/esm/components/molecules/TextArea/index.js +0 -2
- package/esm/components/molecules/TextArea/index.js.map +0 -1
- package/esm/components/organisms/DataGrid/Footer/index.js +0 -2
- package/esm/components/organisms/DataGrid/Footer/index.js.map +0 -1
- package/esm/components/organisms/DataGrid/Header/index.js +0 -2
- package/esm/components/organisms/DataGrid/Header/index.js.map +0 -1
- package/esm/components/organisms/DataGrid/Row/index.js +0 -2
- package/esm/components/organisms/DataGrid/Row/index.js.map +0 -1
- package/esm/components/organisms/DataGrid/index.js +0 -3
- package/esm/components/organisms/DataGrid/index.js.map +0 -1
- package/esm/components/organisms/DataGrid/types.js +0 -2
- package/esm/components/organisms/DataGrid/types.js.map +0 -1
- package/esm/hooks/index.js +0 -4
- package/esm/hooks/index.js.map +0 -1
|
@@ -1,51 +1,79 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import { IconComponent } from '@tecsinapse/react-core';
|
|
4
2
|
import React from 'react';
|
|
5
|
-
import useIconTextButton from
|
|
6
|
-
import { StyledIconTextButton } from
|
|
7
|
-
import TextComponent from
|
|
3
|
+
import useIconTextButton from './hooks/useIconTextButton.js';
|
|
4
|
+
import { StyledIconTextButton } from './styled.js';
|
|
5
|
+
import TextComponent from './TextComponent.js';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
const IconTextButton = (_a) => {
|
|
36
|
+
var _b = _a, {
|
|
11
37
|
iconProps,
|
|
12
|
-
iconPosition =
|
|
38
|
+
iconPosition = "left",
|
|
13
39
|
textProps,
|
|
14
40
|
label,
|
|
15
|
-
variant =
|
|
16
|
-
size =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
variant = "filled",
|
|
42
|
+
size = "default"
|
|
43
|
+
} = _b, rest = __objRest(_b, [
|
|
44
|
+
"iconProps",
|
|
45
|
+
"iconPosition",
|
|
46
|
+
"textProps",
|
|
47
|
+
"label",
|
|
48
|
+
"variant",
|
|
49
|
+
"size"
|
|
50
|
+
]);
|
|
51
|
+
const { handleHover, handlePressed, defaultFontColor } = useIconTextButton(variant);
|
|
52
|
+
return /* @__PURE__ */ React.createElement(StyledIconTextButton, __spreadValues({
|
|
25
53
|
boxed: !label,
|
|
26
|
-
variant
|
|
27
|
-
size
|
|
54
|
+
variant,
|
|
55
|
+
size,
|
|
28
56
|
onMouseOut: () => handleHover(true),
|
|
29
57
|
onMouseOver: () => handleHover(false),
|
|
30
58
|
onPressIn: () => handlePressed(true),
|
|
31
59
|
onPressOut: () => handlePressed(false)
|
|
32
|
-
}, rest), iconPosition ===
|
|
33
|
-
iconProps
|
|
34
|
-
size
|
|
35
|
-
defaultFontColor
|
|
36
|
-
}) : React.createElement(React.Fragment, null), React.createElement(TextComponent, {
|
|
37
|
-
label
|
|
38
|
-
defaultFontColor
|
|
60
|
+
}, rest), iconPosition === "left" ? /* @__PURE__ */ React.createElement(IconComponent, {
|
|
61
|
+
iconProps,
|
|
62
|
+
size,
|
|
63
|
+
defaultFontColor
|
|
64
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement(TextComponent, {
|
|
65
|
+
label,
|
|
66
|
+
defaultFontColor,
|
|
39
67
|
hasIcon: !!iconProps,
|
|
40
|
-
iconPosition
|
|
41
|
-
textProps
|
|
42
|
-
size
|
|
43
|
-
}), iconPosition ===
|
|
44
|
-
iconProps
|
|
45
|
-
size
|
|
46
|
-
defaultFontColor
|
|
47
|
-
}) : React.createElement(React.Fragment, null));
|
|
68
|
+
iconPosition,
|
|
69
|
+
textProps,
|
|
70
|
+
size
|
|
71
|
+
}), iconPosition === "right" ? /* @__PURE__ */ React.createElement(IconComponent, {
|
|
72
|
+
iconProps,
|
|
73
|
+
size,
|
|
74
|
+
defaultFontColor
|
|
75
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
48
76
|
};
|
|
49
77
|
|
|
50
|
-
export default
|
|
51
|
-
//# sourceMappingURL=IconTextButton.js.map
|
|
78
|
+
export { IconTextButton as default };
|
|
79
|
+
//# sourceMappingURL=IconTextButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconTextButton.js","
|
|
1
|
+
{"version":3,"file":"IconTextButton.js","sources":["../../../../src/components/molecules/IconTextButton/IconTextButton.tsx"],"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 } =\n useIconTextButton(variant);\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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUM,MAAA,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SAAA;AAAA,IACA,IAAA;AAAA,GACF,CAAA,EACC,YAAiB,KAAA,OAAA,mBACf,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA;AAAA,IACC,SAAA;AAAA,IACA,IAAA;AAAA,IACA,gBAAA;AAAA,GACF,CAAA,2DAEE,CAEN,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import { Text } from '@tecsinapse/react-core';
|
|
4
2
|
import React from 'react';
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
const TextComponent = ({
|
|
21
|
+
textProps,
|
|
22
|
+
size = "default",
|
|
23
|
+
defaultFontColor,
|
|
24
|
+
label
|
|
25
|
+
}) => {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
return label ? /* @__PURE__ */ React.createElement(Text, __spreadValues({
|
|
28
|
+
typography: ((_a = textProps == null ? void 0 : textProps.typography) != null ? _a : size === "small") ? "sub" : "base",
|
|
29
|
+
fontWeight: (_b = textProps == null ? void 0 : textProps.fontWeight) != null ? _b : "bold",
|
|
30
|
+
fontColor: (_c = textProps == null ? void 0 : textProps.fontColor) != null ? _c : defaultFontColor
|
|
31
|
+
}, textProps), label) : /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
20
32
|
};
|
|
33
|
+
var TextComponent$1 = React.memo(TextComponent);
|
|
21
34
|
|
|
22
|
-
export default
|
|
23
|
-
//# sourceMappingURL=TextComponent.js.map
|
|
35
|
+
export { TextComponent$1 as default };
|
|
36
|
+
//# sourceMappingURL=TextComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextComponent.js","
|
|
1
|
+
{"version":3,"file":"TextComponent.js","sources":["../../../../src/components/molecules/IconTextButton/TextComponent.tsx"],"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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAM,gBAAwC,CAAC;AAAA,EAC7C,SAAA;AAAA,EACA,IAAO,GAAA,SAAA;AAAA,EACP,gBAAA;AAAA,EACA,KAAA;AACF,CAAM,KAAA;AAvBN,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwBE,EAAA,OAAO,wBACJ,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AAAA,IACC,cAAY,EAAW,GAAA,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,UAAA,KAAX,IAAyB,GAAA,EAAA,GAAA,IAAA,KAAS,WAAU,KAAQ,GAAA,MAAA;AAAA,IAChE,UAAA,EAAA,CAAY,EAAW,GAAA,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,UAAA,KAAX,IAAyB,GAAA,EAAA,GAAA,MAAA;AAAA,IACrC,SAAA,EAAA,CAAW,EAAW,GAAA,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,SAAA,KAAX,IAAwB,GAAA,EAAA,GAAA,gBAAA;AAAA,GAC/B,EAAA,SAAA,CAAA,EAEH,KACH,CAAA,mBAEE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA,CAAA;AAEN,CAAA,CAAA;AAEA,sBAAe,KAAA,CAAM,KAAK,aAAa,CAAA;;;;"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { fontColorVC } from '@tecsinapse/react-core';
|
|
2
|
-
import {
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
3
|
|
|
4
|
-
const useIconTextButton = variant => {
|
|
4
|
+
const useIconTextButton = (variant) => {
|
|
5
5
|
const [hover, setHover] = useState(false);
|
|
6
6
|
const [pressed, setPressed] = useState(false);
|
|
7
|
-
const defaultFontColor = !pressed && hover ?
|
|
8
|
-
const handleHover = useCallback(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const defaultFontColor = !pressed && hover ? "light" : fontColorVC[variant];
|
|
8
|
+
const handleHover = useCallback(
|
|
9
|
+
(value) => {
|
|
10
|
+
setHover(value);
|
|
11
|
+
},
|
|
12
|
+
[setHover]
|
|
13
|
+
);
|
|
14
|
+
const handlePressed = useCallback(
|
|
15
|
+
(value) => {
|
|
16
|
+
setPressed(value);
|
|
17
|
+
},
|
|
18
|
+
[setPressed]
|
|
19
|
+
);
|
|
14
20
|
return {
|
|
15
21
|
handleHover,
|
|
16
22
|
handlePressed,
|
|
@@ -18,5 +24,5 @@ const useIconTextButton = variant => {
|
|
|
18
24
|
};
|
|
19
25
|
};
|
|
20
26
|
|
|
21
|
-
export default
|
|
22
|
-
//# sourceMappingURL=useIconTextButton.js.map
|
|
27
|
+
export { useIconTextButton as default };
|
|
28
|
+
//# sourceMappingURL=useIconTextButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIconTextButton.js","
|
|
1
|
+
{"version":3,"file":"useIconTextButton.js","sources":["../../../../../src/components/molecules/IconTextButton/hooks/useIconTextButton.ts"],"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"],"names":[],"mappings":";;;AAGM,MAAA,iBAAA,GAAoB,CAAC,OAAyB,KAAA;AAClD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AACjD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAkB,KAAK,CAAA,CAAA;AAErD,EAAA,MAAM,gBAAmB,GAAA,CAAC,OAAW,IAAA,KAAA,GAAQ,UAAU,WAAY,CAAA,OAAA,CAAA,CAAA;AAEnE,EAAA,MAAM,WAAc,GAAA,WAAA;AAAA,IAClB,CAAC,KAAmB,KAAA;AAClB,MAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,KAChB;AAAA,IACA,CAAC,QAAQ,CAAA;AAAA,GACX,CAAA;AAEA,EAAA,MAAM,aAAgB,GAAA,WAAA;AAAA,IACpB,CAAC,KAAmB,KAAA;AAClB,MAAA,UAAA,CAAW,KAAK,CAAA,CAAA;AAAA,KAClB;AAAA,IACA,CAAC,UAAU,CAAA;AAAA,GACb,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,WAAA;AAAA,IACA,aAAA;AAAA,IACA,gBAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let {
|
|
17
|
-
theme
|
|
18
|
-
} = _ref2;
|
|
19
|
-
return theme === null || theme === void 0 ? void 0 : theme.spacing.mili;
|
|
20
|
-
}, _ref3 => {
|
|
21
|
-
let {
|
|
22
|
-
boxed,
|
|
23
|
-
theme
|
|
24
|
-
} = _ref3;
|
|
25
|
-
return boxed && boxedStyle({
|
|
26
|
-
theme
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=styled.js.map
|
|
1
|
+
import nativeStyled from '@emotion/native';
|
|
2
|
+
import Button from '../../atoms/Button/Button.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
const boxedStyle = ({ theme }) => `
|
|
6
|
+
padding: ${theme == null ? void 0 : theme.spacing.centi};
|
|
7
|
+
aspect-ratio: 1;
|
|
8
|
+
`;
|
|
9
|
+
const StyledIconTextButton = nativeStyled(Button)`
|
|
10
|
+
gap: ${({ theme }) => theme == null ? void 0 : theme.spacing.mili};
|
|
11
|
+
${({ boxed, theme }) => boxed && boxedStyle({ theme })};
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export { StyledIconTextButton };
|
|
15
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","
|
|
1
|
+
{"version":3,"file":"styled.js","sources":["../../../../src/components/molecules/IconTextButton/styled.ts"],"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"],"names":["styled"],"mappings":";;;;AAIA,MAAM,UAAa,GAAA,CAAC,EAAE,KAAA,EACpB,KAAA,CAAA;AAAA,aAAA,EACa,+BAAO,OAAQ,CAAA,KAAA,CAAA;AAAA;AAAA,EAAA,CAAA,CAAA;AAIjB,MAAA,oBAAA,GAAuBA,aAAO,MAAM,CAAA,CAAA;AAAA,OAAA,EAKxC,CAAC,EAAE,KAAM,EAAA,KAAM,+BAAO,OAAQ,CAAA,IAAA,CAAA;AAAA,EACnC,EAAA,CAAC,EAAE,KAAO,EAAA,KAAA,OAAY,KAAS,IAAA,UAAA,CAAW,EAAE,KAAA,EAAO,CAAA,CAAA;AAAA;;;;"}
|
|
@@ -93,25 +93,20 @@ const Select = (_a) => {
|
|
|
93
93
|
keyExtractor,
|
|
94
94
|
labelExtractor
|
|
95
95
|
);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (typeof options !== "function") {
|
|
98
|
-
setSelectOptions(options);
|
|
99
|
-
}
|
|
100
|
-
}, [options]);
|
|
101
96
|
const handleLazyFocus = React.useCallback(async () => {
|
|
102
97
|
if (!dropDownVisible && typeof options === "function") {
|
|
103
98
|
try {
|
|
104
99
|
const result = await options();
|
|
105
100
|
if (result) {
|
|
106
|
-
setSelectOptions(result);
|
|
101
|
+
setSelectOptions(result != null ? result : []);
|
|
107
102
|
}
|
|
108
103
|
} catch (e) {
|
|
109
104
|
}
|
|
110
105
|
}
|
|
111
|
-
}, [options,
|
|
106
|
+
}, [options, setSelectOptions, dropDownVisible]);
|
|
112
107
|
const handleOnSearch = React.useCallback(
|
|
113
108
|
async (searchInput) => {
|
|
114
|
-
if (searchInput !== void 0 && onSearch) {
|
|
109
|
+
if (searchInput !== void 0 && onSearch && dropDownVisible) {
|
|
115
110
|
try {
|
|
116
111
|
const result = await onSearch(searchInput);
|
|
117
112
|
if (result) {
|
|
@@ -139,7 +134,7 @@ const Select = (_a) => {
|
|
|
139
134
|
}
|
|
140
135
|
}
|
|
141
136
|
},
|
|
142
|
-
[
|
|
137
|
+
[onSearch, value, keyExtractor, dropDownVisible, setSelectOptions]
|
|
143
138
|
);
|
|
144
139
|
const handlePressInput = async () => {
|
|
145
140
|
await handleLazyFocus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../src/components/molecules/Select/Select.tsx"],"sourcesContent":["import {\n PressableInputContainer,\n Text,\n TextProps,\n} from '@tecsinapse/react-core';\nimport React, { useEffect, useState } from 'react';\nimport { Transition } from 'react-transition-group';\nimport { useClickAwayListener } from '../../../hooks';\nimport { defaultStyles, transition } from './animations';\nimport { Dropdown } from './Dropdown';\nimport { getDisplayValue } from './functions';\nimport {\n RightComponent,\n StyledContainer,\n StyledInputContainer,\n} from './styled';\n\nexport interface SelectProps<Data, Type extends 'single' | 'multi'>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n options: ((searchInput?: string) => Promise<Data[]>) | Data[];\n onSelect: (\n option: Type extends 'single' ? Data | undefined : Data[]\n ) => never | void;\n value: Type extends 'single' ? Data | undefined : Data[];\n type: Type;\n keyExtractor: (t: Data, index?: number) => string;\n labelExtractor: (t: Data) => string;\n placeholder?: string;\n onSearch?:\n | ((searchArg: string) => void)\n | ((searchInput?: string) => Promise<Data[]>)\n | never;\n searchBarPlaceholder?: string;\n hideSearchBar?: boolean;\n selectAllLabel?: string;\n disabled?: boolean;\n label?: string;\n anchor?: 'top' | 'bottom';\n displayTextProps?: TextProps;\n}\n\n/** NOTE: For better performance, you should memoize options and handlers */\nconst Select = <Data, Type extends 'single' | 'multi'>({\n value,\n options,\n keyExtractor,\n onSelect,\n type,\n labelExtractor,\n placeholder,\n onSearch,\n searchBarPlaceholder = 'Busque a opção desejada',\n hideSearchBar = true,\n label,\n disabled = false,\n anchor = 'bottom',\n displayTextProps,\n selectAllLabel = 'Selecionar todos',\n ...rest\n}: SelectProps<Data, Type>): JSX.Element => {\n const [dropDownVisible, setDropDownVisible] = React.useState<boolean>(false);\n const [selectOptions, setSelectOptions] = useState<Data[]>([]);\n const refDropDown = React.useRef(null);\n useClickAwayListener(refDropDown, setDropDownVisible);\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n // TODO: Add Skeleton to modal height when loading is true\n\n const onlyLabel = label && !placeholder;\n const hasValue =\n type === 'single' ? !!value : ((value || []) as []).length > 0;\n const _placeholder = onlyLabel ? label : placeholder;\n const _label = hasValue ? label : undefined;\n\n const displayValue = getDisplayValue<Data>(\n type,\n value,\n selectOptions,\n _placeholder,\n keyExtractor,\n labelExtractor\n );\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n const handleLazyFocus = React.useCallback(async () => {\n if (!dropDownVisible && typeof options === 'function') {\n try {\n const result = await options();\n if (result) {\n setSelectOptions(result);\n }\n } catch (e) {\n // TODO: Catch error\n }\n }\n }, [options, value, setSelectOptions, dropDownVisible]);\n\n const handleOnSearch = React.useCallback(\n async (searchInput: string | undefined) => {\n if (searchInput !== undefined && onSearch) {\n try {\n //TODO: Remove code duplicated below (Select in react-native-kit)\n const result = await onSearch(searchInput);\n if (result) {\n if (type === 'single') {\n if (\n value &&\n !result.find(\n v => keyExtractor(value as Data) === keyExtractor(v)\n )\n ) {\n setSelectOptions([value as Data, ...result]);\n } else setSelectOptions(result);\n } else {\n if ((value as Data[]).length > 0) {\n const selectedValues =\n (value as Data[]).filter(\n v =>\n !result.find(\n current =>\n keyExtractor(v as Data) === keyExtractor(current)\n )\n ) || [];\n setSelectOptions([...selectedValues, ...result]);\n } else {\n setSelectOptions(result);\n }\n }\n }\n } catch (e) {\n // TODO: Catch error\n }\n }\n },\n [options, value, keyExtractor]\n );\n\n const handlePressInput = async () => {\n await handleLazyFocus();\n };\n\n const onPress = React.useCallback(\n () => setDropDownVisible(prev => !prev),\n [setDropDownVisible]\n );\n\n return (\n <StyledContainer ref={refDropDown} {...rest}>\n <StyledInputContainer onFocus={handlePressInput}>\n <PressableInputContainer\n label={_label}\n onPress={onPress}\n disabled={disabled}\n rightComponent={RightComponent}\n >\n <Text\n {...displayTextProps}\n ellipsizeMode=\"tail\"\n numberOfLines={1}\n fontWeight={'bold'}\n >\n {displayValue}\n </Text>\n </PressableInputContainer>\n </StyledInputContainer>\n <Transition in={dropDownVisible} timeout={300}>\n {state => (\n <Dropdown\n options={selectOptions ?? []}\n onSelect={onSelect}\n value={value}\n type={type}\n keyExtractor={keyExtractor}\n labelExtractor={labelExtractor}\n hideSearchBar={hideSearchBar}\n searchBarPlaceholder={searchBarPlaceholder}\n onSearch={handleOnSearch}\n style={{ ...defaultStyles, ...transition[anchor][state] }}\n setDropDownVisible={setDropDownVisible}\n anchor={anchor}\n selectAllLabel={selectAllLabel}\n />\n )}\n </Transition>\n </StyledContainer>\n );\n};\n\nexport default Select;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CM,MAAA,MAAA,GAAS,CAAwC,EAiBX,KAAA;AAjBW,EACrD,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,oBAAuB,GAAA,+BAAA;AAAA,IACvB,aAAgB,GAAA,IAAA;AAAA,IAChB,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,MAAS,GAAA,QAAA;AAAA,IACT,gBAAA;AAAA,IACA,cAAiB,GAAA,kBAAA;AAAA,GAzDnB,GA0CuD,EAgBlD,EAAA,IAAA,GAAA,SAAA,CAhBkD,EAgBlD,EAAA;AAAA,IAfH,OAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,sBAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,kBAAA;AAAA,IACA,gBAAA;AAAA,GAAA,CAAA,CAAA;AAGA,EAAA,MAAM,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,KAAA,CAAM,SAAkB,KAAK,CAAA,CAAA;AAC3E,EAAA,MAAM,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA,CAAiB,EAAE,CAAA,CAAA;AAC7D,EAAM,MAAA,WAAA,GAAc,KAAM,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AACrC,EA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CAAA;AAAA,IACjD,kBAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,GACF,CAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../src/components/molecules/Select/Select.tsx"],"sourcesContent":["import {\n PressableInputContainer,\n Text,\n TextProps,\n} from '@tecsinapse/react-core';\nimport React, { useEffect, useState } from 'react';\nimport { Transition } from 'react-transition-group';\nimport { useClickAwayListener } from '../../../hooks';\nimport { defaultStyles, transition } from './animations';\nimport { Dropdown } from './Dropdown';\nimport { getDisplayValue } from './functions';\nimport {\n RightComponent,\n StyledContainer,\n StyledInputContainer,\n} from './styled';\n\nexport interface SelectProps<Data, Type extends 'single' | 'multi'>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n options: ((searchInput?: string) => Promise<Data[]>) | Data[];\n onSelect: (\n option: Type extends 'single' ? Data | undefined : Data[]\n ) => never | void;\n value: Type extends 'single' ? Data | undefined : Data[];\n type: Type;\n keyExtractor: (t: Data, index?: number) => string;\n labelExtractor: (t: Data) => string;\n placeholder?: string;\n onSearch?:\n | ((searchArg: string) => void)\n | ((searchInput?: string) => Promise<Data[]>)\n | never;\n searchBarPlaceholder?: string;\n hideSearchBar?: boolean;\n selectAllLabel?: string;\n disabled?: boolean;\n label?: string;\n anchor?: 'top' | 'bottom';\n displayTextProps?: TextProps;\n}\n\n/** NOTE: For better performance, you should memoize options and handlers */\nconst Select = <Data, Type extends 'single' | 'multi'>({\n value,\n options,\n keyExtractor,\n onSelect,\n type,\n labelExtractor,\n placeholder,\n onSearch,\n searchBarPlaceholder = 'Busque a opção desejada',\n hideSearchBar = true,\n label,\n disabled = false,\n anchor = 'bottom',\n displayTextProps,\n selectAllLabel = 'Selecionar todos',\n ...rest\n}: SelectProps<Data, Type>): JSX.Element => {\n const [dropDownVisible, setDropDownVisible] = React.useState<boolean>(false);\n const [selectOptions, setSelectOptions] = useState<Data[]>([]);\n const refDropDown = React.useRef(null);\n useClickAwayListener(refDropDown, setDropDownVisible);\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n // TODO: Add Skeleton to modal height when loading is true\n\n const onlyLabel = label && !placeholder;\n const hasValue =\n type === 'single' ? !!value : ((value || []) as []).length > 0;\n const _placeholder = onlyLabel ? label : placeholder;\n const _label = hasValue ? label : undefined;\n\n const displayValue = getDisplayValue<Data>(\n type,\n value,\n selectOptions,\n _placeholder,\n keyExtractor,\n labelExtractor\n );\n\n const handleLazyFocus = React.useCallback(async () => {\n if (!dropDownVisible && typeof options === 'function') {\n try {\n const result = await options();\n if (result) {\n setSelectOptions(result ?? []);\n }\n } catch (e) {\n // TODO: Catch error\n }\n }\n }, [options, setSelectOptions, dropDownVisible]);\n\n const handleOnSearch = React.useCallback(\n async (searchInput: string | undefined) => {\n if (searchInput !== undefined && onSearch && dropDownVisible) {\n try {\n //TODO: Remove code duplicated below (Select in react-native-kit)\n const result = await onSearch(searchInput);\n if (result) {\n if (type === 'single') {\n if (\n value &&\n !result.find(\n v => keyExtractor(value as Data) === keyExtractor(v)\n )\n ) {\n setSelectOptions([value as Data, ...result]);\n } else setSelectOptions(result);\n } else {\n if ((value as Data[]).length > 0) {\n const selectedValues =\n (value as Data[]).filter(\n v =>\n !result.find(\n current =>\n keyExtractor(v as Data) === keyExtractor(current)\n )\n ) || [];\n setSelectOptions([...selectedValues, ...result]);\n } else {\n setSelectOptions(result);\n }\n }\n }\n } catch (e) {\n // TODO: Catch error\n }\n }\n },\n [onSearch, value, keyExtractor, dropDownVisible, setSelectOptions]\n );\n\n const handlePressInput = async () => {\n await handleLazyFocus();\n };\n\n const onPress = React.useCallback(\n () => setDropDownVisible(prev => !prev),\n [setDropDownVisible]\n );\n\n return (\n <StyledContainer ref={refDropDown} {...rest}>\n <StyledInputContainer onFocus={handlePressInput}>\n <PressableInputContainer\n label={_label}\n onPress={onPress}\n disabled={disabled}\n rightComponent={RightComponent}\n >\n <Text\n {...displayTextProps}\n ellipsizeMode=\"tail\"\n numberOfLines={1}\n fontWeight={'bold'}\n >\n {displayValue}\n </Text>\n </PressableInputContainer>\n </StyledInputContainer>\n <Transition in={dropDownVisible} timeout={300}>\n {state => (\n <Dropdown\n options={selectOptions ?? []}\n onSelect={onSelect}\n value={value}\n type={type}\n keyExtractor={keyExtractor}\n labelExtractor={labelExtractor}\n hideSearchBar={hideSearchBar}\n searchBarPlaceholder={searchBarPlaceholder}\n onSearch={handleOnSearch}\n style={{ ...defaultStyles, ...transition[anchor][state] }}\n setDropDownVisible={setDropDownVisible}\n anchor={anchor}\n selectAllLabel={selectAllLabel}\n />\n )}\n </Transition>\n </StyledContainer>\n );\n};\n\nexport default Select;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CM,MAAA,MAAA,GAAS,CAAwC,EAiBX,KAAA;AAjBW,EACrD,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,oBAAuB,GAAA,+BAAA;AAAA,IACvB,aAAgB,GAAA,IAAA;AAAA,IAChB,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,MAAS,GAAA,QAAA;AAAA,IACT,gBAAA;AAAA,IACA,cAAiB,GAAA,kBAAA;AAAA,GAzDnB,GA0CuD,EAgBlD,EAAA,IAAA,GAAA,SAAA,CAhBkD,EAgBlD,EAAA;AAAA,IAfH,OAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,sBAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,Q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AA,IACA,IAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,IACA,oBAAA;AAAA,IACA,QAAU,EAAA,cAAA;AAAA,IACV,KAAO,EAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAK,aAAkB,CAAA,EAAA,UAAA,CAAW,MAAQ,CAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IACjD,kBAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,GACF,CAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getDisplayValue: <Data>(type: 'multi' | 'single', value: Data | Data[] | undefined, options: Data[], placeholder: string | undefined, keyExtractor: (option: Data, idx?: number
|
|
1
|
+
export declare const getDisplayValue: <Data>(type: 'multi' | 'single', value: Data | Data[] | undefined, options: Data[], placeholder: string | undefined, keyExtractor: (option: Data, idx?: number) => string, labelExtractor: (option: Data) => string) => string | Data | Data[] | undefined;
|
|
@@ -25,5 +25,5 @@ export interface DataGridProps<Data> extends React.HTMLAttributes<HTMLDivElement
|
|
|
25
25
|
emptyPlaceholder?: React.ReactNode;
|
|
26
26
|
exportComponent?: React.ReactNode;
|
|
27
27
|
}
|
|
28
|
-
declare const DataGrid: <Data>({ headers, data, rowKeyExtractor, toolbarTitle, toolbarFooter, toolbarRightIcons, selectable, selectedRows, onSelectedRows, pagination, rowsPerPage, onRowsPerPageChange, rowsPerPageOptions
|
|
28
|
+
declare const DataGrid: <Data>({ headers, data, rowKeyExtractor, toolbarTitle, toolbarFooter, toolbarRightIcons, selectable, selectedRows, onSelectedRows, pagination, rowsPerPage, onRowsPerPageChange, rowsPerPageOptions, rowsPerPageLabel, exportLabel, exportFunction, rowsCount, page, onPageChange, loading, skeletonComponent, emptyPlaceholder, exportComponent, ...rest }: DataGridProps<Data>) => JSX.Element;
|
|
29
29
|
export default DataGrid;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: React.MemoExoticComponent<({ rowKeyExtractor, data, checked
|
|
2
|
+
declare const _default: React.MemoExoticComponent<({ rowKeyExtractor, data, checked, handleSelect, selectable, headers, }: {
|
|
3
3
|
rowKeyExtractor: any;
|
|
4
4
|
data: any;
|
|
5
5
|
checked: any;
|
package/esm/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type { TagProps } from './components/atoms/Tag';
|
|
|
19
19
|
export { Tooltip } from './components/atoms/Tooltip';
|
|
20
20
|
export type { ITooltip } from './components/atoms/Tooltip';
|
|
21
21
|
export { Breadcrumbs } from './components/molecules/Breadcrumbs';
|
|
22
|
-
export type { BreadcrumbsProps, BreadcrumbType
|
|
22
|
+
export type { BreadcrumbsProps, BreadcrumbType } from './components/molecules/Breadcrumbs';
|
|
23
23
|
export { DatePicker } from './components/molecules/DatePicker';
|
|
24
24
|
export type { WebDatePickerProps } from './components/molecules/DatePicker';
|
|
25
25
|
export { DateTimePicker } from './components/molecules/DateTimePicker';
|
|
@@ -27,13 +27,14 @@ export type { WebDateTimePickerProps } from './components/molecules/DateTimePick
|
|
|
27
27
|
export { Drawer } from './components/molecules/Drawer';
|
|
28
28
|
export type { DrawerProps } from './components/molecules/Drawer';
|
|
29
29
|
export { Grid, GridItem } from './components/molecules/Grid';
|
|
30
|
-
export type {
|
|
30
|
+
export type { IGridItemWeb, IGridWeb } from './components/molecules/Grid';
|
|
31
|
+
export { IconTextButton } from './components/molecules/IconTextButton';
|
|
31
32
|
export { InputPassword } from './components/molecules/InputPassword';
|
|
32
33
|
export type { InputPasswordWebProps } from './components/molecules/InputPassword';
|
|
33
34
|
export { LabeledSwitch } from './components/molecules/LabeledSwitch';
|
|
34
35
|
export type { LabeledSwitchWebProps } from './components/molecules/LabeledSwitch';
|
|
35
36
|
export { Menubar } from './components/molecules/Menubar';
|
|
36
|
-
export type { MenubarItemsOptions, MenubarMostUsedType, MenubarOptionsType, MenubarProps
|
|
37
|
+
export type { MenubarItemsOptions, MenubarMostUsedType, MenubarOptionsType, MenubarProps } from './components/molecules/Menubar';
|
|
37
38
|
export { Select } from './components/molecules/Select';
|
|
38
39
|
export type { SelectProps } from './components/molecules/Select';
|
|
39
40
|
export { Snackbar } from './components/molecules/Snackbar';
|
|
@@ -41,5 +42,5 @@ export type { SnackbarWebProps } from './components/molecules/Snackbar';
|
|
|
41
42
|
export { TextArea } from './components/molecules/TextArea';
|
|
42
43
|
export type { TextAreaProps } from './components/molecules/TextArea';
|
|
43
44
|
export { DataGrid } from './components/organisms/DataGrid';
|
|
44
|
-
export type { DataGridProps, HeadersType
|
|
45
|
+
export type { DataGridProps, HeadersType } from './components/organisms/DataGrid';
|
|
45
46
|
export * from './hooks';
|
package/esm/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { DateTimePicker } from './components/molecules/DateTimePicker/DateTimePi
|
|
|
16
16
|
export { default as Drawer } from './components/molecules/Drawer/Drawer.js';
|
|
17
17
|
export { default as GridItem } from './components/molecules/Grid/Item/Item.js';
|
|
18
18
|
export { default as Grid } from './components/molecules/Grid/Grid.js';
|
|
19
|
+
export { default as IconTextButton } from './components/molecules/IconTextButton/IconTextButton.js';
|
|
19
20
|
export { default as InputPassword } from './components/molecules/InputPassword/InputPassword.js';
|
|
20
21
|
export { default as LabeledSwitch } from './components/molecules/LabeledSwitch/LabeledSwitch.js';
|
|
21
22
|
export { default as Menubar } from './components/molecules/Menubar/Menubar.js';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-web-kit",
|
|
3
3
|
"description": "TecSinapse React components",
|
|
4
|
-
"version": "1.22.0
|
|
4
|
+
"version": "1.22.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@emotion/native": "^11.10.0",
|
|
21
21
|
"@emotion/react": "^11.10.0",
|
|
22
22
|
"@emotion/styled": "^11.10.0",
|
|
23
|
-
"@tecsinapse/react-core": "^1.21.0
|
|
23
|
+
"@tecsinapse/react-core": "^1.21.0",
|
|
24
24
|
"@types/react-native": "^0.64.4",
|
|
25
25
|
"react-native-vector-icons": "^9.2.0",
|
|
26
26
|
"react-transition-group": "^4.4.2"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
40
40
|
"react-native-web": "^0.17.1 || ^0.18.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "92debfcee6bd043a295edc3697e3795dccabf8f6"
|
|
43
43
|
}
|
|
@@ -86,28 +86,22 @@ const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
86
86
|
labelExtractor
|
|
87
87
|
);
|
|
88
88
|
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (typeof options !== 'function') {
|
|
91
|
-
setSelectOptions(options);
|
|
92
|
-
}
|
|
93
|
-
}, [options]);
|
|
94
|
-
|
|
95
89
|
const handleLazyFocus = React.useCallback(async () => {
|
|
96
90
|
if (!dropDownVisible && typeof options === 'function') {
|
|
97
91
|
try {
|
|
98
92
|
const result = await options();
|
|
99
93
|
if (result) {
|
|
100
|
-
setSelectOptions(result);
|
|
94
|
+
setSelectOptions(result ?? []);
|
|
101
95
|
}
|
|
102
96
|
} catch (e) {
|
|
103
97
|
// TODO: Catch error
|
|
104
98
|
}
|
|
105
99
|
}
|
|
106
|
-
}, [options,
|
|
100
|
+
}, [options, setSelectOptions, dropDownVisible]);
|
|
107
101
|
|
|
108
102
|
const handleOnSearch = React.useCallback(
|
|
109
103
|
async (searchInput: string | undefined) => {
|
|
110
|
-
if (searchInput !== undefined && onSearch) {
|
|
104
|
+
if (searchInput !== undefined && onSearch && dropDownVisible) {
|
|
111
105
|
try {
|
|
112
106
|
//TODO: Remove code duplicated below (Select in react-native-kit)
|
|
113
107
|
const result = await onSearch(searchInput);
|
|
@@ -142,7 +136,7 @@ const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
142
136
|
}
|
|
143
137
|
}
|
|
144
138
|
},
|
|
145
|
-
[
|
|
139
|
+
[onSearch, value, keyExtractor, dropDownVisible, setSelectOptions]
|
|
146
140
|
);
|
|
147
141
|
|
|
148
142
|
const handlePressInput = async () => {
|
package/src/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type { ITooltip } from './components/atoms/Tooltip';
|
|
|
21
21
|
export { Breadcrumbs } from './components/molecules/Breadcrumbs';
|
|
22
22
|
export type {
|
|
23
23
|
BreadcrumbsProps,
|
|
24
|
-
BreadcrumbType
|
|
24
|
+
BreadcrumbType
|
|
25
25
|
} from './components/molecules/Breadcrumbs';
|
|
26
26
|
export { DatePicker } from './components/molecules/DatePicker';
|
|
27
27
|
export type { WebDatePickerProps } from './components/molecules/DatePicker';
|
|
@@ -30,7 +30,8 @@ export type { WebDateTimePickerProps } from './components/molecules/DateTimePick
|
|
|
30
30
|
export { Drawer } from './components/molecules/Drawer';
|
|
31
31
|
export type { DrawerProps } from './components/molecules/Drawer';
|
|
32
32
|
export { Grid, GridItem } from './components/molecules/Grid';
|
|
33
|
-
export type {
|
|
33
|
+
export type { IGridItemWeb, IGridWeb } from './components/molecules/Grid';
|
|
34
|
+
export { IconTextButton } from './components/molecules/IconTextButton';
|
|
34
35
|
export { InputPassword } from './components/molecules/InputPassword';
|
|
35
36
|
export type { InputPasswordWebProps } from './components/molecules/InputPassword';
|
|
36
37
|
export { LabeledSwitch } from './components/molecules/LabeledSwitch';
|
|
@@ -40,7 +41,7 @@ export type {
|
|
|
40
41
|
MenubarItemsOptions,
|
|
41
42
|
MenubarMostUsedType,
|
|
42
43
|
MenubarOptionsType,
|
|
43
|
-
MenubarProps
|
|
44
|
+
MenubarProps
|
|
44
45
|
} from './components/molecules/Menubar';
|
|
45
46
|
export { Select } from './components/molecules/Select';
|
|
46
47
|
export type { SelectProps } from './components/molecules/Select';
|
|
@@ -51,6 +52,7 @@ export type { TextAreaProps } from './components/molecules/TextArea';
|
|
|
51
52
|
export { DataGrid } from './components/organisms/DataGrid';
|
|
52
53
|
export type {
|
|
53
54
|
DataGridProps,
|
|
54
|
-
HeadersType
|
|
55
|
+
HeadersType
|
|
55
56
|
} from './components/organisms/DataGrid';
|
|
56
57
|
export * from './hooks';
|
|
58
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Accordion"],"sources":["../../../../src/components/atoms/Accordion/index.ts"],"sourcesContent":["export { default as Accordion } from './Accordion';\nexport type { AccordionProps } from './Accordion';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,SAApB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Badge"],"sources":["../../../../src/components/atoms/Badge/index.ts"],"sourcesContent":["export { default as Badge } from './Badge';\nexport type { BadgeWebProps } from './Badge';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,KAApB"}
|