@tecsinapse/react-native-kit 1.16.0 → 1.17.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/components/atoms/Avatar/Avatar.js +1 -3
  3. package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
  4. package/dist/components/atoms/Avatar/index.js +4 -9
  5. package/dist/components/atoms/Avatar/index.js.map +1 -1
  6. package/dist/components/atoms/Badge/Badge.js +1 -3
  7. package/dist/components/atoms/Badge/Badge.js.map +1 -1
  8. package/dist/components/atoms/Badge/index.js +5 -15
  9. package/dist/components/atoms/Badge/index.js.map +1 -1
  10. package/dist/components/atoms/BottomNavigator/BottomNavigator.js +3 -5
  11. package/dist/components/atoms/BottomNavigator/BottomNavigator.js.map +1 -1
  12. package/dist/components/atoms/BottomNavigator/Item.js +1 -3
  13. package/dist/components/atoms/BottomNavigator/Item.js.map +1 -1
  14. package/dist/components/atoms/BottomNavigator/index.js +7 -21
  15. package/dist/components/atoms/BottomNavigator/index.js.map +1 -1
  16. package/dist/components/atoms/BottomNavigator/styled.js +1 -3
  17. package/dist/components/atoms/BottomNavigator/styled.js.map +1 -1
  18. package/dist/components/atoms/Button/Button.js +2 -4
  19. package/dist/components/atoms/Button/Button.js.map +1 -1
  20. package/dist/components/atoms/Button/States/Error.js +1 -3
  21. package/dist/components/atoms/Button/States/Error.js.map +1 -1
  22. package/dist/components/atoms/Button/States/Loading.js +1 -3
  23. package/dist/components/atoms/Button/States/Loading.js.map +1 -1
  24. package/dist/components/atoms/Button/States/Success.js +1 -3
  25. package/dist/components/atoms/Button/States/Success.js.map +1 -1
  26. package/dist/components/atoms/Button/States/index.js +8 -21
  27. package/dist/components/atoms/Button/States/index.js.map +1 -1
  28. package/dist/components/atoms/Button/index.js +9 -33
  29. package/dist/components/atoms/Button/index.js.map +1 -1
  30. package/dist/components/atoms/GroupButton/GroupButtonOption.js +1 -3
  31. package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
  32. package/dist/components/atoms/GroupButton/index.js +4 -9
  33. package/dist/components/atoms/GroupButton/index.js.map +1 -1
  34. package/dist/components/atoms/Header/Header.js +9 -11
  35. package/dist/components/atoms/Header/Header.js.map +1 -1
  36. package/dist/components/atoms/Header/index.js +5 -15
  37. package/dist/components/atoms/Header/index.js.map +1 -1
  38. package/dist/components/atoms/Header/styled.js +1 -3
  39. package/dist/components/atoms/Header/styled.js.map +1 -1
  40. package/dist/components/atoms/Input/Input.js +1 -3
  41. package/dist/components/atoms/Input/Input.js.map +1 -1
  42. package/dist/components/atoms/Input/index.js +5 -15
  43. package/dist/components/atoms/Input/index.js.map +1 -1
  44. package/dist/components/atoms/Input/styled.js +1 -3
  45. package/dist/components/atoms/Input/styled.js.map +1 -1
  46. package/dist/components/atoms/InputMask/InputMask.d.ts +8 -0
  47. package/dist/components/atoms/InputMask/InputMask.js +87 -0
  48. package/dist/components/atoms/InputMask/InputMask.js.map +1 -0
  49. package/dist/components/atoms/InputMask/index.d.ts +1 -0
  50. package/dist/components/atoms/InputMask/index.js +14 -0
  51. package/dist/components/atoms/InputMask/index.js.map +1 -0
  52. package/dist/components/atoms/InputMask/styled.d.ts +5 -0
  53. package/dist/components/atoms/InputMask/styled.js +27 -0
  54. package/dist/components/atoms/InputMask/styled.js.map +1 -0
  55. package/dist/components/atoms/Modal/ModalGroupManager.js +1 -3
  56. package/dist/components/atoms/Modal/ModalGroupManager.js.map +1 -1
  57. package/dist/components/atoms/Modal/ModalLifecycleHandler.d.ts +1 -0
  58. package/dist/components/atoms/Modal/ModalLifecycleHandler.js +30 -30
  59. package/dist/components/atoms/Modal/ModalLifecycleHandler.js.map +1 -1
  60. package/dist/components/atoms/Modal/index.d.ts +1 -0
  61. package/dist/components/atoms/Modal/index.js +15 -39
  62. package/dist/components/atoms/Modal/index.js.map +1 -1
  63. package/dist/components/atoms/Modal/ui/BaseModalView.js +1 -3
  64. package/dist/components/atoms/Modal/ui/BaseModalView.js.map +1 -1
  65. package/dist/components/atoms/Modal/ui/styled.js +1 -3
  66. package/dist/components/atoms/Modal/ui/styled.js.map +1 -1
  67. package/dist/components/atoms/Modal/ui/types.js +1 -3
  68. package/dist/components/atoms/Modal/useLazyModalManager.d.ts +1 -1
  69. package/dist/components/atoms/Modal/useLazyModalManager.js +3 -5
  70. package/dist/components/atoms/Modal/useLazyModalManager.js.map +1 -1
  71. package/dist/components/atoms/Modal/useModalManager.d.ts +1 -1
  72. package/dist/components/atoms/Modal/useModalManager.js +3 -5
  73. package/dist/components/atoms/Modal/useModalManager.js.map +1 -1
  74. package/dist/components/atoms/Modal/useModalRemoteControl.d.ts +4 -0
  75. package/dist/components/atoms/Modal/useModalRemoteControl.js +24 -0
  76. package/dist/components/atoms/Modal/useModalRemoteControl.js.map +1 -0
  77. package/dist/components/atoms/Skeleton/Pulse.js +1 -3
  78. package/dist/components/atoms/Skeleton/Pulse.js.map +1 -1
  79. package/dist/components/atoms/Skeleton/Skeleton.js +3 -5
  80. package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -1
  81. package/dist/components/atoms/Skeleton/Wave.js +1 -3
  82. package/dist/components/atoms/Skeleton/Wave.js.map +1 -1
  83. package/dist/components/atoms/Skeleton/animation.js +1 -3
  84. package/dist/components/atoms/Skeleton/animation.js.map +1 -1
  85. package/dist/components/atoms/Skeleton/index.js +5 -15
  86. package/dist/components/atoms/Skeleton/index.js.map +1 -1
  87. package/dist/components/atoms/Skeleton/styled.js +1 -3
  88. package/dist/components/atoms/Skeleton/styled.js.map +1 -1
  89. package/dist/components/atoms/Skeleton/types.js +1 -3
  90. package/dist/components/atoms/SnappingSlider/SnappingSlider.js +1 -3
  91. package/dist/components/atoms/SnappingSlider/SnappingSlider.js.map +1 -1
  92. package/dist/components/atoms/SnappingSlider/index.js +5 -15
  93. package/dist/components/atoms/SnappingSlider/index.js.map +1 -1
  94. package/dist/components/atoms/Tag/Tag.js +1 -3
  95. package/dist/components/atoms/Tag/Tag.js.map +1 -1
  96. package/dist/components/atoms/Tag/index.js +5 -15
  97. package/dist/components/atoms/Tag/index.js.map +1 -1
  98. package/dist/components/atoms/Text/Text.js +1 -3
  99. package/dist/components/atoms/Text/Text.js.map +1 -1
  100. package/dist/components/atoms/Text/index.js +5 -15
  101. package/dist/components/atoms/Text/index.js.map +1 -1
  102. package/dist/components/atoms/Text/styled.js +4 -6
  103. package/dist/components/atoms/Text/styled.js.map +1 -1
  104. package/dist/components/atoms/TextArea/TextArea.js +1 -3
  105. package/dist/components/atoms/TextArea/TextArea.js.map +1 -1
  106. package/dist/components/atoms/TextArea/index.js +5 -15
  107. package/dist/components/atoms/TextArea/index.js.map +1 -1
  108. package/dist/components/atoms/TextArea/styled.js +1 -3
  109. package/dist/components/atoms/TextArea/styled.js.map +1 -1
  110. package/dist/components/molecules/Calendar/Calendar.js +1 -3
  111. package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
  112. package/dist/components/molecules/Calendar/index.js +4 -9
  113. package/dist/components/molecules/Calendar/index.js.map +1 -1
  114. package/dist/components/molecules/DatePicker/DatePicker.js +2 -4
  115. package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
  116. package/dist/components/molecules/DatePicker/index.js +5 -15
  117. package/dist/components/molecules/DatePicker/index.js.map +1 -1
  118. package/dist/components/molecules/DatePicker/styled.js +1 -3
  119. package/dist/components/molecules/DatePicker/styled.js.map +1 -1
  120. package/dist/components/molecules/DateTimePicker/DateTimePicker.js +1 -3
  121. package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  122. package/dist/components/molecules/DateTimePicker/index.js +5 -15
  123. package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
  124. package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +1 -3
  125. package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
  126. package/dist/components/molecules/DateTimeSelector/index.js +4 -9
  127. package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
  128. package/dist/components/molecules/InputPassword/InputPassword.js +1 -3
  129. package/dist/components/molecules/InputPassword/InputPassword.js.map +1 -1
  130. package/dist/components/molecules/InputPassword/index.js +5 -15
  131. package/dist/components/molecules/InputPassword/index.js.map +1 -1
  132. package/dist/components/molecules/Select/Modal.js +3 -5
  133. package/dist/components/molecules/Select/Modal.js.map +1 -1
  134. package/dist/components/molecules/Select/Select.js +3 -5
  135. package/dist/components/molecules/Select/Select.js.map +1 -1
  136. package/dist/components/molecules/Select/index.js +5 -15
  137. package/dist/components/molecules/Select/index.js.map +1 -1
  138. package/dist/components/molecules/Select/styled.js +2 -4
  139. package/dist/components/molecules/Select/styled.js.map +1 -1
  140. package/dist/components/molecules/Snackbar/Snackbar.js +1 -3
  141. package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
  142. package/dist/components/molecules/Snackbar/index.js +5 -15
  143. package/dist/components/molecules/Snackbar/index.js.map +1 -1
  144. package/dist/components/molecules/Snackbar/styled.js +1 -3
  145. package/dist/components/molecules/Snackbar/styled.js.map +1 -1
  146. package/dist/index.d.ts +2 -1
  147. package/dist/index.js +75 -267
  148. package/dist/index.js.map +1 -1
  149. package/dist/utils/date.js +1 -3
  150. package/dist/utils/date.js.map +1 -1
  151. package/package.json +6 -6
  152. package/src/components/atoms/InputMask/InputMask.tsx +96 -0
  153. package/src/components/atoms/InputMask/index.ts +1 -0
  154. package/src/components/atoms/InputMask/styled.ts +25 -0
  155. package/src/components/atoms/Modal/ModalLifecycleHandler.ts +15 -4
  156. package/src/components/atoms/Modal/index.ts +2 -1
  157. package/src/components/atoms/Modal/useLazyModalManager.ts +2 -2
  158. package/src/components/atoms/Modal/useModalManager.ts +2 -2
  159. package/src/components/atoms/Modal/useModalRemoteControl.ts +26 -0
  160. package/src/components/atoms/Skeleton/Skeleton.tsx +6 -0
  161. package/src/index.ts +2 -0
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.StyledNativeText = exports.fontStyles = void 0;
7
5
 
