@tecsinapse/react-native-kit 1.18.6 → 1.21.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 +39 -0
- package/dist/components/atoms/Avatar/Avatar.js +4 -2
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/components/atoms/Avatar/index.js +9 -4
- package/dist/components/atoms/Avatar/index.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.js +11 -8
- package/dist/components/atoms/Badge/Badge.js.map +1 -1
- package/dist/components/atoms/Badge/index.js +15 -5
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/BottomNavigator.js +13 -10
- package/dist/components/atoms/BottomNavigator/BottomNavigator.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/Item.js +11 -8
- package/dist/components/atoms/BottomNavigator/Item.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/index.js +21 -7
- package/dist/components/atoms/BottomNavigator/index.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/styled.js +64 -45
- package/dist/components/atoms/BottomNavigator/styled.js.map +1 -1
- package/dist/components/atoms/Button/Button.d.ts +2 -2
- package/dist/components/atoms/Button/Button.js +11 -8
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/States/Error.js +4 -2
- package/dist/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/components/atoms/Button/States/Loading.js +4 -2
- package/dist/components/atoms/Button/States/Loading.js.map +1 -1
- package/dist/components/atoms/Button/States/Success.js +4 -2
- package/dist/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/components/atoms/Button/States/index.js +21 -8
- package/dist/components/atoms/Button/States/index.js.map +1 -1
- package/dist/components/atoms/Button/index.js +33 -9
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButtonOption.js +4 -2
- package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
- package/dist/components/atoms/GroupButton/index.js +9 -4
- package/dist/components/atoms/GroupButton/index.js.map +1 -1
- package/dist/components/atoms/Header/Header.js +19 -16
- package/dist/components/atoms/Header/Header.js.map +1 -1
- package/dist/components/atoms/Header/index.js +15 -5
- package/dist/components/atoms/Header/index.js.map +1 -1
- package/dist/components/atoms/Header/styled.js +17 -17
- package/dist/components/atoms/Header/styled.js.map +1 -1
- package/dist/components/atoms/Input/Input.d.ts +3 -2
- package/dist/components/atoms/Input/Input.js +31 -28
- package/dist/components/atoms/Input/Input.js.map +1 -1
- package/dist/components/atoms/Input/index.js +15 -5
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/Input/styled.js +13 -8
- package/dist/components/atoms/Input/styled.js.map +1 -1
- package/dist/components/atoms/InputMask/InputMask.js +32 -28
- package/dist/components/atoms/InputMask/InputMask.js.map +1 -1
- package/dist/components/atoms/InputMask/index.js +15 -5
- package/dist/components/atoms/InputMask/index.js.map +1 -1
- package/dist/components/atoms/InputMask/styled.js +14 -11
- package/dist/components/atoms/InputMask/styled.js.map +1 -1
- package/dist/components/atoms/Modal/ModalGroupManager.js +10 -7
- package/dist/components/atoms/Modal/ModalGroupManager.js.map +1 -1
- package/dist/components/atoms/Modal/ModalLifecycleHandler.d.ts +2 -2
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js +31 -25
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js.map +1 -1
- package/dist/components/atoms/Modal/index.js +45 -8
- package/dist/components/atoms/Modal/index.js.map +1 -1
- package/dist/components/atoms/Modal/ui/BaseModalView.d.ts +2 -2
- package/dist/components/atoms/Modal/ui/BaseModalView.js +19 -16
- package/dist/components/atoms/Modal/ui/BaseModalView.js.map +1 -1
- package/dist/components/atoms/Modal/ui/styled.js +19 -21
- package/dist/components/atoms/Modal/ui/styled.js.map +1 -1
- package/dist/components/atoms/Modal/ui/types.d.ts +1 -1
- package/dist/components/atoms/Modal/ui/types.js +3 -1
- package/dist/components/atoms/Modal/ui/types.js.map +1 -1
- package/dist/components/atoms/Modal/useLazyModalManager.d.ts +2 -2
- package/dist/components/atoms/Modal/useLazyModalManager.js +4 -2
- package/dist/components/atoms/Modal/useLazyModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalManager.d.ts +2 -2
- package/dist/components/atoms/Modal/useModalManager.js +4 -2
- package/dist/components/atoms/Modal/useModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalRemoteControl.js +3 -1
- package/dist/components/atoms/Modal/useModalRemoteControl.js.map +1 -1
- package/dist/components/atoms/Skeleton/Pulse.js +16 -11
- package/dist/components/atoms/Skeleton/Pulse.js.map +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.js +14 -11
- package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/atoms/Skeleton/Wave.js +17 -12
- package/dist/components/atoms/Skeleton/Wave.js.map +1 -1
- package/dist/components/atoms/Skeleton/animation.js +4 -2
- package/dist/components/atoms/Skeleton/animation.js.map +1 -1
- package/dist/components/atoms/Skeleton/index.js +15 -5
- package/dist/components/atoms/Skeleton/index.js.map +1 -1
- package/dist/components/atoms/Skeleton/styled.js +25 -15
- package/dist/components/atoms/Skeleton/styled.js.map +1 -1
- package/dist/components/atoms/Skeleton/types.js +3 -1
- package/dist/components/atoms/Skeleton/types.js.map +1 -1
- package/dist/components/atoms/SnappingSlider/SnappingSlider.js +12 -9
- package/dist/components/atoms/SnappingSlider/SnappingSlider.js.map +1 -1
- package/dist/components/atoms/SnappingSlider/index.js +15 -5
- package/dist/components/atoms/SnappingSlider/index.js.map +1 -1
- package/dist/components/atoms/Tag/Tag.js +9 -6
- package/dist/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/components/atoms/Tag/index.js +15 -5
- package/dist/components/atoms/Tag/index.js.map +1 -1
- package/dist/components/atoms/Text/Text.js +8 -5
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/components/atoms/Text/index.js +15 -5
- package/dist/components/atoms/Text/index.js.map +1 -1
- package/dist/components/atoms/Text/styled.js +17 -13
- package/dist/components/atoms/Text/styled.js.map +1 -1
- package/dist/components/atoms/TextArea/TextArea.js +31 -28
- package/dist/components/atoms/TextArea/TextArea.js.map +1 -1
- package/dist/components/atoms/TextArea/index.js +15 -5
- package/dist/components/atoms/TextArea/index.js.map +1 -1
- package/dist/components/atoms/TextArea/styled.js +3 -1
- package/dist/components/atoms/TextArea/styled.js.map +1 -1
- package/dist/components/molecules/Calendar/Calendar.js +10 -7
- package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/components/molecules/Calendar/index.js +9 -4
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js +17 -13
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/index.js +15 -5
- package/dist/components/molecules/DatePicker/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.js +13 -6
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +15 -11
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/index.js +15 -5
- package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +10 -7
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js +9 -4
- package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
- package/dist/components/molecules/Grid/Grid.d.ts +5 -0
- package/dist/components/molecules/Grid/Grid.js +63 -0
- package/dist/components/molecules/Grid/Grid.js.map +1 -0
- package/dist/components/molecules/Grid/Item/Item.d.ts +7 -0
- package/dist/components/molecules/Grid/Item/Item.js +81 -0
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -0
- package/dist/components/molecules/Grid/Item/index.d.ts +1 -0
- package/dist/components/molecules/Grid/Item/index.js +24 -0
- package/dist/components/molecules/Grid/Item/index.js.map +1 -0
- package/dist/components/molecules/Grid/index.d.ts +2 -0
- package/dist/components/molecules/Grid/index.js +24 -0
- package/dist/components/molecules/Grid/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +6 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js +53 -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 +39 -0
- package/dist/components/molecules/IconTextButton/TextComponent.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 +2 -0
- package/dist/components/molecules/IconTextButton/styled.js +48 -0
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/InputPassword/InputPassword.d.ts +3 -2
- package/dist/components/molecules/InputPassword/InputPassword.js +9 -6
- package/dist/components/molecules/InputPassword/InputPassword.js.map +1 -1
- package/dist/components/molecules/InputPassword/index.js +15 -5
- package/dist/components/molecules/InputPassword/index.js.map +1 -1
- package/dist/components/molecules/LabeledSwitch/LabelComponent.d.ts +13 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js +41 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +8 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +56 -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 +9 -0
- package/dist/components/molecules/LabeledSwitch/styled.js +32 -0
- package/dist/components/molecules/LabeledSwitch/styled.js.map +1 -0
- package/dist/components/molecules/Select/Modal.d.ts +1 -1
- package/dist/components/molecules/Select/Modal.js +45 -39
- package/dist/components/molecules/Select/Modal.js.map +1 -1
- package/dist/components/molecules/Select/Select.js +39 -36
- package/dist/components/molecules/Select/Select.js.map +1 -1
- package/dist/components/molecules/Select/index.js +15 -5
- package/dist/components/molecules/Select/index.js.map +1 -1
- package/dist/components/molecules/Select/styled.js +78 -85
- package/dist/components/molecules/Select/styled.js.map +1 -1
- package/dist/components/molecules/Snackbar/Snackbar.js +14 -11
- package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/molecules/Snackbar/index.js +15 -5
- package/dist/components/molecules/Snackbar/index.js.map +1 -1
- package/dist/components/molecules/Snackbar/styled.js +18 -9
- package/dist/components/molecules/Snackbar/styled.js.map +1 -1
- package/dist/index.d.ts +17 -14
- package/dist/index.js +379 -116
- package/dist/index.js.map +1 -1
- package/dist/utils/date.js +3 -1
- package/dist/utils/date.js.map +1 -1
- package/package.json +5 -5
- package/src/components/atoms/BottomNavigator/BottomNavigator.tsx +3 -6
- package/src/components/atoms/Button/Button.tsx +19 -13
- package/src/components/atoms/Button/index.ts +1 -1
- package/src/components/atoms/Input/Input.tsx +8 -6
- package/src/components/atoms/Input/styled.ts +1 -3
- package/src/components/atoms/Modal/ModalGroupManager.tsx +22 -17
- package/src/components/atoms/Modal/ModalLifecycleHandler.ts +139 -126
- package/src/components/atoms/Modal/index.ts +7 -7
- package/src/components/atoms/Modal/ui/BaseModalView.tsx +150 -127
- package/src/components/atoms/Modal/ui/styled.ts +17 -17
- package/src/components/atoms/Modal/ui/types.ts +9 -8
- package/src/components/atoms/Modal/useLazyModalManager.ts +32 -31
- package/src/components/atoms/Modal/useModalManager.ts +28 -26
- package/src/components/atoms/Modal/useModalRemoteControl.ts +16 -18
- package/src/components/molecules/Calendar/Calendar.tsx +5 -1
- package/src/components/molecules/DatePicker/DatePicker.tsx +26 -17
- package/src/components/molecules/DatePicker/styled.ts +4 -4
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +18 -16
- package/src/components/molecules/DateTimeSelector/DateTimeSelector.tsx +4 -1
- package/src/components/molecules/Grid/Grid.tsx +68 -0
- package/src/components/molecules/Grid/Item/Item.tsx +77 -0
- package/src/components/molecules/Grid/Item/index.ts +1 -0
- package/src/components/molecules/Grid/index.ts +2 -0
- package/src/components/molecules/IconTextButton/IconTextButton.tsx +55 -0
- package/src/components/molecules/IconTextButton/TextComponent.tsx +43 -0
- package/src/components/molecules/IconTextButton/index.ts +4 -0
- package/src/components/molecules/IconTextButton/styled.ts +35 -0
- package/src/components/molecules/InputPassword/InputPassword.tsx +3 -2
- package/src/components/molecules/LabeledSwitch/LabelComponent.tsx +46 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +59 -0
- package/src/components/molecules/LabeledSwitch/index.ts +4 -0
- package/src/components/molecules/LabeledSwitch/styled.ts +27 -0
- package/src/components/molecules/Select/Modal.tsx +88 -66
- package/src/components/molecules/Select/Select.tsx +1 -1
- package/src/index.ts +38 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.js","names":["boxedStyle","theme","spacing","centi","StyledIconTextButton","styled","Button","boxed","StyledText","Text","iconPosition","hasIcon","css","mili"],"sources":["../../../../src/components/molecules/IconTextButton/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { IconPositionOptions, StyleProps } from '@tecsinapse/react-core';\nimport { Button } from '../../atoms/Button';\nimport { Text } from '../../atoms/Text';\n\nconst boxedStyle = ({ theme }: Partial<StyleProps>) => `\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 ${({ boxed, theme }) => boxed && boxedStyle({ theme })};\n`;\n\nexport const StyledText = styled(Text)<\n Partial<StyleProps> & {\n iconPosition: IconPositionOptions;\n hasIcon?: boolean;\n }\n>`\n ${({ theme, iconPosition, hasIcon = false }) => {\n if (hasIcon && iconPosition === 'left')\n return css`\n margin-left: ${theme?.spacing.mili};\n `;\n else if (hasIcon && iconPosition === 'right')\n return css`\n margin-right: ${theme?.spacing.mili};\n `;\n }}\n`;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EAAA,IAAC;IAAEC;EAAF,CAAD;EAAA,gCACJA,KADI,aACJA,KADI,uBACJA,KAAK,CAAEC,OAAP,CAAeC,KADX;AAAA,CAAnB;;AAKO,MAAMC,oBAAoB,GAAG,IAAAC,eAAA,EAAOC,cAAP,CAAH,iFAK7B;EAAA,IAAC;IAAEC,KAAF;IAASN;EAAT,CAAD;EAAA,OAAsBM,KAAK,IAAIP,UAAU,CAAC;IAAEC;EAAF,CAAD,CAAzC;AAAA,CAL6B,CAA1B;;AAQA,MAAMO,UAAU,GAAG,IAAAH,eAAA,EAAOI,UAAP,CAAH,kFAMnB,SAA8C;EAAA,IAA7C;IAAER,KAAF;IAASS,YAAT;IAAuBC,OAAO,GAAG;EAAjC,CAA6C;EAC9C,IAAIA,OAAO,IAAID,YAAY,KAAK,MAAhC,EACE,WAAOE,WAAP,6GACiBX,KADjB,aACiBA,KADjB,uBACiBA,KAAK,CAAEC,OAAP,CAAeW,IADhC,EADF,KAIK,IAAIF,OAAO,IAAID,YAAY,KAAK,OAAhC,EACH,WAAOE,WAAP,8GACkBX,KADlB,aACkBA,KADlB,uBACkBA,KAAK,CAAEC,OAAP,CAAeW,IADjC;AAGH,CAfoB,CAAhB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { InputNativeProps } from '../../atoms/Input';
|
|
3
|
+
import { TextInput } from 'react-native';
|
|
3
4
|
export declare type InputPasswordNativeProps = InputNativeProps;
|
|
4
|
-
declare const InputPassword:
|
|
5
|
+
declare const InputPassword: React.ForwardRefExoticComponent<Pick<InputNativeProps, string | number> & React.RefAttributes<TextInput>>;
|
|
5
6
|
export default InputPassword;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.default = void 0;
|
|
5
7
|
|
|
6
8
|
var _reactCore = require("@tecsinapse/react-core");
|
|
@@ -13,12 +15,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
15
|
|
|
14
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
17
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
17
19
|
|
|
18
|
-
const InputPassword = _react.default.forwardRef(({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const InputPassword = _react.default.forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
rightComponent,
|
|
23
|
+
...rest
|
|
24
|
+
} = _ref;
|
|
22
25
|
const [revealed, setRevealed] = (0, _react.useState)(false);
|
|
23
26
|
return _react.default.createElement(_Input.Input, _extends({}, rest, {
|
|
24
27
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"InputPassword.js","names":["InputPassword","React","forwardRef","ref","rightComponent","rest","revealed","setRevealed","useState","displayName"],"sources":["../../../../src/components/molecules/InputPassword/InputPassword.tsx"],"sourcesContent":["import { InputPasswordIcon } from '@tecsinapse/react-core';\nimport React, { useState } from 'react';\nimport { Input, InputNativeProps } from '../../atoms/Input';\nimport { TextInput } from 'react-native';\n\nexport type InputPasswordNativeProps = InputNativeProps;\n\nconst InputPassword = React.forwardRef<TextInput, InputPasswordNativeProps>(\n ({ rightComponent, ...rest }, ref) => {\n const [revealed, setRevealed] = useState(false);\n return (\n <Input\n {...rest}\n ref={ref}\n secureTextEntry={!revealed}\n rightComponent={\n <>\n <InputPasswordIcon\n onChangeState={setRevealed}\n revealed={revealed}\n effect=\"none\"\n />\n {rightComponent}\n </>\n }\n />\n );\n }\n);\n\nInputPassword.displayName = 'InputPassword';\n\nexport default InputPassword;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAKA,MAAMA,aAAa,GAAGC,cAAA,CAAMC,UAAN,CACpB,OAA8BC,GAA9B,KAAsC;EAAA,IAArC;IAAEC,cAAF;IAAkB,GAAGC;EAArB,CAAqC;EACpC,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0B,IAAAC,eAAA,EAAS,KAAT,CAAhC;EACA,OACE,6BAAC,YAAD,eACMH,IADN;IAEE,GAAG,EAAEF,GAFP;IAGE,eAAe,EAAE,CAACG,QAHpB;IAIE,cAAc,EACZ,4DACE,6BAAC,4BAAD;MACE,aAAa,EAAEC,WADjB;MAEE,QAAQ,EAAED,QAFZ;MAGE,MAAM,EAAC;IAHT,EADF,EAMGF,cANH;EALJ,GADF;AAiBD,CApBmB,CAAtB;;AAuBAJ,aAAa,CAACS,WAAd,GAA4B,eAA5B;eAEeT,a"}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "InputPassword", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _InputPassword.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "InputPasswordNativeProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _InputPassword.InputPasswordNativeProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
5
18
|
|
|
6
19
|
var _InputPassword = _interopRequireWildcard(require("./InputPassword"));
|
|
7
20
|
|
|
8
|
-
exports.InputPassword = _InputPassword.default;
|
|
9
|
-
exports.InputPasswordNativeProps = _InputPassword.InputPasswordNativeProps;
|
|
10
|
-
|
|
11
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
22
|
|
|
13
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/InputPassword/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/InputPassword/index.ts"],"sourcesContent":["export {\n default as InputPassword,\n InputPasswordNativeProps,\n} from './InputPassword';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LabelPositionOptions } from '@tecsinapse/react-core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps } from 'react-native';
|
|
4
|
+
import { TextNativeProps } from '../../atoms/Text';
|
|
5
|
+
export interface LabelComponentProps extends PressableProps {
|
|
6
|
+
label: string;
|
|
7
|
+
labelPosition: LabelPositionOptions;
|
|
8
|
+
labelProps?: TextNativeProps;
|
|
9
|
+
active: boolean;
|
|
10
|
+
switchDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.NamedExoticComponent<LabelComponentProps>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _styled = require("./styled");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _extends() { _extends = Object.assign ? 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); }
|
|
17
|
+
|
|
18
|
+
const LabelComponent = _ref => {
|
|
19
|
+
var _labelProps$fontColor, _labelProps$fontWeigh;
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
label,
|
|
23
|
+
labelPosition,
|
|
24
|
+
labelProps,
|
|
25
|
+
active,
|
|
26
|
+
switchDisabled = false,
|
|
27
|
+
...rest
|
|
28
|
+
} = _ref;
|
|
29
|
+
const defaultFontColor = active && !switchDisabled ? 'dark' : 'medium';
|
|
30
|
+
const defaultFontWeight = active && !switchDisabled ? 'bold' : 'regular';
|
|
31
|
+
return _react.default.createElement(_reactNative.Pressable, rest, _react.default.createElement(_styled.StyledLabel, _extends({
|
|
32
|
+
labelPosition: labelPosition,
|
|
33
|
+
fontColor: (_labelProps$fontColor = labelProps === null || labelProps === void 0 ? void 0 : labelProps.fontColor) !== null && _labelProps$fontColor !== void 0 ? _labelProps$fontColor : defaultFontColor,
|
|
34
|
+
fontWeight: (_labelProps$fontWeigh = labelProps === null || labelProps === void 0 ? void 0 : labelProps.fontWeight) !== null && _labelProps$fontWeigh !== void 0 ? _labelProps$fontWeigh : defaultFontWeight
|
|
35
|
+
}, labelProps), label));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var _default = _react.default.memo(LabelComponent);
|
|
39
|
+
|
|
40
|
+
exports.default = _default;
|
|
41
|
+
//# sourceMappingURL=LabelComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelComponent.js","names":["LabelComponent","label","labelPosition","labelProps","active","switchDisabled","rest","defaultFontColor","defaultFontWeight","fontColor","fontWeight","React","memo"],"sources":["../../../../src/components/molecules/LabeledSwitch/LabelComponent.tsx"],"sourcesContent":["import {\n FontColor,\n FontWeight,\n LabelPositionOptions,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { Pressable, PressableProps } from 'react-native';\nimport { TextNativeProps } from '../../atoms/Text';\nimport { StyledLabel } from './styled';\n\nexport interface LabelComponentProps extends PressableProps {\n label: string;\n labelPosition: LabelPositionOptions;\n labelProps?: TextNativeProps;\n active: boolean;\n switchDisabled?: boolean;\n}\n\nconst LabelComponent: FC<LabelComponentProps> = ({\n label,\n labelPosition,\n labelProps,\n active,\n switchDisabled = false,\n ...rest\n}) => {\n const defaultFontColor: keyof FontColor =\n active && !switchDisabled ? 'dark' : 'medium';\n const defaultFontWeight: keyof FontWeight =\n active && !switchDisabled ? 'bold' : 'regular';\n\n return (\n <Pressable {...rest}>\n <StyledLabel\n labelPosition={labelPosition}\n fontColor={labelProps?.fontColor ?? defaultFontColor}\n fontWeight={labelProps?.fontWeight ?? defaultFontWeight}\n {...labelProps}\n >\n {label}\n </StyledLabel>\n </Pressable>\n );\n};\n\nexport default React.memo(LabelComponent);\n"],"mappings":";;;;;;;AAKA;;AACA;;AAEA;;;;;;AAUA,MAAMA,cAAuC,GAAG,QAO1C;EAAA;;EAAA,IAP2C;IAC/CC,KAD+C;IAE/CC,aAF+C;IAG/CC,UAH+C;IAI/CC,MAJ+C;IAK/CC,cAAc,GAAG,KAL8B;IAM/C,GAAGC;EAN4C,CAO3C;EACJ,MAAMC,gBAAiC,GACrCH,MAAM,IAAI,CAACC,cAAX,GAA4B,MAA5B,GAAqC,QADvC;EAEA,MAAMG,iBAAmC,GACvCJ,MAAM,IAAI,CAACC,cAAX,GAA4B,MAA5B,GAAqC,SADvC;EAGA,OACE,6BAAC,sBAAD,EAAeC,IAAf,EACE,6BAAC,mBAAD;IACE,aAAa,EAAEJ,aADjB;IAEE,SAAS,2BAAEC,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEM,SAAd,yEAA2BF,gBAFtC;IAGE,UAAU,2BAAEJ,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEO,UAAd,yEAA4BF;EAHxC,GAIML,UAJN,GAMGF,KANH,CADF,CADF;AAYD,CAzBD;;eA2BeU,cAAA,CAAMC,IAAN,CAAWZ,cAAX,C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LabeledSwitchProps } from '@tecsinapse/react-core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { TextNativeProps } from '../../atoms/Text';
|
|
4
|
+
export declare type LabeledSwitchNativeProps = LabeledSwitchProps & {
|
|
5
|
+
labelProps?: TextNativeProps;
|
|
6
|
+
};
|
|
7
|
+
declare const LabeledSwitch: FC<LabeledSwitchNativeProps>;
|
|
8
|
+
export default LabeledSwitch;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _LabelComponent = _interopRequireDefault(require("./LabelComponent"));
|
|
13
|
+
|
|
14
|
+
var _styled = require("./styled");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign ? 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); }
|
|
19
|
+
|
|
20
|
+
const LabeledSwitch = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
label,
|
|
23
|
+
labelPosition = 'right',
|
|
24
|
+
labelProps,
|
|
25
|
+
pressableLabel = false,
|
|
26
|
+
active,
|
|
27
|
+
disabled,
|
|
28
|
+
onChange,
|
|
29
|
+
...rest
|
|
30
|
+
} = _ref;
|
|
31
|
+
return _react.default.createElement(_styled.StyledView, null, labelPosition === 'left' ? _react.default.createElement(_LabelComponent.default, {
|
|
32
|
+
active: active,
|
|
33
|
+
label: label,
|
|
34
|
+
labelPosition: 'left',
|
|
35
|
+
labelProps: labelProps,
|
|
36
|
+
disabled: !pressableLabel || disabled,
|
|
37
|
+
switchDisabled: disabled,
|
|
38
|
+
onPress: () => onChange(!active)
|
|
39
|
+
}) : _react.default.createElement(_react.default.Fragment, null), _react.default.createElement(_reactCore.Switch, _extends({
|
|
40
|
+
active: active,
|
|
41
|
+
onChange: onChange,
|
|
42
|
+
disabled: disabled
|
|
43
|
+
}, rest)), labelPosition === 'right' ? _react.default.createElement(_LabelComponent.default, {
|
|
44
|
+
active: active,
|
|
45
|
+
label: label,
|
|
46
|
+
labelPosition: 'right',
|
|
47
|
+
labelProps: labelProps,
|
|
48
|
+
disabled: !pressableLabel || disabled,
|
|
49
|
+
switchDisabled: disabled,
|
|
50
|
+
onPress: () => onChange(!active)
|
|
51
|
+
}) : _react.default.createElement(_react.default.Fragment, null));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var _default = LabeledSwitch;
|
|
55
|
+
exports.default = _default;
|
|
56
|
+
//# sourceMappingURL=LabeledSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabeledSwitch.js","names":["LabeledSwitch","label","labelPosition","labelProps","pressableLabel","active","disabled","onChange","rest"],"sources":["../../../../src/components/molecules/LabeledSwitch/LabeledSwitch.tsx"],"sourcesContent":["import { LabeledSwitchProps, Switch } from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { TextNativeProps } from '../../atoms/Text';\nimport LabelComponent from './LabelComponent';\nimport { StyledView } from './styled';\n\nexport type LabeledSwitchNativeProps = LabeledSwitchProps & {\n labelProps?: TextNativeProps;\n};\n\nconst LabeledSwitch: FC<LabeledSwitchNativeProps> = ({\n label,\n labelPosition = 'right',\n labelProps,\n pressableLabel = false,\n active,\n disabled,\n onChange,\n ...rest\n}) => {\n return (\n <StyledView>\n {labelPosition === 'left' ? (\n <LabelComponent\n active={active}\n label={label}\n labelPosition={'left'}\n labelProps={labelProps}\n disabled={!pressableLabel || disabled}\n switchDisabled={disabled}\n onPress={() => onChange(!active)}\n />\n ) : (\n <></>\n )}\n <Switch\n active={active}\n onChange={onChange}\n disabled={disabled}\n {...rest}\n />\n {labelPosition === 'right' ? (\n <LabelComponent\n active={active}\n label={label}\n labelPosition={'right'}\n labelProps={labelProps}\n disabled={!pressableLabel || disabled}\n switchDisabled={disabled}\n onPress={() => onChange(!active)}\n />\n ) : (\n <></>\n )}\n </StyledView>\n );\n};\n\nexport default LabeledSwitch;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAMA,MAAMA,aAA2C,GAAG,QAS9C;EAAA,IAT+C;IACnDC,KADmD;IAEnDC,aAAa,GAAG,OAFmC;IAGnDC,UAHmD;IAInDC,cAAc,GAAG,KAJkC;IAKnDC,MALmD;IAMnDC,QANmD;IAOnDC,QAPmD;IAQnD,GAAGC;EARgD,CAS/C;EACJ,OACE,6BAAC,kBAAD,QACGN,aAAa,KAAK,MAAlB,GACC,6BAAC,uBAAD;IACE,MAAM,EAAEG,MADV;IAEE,KAAK,EAAEJ,KAFT;IAGE,aAAa,EAAE,MAHjB;IAIE,UAAU,EAAEE,UAJd;IAKE,QAAQ,EAAE,CAACC,cAAD,IAAmBE,QAL/B;IAME,cAAc,EAAEA,QANlB;IAOE,OAAO,EAAE,MAAMC,QAAQ,CAAC,CAACF,MAAF;EAPzB,EADD,GAWC,2DAZJ,EAcE,6BAAC,iBAAD;IACE,MAAM,EAAEA,MADV;IAEE,QAAQ,EAAEE,QAFZ;IAGE,QAAQ,EAAED;EAHZ,GAIME,IAJN,EAdF,EAoBGN,aAAa,KAAK,OAAlB,GACC,6BAAC,uBAAD;IACE,MAAM,EAAEG,MADV;IAEE,KAAK,EAAEJ,KAFT;IAGE,aAAa,EAAE,OAHjB;IAIE,UAAU,EAAEE,UAJd;IAKE,QAAQ,EAAE,CAACC,cAAD,IAAmBE,QAL/B;IAME,cAAc,EAAEA,QANlB;IAOE,OAAO,EAAE,MAAMC,QAAQ,CAAC,CAACF,MAAF;EAPzB,EADD,GAWC,2DA/BJ,CADF;AAoCD,CA9CD;;eAgDeL,a"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LabeledSwitch, LabeledSwitchNativeProps, } from './LabeledSwitch';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LabeledSwitch", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LabeledSwitch.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "LabeledSwitchNativeProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _LabeledSwitch.LabeledSwitchNativeProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _LabeledSwitch = _interopRequireWildcard(require("./LabeledSwitch"));
|
|
20
|
+
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/molecules/LabeledSwitch/index.ts"],"sourcesContent":["export {\n default as LabeledSwitch,\n LabeledSwitchNativeProps,\n} from './LabeledSwitch';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
export declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any> | undefined;
|
|
6
|
+
}, {}, {
|
|
7
|
+
ref?: import("react").Ref<View> | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const StyledLabel: import("@emotion/native").StyledComponent<any, {}, {}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledView = exports.StyledLabel = void 0;
|
|
7
|
+
|
|
8
|
+
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _Text = require("../../atoms/Text");
|
|
13
|
+
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
21
|
+
|
|
22
|
+
const StyledView = (0, _native.default)(_reactNative.View)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
|
|
23
|
+
exports.StyledView = StyledView;
|
|
24
|
+
const StyledLabel = (0, _native.default)(_Text.Text)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), _ref => {
|
|
25
|
+
let {
|
|
26
|
+
theme,
|
|
27
|
+
labelPosition
|
|
28
|
+
} = _ref;
|
|
29
|
+
if (labelPosition === 'right') return (0, _native.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), theme === null || theme === void 0 ? void 0 : theme.spacing.centi);else if (labelPosition === 'left') return (0, _native.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-right: ", ";\n "])), theme === null || theme === void 0 ? void 0 : theme.spacing.centi);
|
|
30
|
+
});
|
|
31
|
+
exports.StyledLabel = StyledLabel;
|
|
32
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.js","names":["StyledView","styled","View","StyledLabel","Text","theme","labelPosition","css","spacing","centi"],"sources":["../../../../src/components/molecules/LabeledSwitch/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { LabelPositionOptions, StyleProps } from '@tecsinapse/react-core';\nimport { View } from 'react-native';\nimport { Text } from '../../atoms/Text';\n\nexport const StyledView = styled(View)`\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledLabel = styled(Text)<\n Partial<StyleProps> & {\n labelPosition: LabelPositionOptions;\n }\n>`\n ${({ theme, labelPosition }) => {\n if (labelPosition === 'right')\n return css`\n margin-left: ${theme?.spacing.centi};\n `;\n else if (labelPosition === 'left')\n return css`\n margin-right: ${theme?.spacing.centi};\n `;\n }}\n`;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAEO,MAAMA,UAAU,GAAG,IAAAC,eAAA,EAAOC,iBAAP,CAAH,yIAAhB;;AAMA,MAAMC,WAAW,GAAG,IAAAF,eAAA,EAAOG,UAAP,CAAH,kFAKpB,QAA8B;EAAA,IAA7B;IAAEC,KAAF;IAASC;EAAT,CAA6B;EAC9B,IAAIA,aAAa,KAAK,OAAtB,EACE,WAAOC,WAAP,6GACiBF,KADjB,aACiBA,KADjB,uBACiBA,KAAK,CAAEG,OAAP,CAAeC,KADhC,EADF,KAIK,IAAIH,aAAa,KAAK,MAAtB,EACH,WAAOC,WAAP,8GACkBF,KADlB,aACkBA,KADlB,uBACkBA,KAAK,CAAEG,OAAP,CAAeC,KADjC;AAGH,CAdqB,CAAjB"}
|
|
@@ -3,5 +3,5 @@ import { SelectNativeProps } from './Select';
|
|
|
3
3
|
interface LoadingProps {
|
|
4
4
|
loading?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const Modal: <Data, Type extends "single" | "multi">({ options, keyExtractor, labelExtractor,
|
|
6
|
+
export declare const Modal: <Data, Type extends "single" | "multi">({ options, keyExtractor, labelExtractor, hideSearchBar, searchBarPlaceholder, focused, type, value, onSelect, onSearch, selectModalTitle, selectModalTitleComponent, confirmButtonText, loading, close, closeOnPick, ...others }: SelectNativeProps<Data, Type> & LoadingProps & IBaseModal) => JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.Modal = void 0;
|
|
5
7
|
|
|
6
8
|
var _reactCore = require("@tecsinapse/react-core");
|
|
@@ -25,28 +27,28 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
27
|
|
|
26
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
29
|
|
|
28
|
-
function _extends() { _extends = Object.assign
|
|
29
|
-
|
|
30
|
-
const Component =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
const Component = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
options,
|
|
35
|
+
keyExtractor,
|
|
36
|
+
labelExtractor,
|
|
37
|
+
hideSearchBar,
|
|
38
|
+
searchBarPlaceholder,
|
|
39
|
+
focused,
|
|
40
|
+
type,
|
|
41
|
+
value,
|
|
42
|
+
onSelect,
|
|
43
|
+
onSearch,
|
|
44
|
+
selectModalTitle,
|
|
45
|
+
selectModalTitleComponent,
|
|
46
|
+
confirmButtonText,
|
|
47
|
+
loading,
|
|
48
|
+
close,
|
|
49
|
+
closeOnPick,
|
|
50
|
+
...others
|
|
51
|
+
} = _ref;
|
|
50
52
|
const [selectedValues, setSelectedValues] = React.useState([]);
|
|
51
53
|
const [searchArg, setSearchArg] = (0, _reactCore.useDebouncedState)('', onSearch);
|
|
52
54
|
const ModalComponent = React.useMemo(() => (0, _styled.getStyledModal)((0, _reactCore.getStatusBarHeight)(true)), []);
|
|
@@ -57,7 +59,7 @@ const Component = ({
|
|
|
57
59
|
setSelectedValues(value ? type === 'multi' ? value : [value] : []);
|
|
58
60
|
}, [value, focused, setSelectedValues]);
|
|
59
61
|
const getData = React.useCallback(options => {
|
|
60
|
-
return options
|
|
62
|
+
return options === null || options === void 0 ? void 0 : options.map((option, index) => ({ ...option,
|
|
61
63
|
_checked: type === 'multi' ? !!selectedValues.find(value => keyExtractor(option, index) == keyExtractor(value, index)) : keyExtractor(selectedValues[0] || {}, index) == keyExtractor(option, index)
|
|
62
64
|
}));
|
|
63
65
|
}, [keyExtractor, selectedValues, type]);
|
|
@@ -86,16 +88,19 @@ const Component = ({
|
|
|
86
88
|
}, [selectedValues[0], value, closeOnPick]);
|
|
87
89
|
const handleConfirm = React.useCallback(() => {
|
|
88
90
|
onSelect(type === 'single' ? selectedValues[0] : selectedValues);
|
|
89
|
-
close
|
|
91
|
+
close === null || close === void 0 ? void 0 : close();
|
|
90
92
|
}, [selectedValues]);
|
|
91
|
-
const optionBuilder = React.useCallback(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const optionBuilder = React.useCallback(_ref2 => {
|
|
94
|
+
let {
|
|
95
|
+
item
|
|
96
|
+
} = _ref2;
|
|
97
|
+
return React.createElement(MemoizedOption, {
|
|
98
|
+
item: item,
|
|
99
|
+
type: type,
|
|
100
|
+
handlePressItem: handlePressItem,
|
|
101
|
+
labelExtractor: labelExtractor
|
|
102
|
+
});
|
|
103
|
+
}, []);
|
|
99
104
|
const anyChecked = data.filter(item => item._checked).length;
|
|
100
105
|
const dataLengthChanged = data.length;
|
|
101
106
|
const memoizedFlatlist = React.useMemo(() => React.createElement(_reactNative.FlatList, {
|
|
@@ -149,12 +154,13 @@ const Component = ({
|
|
|
149
154
|
}, confirmButtonText))));
|
|
150
155
|
};
|
|
151
156
|
|
|
152
|
-
const MemoizedOption =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
const MemoizedOption = _ref3 => {
|
|
158
|
+
let {
|
|
159
|
+
handlePressItem,
|
|
160
|
+
labelExtractor,
|
|
161
|
+
item,
|
|
162
|
+
type
|
|
163
|
+
} = _ref3;
|
|
158
164
|
return React.useMemo(() => {
|
|
159
165
|
const label = labelExtractor(item);
|
|
160
166
|
return React.createElement(_styled.ListItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/Select/Modal.tsx"],"names":["Component","options","keyExtractor","labelExtractor","groupKeyExtractor","hideSearchBar","searchBarPlaceholder","focused","type","value","onSelect","onSearch","selectModalTitle","selectModalTitleComponent","confirmButtonText","loading","close","closeOnPick","others","selectedValues","setSelectedValues","React","useState","searchArg","setSearchArg","ModalComponent","useMemo","_closeOnPick","useEffect","getData","useCallback","map","option","index","_checked","find","data","handlePressItem","newArr","found","push","handleConfirm","optionBuilder","item","anyChecked","filter","length","dataLengthChanged","memoizedFlatlist","titleTextModal","maxWidth","headerContent","onPress","icon","name","fontColor","text","MemoizedOption","label","Modal"],"mappings":";;;;;AAAA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAcA,MAAMA,SAAS,GAAG,CAAwC;AACxDC,EAAAA,OADwD;AAExDC,EAAAA,YAFwD;AAGxDC,EAAAA,cAHwD;AAIxDC,EAAAA,iBAJwD;AAKxDC,EAAAA,aALwD;AAMxDC,EAAAA,oBANwD;AAOxDC,EAAAA,OAPwD;AAQxDC,EAAAA,IARwD;AASxDC,EAAAA,KATwD;AAUxDC,EAAAA,QAVwD;AAWxDC,EAAAA,QAXwD;AAYxDC,EAAAA,gBAZwD;AAaxDC,EAAAA,yBAbwD;AAcxDC,EAAAA,iBAdwD;AAexDC,EAAAA,OAfwD;AAgBxDC,EAAAA,KAhBwD;AAiBxDC,EAAAA,WAjBwD;AAkBxD,KAAGC;AAlBqD,CAAxC,KAmB4D;AAC5E,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCC,KAAK,CAACC,QAAN,CAAuB,EAAvB,CAA5C;AACA,QAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4B,kCAA0B,EAA1B,EAA8Bb,QAA9B,CAAlC;AACA,QAAMc,cAAc,GAAGJ,KAAK,CAACK,OAAN,CACrB,MAAM,4BAAe,mCAAmB,IAAnB,CAAf,CADe,EAErB,EAFqB,CAAvB;;AAIA,QAAMC,YAAY,GAAGV,WAAW,IAAIT,IAAI,KAAK,QAA7C;;AAIAa,EAAAA,KAAK,CAACO,SAAN,CAAgB,MAAM;AACpBR,IAAAA,iBAAiB,CACdX,KAAK,GAAID,IAAI,K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,CAACT,QAAL,GAAgB,MAAhB,GAAyB;AAA3C,OACGwB,KADH,CALF,CADD,GAWC,oBAAC,sBAAD;AACE,MAAA,KAAK,EAAE,SADT;AAEE,MAAA,aAAa,EAAE,OAFjB;AAGE,MAAA,OAAO,EAAEf,IAAI,CAACT;AAHhB,OAKE,oBAAC,UAAD;AAAM,MAAA,UAAU,EAAES,IAAI,CAACT,QAAL,GAAgB,MAAhB,GAAyB;AAA3C,OACGwB,KADH,CALF,CAZJ,CADF,CADF;AA2BD,GA7BM,EA6BJ,CAACf,IAAI,CAACT,QAAN,CA7BI,CAAP;AA8BD,CA/BD;;AAiCO,MAAMyB,KAAK,GAAG3D,SAAd","sourcesContent":["import {\n Checkbox,\n getStatusBarHeight,\n RadioButton,\n RFValue,\n useDebouncedState,\n} from '@tecsinapse/react-core';\nimport * as React from 'react';\nimport { FlatList, ListRenderItemInfo, View } from 'react-native';\nimport { Button } from '../../atoms/Button';\nimport { Header } from '../../atoms/Header';\nimport { Input } from '../../atoms/Input';\nimport { IBaseModal, ModalView } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { SelectNativeProps } from './Select';\nimport {\n FetchIndicator,\n getStyledModal,\n ListItem,\n ModalFooter,\n SearchBarContainer,\n SelectIcon,\n TextTitleModal,\n} from './styled';\n\ninterface LoadingProps {\n loading?: boolean;\n}\n\nconst Component = <Data, Type extends 'single' | 'multi'>({\n options,\n keyExtractor,\n labelExtractor,\n groupKeyExtractor,\n hideSearchBar,\n searchBarPlaceholder,\n focused,\n type,\n value,\n onSelect,\n onSearch,\n selectModalTitle,\n selectModalTitleComponent,\n confirmButtonText,\n loading,\n close,\n closeOnPick,\n ...others\n}: SelectNativeProps<Data, Type> & LoadingProps & IBaseModal): JSX.Element => {\n const [selectedValues, setSelectedValues] = React.useState<Data[]>([]);\n const [searchArg, setSearchArg] = useDebouncedState<string>('', onSearch);\n const ModalComponent = React.useMemo(\n () => getStyledModal(getStatusBarHeight(true)),\n []\n );\n const _closeOnPick = closeOnPick && type === 'single';\n\n // Resets the temporary state to the initial state whenever the\n // modal is reopened or the value changes\n React.useEffect(() => {\n setSelectedValues(\n (value ? (type === 'multi' ? value : [value]) : []) as Data[]\n );\n }, [value, focused, setSelectedValues]);\n\n const getData = React.useCallback((options: Data[]) => {\n return options?.map((option, index) => ({\n ...option,\n _checked:\n type === 'multi'\n ? !!selectedValues.find(\n value => keyExtractor(option, index) == keyExtractor(value, index)\n )\n : keyExtractor((selectedValues[0] || {}) as Data, index) ==\n keyExtractor(option, index),\n }));\n }, [keyExtractor, selectedValues, type])\n\n const data = React.useMemo(() => typeof options !== 'function' ? getData(options) : [], [options, getData]);\n\n const handlePressItem = React.useCallback((option: Data) => {\n setSelectedValues(selectedValues => {\n if (type === 'multi') {\n const newArr: Data[] = [];\n let found = false;\n for (const value of selectedValues) {\n if (keyExtractor(value) != keyExtractor(option)) newArr.push(value);\n else found = true;\n }\n if (!found) newArr.push(option);\n return newArr;\n }\n return keyExtractor((selectedValues[0] || {}) as Data) ===\n keyExtractor(option)\n ? []\n : [option];\n });\n }, [selectedValues, setSelectedValues, keyExtractor, type])\n\n React.useEffect(() => {\n if (_closeOnPick && selectedValues[0] && selectedValues[0] !== value) {\n handleConfirm();\n }\n }, [selectedValues[0], value, closeOnPick]);\n\n const handleConfirm = React.useCallback(() => {\n // TS Workaround since TS won't infer the ternary operator's result type correctly\n type OnSelectArg = Parameters<typeof onSelect>[0];\n onSelect(\n (type === 'single' ? selectedValues[0] : selectedValues) as OnSelectArg\n );\n close?.()\n }, [selectedValues]);\n\n const optionBuilder = React.useCallback(({ item }: ListRenderItemInfo<Data & { _checked: boolean }>) => (\n <MemoizedOption\n item={item}\n type={type}\n handlePressItem={handlePressItem}\n labelExtractor={labelExtractor}\n />\n ), [])\n\n const anyChecked = data.filter(item => item._checked).length\n const dataLengthChanged = data.length\n\n const memoizedFlatlist = React.useMemo(() => (\n <FlatList\n data={data}\n keyExtractor={keyExtractor}\n fadingEdgeLength={200}\n renderItem={optionBuilder}\n />\n ), [selectedValues, anyChecked, dataLengthChanged])\n\n const titleTextModal = selectModalTitle ? (\n <TextTitleModal\n typography=\"h4\"\n fontWeight=\"bold\"\n numberOfLines={3}\n style={{ maxWidth: RFValue(250) }}\n >\n {selectModalTitle}\n </TextTitleModal>\n ) : null;\n\n const headerContent = selectModalTitleComponent\n ? selectModalTitleComponent\n : titleTextModal;\n\n return (\n <ModalView {...others} BoxComponent={ModalComponent} showCloseBar={false}>\n <Header\n rightButton={{\n onPress: close,\n icon: {\n name: 'close',\n type: 'material-community',\n fontColor: 'light',\n },\n }}\n >\n {headerContent}\n </Header>\n\n {!hideSearchBar && (\n <SearchBarContainer>\n <Input\n placeholder={searchBarPlaceholder}\n value={searchArg}\n onChange={text => setSearchArg(text)}\n leftComponent={\n <SelectIcon name=\"search\" type=\"ionicon\" size=\"centi\" />\n }\n />\n </SearchBarContainer>\n )}\n\n {loading && (\n <FetchIndicator animating={true} color={'grey'} size={'large'} />\n )}\n\n {memoizedFlatlist}\n\n { !_closeOnPick && <ModalFooter>\n <Button\n variant={'filled'}\n color={'primary'}\n onPress={handleConfirm}\n disabled={loading}\n >\n <Text fontColor={'light'} fontWeight=\"bold\">\n {confirmButtonText}\n </Text>\n </Button>\n </ModalFooter>}\n </ModalView>\n );\n};\n\ninterface IOption<T> {\n item: T & { _checked: boolean }\n type: 'single' | 'multi'\n labelExtractor: (option: T) => string\n handlePressItem: (option: T) => void\n}\n\nconst MemoizedOption: React.FC<IOption<any>> = ({ handlePressItem, labelExtractor, item, type }) => {\n return React.useMemo(() => {\n const label = labelExtractor(item)\n return (\n <ListItem onPress={() => handlePressItem(item)}>\n <View pointerEvents={'none'}>\n {type === 'multi' ? (\n <Checkbox\n color={'primary'}\n labelPosition={'right'}\n checked={item._checked}\n >\n <Text fontWeight={item._checked ? 'bold' : 'regular'}>\n {label}\n </Text>\n </Checkbox>\n ) : (\n <RadioButton\n color={'primary'}\n labelPosition={'right'}\n checked={item._checked}\n >\n <Text fontWeight={item._checked ? 'bold' : 'regular'}>\n {label}\n </Text>\n </RadioButton>\n )}\n </View>\n </ListItem>\n )\n }, [item._checked])\n}\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["Component","options","keyExtractor","labelExtractor","hideSearchBar","searchBarPlaceholder","focused","type","value","onSelect","onSearch","selectModalTitle","selectModalTitleComponent","confirmButtonText","loading","close","closeOnPick","others","selectedValues","setSelectedValues","React","useState","searchArg","setSearchArg","useDebouncedState","ModalComponent","useMemo","getStyledModal","getStatusBarHeight","_closeOnPick","useEffect","getData","useCallback","map","option","index","_checked","find","data","handlePressItem","newArr","found","push","handleConfirm","optionBuilder","item","anyChecked","filter","length","dataLengthChanged","memoizedFlatlist","titleTextModal","maxWidth","RFValue","headerContent","onPress","icon","name","fontColor","text","MemoizedOption","label","Modal"],"sources":["../../../../src/components/molecules/Select/Modal.tsx"],"sourcesContent":["import {\n Checkbox,\n getStatusBarHeight,\n RadioButton,\n RFValue,\n useDebouncedState,\n} from '@tecsinapse/react-core';\nimport * as React from 'react';\nimport { FlatList, ListRenderItemInfo, View } from 'react-native';\nimport { Button } from '../../atoms/Button';\nimport { Header } from '../../atoms/Header';\nimport { Input } from '../../atoms/Input';\nimport { IBaseModal, ModalView } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { SelectNativeProps } from './Select';\nimport {\n FetchIndicator,\n getStyledModal,\n ListItem,\n ModalFooter,\n SearchBarContainer,\n SelectIcon,\n TextTitleModal,\n} from './styled';\n\ninterface LoadingProps {\n loading?: boolean;\n}\n\nconst Component = <Data, Type extends 'single' | 'multi'>({\n options,\n keyExtractor,\n labelExtractor,\n hideSearchBar,\n searchBarPlaceholder,\n focused,\n type,\n value,\n onSelect,\n onSearch,\n selectModalTitle,\n selectModalTitleComponent,\n confirmButtonText,\n loading,\n close,\n closeOnPick,\n ...others\n}: SelectNativeProps<Data, Type> & LoadingProps & IBaseModal): JSX.Element => {\n const [selectedValues, setSelectedValues] = React.useState<Data[]>([]);\n const [searchArg, setSearchArg] = useDebouncedState<string>('', onSearch);\n const ModalComponent = React.useMemo(\n () => getStyledModal(getStatusBarHeight(true)),\n []\n );\n const _closeOnPick = closeOnPick && type === 'single';\n\n // Resets the temporary state to the initial state whenever the\n // modal is reopened or the value changes\n React.useEffect(() => {\n setSelectedValues(\n (value ? (type === 'multi' ? value : [value]) : []) as Data[]\n );\n }, [value, focused, setSelectedValues]);\n\n const getData = React.useCallback(\n (options: Data[]) => {\n return options?.map((option, index) => ({\n ...option,\n _checked:\n type === 'multi'\n ? !!selectedValues.find(\n value =>\n keyExtractor(option, index) == keyExtractor(value, index)\n )\n : keyExtractor((selectedValues[0] || {}) as Data, index) ==\n keyExtractor(option, index),\n }));\n },\n [keyExtractor, selectedValues, type]\n );\n\n const data = React.useMemo(\n () => (typeof options !== 'function' ? getData(options) : []),\n [options, getData]\n );\n\n const handlePressItem = React.useCallback(\n (option: Data) => {\n setSelectedValues(selectedValues => {\n if (type === 'multi') {\n const newArr: Data[] = [];\n let found = false;\n for (const value of selectedValues) {\n if (keyExtractor(value) != keyExtractor(option)) newArr.push(value);\n else found = true;\n }\n if (!found) newArr.push(option);\n return newArr;\n }\n return keyExtractor((selectedValues[0] || {}) as Data) ===\n keyExtractor(option)\n ? []\n : [option];\n });\n },\n [selectedValues, setSelectedValues, keyExtractor, type]\n );\n\n React.useEffect(() => {\n if (_closeOnPick && selectedValues[0] && selectedValues[0] !== value) {\n handleConfirm();\n }\n }, [selectedValues[0], value, closeOnPick]);\n\n const handleConfirm = React.useCallback(() => {\n // TS Workaround since TS won't infer the ternary operator's result type correctly\n type OnSelectArg = Parameters<typeof onSelect>[0];\n onSelect(\n (type === 'single' ? selectedValues[0] : selectedValues) as OnSelectArg\n );\n close?.();\n }, [selectedValues]);\n\n const optionBuilder = React.useCallback(\n ({ item }: ListRenderItemInfo<Data & { _checked: boolean }>) => (\n <MemoizedOption\n item={item}\n type={type}\n handlePressItem={handlePressItem}\n labelExtractor={labelExtractor}\n />\n ),\n []\n );\n\n const anyChecked = data.filter(item => item._checked).length;\n const dataLengthChanged = data.length;\n\n const memoizedFlatlist = React.useMemo(\n () => (\n <FlatList\n data={data}\n keyExtractor={keyExtractor}\n fadingEdgeLength={200}\n renderItem={optionBuilder}\n />\n ),\n [selectedValues, anyChecked, dataLengthChanged]\n );\n\n const titleTextModal = selectModalTitle ? (\n <TextTitleModal\n typography=\"h4\"\n fontWeight=\"bold\"\n numberOfLines={3}\n style={{ maxWidth: RFValue(250) }}\n >\n {selectModalTitle}\n </TextTitleModal>\n ) : null;\n\n const headerContent = selectModalTitleComponent\n ? selectModalTitleComponent\n : titleTextModal;\n\n return (\n <ModalView {...others} BoxComponent={ModalComponent} showCloseBar={false}>\n <Header\n rightButton={{\n onPress: close,\n icon: {\n name: 'close',\n type: 'material-community',\n fontColor: 'light',\n },\n }}\n >\n {headerContent}\n </Header>\n\n {!hideSearchBar && (\n <SearchBarContainer>\n <Input\n placeholder={searchBarPlaceholder}\n value={searchArg}\n onChange={text => setSearchArg(text)}\n leftComponent={\n <SelectIcon name=\"search\" type=\"ionicon\" size=\"centi\" />\n }\n />\n </SearchBarContainer>\n )}\n\n {loading && (\n <FetchIndicator animating={true} color={'grey'} size={'large'} />\n )}\n\n {memoizedFlatlist}\n\n {!_closeOnPick && (\n <ModalFooter>\n <Button\n variant={'filled'}\n color={'primary'}\n onPress={handleConfirm}\n disabled={loading}\n >\n <Text fontColor={'light'} fontWeight=\"bold\">\n {confirmButtonText}\n </Text>\n </Button>\n </ModalFooter>\n )}\n </ModalView>\n );\n};\n\ninterface IOption<T> {\n item: T & { _checked: boolean };\n type: 'single' | 'multi';\n labelExtractor: (option: T) => string;\n handlePressItem: (option: T) => void;\n}\n\nconst MemoizedOption = <T,>({\n handlePressItem,\n labelExtractor,\n item,\n type,\n}: IOption<T>): JSX.Element => {\n return React.useMemo(() => {\n const label = labelExtractor(item);\n return (\n <ListItem onPress={() => handlePressItem(item)}>\n <View pointerEvents={'none'}>\n {type === 'multi' ? (\n <Checkbox\n color={'primary'}\n labelPosition={'right'}\n checked={item._checked}\n >\n <Text fontWeight={item._checked ? 'bold' : 'regular'}>\n {label}\n </Text>\n </Checkbox>\n ) : (\n <RadioButton\n color={'primary'}\n labelPosition={'right'}\n checked={item._checked}\n >\n <Text fontWeight={item._checked ? 'bold' : 'regular'}>\n {label}\n </Text>\n </RadioButton>\n )}\n </View>\n </ListItem>\n );\n }, [item._checked]);\n};\n\nexport const Modal = Component;\n"],"mappings":";;;;;;;AAAA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAcA,MAAMA,SAAS,GAAG,QAkB4D;EAAA,IAlBpB;IACxDC,OADwD;IAExDC,YAFwD;IAGxDC,cAHwD;IAIxDC,aAJwD;IAKxDC,oBALwD;IAMxDC,OANwD;IAOxDC,IAPwD;IAQxDC,KARwD;IASxDC,QATwD;IAUxDC,QAVwD;IAWxDC,gBAXwD;IAYxDC,yBAZwD;IAaxDC,iBAbwD;IAcxDC,OAdwD;IAexDC,KAfwD;IAgBxDC,WAhBwD;IAiBxD,GAAGC;EAjBqD,CAkBoB;EAC5E,MAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCC,KAAK,CAACC,QAAN,CAAuB,EAAvB,CAA5C;EACA,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4B,IAAAC,4BAAA,EAA0B,EAA1B,EAA8Bd,QAA9B,CAAlC;EACA,MAAMe,cAAc,GAAGL,KAAK,CAACM,OAAN,CACrB,MAAM,IAAAC,sBAAA,EAAe,IAAAC,6BAAA,EAAmB,IAAnB,CAAf,CADe,EAErB,EAFqB,CAAvB;;EAIA,MAAMC,YAAY,GAAGb,WAAW,IAAIT,IAAI,KAAK,QAA7C;;EAIAa,KAAK,CAACU,SAAN,CAAgB,MAAM;IACpBX,iBAAiB,CACdX,KAAK,GAAID,IAAI,KAAK,OAAT,GA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BM,EA6BJ,CAAChB,IAAI,CAACT,QAAN,CA7BI,CAAP;AA8BD,CApCD;;AAsCO,MAAM0B,KAAK,GAAG9D,SAAd"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.default = void 0;
|
|
5
7
|
|
|
6
8
|
var _reactCore = require("@tecsinapse/react-core");
|
|
@@ -19,37 +21,38 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
23
|
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
23
|
-
|
|
24
|
-
function Select({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
function Select(_ref) {
|
|
27
|
+
let {
|
|
28
|
+
value,
|
|
29
|
+
options,
|
|
30
|
+
keyExtractor,
|
|
31
|
+
groupKeyExtractor,
|
|
32
|
+
onSelect,
|
|
33
|
+
type,
|
|
34
|
+
labelExtractor,
|
|
35
|
+
placeholder,
|
|
36
|
+
onFocus,
|
|
37
|
+
onBlur,
|
|
38
|
+
disabled,
|
|
39
|
+
onSearch,
|
|
40
|
+
selectModalTitle,
|
|
41
|
+
selectModalTitleComponent,
|
|
42
|
+
searchBarPlaceholder,
|
|
43
|
+
hideSearchBar,
|
|
44
|
+
confirmButtonText,
|
|
45
|
+
rightComponent,
|
|
46
|
+
variant = 'default',
|
|
47
|
+
hintComponent,
|
|
48
|
+
hint,
|
|
49
|
+
style,
|
|
50
|
+
controlComponent,
|
|
51
|
+
closeOnPick = type === 'single',
|
|
52
|
+
label,
|
|
53
|
+
numberOfLines,
|
|
54
|
+
...rest
|
|
55
|
+
} = _ref;
|
|
53
56
|
const {
|
|
54
57
|
focused,
|
|
55
58
|
handleBlur,
|
|
@@ -117,13 +120,13 @@ function Select({
|
|
|
117
120
|
const getDisplayValue = React.useCallback(() => {
|
|
118
121
|
if (Array.isArray(value)) {
|
|
119
122
|
if (value.length === 0) return _placeholder;else {
|
|
120
|
-
|
|
121
|
-
return options
|
|
123
|
+
const options = selectOptions.length > 0 ? selectOptions : value;
|
|
124
|
+
return options === null || options === void 0 ? void 0 : options.reduce((acc, option, index) => value.find(key => keyExtractor(option, index) == keyExtractor(key, index)) ? acc + labelExtractor(option) + ', ' : acc, '').slice(0, -2);
|
|
122
125
|
}
|
|
123
126
|
} else {
|
|
124
127
|
if (!value) return _placeholder;
|
|
125
|
-
const selectedOption = selectOptions
|
|
126
|
-
return labelExtractor(selectedOption
|
|
128
|
+
const selectedOption = selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.find((option, index) => keyExtractor(option, index) == keyExtractor(value, index));
|
|
129
|
+
return labelExtractor(selectedOption !== null && selectedOption !== void 0 ? selectedOption : value);
|
|
127
130
|
}
|
|
128
131
|
}, [_placeholder, value, selectOptions]);
|
|
129
132
|
modal.sync(React.createElement(_Modal2.Modal, {
|