@tecsinapse/react-native-kit 1.18.4 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/components/atoms/Button/Button.d.ts +2 -2
  3. package/dist/components/atoms/Button/Button.js.map +1 -1
  4. package/dist/components/molecules/Grid/Grid.d.ts +5 -0
  5. package/dist/components/molecules/Grid/Grid.js +57 -0
  6. package/dist/components/molecules/Grid/Grid.js.map +1 -0
  7. package/dist/components/molecules/Grid/Item/Item.d.ts +7 -0
  8. package/dist/components/molecules/Grid/Item/Item.js +78 -0
  9. package/dist/components/molecules/Grid/Item/Item.js.map +1 -0
  10. package/dist/components/molecules/Grid/Item/index.d.ts +1 -0
  11. package/dist/components/molecules/Grid/Item/index.js +14 -0
  12. package/dist/components/molecules/Grid/Item/index.js.map +1 -0
  13. package/dist/components/molecules/Grid/index.d.ts +2 -0
  14. package/dist/components/molecules/Grid/index.js +15 -0
  15. package/dist/components/molecules/Grid/index.js.map +1 -0
  16. package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +6 -0
  17. package/dist/components/molecules/IconTextButton/IconTextButton.js +50 -0
  18. package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
  19. package/dist/components/molecules/IconTextButton/TextComponent.d.ts +12 -0
  20. package/dist/components/molecules/IconTextButton/TextComponent.js +34 -0
  21. package/dist/components/molecules/IconTextButton/TextComponent.js.map +1 -0
  22. package/dist/components/molecules/IconTextButton/index.d.ts +1 -0
  23. package/dist/components/molecules/IconTextButton/index.js +14 -0
  24. package/dist/components/molecules/IconTextButton/index.js.map +1 -0
  25. package/dist/components/molecules/IconTextButton/styled.d.ts +2 -0
  26. package/dist/components/molecules/IconTextButton/styled.js +46 -0
  27. package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
  28. package/dist/components/molecules/LabeledSwitch/LabelComponent.d.ts +13 -0
  29. package/dist/components/molecules/LabeledSwitch/LabelComponent.js +36 -0
  30. package/dist/components/molecules/LabeledSwitch/LabelComponent.js.map +1 -0
  31. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +8 -0
  32. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +53 -0
  33. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
  34. package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
  35. package/dist/components/molecules/LabeledSwitch/index.js +14 -0
  36. package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
  37. package/dist/components/molecules/LabeledSwitch/styled.d.ts +9 -0
  38. package/dist/components/molecules/LabeledSwitch/styled.js +35 -0
  39. package/dist/components/molecules/LabeledSwitch/styled.js.map +1 -0
  40. package/dist/components/molecules/Select/Select.js +2 -2
  41. package/dist/components/molecules/Select/Select.js.map +1 -1
  42. package/dist/index.d.ts +17 -14
  43. package/dist/index.js +112 -91
  44. package/dist/index.js.map +1 -1
  45. package/package.json +5 -5
  46. package/src/components/atoms/Button/Button.tsx +19 -13
  47. package/src/components/molecules/Grid/Grid.tsx +68 -0
  48. package/src/components/molecules/Grid/Item/Item.tsx +77 -0
  49. package/src/components/molecules/Grid/Item/index.ts +1 -0
  50. package/src/components/molecules/Grid/index.ts +2 -0
  51. package/src/components/molecules/IconTextButton/IconTextButton.tsx +55 -0
  52. package/src/components/molecules/IconTextButton/TextComponent.tsx +43 -0
  53. package/src/components/molecules/IconTextButton/index.ts +4 -0
  54. package/src/components/molecules/IconTextButton/styled.ts +35 -0
  55. package/src/components/molecules/LabeledSwitch/LabelComponent.tsx +46 -0
  56. package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +59 -0
  57. package/src/components/molecules/LabeledSwitch/index.ts +4 -0
  58. package/src/components/molecules/LabeledSwitch/styled.ts +27 -0
  59. package/src/components/molecules/Select/Select.tsx +2 -2
  60. package/src/index.ts +38 -29
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.LabeledSwitchNativeProps = exports.LabeledSwitch = void 0;
5
+
6
+ var _LabeledSwitch = _interopRequireWildcard(require("./LabeledSwitch"));
7
+
8
+ exports.LabeledSwitch = _LabeledSwitch.default;
9
+ exports.LabeledSwitchNativeProps = _LabeledSwitch.LabeledSwitchNativeProps;
10
+
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); }
12
+
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; }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export {\n default as LabeledSwitch,\n LabeledSwitchNativeProps,\n} from './LabeledSwitch';\n"],"file":"index.js"}
@@ -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,35 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.StyledLabel = exports.StyledView = void 0;
5
+
6
+ var _native = _interopRequireWildcard(require("@emotion/native"));
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _Text = require("../../atoms/Text");
11
+
12
+ 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); }
13
+
14
+ 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
+
16
+ const StyledView = (0, _native.default)(_reactNative.View)`
17
+ display: flex;
18
+ flex-direction: row;
19
+ align-items: center;
20
+ `;
21
+ exports.StyledView = StyledView;
22
+ const StyledLabel = (0, _native.default)(_Text.Text)`
23
+ ${({
24
+ theme,
25
+ labelPosition
26
+ }) => {
27
+ if (labelPosition === 'right') return (0, _native.css)`
28
+ margin-left: ${theme == null ? void 0 : theme.spacing.centi};
29
+ `;else if (labelPosition === 'left') return (0, _native.css)`
30
+ margin-right: ${theme == null ? void 0 : theme.spacing.centi};
31
+ `;
32
+ }}
33
+ `;
34
+ exports.StyledLabel = StyledLabel;
35
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/LabeledSwitch/styled.ts"],"names":["StyledView","View","StyledLabel","Text","theme","labelPosition","spacing","centi"],"mappings":";;;;;AAAA;;AAEA;;AACA;;;;;;AAEO,MAAMA,UAAU,GAAG,qBAAOC,iBAAP,CAAa;AACvC;AACA;AACA;AACA,CAJO;;AAMA,MAAMC,WAAW,GAAG,qBAAOC,UAAP,CAIzB;AACF,IAAI,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KAA8B;AAC9B,MAAIA,aAAa,KAAK,OAAtB,EACE,OAAO,gBAAI;AACjB,uBAAuBD,KADP,oBACOA,KAAK,CAAEE,OAAP,CAAeC,KAAM;AAC5C,OAFM,CADF,KAIK,IAAIF,aAAa,KAAK,MAAtB,EACH,OAAO,gBAAI;AACjB,wBAAwBD,KADR,oBACQA,KAAK,CAAEE,OAAP,CAAeC,KAAM;AAC7C,OAFM;AAGH,CAAC;AACJ,CAfO","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"],"file":"styled.js"}
@@ -117,11 +117,11 @@ function Select({
117
117
  const getDisplayValue = React.useCallback(() => {
118
118
  if (Array.isArray(value)) {
119
119
  if (value.length === 0) return _placeholder;else {
120
- let options = selectOptions.length > 0 ? selectOptions : value;
120
+ const options = selectOptions.length > 0 ? selectOptions : value;
121
121
  return options == null ? void 0 : options.reduce((acc, option, index) => value.find(key => keyExtractor(option, index) == keyExtractor(key, index)) ? acc + labelExtractor(option) + ', ' : acc, '').slice(0, -2);
122
122
  }
123
123
  } else {
124
- if (value === undefined) return _placeholder;
124
+ if (!value) return _placeholder;
125
125
  const selectedOption = selectOptions == null ? void 0 : selectOptions.find((option, index) => keyExtractor(option, index) == keyExtractor(value, index));
126
126
  return labelExtractor(selectedOption ?? value);
127
127
  }
@@ -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","label","numberOfLines","rest","focused","handleBlur","handleFocus","selectOptions","setSelectOptions","modal","loading","setLoading","onlyLabel","hasValue","length","_placeholder","_label","undefined","handleLazyFocus","React","useCallback","result","find","v","e","handleOnSearch","searchInput","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;;;;;;;;AAmCA,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,EA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AACE,IAAA,SAAS,EAAEjC,KADb;AAEE,IAAA,OAAO,EAAE4C,gBAFX;AAGE,IAAA,OAAO,EAAEtC,OAHX;AAIE,IAAA,QAAQ,EAAEjB,QAJZ;AAKE,IAAA,cAAc,EAAEyD,UALlB;AAME,IAAA,OAAO,EAAEjD,OANX;AAOE,IAAA,IAAI,EAAEE,IAPR;AAQE,IAAA,aAAa,EAAED,aARjB;AASE,IAAA,KAAK,EAAEoB,MATT;AAUE,IAAA,cAAc,EACZ,0CACE,oBAAC,kBAAD;AAAY,MAAA,IAAI,EAAC,cAAjB;AAAgC,MAAA,IAAI,EAAC,SAArC;AAA+C,MAAA,IAAI,EAAC;AAApD,MADF,EAEGtB,cAFH;AAXJ,KAgBMS,IAhBN,GAkBE,oBAAC,2BAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,UAAU,EAAC,MAFb;AAGE,IAAA,QAAQ,EAAEf;AAHZ,KAKG4C,eAAe,MAAM,GALxB,CAlBF,CAJJ,CADF;AAkCD;;eAEcvD,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 | null | 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 numberOfLines?: number;\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 label,\n numberOfLines,\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 const onlyLabel = label && !placeholder;\n const hasValue =\n type === 'single' ? !!value : ((value || []) as []).length > 0;\n const _placeholder = onlyLabel ? label : placeholder;\n const _label = hasValue ? label : undefined;\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n const handleLazyFocus = React.useCallback(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 }, [options, value, setSelectOptions]);\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 = React.useCallback(() => {\n if (Array.isArray(value)) {\n if (value.length === 0) return _placeholder;\n else {\n let options =\n selectOptions.length > 0 ? selectOptions : (value as Data[]);\n return options\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 labelExtractor(selectedOption ?? (value as Data));\n }\n }, [_placeholder, value, selectOptions]);\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 label={_label}\n rightComponent={\n <>\n <SelectIcon name=\"chevron-down\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledSelectionText\n numberOfLines={numberOfLines}\n fontWeight=\"bold\"\n disabled={disabled}\n >\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","label","numberOfLines","rest","focused","handleBlur","handleFocus","selectOptions","setSelectOptions","modal","loading","setLoading","onlyLabel","hasValue","length","_placeholder","_label","undefined","handleLazyFocus","React","useCallback","result","find","v","e","handleOnSearch","searchInput","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;;;;;;;;AAmCA,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,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gB,CAAC2C,gBAAD,EAAmBX,eAAe,MAAM,EAAxC,CADD,GAGf,oBAAC,6BAAD;AACE,IAAA,SAAS,EAAEjC,KADb;AAEE,IAAA,OAAO,EAAE4C,gBAFX;AAGE,IAAA,OAAO,EAAEtC,OAHX;AAIE,IAAA,QAAQ,EAAEjB,QAJZ;AAKE,IAAA,cAAc,EAAEyD,UALlB;AAME,IAAA,OAAO,EAAEjD,OANX;AAOE,IAAA,IAAI,EAAEE,IAPR;AAQE,IAAA,aAAa,EAAED,aARjB;AASE,IAAA,KAAK,EAAEoB,MATT;AAUE,IAAA,cAAc,EACZ,0CACE,oBAAC,kBAAD;AAAY,MAAA,IAAI,EAAC,cAAjB;AAAgC,MAAA,IAAI,EAAC,SAArC;AAA+C,MAAA,IAAI,EAAC;AAApD,MADF,EAEGtB,cAFH;AAXJ,KAgBMS,IAhBN,GAkBE,oBAAC,2BAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,UAAU,EAAC,MAFb;AAGE,IAAA,QAAQ,EAAEf;AAHZ,KAKG4C,eAAe,MAAM,GALxB,CAlBF,CAJJ,CADF;AAkCD;;eAEcvD,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 | null | 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 numberOfLines?: number;\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 label,\n numberOfLines,\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 const onlyLabel = label && !placeholder;\n const hasValue =\n type === 'single' ? !!value : ((value || []) as []).length > 0;\n const _placeholder = onlyLabel ? label : placeholder;\n const _label = hasValue ? label : undefined;\n\n useEffect(() => {\n if (typeof options !== 'function') {\n setSelectOptions(options);\n }\n }, [options]);\n\n const handleLazyFocus = React.useCallback(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 }, [options, value, setSelectOptions]);\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 = React.useCallback(() => {\n if (Array.isArray(value)) {\n if (value.length === 0) return _placeholder;\n else {\n const options =\n selectOptions.length > 0 ? selectOptions : (value as Data[]);\n return options\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) return _placeholder;\n const selectedOption = selectOptions?.find(\n (option, index) =>\n keyExtractor(option, index) == keyExtractor(value as Data, index)\n );\n return labelExtractor(selectedOption ?? (value as Data));\n }\n }, [_placeholder, value, selectOptions]);\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 label={_label}\n rightComponent={\n <>\n <SelectIcon name=\"chevron-down\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledSelectionText\n numberOfLines={numberOfLines}\n fontWeight=\"bold\"\n disabled={disabled}\n >\n {getDisplayValue() || ' '}\n </StyledSelectionText>\n </HintInputContainer>\n )}\n </>\n );\n}\n\nexport default Select;\n"],"file":"Select.js"}
package/dist/index.d.ts CHANGED
@@ -1,22 +1,25 @@
1
1
  export * from '@tecsinapse/react-core';
2
+ export { Avatar } from './components/atoms/Avatar';
3
+ export { Badge, BadgeNativeProps } from './components/atoms/Badge';
4
+ export { BottomNavigator, BottomNavigatorProps, } from './components/atoms/BottomNavigator';
5
+ export { Button, ButtonNativeProps, Error, Loading, Success, } from './components/atoms/Button';
6
+ export { GroupButtonOption } from './components/atoms/GroupButton';
2
7
  export { Header, HeaderProps } from './components/atoms/Header';
3
- export { Select, SelectNativeProps } from './components/molecules/Select';
4
8
  export { Input, InputNativeProps } from './components/atoms/Input';
5
9
  export { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';
6
- export { TextArea, TextAreaProps } from './components/atoms/TextArea';
7
- export { Text, TextNativeProps } from './components/atoms/Text';
8
- export { Error, Loading, Success, Button, ButtonNativeProps, } from './components/atoms/Button';
9
- export { GroupButtonOption } from './components/atoms/GroupButton';
10
- export { InputPassword, InputPasswordNativeProps, } from './components/molecules/InputPassword';
11
- export { BottomNavigator, BottomNavigatorProps, } from './components/atoms/BottomNavigator';
12
- export { Tag, TagProps } from './components/atoms/Tag';
10
+ export { IBaseModal, ModalGroupManager, ModalLifecycleHandler, ModalView, useLazyModalManager, useModalManager, useModalRemoteControl, } from './components/atoms/Modal';
11
+ export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
13
12
  export { SnappingSlider, SnappingSliderProps, } from './components/atoms/SnappingSlider';
14
- export { Badge, BadgeNativeProps } from './components/atoms/Badge';
15
- export { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';
13
+ export { Tag, TagProps } from './components/atoms/Tag';
14
+ export { Text, TextNativeProps } from './components/atoms/Text';
15
+ export { TextArea, TextAreaProps } from './components/atoms/TextArea';
16
+ export { Calendar } from './components/molecules/Calendar';
16
17
  export { DatePicker, NativeDatePickerProps, } from './components/molecules/DatePicker';
17
18
  export { DateTimePicker, NativeDateTimePickerProps, } from './components/molecules/DateTimePicker';
18
- export { Avatar } from './components/atoms/Avatar';
19
- export { Calendar } from './components/molecules/Calendar';
20
19
  export { DateTimeSelector } from './components/molecules/DateTimeSelector';
21
- export { ModalGroupManager, ModalView, ModalLifecycleHandler, useLazyModalManager, useModalManager, useModalRemoteControl, IBaseModal, } from './components/atoms/Modal';
22
- export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
20
+ export { IconTextButton, NativeIconTextButtonProps, } from './components/molecules/IconTextButton';
21
+ export { InputPassword, InputPasswordNativeProps, } from './components/molecules/InputPassword';
22
+ export { LabeledSwitch, LabeledSwitchNativeProps, } from './components/molecules/LabeledSwitch';
23
+ export { Select, SelectNativeProps } from './components/molecules/Select';
24
+ export { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';
25
+ export { Grid, GridItem } from './components/molecules/Grid';
package/dist/index.js CHANGED
@@ -2,54 +2,60 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  var _exportNames = {
5
+ Avatar: true,
6
+ Badge: true,
7
+ BadgeNativeProps: true,
8
+ BottomNavigator: true,
9
+ BottomNavigatorProps: true,
10
+ Button: true,
11
+ ButtonNativeProps: true,
12
+ Error: true,
13
+ Loading: true,
14
+ Success: true,
15
+ GroupButtonOption: true,
5
16
  Header: true,
6
17
  HeaderProps: true,
7
- Select: true,
8
- SelectNativeProps: true,
9
18
  Input: true,
10
19
  InputNativeProps: true,
11
20
  InputMask: true,
12
21
  InputMaskNativeProps: true,
13
- TextArea: true,
14
- TextAreaProps: true,
15
- Text: true,
16
- TextNativeProps: true,
17
- Error: true,
18
- Loading: true,
19
- Success: true,
20
- Button: true,
21
- ButtonNativeProps: true,
22
- GroupButtonOption: true,
23
- InputPassword: true,
24
- InputPasswordNativeProps: true,
25
- BottomNavigator: true,
26
- BottomNavigatorProps: true,
27
- Tag: true,
28
- TagProps: true,
22
+ IBaseModal: true,
23
+ ModalGroupManager: true,
24
+ ModalLifecycleHandler: true,
25
+ ModalView: true,
26
+ useLazyModalManager: true,
27
+ useModalManager: true,
28
+ useModalRemoteControl: true,
29
+ Skeleton: true,
30
+ SkeletonProps: true,
29
31
  SnappingSlider: true,
30
32
  SnappingSliderProps: true,
31
- Badge: true,
32
- BadgeNativeProps: true,
33
- Snackbar: true,
34
- SnackbarNativeProps: true,
33
+ Tag: true,
34
+ TagProps: true,
35
+ Text: true,
36
+ TextNativeProps: true,
37
+ TextArea: true,
38
+ TextAreaProps: true,
39
+ Calendar: true,
35
40
  DatePicker: true,
36
41
  NativeDatePickerProps: true,
37
42
  DateTimePicker: true,
38
43
  NativeDateTimePickerProps: true,
39
- Avatar: true,
40
- Calendar: true,
41
44
  DateTimeSelector: true,
42
- ModalGroupManager: true,
43
- ModalView: true,
44
- ModalLifecycleHandler: true,
45
- useLazyModalManager: true,
46
- useModalManager: true,
47
- useModalRemoteControl: true,
48
- IBaseModal: true,
49
- Skeleton: true,
50
- SkeletonProps: true
45
+ IconTextButton: true,
46
+ NativeIconTextButtonProps: true,
47
+ InputPassword: true,
48
+ InputPasswordNativeProps: true,
49
+ LabeledSwitch: true,
50
+ LabeledSwitchNativeProps: true,
51
+ Select: true,
52
+ SelectNativeProps: true,
53
+ Snackbar: true,
54
+ SnackbarNativeProps: true,
55
+ Grid: true,
56
+ GridItem: true
51
57
  };
52
- exports.SkeletonProps = exports.Skeleton = exports.IBaseModal = exports.useModalRemoteControl = exports.useModalManager = exports.useLazyModalManager = exports.ModalLifecycleHandler = exports.ModalView = exports.ModalGroupManager = exports.DateTimeSelector = exports.Calendar = exports.Avatar = exports.NativeDateTimePickerProps = exports.DateTimePicker = exports.NativeDatePickerProps = exports.DatePicker = exports.SnackbarNativeProps = exports.Snackbar = exports.BadgeNativeProps = exports.Badge = exports.SnappingSliderProps = exports.SnappingSlider = exports.TagProps = exports.Tag = exports.BottomNavigatorProps = exports.BottomNavigator = exports.InputPasswordNativeProps = exports.InputPassword = exports.GroupButtonOption = exports.ButtonNativeProps = exports.Button = exports.Success = exports.Loading = exports.Error = exports.TextNativeProps = exports.Text = exports.TextAreaProps = exports.TextArea = exports.InputMaskNativeProps = exports.InputMask = exports.InputNativeProps = exports.Input = exports.SelectNativeProps = exports.Select = exports.HeaderProps = exports.Header = void 0;
58
+ exports.GridItem = exports.Grid = exports.SnackbarNativeProps = exports.Snackbar = exports.SelectNativeProps = exports.Select = exports.LabeledSwitchNativeProps = exports.LabeledSwitch = exports.InputPasswordNativeProps = exports.InputPassword = exports.NativeIconTextButtonProps = exports.IconTextButton = exports.DateTimeSelector = exports.NativeDateTimePickerProps = exports.DateTimePicker = exports.NativeDatePickerProps = exports.DatePicker = exports.Calendar = exports.TextAreaProps = exports.TextArea = exports.TextNativeProps = exports.Text = exports.TagProps = exports.Tag = exports.SnappingSliderProps = exports.SnappingSlider = exports.SkeletonProps = exports.Skeleton = exports.useModalRemoteControl = exports.useModalManager = exports.useLazyModalManager = exports.ModalView = exports.ModalLifecycleHandler = exports.ModalGroupManager = exports.IBaseModal = exports.InputMaskNativeProps = exports.InputMask = exports.InputNativeProps = exports.Input = exports.HeaderProps = exports.Header = exports.GroupButtonOption = exports.Success = exports.Loading = exports.Error = exports.ButtonNativeProps = exports.Button = exports.BottomNavigatorProps = exports.BottomNavigator = exports.BadgeNativeProps = exports.Badge = exports.Avatar = void 0;
53
59
 
54
60
  var _reactCore = require("@tecsinapse/react-core");
55
61
 
@@ -60,16 +66,37 @@ Object.keys(_reactCore).forEach(function (key) {
60
66
  exports[key] = _reactCore[key];
61
67
  });
62
68
 
69
+ var _Avatar = require("./components/atoms/Avatar");
70
+
71
+ exports.Avatar = _Avatar.Avatar;
72
+
73
+ var _Badge = require("./components/atoms/Badge");
74
+
75
+ exports.Badge = _Badge.Badge;
76
+ exports.BadgeNativeProps = _Badge.BadgeNativeProps;
77
+
78
+ var _BottomNavigator = require("./components/atoms/BottomNavigator");
79
+
80
+ exports.BottomNavigator = _BottomNavigator.BottomNavigator;
81
+ exports.BottomNavigatorProps = _BottomNavigator.BottomNavigatorProps;
82
+
83
+ var _Button = require("./components/atoms/Button");
84
+
85
+ exports.Button = _Button.Button;
86
+ exports.ButtonNativeProps = _Button.ButtonNativeProps;
87
+ exports.Error = _Button.Error;
88
+ exports.Loading = _Button.Loading;
89
+ exports.Success = _Button.Success;
90
+
91
+ var _GroupButton = require("./components/atoms/GroupButton");
92
+
93
+ exports.GroupButtonOption = _GroupButton.GroupButtonOption;
94
+
63
95
  var _Header = require("./components/atoms/Header");
64
96
 
65
97
  exports.Header = _Header.Header;
66
98
  exports.HeaderProps = _Header.HeaderProps;
67
99
 
68
- var _Select = require("./components/molecules/Select");
69
-
70
- exports.Select = _Select.Select;
71
- exports.SelectNativeProps = _Select.SelectNativeProps;
72
-
73
100
  var _Input = require("./components/atoms/Input");
74
101
 
75
102
  exports.Input = _Input.Input;
@@ -80,57 +107,44 @@ var _InputMask = require("./components/atoms/InputMask");
80
107
  exports.InputMask = _InputMask.InputMask;
81
108
  exports.InputMaskNativeProps = _InputMask.InputMaskNativeProps;
82
109
 
83
- var _TextArea = require("./components/atoms/TextArea");
84
-
85
- exports.TextArea = _TextArea.TextArea;
86
- exports.TextAreaProps = _TextArea.TextAreaProps;
87
-
88
- var _Text = require("./components/atoms/Text");
89
-
90
- exports.Text = _Text.Text;
91
- exports.TextNativeProps = _Text.TextNativeProps;
92
-
93
- var _Button = require("./components/atoms/Button");
94
-
95
- exports.Error = _Button.Error;
96
- exports.Loading = _Button.Loading;
97
- exports.Success = _Button.Success;
98
- exports.Button = _Button.Button;
99
- exports.ButtonNativeProps = _Button.ButtonNativeProps;
100
-
101
- var _GroupButton = require("./components/atoms/GroupButton");
110
+ var _Modal = require("./components/atoms/Modal");
102
111
 
103
- exports.GroupButtonOption = _GroupButton.GroupButtonOption;
112
+ exports.IBaseModal = _Modal.IBaseModal;
113
+ exports.ModalGroupManager = _Modal.ModalGroupManager;
114
+ exports.ModalLifecycleHandler = _Modal.ModalLifecycleHandler;
115
+ exports.ModalView = _Modal.ModalView;
116
+ exports.useLazyModalManager = _Modal.useLazyModalManager;
117
+ exports.useModalManager = _Modal.useModalManager;
118
+ exports.useModalRemoteControl = _Modal.useModalRemoteControl;
104
119
 
105
- var _InputPassword = require("./components/molecules/InputPassword");
120
+ var _Skeleton = require("./components/atoms/Skeleton");
106
121
 
107
- exports.InputPassword = _InputPassword.InputPassword;
108
- exports.InputPasswordNativeProps = _InputPassword.InputPasswordNativeProps;
122
+ exports.Skeleton = _Skeleton.Skeleton;
123
+ exports.SkeletonProps = _Skeleton.SkeletonProps;
109
124
 
110
- var _BottomNavigator = require("./components/atoms/BottomNavigator");
125
+ var _SnappingSlider = require("./components/atoms/SnappingSlider");
111
126
 
112
- exports.BottomNavigator = _BottomNavigator.BottomNavigator;
113
- exports.BottomNavigatorProps = _BottomNavigator.BottomNavigatorProps;
127
+ exports.SnappingSlider = _SnappingSlider.SnappingSlider;
128
+ exports.SnappingSliderProps = _SnappingSlider.SnappingSliderProps;
114
129
 
115
130
  var _Tag = require("./components/atoms/Tag");
116
131
 
117
132
  exports.Tag = _Tag.Tag;
118
133
  exports.TagProps = _Tag.TagProps;
119
134
 
120
- var _SnappingSlider = require("./components/atoms/SnappingSlider");
135
+ var _Text = require("./components/atoms/Text");
121
136
 
122
- exports.SnappingSlider = _SnappingSlider.SnappingSlider;
123
- exports.SnappingSliderProps = _SnappingSlider.SnappingSliderProps;
137
+ exports.Text = _Text.Text;
138
+ exports.TextNativeProps = _Text.TextNativeProps;
124
139
 
125
- var _Badge = require("./components/atoms/Badge");
140
+ var _TextArea = require("./components/atoms/TextArea");
126
141
 
127
- exports.Badge = _Badge.Badge;
128
- exports.BadgeNativeProps = _Badge.BadgeNativeProps;
142
+ exports.TextArea = _TextArea.TextArea;
143
+ exports.TextAreaProps = _TextArea.TextAreaProps;
129
144
 
130
- var _Snackbar = require("./components/molecules/Snackbar");
145
+ var _Calendar = require("./components/molecules/Calendar");
131
146
 
132
- exports.Snackbar = _Snackbar.Snackbar;
133
- exports.SnackbarNativeProps = _Snackbar.SnackbarNativeProps;
147
+ exports.Calendar = _Calendar.Calendar;
134
148
 
135
149
  var _DatePicker = require("./components/molecules/DatePicker");
136
150
 
@@ -142,30 +156,37 @@ var _DateTimePicker = require("./components/molecules/DateTimePicker");
142
156
  exports.DateTimePicker = _DateTimePicker.DateTimePicker;
143
157
  exports.NativeDateTimePickerProps = _DateTimePicker.NativeDateTimePickerProps;
144
158
 
145
- var _Avatar = require("./components/atoms/Avatar");
159
+ var _DateTimeSelector = require("./components/molecules/DateTimeSelector");
146
160
 
147
- exports.Avatar = _Avatar.Avatar;
161
+ exports.DateTimeSelector = _DateTimeSelector.DateTimeSelector;
148
162
 
149
- var _Calendar = require("./components/molecules/Calendar");
163
+ var _IconTextButton = require("./components/molecules/IconTextButton");
150
164
 
151
- exports.Calendar = _Calendar.Calendar;
165
+ exports.IconTextButton = _IconTextButton.IconTextButton;
166
+ exports.NativeIconTextButtonProps = _IconTextButton.NativeIconTextButtonProps;
152
167
 
153
- var _DateTimeSelector = require("./components/molecules/DateTimeSelector");
168
+ var _InputPassword = require("./components/molecules/InputPassword");
154
169
 
155
- exports.DateTimeSelector = _DateTimeSelector.DateTimeSelector;
170
+ exports.InputPassword = _InputPassword.InputPassword;
171
+ exports.InputPasswordNativeProps = _InputPassword.InputPasswordNativeProps;
156
172
 
157
- var _Modal = require("./components/atoms/Modal");
173
+ var _LabeledSwitch = require("./components/molecules/LabeledSwitch");
158
174
 
159
- exports.ModalGroupManager = _Modal.ModalGroupManager;
160
- exports.ModalView = _Modal.ModalView;
161
- exports.ModalLifecycleHandler = _Modal.ModalLifecycleHandler;
162
- exports.useLazyModalManager = _Modal.useLazyModalManager;
163
- exports.useModalManager = _Modal.useModalManager;
164
- exports.useModalRemoteControl = _Modal.useModalRemoteControl;
165
- exports.IBaseModal = _Modal.IBaseModal;
175
+ exports.LabeledSwitch = _LabeledSwitch.LabeledSwitch;
176
+ exports.LabeledSwitchNativeProps = _LabeledSwitch.LabeledSwitchNativeProps;
166
177
 
167
- var _Skeleton = require("./components/atoms/Skeleton");
178
+ var _Select = require("./components/molecules/Select");
168
179
 
169
- exports.Skeleton = _Skeleton.Skeleton;
170
- exports.SkeletonProps = _Skeleton.SkeletonProps;
180
+ exports.Select = _Select.Select;
181
+ exports.SelectNativeProps = _Select.SelectNativeProps;
182
+
183
+ var _Snackbar = require("./components/molecules/Snackbar");
184
+
185
+ exports.Snackbar = _Snackbar.Snackbar;
186
+ exports.SnackbarNativeProps = _Snackbar.SnackbarNativeProps;
187
+
188
+ var _Grid = require("./components/molecules/Grid");
189
+
190
+ exports.Grid = _Grid.Grid;
191
+ exports.GridItem = _Grid.GridItem;
171
192
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;;;;AAOA;;;;AACA;;;;;AAIA;;;;;AAIA;;;;;AACA;;;;;AAIA;;;;;AACA;;;;;AACA;;;;;AAIA;;;;;AAIA;;;;AACA;;;;AACA;;;;AACA;;;;;;;;;;AASA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport { Header, HeaderProps } from './components/atoms/Header';\nexport { Select, SelectNativeProps } from './components/molecules/Select';\nexport { Input, InputNativeProps } from './components/atoms/Input';\nexport { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';\nexport { TextArea, TextAreaProps } from './components/atoms/TextArea';\nexport { Text, TextNativeProps } from './components/atoms/Text';\nexport {\n Error,\n Loading,\n Success,\n Button,\n ButtonNativeProps,\n} from './components/atoms/Button';\nexport { GroupButtonOption } from './components/atoms/GroupButton';\nexport {\n InputPassword,\n InputPasswordNativeProps,\n} from './components/molecules/InputPassword';\nexport {\n BottomNavigator,\n BottomNavigatorProps,\n} from './components/atoms/BottomNavigator';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport {\n SnappingSlider,\n SnappingSliderProps,\n} from './components/atoms/SnappingSlider';\nexport { Badge, BadgeNativeProps } from './components/atoms/Badge';\nexport { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';\nexport {\n DatePicker,\n NativeDatePickerProps,\n} from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n NativeDateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport { Avatar } from './components/atoms/Avatar';\nexport { Calendar } from './components/molecules/Calendar';\nexport { DateTimeSelector } from './components/molecules/DateTimeSelector';\nexport {\n ModalGroupManager,\n ModalView,\n ModalLifecycleHandler,\n useLazyModalManager,\n useModalManager,\n useModalRemoteControl,\n IBaseModal,\n} from './components/atoms/Modal';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;AACA;;;;;AACA;;;;;AAIA;;;;;;;;AAOA;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;;;;;;AASA;;;;;AACA;;;;;AAIA;;;;;AACA;;;;;AACA;;;;;AACA;;;;AACA;;;;;AAIA;;;;;AAIA;;;;AACA;;;;;AAIA;;;;;AAIA;;;;;AAIA;;;;;AACA;;;;;AACA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport { Avatar } from './components/atoms/Avatar';\nexport { Badge, BadgeNativeProps } from './components/atoms/Badge';\nexport {\n BottomNavigator,\n BottomNavigatorProps,\n} from './components/atoms/BottomNavigator';\nexport {\n Button,\n ButtonNativeProps,\n Error,\n Loading,\n Success,\n} from './components/atoms/Button';\nexport { GroupButtonOption } from './components/atoms/GroupButton';\nexport { Header, HeaderProps } from './components/atoms/Header';\nexport { Input, InputNativeProps } from './components/atoms/Input';\nexport { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';\nexport {\n IBaseModal,\n ModalGroupManager,\n ModalLifecycleHandler,\n ModalView,\n useLazyModalManager,\n useModalManager,\n useModalRemoteControl,\n} from './components/atoms/Modal';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\nexport {\n SnappingSlider,\n SnappingSliderProps,\n} from './components/atoms/SnappingSlider';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport { Text, TextNativeProps } from './components/atoms/Text';\nexport { TextArea, TextAreaProps } from './components/atoms/TextArea';\nexport { Calendar } from './components/molecules/Calendar';\nexport {\n DatePicker,\n NativeDatePickerProps,\n} from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n NativeDateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport { DateTimeSelector } from './components/molecules/DateTimeSelector';\nexport {\n IconTextButton,\n NativeIconTextButtonProps,\n} from './components/molecules/IconTextButton';\nexport {\n InputPassword,\n InputPasswordNativeProps,\n} from './components/molecules/InputPassword';\nexport {\n LabeledSwitch,\n LabeledSwitchNativeProps,\n} from './components/molecules/LabeledSwitch';\nexport { Select, SelectNativeProps } from './components/molecules/Select';\nexport { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';\nexport { Grid, GridItem } from './components/molecules/Grid';\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tecsinapse/react-native-kit",
3
3
  "description": "TecSinapse React Native components",
4
- "version": "1.18.4",
4
+ "version": "1.19.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "MIT",
@@ -14,9 +14,9 @@
14
14
  "yalc:show": "yalc installations show $npm_package_name"
15
15
  },
16
16
  "dependencies": {
17
- "@emotion/native": "^11.0.0",
18
- "@emotion/react": "^11.4.1",
19
- "@tecsinapse/react-core": "^1.17.3",
17
+ "@emotion/native": "^11.10.0",
18
+ "@emotion/react": "^11.10.0",
19
+ "@tecsinapse/react-core": "^1.18.0",
20
20
  "react-native-linear-gradient": "^2.5.6"
21
21
  },
22
22
  "repository": {
@@ -39,5 +39,5 @@
39
39
  "devDependencies": {
40
40
  "@types/uuid": "^8.3.3"
41
41
  },
42
- "gitHead": "941e9b8aca99e29d87c1cc309e60d099c13be116"
42
+ "gitHead": "7014df32d2de88a1f42259b56599d7fc10d794a9"
43
43
  }
@@ -1,17 +1,23 @@
1
- import { Button as ButtonCore, ButtonProps } from "@tecsinapse/react-core";
2
- import React, { FC, useCallback } from "react";
3
- import { Keyboard } from "react-native";
1
+ import { Button as ButtonCore, ButtonProps } from '@tecsinapse/react-core';
2
+ import React, { FC, useCallback } from 'react';
3
+ import { Keyboard } from 'react-native';
4
4
 
5
5
  export type ButtonNativeProps = ButtonProps & {
6
- autoDismissKeyboard?: boolean
7
- }
6
+ autoDismissKeyboard?: boolean;
7
+ };
8
8
 
9
- export const Button: FC<ButtonNativeProps> = ({ autoDismissKeyboard = true, onPress, ...others }) => {
9
+ export const Button: FC<ButtonNativeProps> = ({
10
+ autoDismissKeyboard = true,
11
+ onPress,
12
+ ...others
13
+ }) => {
14
+ const handleOnPress = useCallback(
15
+ event => {
16
+ autoDismissKeyboard && Keyboard.dismiss();
17
+ onPress?.(event);
18
+ },
19
+ [onPress]
20
+ );
10
21
 
11
- const handleOnPress = useCallback((event) => {
12
- autoDismissKeyboard && Keyboard.dismiss()
13
- onPress?.(event)
14
- }, [onPress])
15
-
16
- return <ButtonCore {...others} onPress={handleOnPress}/>
17
- }
22
+ return <ButtonCore {...others} onPress={handleOnPress} />;
23
+ };
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { View, ViewProps } from 'react-native';
3
+ import { GridItem } from './Item';
4
+ import { IGrid } from '@tecsinapse/react-core';
5
+
6
+ export type IGridNative = IGrid & ViewProps;
7
+
8
+ const Grid = ({
9
+ children,
10
+ columns = 12,
11
+ layout,
12
+ style,
13
+ spacing,
14
+ ...rest
15
+ }: IGridNative): JSX.Element => {
16
+ if (layout) {
17
+ const flatLayout = layout.flat();
18
+ return (
19
+ <View
20
+ style={[
21
+ style,
22
+ {
23
+ display: 'flex',
24
+ flexDirection: 'row',
25
+ flexWrap: 'wrap',
26
+ },
27
+ ]}
28
+ {...rest}
29
+ >
30
+ {React.Children.map(children, (child, index) => (
31
+ <GridItem
32
+ key={`child-${index}`}
33
+ columns={columns}
34
+ span={flatLayout[index]}
35
+ spacing={spacing}
36
+ >
37
+ {child}
38
+ </GridItem>
39
+ ))}
40
+ </View>
41
+ );
42
+ }
43
+
44
+ return (
45
+ <View
46
+ style={[
47
+ style,
48
+ {
49
+ display: 'flex',
50
+ flexDirection: 'row',
51
+ flexWrap: 'wrap',
52
+ },
53
+ ]}
54
+ {...rest}
55
+ >
56
+ {React.Children.map(children, (child, index) => {
57
+ return React.cloneElement(child, {
58
+ ...child?.props,
59
+ columns,
60
+ spacing: child?.props.spacing ?? spacing,
61
+ key: `child-${index}`,
62
+ });
63
+ })}
64
+ </View>
65
+ );
66
+ };
67
+
68
+ export default Grid;