8
6
  var _native = _interopRequireWildcard(require("@emotion/native"));
@@ -20,11 +18,11 @@ const fontStyles = ({
20
18
  fontStack = 'default',
21
19
  fontWeight = 'regular'
22
20
  }) => {
23
- const fontFamily = (theme === null || theme === void 0 ? void 0 : theme.font.stack[fontStack]) || '';
24
- const fontStyle = theme === null || theme === void 0 ? void 0 : theme.font.files[fontWeight];
21
+ const fontFamily = (theme == null ? void 0 : theme.font.stack[fontStack]) || '';
22
+ const fontStyle = theme == null ? void 0 : theme.font.files[fontWeight];
25
23
  return (0, _native.css)`
26
24
  ${_reactNative.Platform.OS === 'android' ? 'font-weight: normal;' : undefined}
27
- font-family: ${fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.replace('{0}', fontFamily)};
25
+ font-family: ${fontStyle == null ? void 0 : fontStyle.replace('{0}', fontFamily)};
28
26
  `;
29
27
  };
30
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Text/styled.ts"],"names":["fontStyles","theme","fontStack","fontWeight","fontFamily","font","stack","fontStyle","files","Platform","OS","undefined","replace","StyledNativeText","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;;;;;AAQO,MAAMA,UAAU,GAAG,CAAC;AACzBC,EAAAA,KADyB;AAEzBC,EAAAA,SAAS,GAAG,SAFa;AAGzBC,EAAAA,UAAU,GAAG;AAHY,CAAD,KAIiB;AACzC,QAAMC,UAAU,GAAG,CAAAH,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEI,IAAP,CAAYC,KAAZ,CAAkBJ,SAAlB,MAAgC,EAAnD;AACA,QAAMK,SAAS,GAAGN,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEI,IAAP,CAAYG,KAAZ,CAAkBL,UAAlB,CAAlB;AACA,SAAO,gBAAI;AACb,MAAMM,sBAASC,EAAT,KAAgB,SAAhB,GAA4B,sBAA5B,GAAqDC,SAAU;AACrE,mBAAmBJ,SAFP,aAEOA,SAFP,uBAEOA,SAAS,CAAEK,OAAX,CAAmB,KAAnB,EAA0BR,UAA1B,CAAsC;AACzD,GAHE;AAID,CAXM;;;AAaA,MAAMS,gBAAgB,GAAG,qBAAOC,eAAP,EAE9Bd,UAF8B,CAAzB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport {\n FontStackType,\n FontWeightType,\n StyleProps,\n Text,\n} from '@tecsinapse/react-core';\nimport { Platform } from 'react-native';\nimport { TextNativeProps } from './Text';\n\nexport interface Font {\n fontStack?: FontStackType;\n fontWeight?: FontWeightType;\n}\n\nexport const fontStyles = ({\n theme,\n fontStack = 'default',\n fontWeight = 'regular',\n}: Partial<Font & Partial<StyleProps>>) => {\n const fontFamily = theme?.font.stack[fontStack] || '';\n const fontStyle = theme?.font.files[fontWeight];\n return css`\n ${Platform.OS === 'android' ? 'font-weight: normal;' : undefined}\n font-family: ${fontStyle?.replace('{0}', fontFamily)};\n `;\n};\n\nexport const StyledNativeText = styled(Text)<\n Font & Partial<TextNativeProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Text/styled.ts"],"names":["fontStyles","theme","fontStack","fontWeight","fontFamily","font","stack","fontStyle","files","Platform","OS","undefined","replace","StyledNativeText","Text"],"mappings":";;;;;AAAA;;AACA;;AAMA;;;;;;AAQO,MAAMA,UAAU,GAAG,CAAC;AACzBC,EAAAA,KADyB;AAEzBC,EAAAA,SAAS,GAAG,SAFa;AAGzBC,EAAAA,UAAU,GAAG;AAHY,CAAD,KAIiB;AACzC,QAAMC,UAAU,GAAG,CAAAH,KAAK,QAAL,YAAAA,KAAK,CAAEI,IAAP,CAAYC,KAAZ,CAAkBJ,SAAlB,MAAgC,EAAnD;AACA,QAAMK,SAAS,GAAGN,KAAH,oBAAGA,KAAK,CAAEI,IAAP,CAAYG,KAAZ,CAAkBL,UAAlB,CAAlB;AACA,SAAO,gBAAI;AACb,MAAMM,sBAASC,EAAT,KAAgB,SAAhB,GAA4B,sBAA5B,GAAqDC,SAAU;AACrE,mBAAmBJ,SAFP,oBAEOA,SAAS,CAAEK,OAAX,CAAmB,KAAnB,EAA0BR,UAA1B,CAAsC;AACzD,GAHE;AAID,CAXM;;;AAaA,MAAMS,gBAAgB,GAAG,qBAAOC,eAAP,EAE9Bd,UAF8B,CAAzB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport {\n FontStackType,\n FontWeightType,\n StyleProps,\n Text,\n} from '@tecsinapse/react-core';\nimport { Platform } from 'react-native';\nimport { TextNativeProps } from './Text';\n\nexport interface Font {\n fontStack?: FontStackType;\n fontWeight?: FontWeightType;\n}\n\nexport const fontStyles = ({\n theme,\n fontStack = 'default',\n fontWeight = 'regular',\n}: Partial<Font & Partial<StyleProps>>) => {\n const fontFamily = theme?.font.stack[fontStack] || '';\n const fontStyle = theme?.font.files[fontWeight];\n return css`\n ${Platform.OS === 'android' ? 'font-weight: normal;' : undefined}\n font-family: ${fontStyle?.replace('{0}', fontFamily)};\n `;\n};\n\nexport const StyledNativeText = styled(Text)<\n Font & Partial<TextNativeProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
6
  var _react = _interopRequireDefault(require("react"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","maxLength","rest","focused","handleBlur","handleFocus","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;;;;;AAIA,MAAM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O,EAAES,OAdX;AAeE,IAAA,QAAQ,EAAEf,QAfZ;AAgBE,IAAA,OAAO,EAAEO,OAhBX;AAiBE,IAAA,KAAK,EAAEK,KAjBT;AAkBE,IAAA,aAAa,EAAEJ,aAlBjB;AAmBE,IAAA,IAAI,EAAEC,IAnBR;AAoBE,IAAA,KAAK,EAAER,KApBT;AAqBE,IAAA,aAAa,EAAEiB,UArBjB;AAsBE,IAAA,SAAS,EAAEL;AAtBb,KAwBE,6BAAC,yBAAD,eACMC,IADN;AAEE,IAAA,SAAS,EAAEV,cAFb;AAGE,IAAA,UAAU,EAAEC,eAHd;AAIE,IAAA,QAAQ,EAAEL,QAJZ;AAKE,IAAA,OAAO,EAAEiB,WALX;AAME,IAAA,MAAM,EAAED,UANV;AAOE,IAAA,iBAAiB,EAAE,KAPrB;AAQE,IAAA,SAAS,MARX;AASE,IAAA,KAAK,EAAEJ,KATT;AAUE,IAAA,SAAS,EAAEC;AAVb,KAxBF,CADF;AAuCD,CAvED;;eAyEevB,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n useInputFocus,\n TextAreaProps as ITACore,\n TextArea as TACore,\n} from '@tecsinapse/react-core';\nimport { Text } from '../Text';\nimport { StyledNativeInput } from './styled';\n\nexport type TextAreaProps = Omit<ITACore, 'TextComponent' | 'focused'>;\n\nconst TextArea: FC<TextAreaProps> = ({\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n maxLength,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <TACore\n label={label}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n value={value}\n hintComponent={hintComponent}\n hint={hint}\n style={style}\n TextComponent={Text}\n maxLength={maxLength}\n >\n <StyledNativeInput\n {...rest}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n value={value}\n maxLength={maxLength}\n />\n </TACore>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","maxLength","rest","focused","handleBlur","handleFocus","Text"],"mappings":";;;;;AAAA;;AACA;;AAKA;;AACA;;;;;;AAIA,MAAMA,QAA2B,GAAG,CAAC;AACnCC,EAAAA,KADmC;AAEnCC,EAAAA,UAFmC;AAGnCC,EAAAA,iBAHmC;AAInCC,EAAAA,cAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,UANmC;AAOnCC,EAAAA,WAPmC;AAQnCC,EAAAA,aARmC;AASnCC,EAAAA,cATmC;AAUnCC,EAAAA,QAVmC;AAWnCC,EAAAA,KAXmC;AAYnCC,EAAAA,WAZmC;AAanCC,EAAAA,oBAbmC;AAcnCC,EAAAA,cAAc,GAAG,SAdkB;AAenCC,EAAAA,eAAe,GAAG,MAfiB;AAgBnCC,EAAAA,mBAhBmC;AAiBnCC,EAAAA,OAAO,GAAG,SAjByB;AAkBnCC,EAAAA,aAlBmC;AAmBnCC,EAAAA,IAnBmC;AAoBnCC,EA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B;AAQE,IAAA,SAAS,MARX;AASE,IAAA,KAAK,EAAEJ,KATT;AAUE,IAAA,SAAS,EAAEC;AAVb,KAxBF,CADF;AAuCD,CAvED;;eAyEevB,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n useInputFocus,\n TextAreaProps as ITACore,\n TextArea as TACore,\n} from '@tecsinapse/react-core';\nimport { Text } from '../Text';\nimport { StyledNativeInput } from './styled';\n\nexport type TextAreaProps = Omit<ITACore, 'TextComponent' | 'focused'>;\n\nconst TextArea: FC<TextAreaProps> = ({\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n maxLength,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <TACore\n label={label}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n value={value}\n hintComponent={hintComponent}\n hint={hint}\n style={style}\n TextComponent={Text}\n maxLength={maxLength}\n >\n <StyledNativeInput\n {...rest}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n value={value}\n maxLength={maxLength}\n />\n </TACore>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
@@ -1,23 +1,13 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "TextArea", {
7
- enumerable: true,
8
- get: function () {
9
- return _TextArea.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "TextAreaProps", {
13
- enumerable: true,
14
- get: function () {
15
- return _TextArea.TextAreaProps;
16
- }
17
- });
3
+ exports.__esModule = true;
4
+ exports.TextAreaProps = exports.TextArea = void 0;
18
5
 
19
6
  var _TextArea = _interopRequireWildcard(require("./TextArea"));
20
7
 
8
+ exports.TextArea = _TextArea.default;
9
+ exports.TextAreaProps = _TextArea.TextAreaProps;
10
+
21
11
  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
12
 
23
13
  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/atoms/TextArea/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export { default as TextArea, TextAreaProps } from './TextArea';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/TextArea/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as TextArea, TextAreaProps } from './TextArea';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.StyledNativeInput = void 0;
7
5
 
8
6
  var _native = _interopRequireDefault(require("@emotion/native"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/TextArea/styled.ts"],"names":["StyledNativeInput","TextAreaInputBase","fontStyles"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAGO,MAAMA,iBAAiB,GAAG,qBAAOC,4BAAP,EAE/BC,kBAF+B,CAA1B","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps, TextAreaInputBase } from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { TextAreaProps } from './TextArea';\n\nexport const StyledNativeInput = styled(TextAreaInputBase)<\n Font & Partial<TextAreaProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/TextArea/styled.ts"],"names":["StyledNativeInput","TextAreaInputBase","fontStyles"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;AAGO,MAAMA,iBAAiB,GAAG,qBAAOC,4BAAP,EAE/BC,kBAF+B,CAA1B","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps, TextAreaInputBase } from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { TextAreaProps } from './TextArea';\n\nexport const StyledNativeInput = styled(TextAreaInputBase)<\n Font & Partial<TextAreaProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.Calendar = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Calendar/Calendar.tsx"],"names":["Calendar","locale","rest","Text"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEO,MAAMA,QAAQ,GAAG,CAA0B;AAChDC,EAAAA,MADgD;AAEhD,KAAGC;AAF6C,CAA1B,KAGa;AACnC,SACE,6BAAC,mBAAD,eACMA,IADN;AAEE,IAAA,aAAa,EAAEC,UAFjB;AAGE,IAAA,MAAM,EAAEF,MAAM,IAAI;AAHpB,KADF;AAOD,CAXM","sourcesContent":["import { Calendar as CalendarCore, CalendarProps, SelectionType } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { Text } from '../../atoms/Text';\n\nexport const Calendar = <T extends SelectionType>({\n locale,\n ...rest\n}: CalendarProps<T>): JSX.Element => {\n return (\n <CalendarCore\n {...rest}\n TextComponent={Text}\n locale={locale ?? getLocale()}\n />\n );\n};\n"],"file":"Calendar.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Calendar/Calendar.tsx"],"names":["Calendar","locale","rest","Text"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEO,MAAMA,QAAQ,GAAG,CAA0B;AAChDC,EAAAA,MADgD;AAEhD,KAAGC;AAF6C,CAA1B,KAGa;AACnC,SACE,6BAAC,mBAAD,eACMA,IADN;AAEE,IAAA,aAAa,EAAEC,UAFjB;AAGE,IAAA,MAAM,EAAEF,MAAM,IAAI;AAHpB,KADF;AAOD,CAXM","sourcesContent":["import { Calendar as CalendarCore, CalendarProps, SelectionType } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { Text } from '../../atoms/Text';\n\nexport const Calendar = <T extends SelectionType>({\n locale,\n ...rest\n}: CalendarProps<T>): JSX.Element => {\n return (\n <CalendarCore\n {...rest}\n TextComponent={Text}\n locale={locale ?? getLocale()}\n />\n );\n};\n"],"file":"Calendar.js"}
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Calendar", {
7
- enumerable: true,
8
- get: function () {
9
- return _Calendar.Calendar;
10
- }
11
- });
3
+ exports.__esModule = true;
4
+ exports.Calendar = void 0;
12
5
 
13
6
  var _Calendar = require("./Calendar");
7
+
8
+ exports.Calendar = _Calendar.Calendar;
14
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Calendar/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { Calendar } from './Calendar';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Calendar/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { Calendar } from './Calendar';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.DatePicker = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -31,7 +29,7 @@ const DatePicker = ({
31
29
  const modal = (0, _Modal.useLazyModalManager)();
32
30
 
33
31
  const handleChange = value => {
34
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
32
+ onChange == null ? void 0 : onChange(value);
35
33
  modal.requestUpdate();
36
34
  };
37
35
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","locale","onChange","rest","modal","handleChange","value","requestUpdate","Text","Calendar","show","close","calendar","blur","sync","NativeModal","children","others","CalendarBoxContent"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO,MAAMA,UAAU,GAAG,CAA0B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,QAAV;AAAoB,KAAGC;AAAvB,CAA1B,KAAmG;AAE3H,QAAMC,KAAK,GAAG,iCAAd;;AAEA,QAAMC,YAAY,GAAIC,KAAD,IAAsB;AACzCJ,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGI,KAAH,CAAR;AACAF,IAAAA,KAAK,CAACG,aAAN;AACD,GAHD;;AAKA,SACE,6BAAC,qBAAD,eACMJ,IADN;AAEE,IAAA,aAAa,EAAEK,UAFjB;AAGE,IAAA,iBAAiB,EAAEC,kBAHrB;AAIE,IAAA,MAAM,EAAER,MAAM,IAAI,sBAJpB;AAKE,IAAA,QAAQ,EAAEI,YALZ;AAME,IAAA,mBAAmB,EAAE,MAAMD,KAAK,CAACM,IAAN,EAN7B;AAOE,IAAA,oBAAoB,EAAE,MAAMN,KAAK,CAACO,KAAN,EAP9B;AAQE,IAAA,cAAc,EAAE,CAACC,QAAD,EAAWC,IAAX,KAAoBT,KAAK,CAACU,IAAN,CAClC,6BAAC,WAAD;AAAa,MAAA,OAAO,EAAED;AAAtB,OACGD,QADH,CADkC;AARtC,KADF;AAiBD,CA1BM;;;;AA4BP,MAAMG,WAA2B,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAD,KAA6B;AAC/D,SACE,6BAAC,gBAAD;AAAW,IAAA,YAAY,EAAEC;AAAzB,KAAiDD,MAAjD,GACGD,QADH,CADF;AAKD,CAND","sourcesContent":["import {\n DatePicker as DatePickerCore, DatePickerProps, SelectionType, Value\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { IBaseModal, ModalView, useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { Calendar } from '../Calendar';\nimport { CalendarBoxContent } from './styled';\n\nexport type NativeDatePickerProps<T extends SelectionType> = Omit<DatePickerProps<T>, 'CalendarComponent' | 'renderCalendar' | 'requestCloseCalendar' | 'requestShowCalendar'>\n\nexport const DatePicker = <T extends SelectionType>({ locale, onChange, ...rest }: NativeDatePickerProps<T>): JSX.Element => {\n\n const modal = useLazyModalManager()\n \n const handleChange = (value?: Value<T>) => {\n onChange?.(value)\n modal.requestUpdate()\n }\n \n return (\n <DatePickerCore\n {...rest}\n TextComponent={Text}\n CalendarComponent={Calendar}\n locale={locale ?? getLocale()}\n onChange={handleChange}\n requestShowCalendar={() => modal.show()}\n requestCloseCalendar={() => modal.close()}\n renderCalendar={(calendar, blur) => modal.sync(\n <NativeModal onClose={blur}>\n {calendar}\n </NativeModal>\n )}\n />\n );\n\n};\n\nconst NativeModal: FC<IBaseModal> = ({ children, ...others }) => {\n return (\n <ModalView BoxComponent={CalendarBoxContent} {...others}>\n {children}\n </ModalView>\n )\n}"],"file":"DatePicker.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","locale","onChange","rest","modal","handleChange","value","requestUpdate","Text","Calendar","show","close","calendar","blur","sync","NativeModal","children","others","CalendarBoxContent"],"mappings":";;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO,MAAMA,UAAU,GAAG,CAA0B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,QAAV;AAAoB,KAAGC;AAAvB,CAA1B,KAAmG;AAE3H,QAAMC,KAAK,GAAG,iCAAd;;AAEA,QAAMC,YAAY,GAAIC,KAAD,IAAsB;AACzCJ,IAAAA,QAAQ,QAAR,YAAAA,QAAQ,CAAGI,KAAH,CAAR;AACAF,IAAAA,KAAK,CAACG,aAAN;AACD,GAHD;;AAKA,SACE,6BAAC,qBAAD,eACMJ,IADN;AAEE,IAAA,aAAa,EAAEK,UAFjB;AAGE,IAAA,iBAAiB,EAAEC,kBAHrB;AAIE,IAAA,MAAM,EAAER,MAAM,IAAI,sBAJpB;AAKE,IAAA,QAAQ,EAAEI,YALZ;AAME,IAAA,mBAAmB,EAAE,MAAMD,KAAK,CAACM,IAAN,EAN7B;AAOE,IAAA,oBAAoB,EAAE,MAAMN,KAAK,CAACO,KAAN,EAP9B;AAQE,IAAA,cAAc,EAAE,CAACC,QAAD,EAAWC,IAAX,KAAoBT,KAAK,CAACU,IAAN,CAClC,6BAAC,WAAD;AAAa,MAAA,OAAO,EAAED;AAAtB,OACGD,QADH,CADkC;AARtC,KADF;AAiBD,CA1BM;;;;AA4BP,MAAMG,WAA2B,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAD,KAA6B;AAC/D,SACE,6BAAC,gBAAD;AAAW,IAAA,YAAY,EAAEC;AAAzB,KAAiDD,MAAjD,GACGD,QADH,CADF;AAKD,CAND","sourcesContent":["import {\n DatePicker as DatePickerCore, DatePickerProps, SelectionType, Value\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { IBaseModal, ModalView, useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { Calendar } from '../Calendar';\nimport { CalendarBoxContent } from './styled';\n\nexport type NativeDatePickerProps<T extends SelectionType> = Omit<DatePickerProps<T>, 'CalendarComponent' | 'renderCalendar' | 'requestCloseCalendar' | 'requestShowCalendar'>\n\nexport const DatePicker = <T extends SelectionType>({ locale, onChange, ...rest }: NativeDatePickerProps<T>): JSX.Element => {\n\n const modal = useLazyModalManager()\n \n const handleChange = (value?: Value<T>) => {\n onChange?.(value)\n modal.requestUpdate()\n }\n \n return (\n <DatePickerCore\n {...rest}\n TextComponent={Text}\n CalendarComponent={Calendar}\n locale={locale ?? getLocale()}\n onChange={handleChange}\n requestShowCalendar={() => modal.show()}\n requestCloseCalendar={() => modal.close()}\n renderCalendar={(calendar, blur) => modal.sync(\n <NativeModal onClose={blur}>\n {calendar}\n </NativeModal>\n )}\n />\n );\n\n};\n\nconst NativeModal: FC<IBaseModal> = ({ children, ...others }) => {\n return (\n <ModalView BoxComponent={CalendarBoxContent} {...others}>\n {children}\n </ModalView>\n )\n}"],"file":"DatePicker.js"}
@@ -1,20 +1,10 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DatePicker", {
7
- enumerable: true,
8
- get: function () {
9
- return _DatePicker.DatePicker;
10
- }
11
- });
12
- Object.defineProperty(exports, "NativeDatePickerProps", {
13
- enumerable: true,
14
- get: function () {
15
- return _DatePicker.NativeDatePickerProps;
16
- }
17
- });
3
+ exports.__esModule = true;
4
+ exports.NativeDatePickerProps = exports.DatePicker = void 0;
18
5
 
19
6
  var _DatePicker = require("./DatePicker");
7
+
8
+ exports.DatePicker = _DatePicker.DatePicker;
9
+ exports.NativeDatePickerProps = _DatePicker.NativeDatePickerProps;
20
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export { DatePicker, NativeDatePickerProps } from './DatePicker';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { DatePicker, NativeDatePickerProps } from './DatePicker';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.CalendarBoxContent = void 0;
7
5
 
8
6
  var _native = _interopRequireDefault(require("@emotion/native"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["CalendarBoxContent","BoxContent","theme","color","secondary","xlight"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEO,MAAMA,kBAAkB,GAAG,qBAAOC,qBAAP,CAAwC;AAC1E,wBAAwB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACpE,CAFO","sourcesContent":["import styled from \"@emotion/native\";\nimport { BoxContent, StyleProps } from \"@tecsinapse/react-core\";\n\nexport const CalendarBoxContent = styled(BoxContent)<Partial<StyleProps>>`\n background-color: ${({ theme }) => theme.color.secondary.xlight};\n`"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/styled.ts"],"names":["CalendarBoxContent","BoxContent","theme","color","secondary","xlight"],"mappings":";;;;;AAAA;;AACA;;;;AAEO,MAAMA,kBAAkB,GAAG,qBAAOC,qBAAP,CAAwC;AAC1E,wBAAwB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AACpE,CAFO","sourcesContent":["import styled from \"@emotion/native\";\nimport { BoxContent, StyleProps } from \"@tecsinapse/react-core\";\n\nexport const CalendarBoxContent = styled(BoxContent)<Partial<StyleProps>>`\n background-color: ${({ theme }) => theme.color.secondary.xlight};\n`"],"file":"styled.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.DateTimePicker = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/DateTimePicker.tsx"],"names":["DateTimePicker","locale","rest","modal","Text","DateTimeSelector","show","close","selector","blur","sync","NativeModal","children","others"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO,MAAMA,cAA6C,GAAG,CAAC;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAD,KAAyB;AAEpF,QAAMC,KAAK,GAAG,iCAAd;AAEA,SACE,6BAAC,yBAAD,eACMD,IADN;AAEE,IAAA,aAAa,EAAEE,UAFjB;AAGE,IAAA,yBAAyB,EAAEC,kCAH7B;AAIE,IAAA,MAAM,EAAEJ,MAAM,IAAI,sBAJpB;AAKE,IAAA,mBAAmB,EAAE,MAAME,KAAK,CAACG,IAAN,EAL7B;AAME,IAAA,oBAAoB,EAAE,MAAMH,KAAK,CAACI,KAAN,EAN9B;AAOE,IAAA,cAAc,EAAE,CAACC,QAAD,EAAWC,IAAX,KAAoBN,KAAK,CAACO,IAAN,CAClC,6BAAC,WAAD;AAAa,MAAA,OAAO,EAAED;AAAtB,OACGD,QADH,CADkC;AAPtC,KADF;AAeD,CAnBM;;;;AAqBP,MAAMG,WAA2B,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAD,KAA6B;AAC/D,SACE,6BAAC,gBAAD,EAAeA,MAAf,EACGD,QADH,CADF;AAKD,CAND","sourcesContent":["import {\n DateTimePicker as DateTimePickerCore,\n DateTimePickerProps\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { IBaseModal, ModalView, useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { DateTimeSelector } from '../DateTimeSelector';\n\nexport type NativeDateTimePickerProps = Omit<DateTimePickerProps, 'DateTimeSelectorComponent' | 'renderSelector' | 'requestCloseSelector' | 'requestShowSelector'>\n\nexport const DateTimePicker: FC<NativeDateTimePickerProps> = ({ locale, ...rest }) => {\n\n const modal = useLazyModalManager()\n\n return (\n <DateTimePickerCore\n {...rest}\n TextComponent={Text}\n DateTimeSelectorComponent={DateTimeSelector}\n locale={locale ?? getLocale()}\n requestShowSelector={() => modal.show()}\n requestCloseSelector={() => modal.close()}\n renderSelector={(selector, blur) => modal.sync(\n <NativeModal onClose={blur}>\n {selector}\n </NativeModal>\n )}\n />\n );\n};\n\nconst NativeModal: FC<IBaseModal> = ({ children, ...others }) => {\n return (\n <ModalView {...others}>\n {children}\n </ModalView>\n )\n}"],"file":"DateTimePicker.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/DateTimePicker.tsx"],"names":["DateTimePicker","locale","rest","modal","Text","DateTimeSelector","show","close","selector","blur","sync","NativeModal","children","others"],"mappings":";;;;;AAAA;;AAIA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO,MAAMA,cAA6C,GAAG,CAAC;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAD,KAAyB;AAEpF,QAAMC,KAAK,GAAG,iCAAd;AAEA,SACE,6BAAC,yBAAD,eACMD,IADN;AAEE,IAAA,aAAa,EAAEE,UAFjB;AAGE,IAAA,yBAAyB,EAAEC,kCAH7B;AAIE,IAAA,MAAM,EAAEJ,MAAM,IAAI,sBAJpB;AAKE,IAAA,mBAAmB,EAAE,MAAME,KAAK,CAACG,IAAN,EAL7B;AAME,IAAA,oBAAoB,EAAE,MAAMH,KAAK,CAACI,KAAN,EAN9B;AAOE,IAAA,cAAc,EAAE,CAACC,QAAD,EAAWC,IAAX,KAAoBN,KAAK,CAACO,IAAN,CAClC,6BAAC,WAAD;AAAa,MAAA,OAAO,EAAED;AAAtB,OACGD,QADH,CADkC;AAPtC,KADF;AAeD,CAnBM;;;;AAqBP,MAAMG,WAA2B,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAD,KAA6B;AAC/D,SACE,6BAAC,gBAAD,EAAeA,MAAf,EACGD,QADH,CADF;AAKD,CAND","sourcesContent":["import {\n DateTimePicker as DateTimePickerCore,\n DateTimePickerProps\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { getLocale } from '../../../utils/date';\nimport { IBaseModal, ModalView, useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { DateTimeSelector } from '../DateTimeSelector';\n\nexport type NativeDateTimePickerProps = Omit<DateTimePickerProps, 'DateTimeSelectorComponent' | 'renderSelector' | 'requestCloseSelector' | 'requestShowSelector'>\n\nexport const DateTimePicker: FC<NativeDateTimePickerProps> = ({ locale, ...rest }) => {\n\n const modal = useLazyModalManager()\n\n return (\n <DateTimePickerCore\n {...rest}\n TextComponent={Text}\n DateTimeSelectorComponent={DateTimeSelector}\n locale={locale ?? getLocale()}\n requestShowSelector={() => modal.show()}\n requestCloseSelector={() => modal.close()}\n renderSelector={(selector, blur) => modal.sync(\n <NativeModal onClose={blur}>\n {selector}\n </NativeModal>\n )}\n />\n );\n};\n\nconst NativeModal: FC<IBaseModal> = ({ children, ...others }) => {\n return (\n <ModalView {...others}>\n {children}\n </ModalView>\n )\n}"],"file":"DateTimePicker.js"}
@@ -1,20 +1,10 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DateTimePicker", {
7
- enumerable: true,
8
- get: function () {
9
- return _DateTimePicker.DateTimePicker;
10
- }
11
- });
12
- Object.defineProperty(exports, "NativeDateTimePickerProps", {
13
- enumerable: true,
14
- get: function () {
15
- return _DateTimePicker.NativeDateTimePickerProps;
16
- }
17
- });
3
+ exports.__esModule = true;
4
+ exports.NativeDateTimePickerProps = exports.DateTimePicker = void 0;
18
5
 
19
6
  var _DateTimePicker = require("./DateTimePicker");
7
+
8
+ exports.DateTimePicker = _DateTimePicker.DateTimePicker;
9
+ exports.NativeDateTimePickerProps = _DateTimePicker.NativeDateTimePickerProps;
20
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export { DateTimePicker, NativeDateTimePickerProps } from './DateTimePicker';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { DateTimePicker, NativeDateTimePickerProps } from './DateTimePicker';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.DateTimeSelector = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/DateTimeSelector.tsx"],"names":["DateTimeSelector","locale","rest","Text"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AACA;;;;;;AAEO,MAAMA,gBAA2C,GAAG,CAAC;AAACC,EAAAA,MAAD;AAAS,KAAGC;AAAZ,CAAD,KAAuB;AAChF,SACE,6BAAC,2BAAD,eACMA,IADN;AAEE,IAAA,aAAa,EAAEC,UAFjB;AAGE,IAAA,MAAM,EAAEF,MAAM,IAAI;AAHpB,KADF;AAOD,CARM","sourcesContent":["import {\n DateTimeSelector as DateTimeSelectorCore,\n DateTimeSelectorProps,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { Text } from '../../atoms/Text';\nimport { getLocale } from '../../../utils/date';\n\nexport const DateTimeSelector: FC<DateTimeSelectorProps> = ({locale, ...rest}) => {\n return (\n <DateTimeSelectorCore\n {...rest}\n TextComponent={Text}\n locale={locale ?? getLocale()}\n />\n );\n};\n"],"file":"DateTimeSelector.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/DateTimeSelector.tsx"],"names":["DateTimeSelector","locale","rest","Text"],"mappings":";;;;;AAAA;;AAIA;;AACA;;AACA;;;;;;AAEO,MAAMA,gBAA2C,GAAG,CAAC;AAACC,EAAAA,MAAD;AAAS,KAAGC;AAAZ,CAAD,KAAuB;AAChF,SACE,6BAAC,2BAAD,eACMA,IADN;AAEE,IAAA,aAAa,EAAEC,UAFjB;AAGE,IAAA,MAAM,EAAEF,MAAM,IAAI;AAHpB,KADF;AAOD,CARM","sourcesContent":["import {\n DateTimeSelector as DateTimeSelectorCore,\n DateTimeSelectorProps,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { Text } from '../../atoms/Text';\nimport { getLocale } from '../../../utils/date';\n\nexport const DateTimeSelector: FC<DateTimeSelectorProps> = ({locale, ...rest}) => {\n return (\n <DateTimeSelectorCore\n {...rest}\n TextComponent={Text}\n locale={locale ?? getLocale()}\n />\n );\n};\n"],"file":"DateTimeSelector.js"}
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DateTimeSelector", {
7
- enumerable: true,
8
- get: function () {
9
- return _DateTimeSelector.DateTimeSelector;
10
- }
11
- });
3
+ exports.__esModule = true;
4
+ exports.DateTimeSelector = void 0;
12
5
 
13
6
  var _DateTimeSelector = require("./DateTimeSelector");
7
+
8
+ exports.DateTimeSelector = _DateTimeSelector.DateTimeSelector;
14
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { DateTimeSelector } from './DateTimeSelector';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DateTimeSelector/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { DateTimeSelector } from './DateTimeSelector';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/InputPassword/InputPassword.tsx"],"names":["InputPassword","React","forwardRef","rightComponent","rest","ref","revealed","setRevealed","displayName"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,aAA2C,GAAGC,eAAMC,UAAN,CAClD,CAAC;AAAEC,EAAAA,cAAF;AAAkB,KAAGC;AAArB,CAAD,EAA8BC,GAA9B,KAAsC;AACpC,QAAM,CAACC,QAAD,EAAWC,WAAX,IAA0B,qBAAS,KAAT,CAAhC;AACA,SACE,6BAAC,YAAD,eACMH,IADN;AAEE,IAAA,GAAG,EAAEC,GAFP;AAGE,IAAA,eAAe,EAAE,CAACC,QAHpB;AAIE,IAAA,cAAc,EACZ,4DACE,6BAAC,4BAAD;AACE,MAAA,aAAa,EAAEC,WADjB;AAEE,MAAA,QAAQ,EAAED,QAFZ;AAGE,MAAA,MAAM,EAAC;AAHT,MADF,EAMGH,cANH;AALJ,KADF;AAiBD,CApBiD,CAApD;;AAuBAH,aAAa,CAACQ,WAAd,GAA4B,eAA5B;eAEeR,a","sourcesContent":["import { InputPasswordIcon } from '@tecsinapse/react-core';\nimport React, { FC, useState } from 'react';\nimport { Input, InputNativeProps } from '../../atoms/Input';\n\nexport type InputPasswordNativeProps = InputNativeProps;\n\nconst InputPassword: FC<InputPasswordNativeProps> = React.forwardRef(\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"],"file":"InputPassword.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/InputPassword/InputPassword.tsx"],"names":["InputPassword","React","forwardRef","rightComponent","rest","ref","revealed","setRevealed","displayName"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,aAA2C,GAAGC,eAAMC,UAAN,CAClD,CAAC;AAAEC,EAAAA,cAAF;AAAkB,KAAGC;AAArB,CAAD,EAA8BC,GAA9B,KAAsC;AACpC,QAAM,CAACC,QAAD,EAAWC,WAAX,IAA0B,qBAAS,KAAT,CAAhC;AACA,SACE,6BAAC,YAAD,eACMH,IADN;AAEE,IAAA,GAAG,EAAEC,GAFP;AAGE,IAAA,eAAe,EAAE,CAACC,QAHpB;AAIE,IAAA,cAAc,EACZ,4DACE,6BAAC,4BAAD;AACE,MAAA,aAAa,EAAEC,WADjB;AAEE,MAAA,QAAQ,EAAED,QAFZ;AAGE,MAAA,MAAM,EAAC;AAHT,MADF,EAMGH,cANH;AALJ,KADF;AAiBD,CApBiD,CAApD;;AAuBAH,aAAa,CAACQ,WAAd,GAA4B,eAA5B;eAEeR,a","sourcesContent":["import { InputPasswordIcon } from '@tecsinapse/react-core';\nimport React, { FC, useState } from 'react';\nimport { Input, InputNativeProps } from '../../atoms/Input';\n\nexport type InputPasswordNativeProps = InputNativeProps;\n\nconst InputPassword: FC<InputPasswordNativeProps> = React.forwardRef(\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"],"file":"InputPassword.js"}
@@ -1,23 +1,13 @@
1
1
  "use strict";
2
2
 
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
- });
3
+ exports.__esModule = true;
4
+ exports.InputPasswordNativeProps = exports.InputPassword = void 0;
18
5
 
