ywana-core8 0.0.877 → 0.0.879

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.
@@ -1,5 +1,5 @@
1
1
  import 'material-design-icons-iconfont/dist/material-design-icons.css';
2
- import React, { useState, useEffect, useContext, Fragment, useRef, useMemo, useCallback, Children } from 'react';
2
+ import React, { useContext, useState, useEffect, Fragment, useRef, useMemo, useCallback, Children } from 'react';
3
3
  import RSwitch from 'react-switch';
4
4
  import moment$1 from 'moment';
5
5
  import { extendMoment } from 'moment-range';
@@ -187,6 +187,46 @@ function _extends() {
187
187
  return _extends.apply(this, arguments);
188
188
  }
189
189
 
190
+ /**
191
+ * Site Context
192
+ */
193
+ var SiteContext = React.createContext({});
194
+
195
+ var TEXTFORMATS = {
196
+ NONE: '',
197
+ NUMERIC: 'numeric',
198
+ DATE: 'date',
199
+ TIME: 'time',
200
+ EMAIL: 'email',
201
+ HTML: 'HTML',
202
+ URL: 'URL'
203
+ };
204
+
205
+ /**
206
+ * Text
207
+ */
208
+ var Text = function Text(_ref) {
209
+ var format = _ref.format,
210
+ children = _ref.children;
211
+ var site = useContext(SiteContext);
212
+ var value = children;
213
+ if (site) {
214
+ var lang = site.lang,
215
+ _site$dictionary = site.dictionary,
216
+ dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
217
+ var term = dictionary[children];
218
+ var text = term ? term[lang] : children;
219
+ if (text) value = text;
220
+ }
221
+ var formatter = Intl.NumberFormat();
222
+ switch (format) {
223
+ case TEXTFORMATS.NUMERIC:
224
+ value = formatter.format(children);
225
+ break;
226
+ }
227
+ return children ? value : '';
228
+ };
229
+
190
230
  /**
191
231
  * Tooltip
192
232
  */
@@ -206,7 +246,7 @@ var Tooltip = function Tooltip(props) {
206
246
  }, /*#__PURE__*/React.createElement("span", {
207
247
  className: "tooltip-text",
208
248
  style: style
209
- }, text), props.children);
249
+ }, /*#__PURE__*/React.createElement(Text, null, text)), props.children);
210
250
  };
211
251
 
212
252
  /**
@@ -343,49 +383,6 @@ var AccordionSection = function AccordionSection(props) {
343
383
  })), open ? /*#__PURE__*/React.createElement("main", null, children) : '');
344
384
  };
345
385
 
346
- /**
347
- * Site Context
348
- */
349
- var SiteContext = React.createContext({});
350
-
351
- var TEXTFORMATS = {
352
- NONE: '',
353
- NUMERIC: 'numeric',
354
- DATE: 'date',
355
- TIME: 'time',
356
- EMAIL: 'email',
357
- HTML: 'HTML',
358
- URL: 'URL'
359
- };
360
-
361
- /**
362
- * Text
363
- */
364
- var Text = function Text(_ref) {
365
- var format = _ref.format,
366
- children = _ref.children,
367
- className = _ref.className;
368
- var site = useContext(SiteContext);
369
- var value = children;
370
- if (site) {
371
- var lang = site.lang,
372
- _site$dictionary = site.dictionary,
373
- dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
374
- var term = dictionary[children];
375
- var text = term ? term[lang] : children;
376
- if (text) value = text;
377
- }
378
- var formatter = Intl.NumberFormat();
379
- switch (format) {
380
- case TEXTFORMATS.NUMERIC:
381
- value = formatter.format(children);
382
- break;
383
- }
384
- return children ? /*#__PURE__*/React.createElement("span", {
385
- className: className
386
- }, value) : '';
387
- };
388
-
389
386
  /**
390
387
  * HTML Button
391
388
  */
@@ -434,13 +431,14 @@ var CheckBox = function CheckBox(props) {
434
431
  if (onChange) onChange(id, value);
435
432
  }
436
433
  var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
