ywana-core8 0.0.881 → 0.0.882
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.cjs +9 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +9 -7
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +9 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/text.js +2 -1
- package/src/html/text.test.js +1 -0
- package/src/html/textfield.js +3 -2
- package/src/html/textfield.test.js +1 -1
- package/src/site/site.js +6 -0
package/dist/index.modern.js
CHANGED
@@ -1283,7 +1283,7 @@ var Content = /*#__PURE__*/function () {
|
|
1283
1283
|
* Text Field
|
1284
1284
|
*/
|
1285
1285
|
var TextField = function TextField(props) {
|
1286
|
-
useContext(SiteContext);
|
1286
|
+
var site = useContext(SiteContext);
|
1287
1287
|
var id = props.id,
|
1288
1288
|
_props$type = props.type,
|
1289
1289
|
type = _props$type === void 0 ? 'text' : _props$type,
|
@@ -1328,9 +1328,7 @@ var TextField = function TextField(props) {
|
|
1328
1328
|
var labelPositionStyle = labelPosition == 'left' ? "label-left" : "label-top";
|
1329
1329
|
var style = labelStyle + " " + labelPositionStyle + " " + borderStyle + " textfield-" + type;
|
1330
1330
|
var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
|
1331
|
-
var placeholderTxt =
|
1332
|
-
format: TEXTFORMATS.STRING
|
1333
|
-
}, placeholder) : null;
|
1331
|
+
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
1334
1332
|
return /*#__PURE__*/React.createElement("div", {
|
1335
1333
|
className: style + " " + id,
|
1336
1334
|
onClick: onClick
|
@@ -1401,9 +1399,7 @@ var TextArea = function TextArea(props) {
|
|
1401
1399
|
var labelStyle = label ? "" : "no-label";
|
1402
1400
|
var style = "textarea " + labelStyle + " textarea-" + type;
|
1403
1401
|
var labelTxt = /*#__PURE__*/React.createElement(Text, null, label);
|
1404
|
-
var placeholderTxt =
|
1405
|
-
format: TEXTFORMATS.STRING
|
1406
|
-
}, placeholder);
|
1402
|
+
var placeholderTxt = site.translate ? site.translate(placeholder) : placeholder;
|
1407
1403
|
return /*#__PURE__*/React.createElement("div", {
|
1408
1404
|
className: "" + style,
|
1409
1405
|
onClick: onClick
|
@@ -3792,6 +3788,12 @@ var SiteProvider = function SiteProvider(_ref) {
|
|
3792
3788
|
setLang: setLang,
|
3793
3789
|
dictionary: dictionary,
|
3794
3790
|
setDictionary: setDictionary,
|
3791
|
+
translate: function translate(key) {
|
3792
|
+
if (!key) return key;
|
3793
|
+
if (dictionary === undefined) return key;
|
3794
|
+
var term = dictionary[key];
|
3795
|
+
return term ? term[lang] : key;
|
3796
|
+
},
|
3795
3797
|
sideNav: sideNav,
|
3796
3798
|
setSideNav: setSideNav,
|
3797
3799
|
showNav: showNav,
|