19
6
  var _InputPassword = _interopRequireWildcard(require("./InputPassword"));
20
7
 
8
+ exports.InputPassword = _InputPassword.default;
9
+ exports.InputPasswordNativeProps = _InputPassword.InputPasswordNativeProps;
10
+
21
11
  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
12
 
23
13
  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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export {\n default as InputPassword,\n InputPasswordNativeProps,\n} from './InputPassword';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/InputPassword/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export {\n default as InputPassword,\n InputPasswordNativeProps,\n} from './InputPassword';\n"],"file":"index.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.Modal = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -60,7 +58,7 @@ const Component = ({
60
58
  }, [value, focused, setSelectedValues]);
61
59
 
62
60
  const getData = options => {
63
- return options === null || options === void 0 ? void 0 : options.map((option, index) => ({ ...option,
61
+ return options == null ? void 0 : options.map((option, index) => ({ ...option,
64
62
  _checked: type === 'multi' ? !!selectedValues.find(value => keyExtractor(option, index) == keyExtractor(value, index)) : keyExtractor(selectedValues[0] || {}, index) == keyExtractor(option, index)
65
63
  }));
66
64
  };
@@ -93,7 +91,7 @@ const Component = ({
93
91
 
94
92
  const handleConfirm = () => {
95
93
  onSelect(type === 'single' ? selectedValues[0] : selectedValues);
96
- close === null || close === void 0 ? void 0 : close();
94
+ close == null ? void 0 : close();
97
95
  };
98
96
 
99
97
  const headerContent = selectModalTitleComponent ? selectModalTitleComponent : selectModalTitle ? React.createElement(_Text.Text, {
@@ -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","map","option","index","_checked","find","data","handlePressItem","newArr","found","push","handleConfirm","headerContent","onPress","icon","name","fontColor","text","item","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AASA,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,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AAA3C,OACG9B,cAAc,CAAC4C,IAAD,CADjB,CALF,CADD,GAWC,oBAAC,sBAAD;AACE,MAAA,KAAK,EAAE,SADT;AAEE,MAAA,aAAa,EAAE,OAFjB;AAGE,MAAA,OAAO,EAAEA,IAAI,CAACd;AAHhB,OAKE,oBAAC,UAAD;AAAM,MAAA,UAAU,EAAEc,IAAI,CAACd,QAAL,GAAgB,MAAhB,GAAyB;AAA3C,OACG9B,cAAc,CAAC4C,IAAD,CADjB,CALF,CAZJ,CADF;AALJ,IA/BJ,EAgEM,CAACpB,YAAD,IAAiB,oBAAC,mBAAD,QACjB,oBAAC,cAAD;AACE,IAAA,OAAO,EAAE,QADX;AAEE,IAAA,KAAK,EAAE,SAFT;AAGE,IAAA,OAAO,EAAEa,aAHX;AAIE,IAAA,QAAQ,EAAEzB;AAJZ,KAME,oBAAC,UAAD;AAAM,IAAA,SAAS,EAAE,OAAjB;AAA0B,IAAA,UAAU,EAAC;AAArC,KACGD,iBADH,CANF,CADiB,CAhEvB,CADF;AA+ED,CAzKD;;AA2KO,MAAMkC,KAAK,GAAGhD,SAAd","sourcesContent":["import { Checkbox, getStatusBarHeight, RadioButton, useDebouncedState } from '@tecsinapse/react-core';\nimport * as React from 'react';\nimport { FlatList, StatusBar, 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, getStyledModal, ListItem, ModalFooter, SearchBarContainer,\n SelectIcon\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(() => getStyledModal(getStatusBarHeight(true)), [])\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 = (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 };\n\n const data = typeof options !== 'function' ? getData(options) : [];\n\n const handlePressItem = (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\n React.useEffect(() => {\n if (_closeOnPick && selectedValues[0] && (selectedValues[0] !== value)) {\n handleConfirm()\n }\n }, [selectedValues[0], value, closeOnPick])\n\n const handleConfirm = () => {\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 };\n\n const headerContent = selectModalTitleComponent ? (\n selectModalTitleComponent\n ) : selectModalTitle ? (\n <Text typography=\"h4\" fontWeight=\"bold\">\n {selectModalTitle}\n </Text>\n ) : null;\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 <FlatList\n data={data}\n keyExtractor={keyExtractor}\n fadingEdgeLength={200}\n renderItem={({ item }) => (\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 {labelExtractor(item)}\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 {labelExtractor(item)}\n </Text>\n </RadioButton>\n )}\n </View>\n </ListItem>\n )}\n />\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\nexport const Modal = Component;\n"],"file":"Modal.js"}
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","map","option","index","_checked","find","data","handlePressItem","newArr","found","push","handle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BAAC,UAAD;AAAM,IAAA,SAAS,EAAE,OAAjB;AAA0B,IAAA,UAAU,EAAC;AAArC,KACGD,iBADH,CANF,CADiB,CAhEvB,CADF;AA+ED,CAzKD;;AA2KO,MAAMkC,KAAK,GAAGhD,SAAd","sourcesContent":["import { Checkbox, getStatusBarHeight, RadioButton, useDebouncedState } from '@tecsinapse/react-core';\nimport * as React from 'react';\nimport { FlatList, StatusBar, 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, getStyledModal, ListItem, ModalFooter, SearchBarContainer,\n SelectIcon\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(() => getStyledModal(getStatusBarHeight(true)), [])\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 = (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 };\n\n const data = typeof options !== 'function' ? getData(options) : [];\n\n const handlePressItem = (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\n React.useEffect(() => {\n if (_closeOnPick && selectedValues[0] && (selectedValues[0] !== value)) {\n handleConfirm()\n }\n }, [selectedValues[0], value, closeOnPick])\n\n const handleConfirm = () => {\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 };\n\n const headerContent = selectModalTitleComponent ? (\n selectModalTitleComponent\n ) : selectModalTitle ? (\n <Text typography=\"h4\" fontWeight=\"bold\">\n {selectModalTitle}\n </Text>\n ) : null;\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 <FlatList\n data={data}\n keyExtractor={keyExtractor}\n fadingEdgeLength={200}\n renderItem={({ item }) => (\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 {labelExtractor(item)}\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 {labelExtractor(item)}\n </Text>\n </RadioButton>\n )}\n </View>\n </ListItem>\n )}\n />\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\nexport const Modal = Component;\n"],"file":"Modal.js"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
6
  var _reactCore = require("@tecsinapse/react-core");
@@ -120,11 +118,11 @@ function Select({
120
118
  const getDisplayValue = () => {
121
119
  if (Array.isArray(value)) {
122
120
  if (value.length === 0) return placeholder;else {
123
- return selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.reduce((acc, option, index) => value.find(key => keyExtractor(option, index) == keyExtractor(key, index)) ? acc + labelExtractor(option) + ', ' : acc, '').slice(0, -2);
121
+ return selectOptions == null ? void 0 : selectOptions.reduce((acc, option, index) => value.find(key => keyExtractor(option, index) == keyExtractor(key, index)) ? acc + labelExtractor(option) + ', ' : acc, '').slice(0, -2);
124
122
  }
125
123
  } else {
126
124
  if (value === undefined) return placeholder;
127
- const selectedOption = selectOptions === null || selectOptions === void 0 ? void 0 : selectOptions.find((option, index) => keyExtractor(option, index) == keyExtractor(value, index));
125
+ const selectedOption = selectOptions == null ? void 0 : selectOptions.find((option, index) => keyExtractor(option, index) == keyExtractor(value, index));
128
126
  return selectedOption ? labelExtractor(selectedOption) : placeholder;
129
127
  }
130
128
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/Select/Select.tsx"],"names":["Select","value","options","keyExtractor","groupKeyExtractor","onSelect","type","labelExtractor","placeholder","onFocus","onBlur","disabled","onSearch","selectModalTitle","selectModalTitleComponent","searchBarPlaceholder","hideSearchBar","confirmButtonText","rightComponent","variant","hintComponent","hint","style","controlComponent","closeOnPick","rest","focused","handleBlur","handleFocus","selectOptions","setSelectOptions","modal","loading","setLoading","handleLazyFocus","result","find","v","e","handleOnSearch","React","useCallback","searchInput","undefined","length","selectedValues","filter","current","requestUpdate","getDisplayValue","Array","isArray","reduce","acc","option","index","key","slice","selectedOption","sync","handlePressInput","show","Text"],"mappings":";;;;;;;AAAA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;AAkCA,SAASA,MAAT,CAAuD;AAErDC,EAAAA,KAFqD;AAGrDC,EAAAA,OAHqD;AAIrDC,EAAAA,YAJqD;AAKrDC,EAAAA,iBALqD;AAMrDC,EAAAA,QANqD;AAOrDC,EAAAA,IAPqD;AAQrDC,EAAAA,cARqD;AASrDC,EAAAA,WATqD;AAUrDC,EAAAA,OAVqD;AAWrDC,EAAAA,MAXqD;AAYrDC,EAAAA,QAZqD;AAarDC,EAAAA,QAbqD;AAcrDC,EAAAA,gBAdqD;AAerDC,EAAAA,yBAfqD;AAgBrDC,EAAAA,oBAhBqD;AAiBrDC,EAAAA,aAjBqD;AAkBrDC,EAAAA,iBAlBqD;AAmBrDC,EAAAA,cAnBqD;AAoBrDC,EAAAA,OAAO,GAAG,SApB2C;AAqBrDC,EAAAA,aArBqD;AAsBrDC,EAAAA,IAtBqD;AAuBrDC,EAAAA,KAvBqD;AAwBrDC,EAAAA,gBAxBqD;AAyBrDC,EAAAA,WAAW,GAAGlB,IAAI,KAAK,QAzB8B;AA0BrD,KAAGmB;AA1BkD,CAAvD,EA2B+C;AAC7C,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC,8BAC3CnB,OAD2C,EAE3CC,MA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core';\nimport * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { Modal } from './Modal';\nimport { SelectIcon, StyledSelectionText } from './styled';\n\nexport interface SelectNativeProps<Data, Type extends 'single' | 'multi'>\n extends Omit<InputContainerProps, 'value' | 'onChange' | 'onChangeText'> {\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\n keyExtractor: (t: Data, index?: number) => string;\n labelExtractor: (t: Data) => string;\n groupKeyExtractor?: (t: Data) => string;\n\n hideSearchBar?: boolean;\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n onSearch?:\n | ((searchArg: string) => void)\n | ((searchInput?: string) => Promise<Data[]>)\n | never;\n searchBarPlaceholder?: string;\n confirmButtonText?: string;\n selectModalTitle?: string;\n selectModalTitleComponent?: JSX.Element;\n closeOnPick?: boolean;\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n}\n\nfunction Select<Data, Type extends 'single' | 'multi'>({\n /** Select props */\n value,\n options,\n keyExtractor,\n groupKeyExtractor,\n onSelect,\n type,\n labelExtractor,\n placeholder,\n onFocus,\n onBlur,\n disabled,\n onSearch,\n selectModalTitle,\n selectModalTitleComponent,\n searchBarPlaceholder,\n hideSearchBar,\n confirmButtonText,\n rightComponent,\n variant = 'default',\n hintComponent,\n hint,\n style,\n controlComponent,\n closeOnPick = type === 'single',\n ...rest\n}: SelectNativeProps<Data, Type>): JSX.Element {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [selectOptions, setSelectOptions] = useState<Data[]>([]);\n const modal = useLazyModalManager();\n\n // TODO: Add Skeleton to modal height when loading is true\n const [loading, setLoading] = useState<boolean>(false);\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n useEffect(() => {\n if (typeof options === 'function') {\n if (value) {\n if (type === 'single') setSelectOptions([value as Data]);\n else setSelectOptions([...(value as Data[])]);\n } else setSelectOptions([]);\n }\n }, [value]);\n\n const handleLazyFocus = async () => {\n if (typeof options === 'function') {\n setLoading(true);\n try {\n const result = await options();\n if (result) {\n if (\n value &&\n !result.find(v => keyExtractor(value as Data) === keyExtractor(v))\n ) {\n setSelectOptions([value as Data, ...result]);\n } else setSelectOptions(result);\n }\n } catch (e) {\n // TODO: Catch error\n } finally {\n setLoading(false);\n }\n }\n };\n\n const handleOnSearch = React.useCallback(\n async (searchInput: string | undefined) => {\n if (searchInput !== undefined && onSearch) {\n setLoading(true);\n try {\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 } finally {\n modal.requestUpdate();\n setLoading(false);\n }\n }\n },\n [options, value, keyExtractor]\n );\n\n const getDisplayValue = () => {\n if (Array.isArray(value)) {\n if (value.length === 0) return placeholder;\n else {\n return selectOptions\n ?.reduce(\n (acc, option, index) =>\n value.find(\n key => keyExtractor(option, index) == keyExtractor(key, index)\n )\n ? acc + labelExtractor(option) + ', '\n : acc,\n ''\n )\n .slice(0, -2);\n }\n } else {\n if (value === undefined) return placeholder;\n const selectedOption = selectOptions?.find(\n (option, index) =>\n keyExtractor(option, index) == keyExtractor(value as Data, index)\n );\n return selectedOption ? labelExtractor(selectedOption) : placeholder;\n }\n };\n\n modal.sync(\n <Modal\n options={selectOptions || []}\n focused={true}\n keyExtractor={keyExtractor}\n labelExtractor={labelExtractor}\n groupKeyExtractor={groupKeyExtractor}\n searchBarPlaceholder={searchBarPlaceholder}\n type={type}\n onSelect={onSelect}\n value={value}\n hideSearchBar={hideSearchBar}\n onSearch={handleOnSearch}\n selectModalTitle={selectModalTitle}\n selectModalTitleComponent={selectModalTitleComponent}\n confirmButtonText={confirmButtonText}\n loading={loading}\n onClose={handleBlur}\n closeOnPick={closeOnPick}\n />\n );\n\n const handlePressInput = async () => {\n modal.show();\n handleFocus();\n await handleLazyFocus();\n };\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, getDisplayValue() || '')\n ) : (\n <HintInputContainer\n viewStyle={style}\n onPress={handlePressInput}\n focused={focused}\n disabled={disabled}\n LabelComponent={Text}\n variant={variant}\n hint={hint}\n hintComponent={hintComponent}\n rightComponent={\n <>\n <SelectIcon name=\"chevron-down\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledSelectionText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledSelectionText>\n </HintInputContainer>\n )}\n </>\n );\n}\n\nexport default Select;\n"],"file":"Select.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/Select/Select.tsx"],"names":["Select","value","options","keyExtractor","groupKeyExtractor","onSelect","type","labelExtractor","placeholder","onFocus","onBlur","disabled","onSearch","selectModalTitle","selectModalTitleComponent","searchBarPlaceholder","hideSearchBar","confirmButtonText","rightComponent","variant","hintComponent","hint","style","controlComponent","closeOnPick","rest","focused","handleBlur","handleFocus","selectOptions","setSelectOptions","modal","loading","setLoading","handleLazyFocus","result","find","v","e","handleOnSearch","React","useCallback","searchInput","undefined","length","selectedValues","filter","current","requestUpdate","getDisplayValue","Array","isArray","reduce","acc","option","index","key","slice","selectedOption","sync","handlePressInput","show","Text"],"mappings":";;;;;AAAA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;AAkCA,SAASA,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ACE,0CACGX,gBAAgB,GACfA,gBAAgB,CAACqC,gBAAD,EAAmBX,eAAe,MAAM,EAAxC,CADD,GAGf,oBAAC,6BAAD;AACE,IAAA,SAAS,EAAE3B,KADb;AAEE,IAAA,OAAO,EAAEsC,gBAFX;AAGE,IAAA,OAAO,EAAElC,OAHX;AAIE,IAAA,QAAQ,EAAEf,QAJZ;AAKE,IAAA,cAAc,EAAEmD,UALlB;AAME,IAAA,OAAO,EAAE3C,OANX;AAOE,IAAA,IAAI,EAAEE,IAPR;AAQE,IAAA,aAAa,EAAED,aARjB;AASE,IAAA,cAAc,EACZ,0CACE,oBAAC,kBAAD;AAAY,MAAA,IAAI,EAAC,cAAjB;AAAgC,MAAA,IAAI,EAAC,SAArC;AAA+C,MAAA,IAAI,EAAC;AAApD,MADF,EAEGF,cAFH;AAVJ,KAeMO,IAfN,GAiBE,oBAAC,2BAAD;AAAqB,IAAA,UAAU,EAAC,MAAhC;AAAuC,IAAA,QAAQ,EAAEd;AAAjD,KACGsC,eAAe,MAAM,GADxB,CAjBF,CAJJ,CADF;AA6BD;;eAEcjD,M","sourcesContent":["import {\n HintInputContainer,\n InputContainerProps,\n useInputFocus,\n} from '@tecsinapse/react-core';\nimport * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { useLazyModalManager } from '../../atoms/Modal';\nimport { Text } from '../../atoms/Text';\nimport { Modal } from './Modal';\nimport { SelectIcon, StyledSelectionText } from './styled';\n\nexport interface SelectNativeProps<Data, Type extends 'single' | 'multi'>\n extends Omit<InputContainerProps, 'value' | 'onChange' | 'onChangeText'> {\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\n keyExtractor: (t: Data, index?: number) => string;\n labelExtractor: (t: Data) => string;\n groupKeyExtractor?: (t: Data) => string;\n\n hideSearchBar?: boolean;\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n onSearch?:\n | ((searchArg: string) => void)\n | ((searchInput?: string) => Promise<Data[]>)\n | never;\n searchBarPlaceholder?: string;\n confirmButtonText?: string;\n selectModalTitle?: string;\n selectModalTitleComponent?: JSX.Element;\n closeOnPick?: boolean;\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n}\n\nfunction Select<Data, Type extends 'single' | 'multi'>({\n /** Select props */\n value,\n options,\n keyExtractor,\n groupKeyExtractor,\n onSelect,\n type,\n labelExtractor,\n placeholder,\n onFocus,\n onBlur,\n disabled,\n onSearch,\n selectModalTitle,\n selectModalTitleComponent,\n searchBarPlaceholder,\n hideSearchBar,\n confirmButtonText,\n rightComponent,\n variant = 'default',\n hintComponent,\n hint,\n style,\n controlComponent,\n closeOnPick = type === 'single',\n ...rest\n}: SelectNativeProps<Data, Type>): JSX.Element {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [selectOptions, setSelectOptions] = useState<Data[]>([]);\n const modal = useLazyModalManager();\n\n // TODO: Add Skeleton to modal height when loading is true\n const [loading, setLoading] = useState<boolean>(false);\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n useEffect(() => {\n if (typeof options === 'function') {\n if (value) {\n if (type === 'single') setSelectOptions([value as Data]);\n else setSelectOptions([...(value as Data[])]);\n } else setSelectOptions([]);\n }\n }, [value]);\n\n const handleLazyFocus = async () => {\n if (typeof options === 'function') {\n setLoading(true);\n try {\n const result = await options();\n if (result) {\n if (\n value &&\n !result.find(v => keyExtractor(value as Data) === keyExtractor(v))\n ) {\n setSelectOptions([value as Data, ...result]);\n } else setSelectOptions(result);\n }\n } catch (e) {\n // TODO: Catch error\n } finally {\n setLoading(false);\n }\n }\n };\n\n const handleOnSearch = React.useCallback(\n async (searchInput: string | undefined) => {\n if (searchInput !== undefined && onSearch) {\n setLoading(true);\n try {\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 } finally {\n modal.requestUpdate();\n setLoading(false);\n }\n }\n },\n [options, value, keyExtractor]\n );\n\n const getDisplayValue = () => {\n if (Array.isArray(value)) {\n if (value.length === 0) return placeholder;\n else {\n return selectOptions\n ?.reduce(\n (acc, option, index) =>\n value.find(\n key => keyExtractor(option, index) == keyExtractor(key, index)\n )\n ? acc + labelExtractor(option) + ', '\n : acc,\n ''\n )\n .slice(0, -2);\n }\n } else {\n if (value === undefined) return placeholder;\n const selectedOption = selectOptions?.find(\n (option, index) =>\n keyExtractor(option, index) == keyExtractor(value as Data, index)\n );\n return selectedOption ? labelExtractor(selectedOption) : placeholder;\n }\n };\n\n modal.sync(\n <Modal\n options={selectOptions || []}\n focused={true}\n keyExtractor={keyExtractor}\n labelExtractor={labelExtractor}\n groupKeyExtractor={groupKeyExtractor}\n searchBarPlaceholder={searchBarPlaceholder}\n type={type}\n onSelect={onSelect}\n value={value}\n hideSearchBar={hideSearchBar}\n onSearch={handleOnSearch}\n selectModalTitle={selectModalTitle}\n selectModalTitleComponent={selectModalTitleComponent}\n confirmButtonText={confirmButtonText}\n loading={loading}\n onClose={handleBlur}\n closeOnPick={closeOnPick}\n />\n );\n\n const handlePressInput = async () => {\n modal.show();\n handleFocus();\n await handleLazyFocus();\n };\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, getDisplayValue() || '')\n ) : (\n <HintInputContainer\n viewStyle={style}\n onPress={handlePressInput}\n focused={focused}\n disabled={disabled}\n LabelComponent={Text}\n variant={variant}\n hint={hint}\n hintComponent={hintComponent}\n rightComponent={\n <>\n <SelectIcon name=\"chevron-down\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledSelectionText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledSelectionText>\n </HintInputContainer>\n )}\n </>\n );\n}\n\nexport default Select;\n"],"file":"Select.js"}