@xaypay/tui 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1596,14 +1596,15 @@ const TD = ({
1596
1596
  optionIndex
1597
1597
  });
1598
1598
  };
1599
- const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex) => {
1599
+ const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex, contentListInnerItem) => {
1600
1600
  handleContentListClick(e, {
1601
1601
  item,
1602
1602
  index,
1603
1603
  innerIndex,
1604
1604
  listContentId,
1605
1605
  listContent,
1606
- listContentIndex
1606
+ listContentIndex,
1607
+ contentListInnerItem
1607
1608
  });
1608
1609
  };
1609
1610
  return /*#__PURE__*/React__default.createElement("td", {
@@ -1763,20 +1764,46 @@ const TD = ({
1763
1764
  height: item.status === 'close' ? '0px' : 'auto'
1764
1765
  }
1765
1766
  }, item.contentList.map((innerItem, innerItemIndex) => {
1766
- return /*#__PURE__*/React__default.createElement("p", {
1767
- key: `${innerItem}_${innerItemIndex}`,
1768
- className: styles$9['list-text'],
1769
- style: {
1770
- maxWidth: '100%',
1771
- color: openListColor,
1772
- textAlign: tBodyTextAlign,
1773
- fontSize: openListFontSize,
1774
- fontStyle: openListFontStyle,
1775
- fontWeight: openListFontWeight,
1776
- fontFamily: openListFontFamily
1777
- },
1778
- onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
1779
- }, innerItem.content === 0 ? innerItem.content.toString() : innerItem.content ? innerItem.content : '');
1767
+ if (Array.isArray(innerItem.content)) {
1768
+ return /*#__PURE__*/React__default.createElement("div", {
1769
+ key: `__${innerItemIndex}__`,
1770
+ style: {
1771
+ display: 'flex',
1772
+ justifyContent: 'center'
1773
+ }
1774
+ }, innerItem.content.map((contInnerItem, contInnerIndex) => {
1775
+ return /*#__PURE__*/React__default.createElement("p", {
1776
+ key: `${contInnerItem}_${contInnerIndex}`,
1777
+ className: styles$9['list-text'],
1778
+ style: {
1779
+ maxWidth: '100%',
1780
+ color: openListColor,
1781
+ textAlign: tBodyTextAlign,
1782
+ fontSize: openListFontSize,
1783
+ fontStyle: openListFontStyle,
1784
+ fontWeight: openListFontWeight,
1785
+ fontFamily: openListFontFamily,
1786
+ marginRight: contInnerIndex === innerItem.content.length - 1 ? '0px' : '10px'
1787
+ },
1788
+ onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex, contInnerItem)
1789
+ }, contInnerItem.content === 0 ? contInnerItem.content.toString() : contInnerItem.content ? contInnerItem.content : '');
1790
+ }));
1791
+ } else {
1792
+ return /*#__PURE__*/React__default.createElement("p", {
1793
+ key: `${innerItem}_${innerItemIndex}`,
1794
+ className: styles$9['list-text'],
1795
+ style: {
1796
+ maxWidth: '100%',
1797
+ color: openListColor,
1798
+ textAlign: tBodyTextAlign,
1799
+ fontSize: openListFontSize,
1800
+ fontStyle: openListFontStyle,
1801
+ fontWeight: openListFontWeight,
1802
+ fontFamily: openListFontFamily
1803
+ },
1804
+ onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
1805
+ }, innerItem.content === 0 ? innerItem.content.toString() : innerItem.content ? innerItem.content : '');
1806
+ }
1780
1807
  }))), !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && hasOwnerProperty(item, 'rightArrow') && item.rightArrow === true ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default.createElement("div", {
1781
1808
  id: item.id,
1782
1809
  style: {
@@ -2256,7 +2283,8 @@ const Table = ({
2256
2283
  listItemId: data.listContentId,
2257
2284
  listItemContent: data.listContent,
2258
2285
  itemIndex: removeItemIndex !== undefined && removeItemIndex < data.innerIndex ? data.innerIndex - 1 : data.innerIndex,
2259
- listItemInnerIndex: data.listContentIndex
2286
+ listItemInnerIndex: data.listContentIndex,
2287
+ contentListInnerItem: data.contentListInnerItem
2260
2288
  };
2261
2289
  getData(listData);
2262
2290
  };
@@ -2727,8 +2755,8 @@ const Modal = ({
2727
2755
  height: height ?? merge.MODAL.height,
2728
2756
  gridTemplateRows: type === 'content' ? 'auto 10fr' : '',
2729
2757
  borderRadius: radius ?? merge.MODAL.radius,
2730
- maxWidth: mMaxWidth ?? merge.MODAL.mMaxWidth,
2731
- maxHeight: mMaxHeight ?? merge.MODAL.mMaxHeight,
2758
+ maxWidth: mMaxWidth ?? merge.MODAL.maxWidth,
2759
+ maxHeight: mMaxHeight ?? merge.MODAL.maxHeight,
2732
2760
  minWidth: type === 'content' ? minWidth ?? merge.MODAL.minWidth : '',
2733
2761
  backgroundColor: backgroundColor ?? merge.MODAL.colors.background,
2734
2762
  minHeight: type === 'content' ? minHeight ?? merge.MODAL.minHeight : ''
@@ -2993,7 +3021,6 @@ const Input = ({
2993
3021
  errorLineHeight,
2994
3022
  labelLineHeight,
2995
3023
  backgroundColor,
2996
- telErrorMessage,
2997
3024
  labelMarginBottom,
2998
3025
  regexpErrorMessage,
2999
3026
  phoneJustifyContent,
@@ -3029,14 +3056,10 @@ const Input = ({
3029
3056
  const handleCheckTypeTel = (val, prevVal) => {
3030
3057
  if (type === 'tel') {
3031
3058
  if (!phoneNumberRegex.test(val)) {
3032
- if (val === '') {
3033
- setInnerErrorMessage('');
3034
- } else {
3035
- telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(merge.INPUT.error.telMessage);
3059
+ if (val !== '') {
3036
3060
  val = prevVal;
3037
3061
  }
3038
3062
  } else {
3039
- setInnerErrorMessage('');
3040
3063
  if (val.length > 8) {
3041
3064
  val = val.substr(0, 8);
3042
3065
  }
@@ -3168,7 +3191,7 @@ const Input = ({
3168
3191
  }
3169
3192
  }
3170
3193
  setInnerValue(() => newValue);
3171
- }, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage, telErrorMessage]);
3194
+ }, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage]);
3172
3195
  return /*#__PURE__*/React__default.createElement("div", {
3173
3196
  className: classProps
3174
3197
  }, label ? /*#__PURE__*/React__default.createElement("label", {
@@ -3340,7 +3363,6 @@ Input.propTypes = {
3340
3363
  boxShadowHover: PropTypes.string,
3341
3364
  errorClassName: PropTypes.string,
3342
3365
  labelFontFamily: PropTypes.string,
3343
- telErrorMessage: PropTypes.string,
3344
3366
  backgroundColor: PropTypes.string,
3345
3367
  phoneAlignItems: PropTypes.string,
3346
3368
  errorLineHeight: PropTypes.string,
@@ -4824,22 +4846,21 @@ const Textarea = ({
4824
4846
  }
4825
4847
  };
4826
4848
  useEffect(() => {
4827
- if (value === undefined) {
4828
- alert('Please add value prop on Textarea component');
4829
- }
4830
4849
  if (!onChange) {
4831
4850
  alert('Please add onChange function on Textarea component');
4832
4851
  }
4852
+ }, [onChange]);
4853
+ useEffect(() => {
4854
+ if (value === undefined) {
4855
+ alert('Please add value prop on Textarea component');
4856
+ }
4833
4857
  if (errorMessage) {
4834
- setError(errorMessage);
4858
+ value === '' ? setError(errorMessage) : setError('');
4835
4859
  } else {
4836
4860
  setError('');
4837
4861
  }
4838
- if (value === '') {
4839
- setError('');
4840
- }
4841
4862
  setInnerValue(value);
4842
- }, [value, onChange, errorMessage]);
4863
+ }, [value, errorMessage]);
4843
4864
  return /*#__PURE__*/React__default.createElement("div", {
4844
4865
  style: {
4845
4866
  width: width ?? merge.TEXTAREA.width
@@ -4911,7 +4932,7 @@ const Textarea = ({
4911
4932
  }, /*#__PURE__*/React__default.createElement("span", {
4912
4933
  style: {
4913
4934
  display: 'inline-block',
4914
- color: errorColor ?? merge.TEXTAREA.error.font.color,
4935
+ color: errorColor ?? merge.TEXTAREA.error.color,
4915
4936
  fontSize: errorSize ?? merge.TEXTAREA.error.font.size,
4916
4937
  fontStyle: errorStyle ?? merge.TEXTAREA.error.font.style,
4917
4938
  fontWeight: errorWeight ?? merge.TEXTAREA.error.font.weight,
package/dist/index.js CHANGED
@@ -1626,14 +1626,15 @@ const TD = ({
1626
1626
  optionIndex
1627
1627
  });
1628
1628
  };
1629
- const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex) => {
1629
+ const handleContentList = (e, item, index, innerIndex, listContentId, listContent, listContentIndex, contentListInnerItem) => {
1630
1630
  handleContentListClick(e, {
1631
1631
  item,
1632
1632
  index,
1633
1633
  innerIndex,
1634
1634
  listContentId,
1635
1635
  listContent,
1636
- listContentIndex
1636
+ listContentIndex,
1637
+ contentListInnerItem
1637
1638
  });
1638
1639
  };
1639
1640
  return /*#__PURE__*/React__default["default"].createElement("td", {
@@ -1793,20 +1794,46 @@ const TD = ({
1793
1794
  height: item.status === 'close' ? '0px' : 'auto'
1794
1795
  }
1795
1796
  }, item.contentList.map((innerItem, innerItemIndex) => {
1796
- return /*#__PURE__*/React__default["default"].createElement("p", {
1797
- key: `${innerItem}_${innerItemIndex}`,
1798
- className: styles$9['list-text'],
1799
- style: {
1800
- maxWidth: '100%',
1801
- color: openListColor,
1802
- textAlign: tBodyTextAlign,
1803
- fontSize: openListFontSize,
1804
- fontStyle: openListFontStyle,
1805
- fontWeight: openListFontWeight,
1806
- fontFamily: openListFontFamily
1807
- },
1808
- onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
1809
- }, innerItem.content === 0 ? innerItem.content.toString() : innerItem.content ? innerItem.content : '');
1797
+ if (Array.isArray(innerItem.content)) {
1798
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1799
+ key: `__${innerItemIndex}__`,
1800
+ style: {
1801
+ display: 'flex',
1802
+ justifyContent: 'center'
1803
+ }
1804
+ }, innerItem.content.map((contInnerItem, contInnerIndex) => {
1805
+ return /*#__PURE__*/React__default["default"].createElement("p", {
1806
+ key: `${contInnerItem}_${contInnerIndex}`,
1807
+ className: styles$9['list-text'],
1808
+ style: {
1809
+ maxWidth: '100%',
1810
+ color: openListColor,
1811
+ textAlign: tBodyTextAlign,
1812
+ fontSize: openListFontSize,
1813
+ fontStyle: openListFontStyle,
1814
+ fontWeight: openListFontWeight,
1815
+ fontFamily: openListFontFamily,
1816
+ marginRight: contInnerIndex === innerItem.content.length - 1 ? '0px' : '10px'
1817
+ },
1818
+ onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex, contInnerItem)
1819
+ }, contInnerItem.content === 0 ? contInnerItem.content.toString() : contInnerItem.content ? contInnerItem.content : '');
1820
+ }));
1821
+ } else {
1822
+ return /*#__PURE__*/React__default["default"].createElement("p", {
1823
+ key: `${innerItem}_${innerItemIndex}`,
1824
+ className: styles$9['list-text'],
1825
+ style: {
1826
+ maxWidth: '100%',
1827
+ color: openListColor,
1828
+ textAlign: tBodyTextAlign,
1829
+ fontSize: openListFontSize,
1830
+ fontStyle: openListFontStyle,
1831
+ fontWeight: openListFontWeight,
1832
+ fontFamily: openListFontFamily
1833
+ },
1834
+ onClick: e => handleContentList(e, item, index, innerIndex, innerItem.id, innerItem.content, innerItemIndex)
1835
+ }, innerItem.content === 0 ? innerItem.content.toString() : innerItem.content ? innerItem.content : '');
1836
+ }
1810
1837
  }))), !hasOwnerProperty(item, 'hideArrow') && item.hideArrow !== false && hasOwnerProperty(item, 'rightArrow') && item.rightArrow === true ? hasOwnerProperty(item, 'contentList') && (hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')) && /*#__PURE__*/React__default["default"].createElement("div", {
1811
1838
  id: item.id,
1812
1839
  style: {
@@ -2286,7 +2313,8 @@ const Table = ({
2286
2313
  listItemId: data.listContentId,
2287
2314
  listItemContent: data.listContent,
2288
2315
  itemIndex: removeItemIndex !== undefined && removeItemIndex < data.innerIndex ? data.innerIndex - 1 : data.innerIndex,
2289
- listItemInnerIndex: data.listContentIndex
2316
+ listItemInnerIndex: data.listContentIndex,
2317
+ contentListInnerItem: data.contentListInnerItem
2290
2318
  };
2291
2319
  getData(listData);
2292
2320
  };
@@ -2757,8 +2785,8 @@ const Modal = ({
2757
2785
  height: height ?? merge.MODAL.height,
2758
2786
  gridTemplateRows: type === 'content' ? 'auto 10fr' : '',
2759
2787
  borderRadius: radius ?? merge.MODAL.radius,
2760
- maxWidth: mMaxWidth ?? merge.MODAL.mMaxWidth,
2761
- maxHeight: mMaxHeight ?? merge.MODAL.mMaxHeight,
2788
+ maxWidth: mMaxWidth ?? merge.MODAL.maxWidth,
2789
+ maxHeight: mMaxHeight ?? merge.MODAL.maxHeight,
2762
2790
  minWidth: type === 'content' ? minWidth ?? merge.MODAL.minWidth : '',
2763
2791
  backgroundColor: backgroundColor ?? merge.MODAL.colors.background,
2764
2792
  minHeight: type === 'content' ? minHeight ?? merge.MODAL.minHeight : ''
@@ -3023,7 +3051,6 @@ const Input = ({
3023
3051
  errorLineHeight,
3024
3052
  labelLineHeight,
3025
3053
  backgroundColor,
3026
- telErrorMessage,
3027
3054
  labelMarginBottom,
3028
3055
  regexpErrorMessage,
3029
3056
  phoneJustifyContent,
@@ -3059,14 +3086,10 @@ const Input = ({
3059
3086
  const handleCheckTypeTel = (val, prevVal) => {
3060
3087
  if (type === 'tel') {
3061
3088
  if (!phoneNumberRegex.test(val)) {
3062
- if (val === '') {
3063
- setInnerErrorMessage('');
3064
- } else {
3065
- telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(merge.INPUT.error.telMessage);
3089
+ if (val !== '') {
3066
3090
  val = prevVal;
3067
3091
  }
3068
3092
  } else {
3069
- setInnerErrorMessage('');
3070
3093
  if (val.length > 8) {
3071
3094
  val = val.substr(0, 8);
3072
3095
  }
@@ -3198,7 +3221,7 @@ const Input = ({
3198
3221
  }
3199
3222
  }
3200
3223
  setInnerValue(() => newValue);
3201
- }, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage, telErrorMessage]);
3224
+ }, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage]);
3202
3225
  return /*#__PURE__*/React__default["default"].createElement("div", {
3203
3226
  className: classProps
3204
3227
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
@@ -3370,7 +3393,6 @@ Input.propTypes = {
3370
3393
  boxShadowHover: PropTypes__default["default"].string,
3371
3394
  errorClassName: PropTypes__default["default"].string,
3372
3395
  labelFontFamily: PropTypes__default["default"].string,
3373
- telErrorMessage: PropTypes__default["default"].string,
3374
3396
  backgroundColor: PropTypes__default["default"].string,
3375
3397
  phoneAlignItems: PropTypes__default["default"].string,
3376
3398
  errorLineHeight: PropTypes__default["default"].string,
@@ -4854,22 +4876,21 @@ const Textarea = ({
4854
4876
  }
4855
4877
  };
4856
4878
  React.useEffect(() => {
4857
- if (value === undefined) {
4858
- alert('Please add value prop on Textarea component');
4859
- }
4860
4879
  if (!onChange) {
4861
4880
  alert('Please add onChange function on Textarea component');
4862
4881
  }
4882
+ }, [onChange]);
4883
+ React.useEffect(() => {
4884
+ if (value === undefined) {
4885
+ alert('Please add value prop on Textarea component');
4886
+ }
4863
4887
  if (errorMessage) {
4864
- setError(errorMessage);
4888
+ value === '' ? setError(errorMessage) : setError('');
4865
4889
  } else {
4866
4890
  setError('');
4867
4891
  }
4868
- if (value === '') {
4869
- setError('');
4870
- }
4871
4892
  setInnerValue(value);
4872
- }, [value, onChange, errorMessage]);
4893
+ }, [value, errorMessage]);
4873
4894
  return /*#__PURE__*/React__default["default"].createElement("div", {
4874
4895
  style: {
4875
4896
  width: width ?? merge.TEXTAREA.width
@@ -4941,7 +4962,7 @@ const Textarea = ({
4941
4962
  }, /*#__PURE__*/React__default["default"].createElement("span", {
4942
4963
  style: {
4943
4964
  display: 'inline-block',
4944
- color: errorColor ?? merge.TEXTAREA.error.font.color,
4965
+ color: errorColor ?? merge.TEXTAREA.error.color,
4945
4966
  fontSize: errorSize ?? merge.TEXTAREA.error.font.size,
4946
4967
  fontStyle: errorStyle ?? merge.TEXTAREA.error.font.style,
4947
4968
  fontWeight: errorWeight ?? merge.TEXTAREA.error.font.weight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
package/tui.config.js CHANGED
@@ -113,7 +113,6 @@ export default {
113
113
  marginTop: '10px',
114
114
  animation: false,
115
115
  transform: 'scale3d(0,0,0)',
116
- telMessage: '',
117
116
  lineHeight: '19px',
118
117
  animationDuration: '240ms',
119
118