434
+ var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
437
435
  return value === true ? /*#__PURE__*/React.createElement("div", {
438
436
  className: "checkbox",
439
437
  key: id + "1"
440
438
  }, /*#__PURE__*/React.createElement("input", {
441
439
  id: id,
442
440
  type: "checkbox",
443
- placeholder: placeholder,
441
+ placeholder: placeholderTxt,
444
442
  checked: true,
445
443
  value: value,
446
444
  onChange: change
@@ -454,7 +452,7 @@ var CheckBox = function CheckBox(props) {
454
452
  }, /*#__PURE__*/React.createElement("input", {
455
453
  id: id,
456
454
  type: "checkbox",
457
- placeholder: placeholder,
455
+ placeholder: placeholderTxt,
458
456
  value: value,
459
457
  onChange: change
460
458
  }), /*#__PURE__*/React.createElement("span", {
@@ -904,7 +902,7 @@ var Property = function Property(props) {
904
902
  className: "property property-" + id + " " + className
905
903
  }, /*#__PURE__*/React.createElement("div", {
906
904
  className: "property-name"
907
- }, name || label), /*#__PURE__*/React.createElement("div", {
905
+ }, /*#__PURE__*/React.createElement(Text, null, name || label)), /*#__PURE__*/React.createElement("div", {
908
906
  className: "property-value"
909
907
  }, editable ? /*#__PURE__*/React.createElement("input", {
910
908
  type: "text",
@@ -1311,13 +1309,14 @@ var TextField = function TextField(props) {
1311
1309
  var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
1312
1310
  var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
1313
1311
  var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
1312
+ var placeholderTxt = placeholder ? /*#__PURE__*/React.createElement(Text, null, placeholder) : null;
1314
1313
  return /*#__PURE__*/React.createElement("div", {
1315
1314
  className: style + " " + id,
1316
1315
  onClick: onClick
1317
1316
  }, /*#__PURE__*/React.createElement("input", {
1318
1317
  id: id,
1319
1318
  type: type,
1320
- placeholder: placeholder,
1319
+ placeholder: placeholderTxt,
1321
1320
  value: value,
1322
1321
  required: true,
1323
1322
  onChange: change,
@@ -1381,12 +1380,13 @@ var TextArea = function TextArea(props) {
1381
1380
  var labelStyle = label ? "" : "no-label";
1382
1381
  var style = "textarea " + labelStyle + " textarea-" + type;
1383
1382
  var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
1383
+ var placeholderTxt = /*#__PURE__*/React.createElement(Text, null, placeholder);
1384
1384
  return /*#__PURE__*/React.createElement("div", {
1385
1385
  className: "" + style,
1386
1386
  onClick: onClick
1387
1387
  }, /*#__PURE__*/React.createElement("textarea", {
1388
1388
  id: id,
1389
- placeholder: placeholder,
1389
+ placeholder: placeholderTxt,
1390
1390
  value: value,
1391
1391
  required: true,
1392
1392
  onChange: change,
@@ -1544,9 +1544,10 @@ var DateRange = function DateRange(props) {
1544
1544
  var next = Object.assign({}, form, (_Object$assign = {}, _Object$assign[id] = value, _Object$assign));
1545
1545
  setForm(next);
1546
1546
  }
1547
+ var labelTxt = label ? /*#__PURE__*/React.createElement(Text, null, label) : null;
1547
1548
  return /*#__PURE__*/React.createElement("div", {
1548
1549
  className: "date-range"
1549
- }, label ? /*#__PURE__*/React.createElement("label", null, label) : null, /*#__PURE__*/React.createElement(TextField, {
1550
+ }, label ? /*#__PURE__*/React.createElement("label", null, labelTxt) : null, /*#__PURE__*/React.createElement(TextField, {
1550
1551
  id: "from",
1551
1552
  type: "date",
1552
1553
  label: "From",
@@ -1571,12 +1572,13 @@ var PasswordField = function PasswordField(props) {
1571
1572
  function toggle() {
1572
1573
  setShow(!show);
1573
1574
  }
1575
+ var labelTxt = label ? /*#__PURE__*/React.createElement(Text, null, label) : null;
1574
1576
  return /*#__PURE__*/React.createElement("div", {
1575
1577
  className: "password-field"
1576
1578
  }, /*#__PURE__*/React.createElement(TextField, {
1577
1579
  id: id,
1578
1580
  type: show ? "text" : "password",
1579
- label: label,
1581
+ label: labelTxt,
1580
1582
  value: value,
1581
1583
  onChange: onChange
1582
1584
  }), /*#__PURE__*/React.createElement(Icon, {
@@ -4946,7 +4948,7 @@ var TaskMonitor = function TaskMonitor(props) {
4946
4948
  }).map(function (task) {
4947
4949
  return {
4948
4950
  id: task.id,
4949
- state: task.state,
4951
+ state: /*#__PURE__*/React.createElement(Text, null, task.state),
4950
4952
  description: task.description,
4951
4953
  progress: /*#__PURE__*/React.createElement(LinearProgress, {
4952
4954
  progress: task.percentage