ywana-core8 0.0.879 → 0.0.881

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.
@@ -199,15 +199,18 @@ var TEXTFORMATS = {
199
199
  TIME: 'time',
200
200
  EMAIL: 'email',
201
201
  HTML: 'HTML',
202
- URL: 'URL'
202
+ URL: 'URL',
203
+ STRING: 'string'
203
204
  };
204
205
 
205
206
  /**
206
207
  * Text
207
208
  */
208
209
  var Text = function Text(_ref) {
209
- var format = _ref.format,
210
- children = _ref.children;
210
+ var _ref$format = _ref.format,
211
+ format = _ref$format === void 0 ? TEXTFORMATS.HTML : _ref$format,
212
+ children = _ref.children,
213
+ className = _ref.className;
211
214
  var site = useContext(SiteContext);
212
215
  var value = children;
213
216
  if (site) {
@@ -224,7 +227,23 @@ var Text = function Text(_ref) {
224
227
  value = formatter.format(children);
225
228
  break;
226
229
  }
227
- return children ? value : '';
230
+ switch (format) {
231
+ case TEXTFORMATS.DATE:
232
+ value = new Date(children).toLocaleDateString();
233
+ break;
234
+ case TEXTFORMATS.TIME:
235
+ value = new Date(children).toLocaleTimeString();
236
+ break;
237
+ }
238
+ if (!children) return '';
239
+ switch (format) {
240
+ case TEXTFORMATS.STRING:
241
+ return value;
242
+ default:
243
+ return /*#__PURE__*/React.createElement("span", {
244
+ className: className
245
+ }, value);
246
+ }
228
247
  };
229
248
 
230
249
  /**
@@ -1309,7 +1328,9 @@ var TextField = function TextField(props) {
1309
1328
  var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
1310
1329
  var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
1311
1330
  var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
1312
- var placeholderTxt = placeholder ? /*#__PURE__*/React.createElement(Text, null, placeholder) : null;
1331
+ var placeholderTxt = placeholder ? /*#__PURE__*/React.createElement(Text, {
1332
+ format: TEXTFORMATS.STRING
1333
+ }, placeholder) : null;
1313
1334
  return /*#__PURE__*/React.createElement("div", {
1314
1335
  className: style + " " + id,
1315
1336
  onClick: onClick
@@ -1380,7 +1401,9 @@ var TextArea = function TextArea(props) {
1380
1401
  var labelStyle = label ? "" : "no-label";
1381
1402
  var style = "textarea " + labelStyle + " textarea-" + type;
1382
1403
  var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
1383
- var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
1404
+ var placeholderTxt = /*#__PURE__*/React.createElement(Text, {
1405
+ format: TEXTFORMATS.STRING
1406
+ }, placeholder);
1384
1407
  return /*#__PURE__*/React.createElement("div", {
1385
1408
  className: "" + style,
1386
1409
  onClick: onClick