@instructure/ui-i18n 8.56.2-pr-snapshot-1721749364069 → 8.56.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/CHANGELOG.md +1 -1
- package/lib/ApplyLocale/index.js +2 -2
- package/lib/ApplyTextDirection/index.js +2 -2
- package/lib/I18nPropTypes.js +2 -2
- package/lib/Locale.js +2 -2
- package/lib/bidirectional.js +2 -2
- package/lib/getTextDirection.js +6 -5
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.56.2
|
|
6
|
+
## [8.56.2](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2) (2024-08-06)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-i18n
|
|
9
9
|
|
package/lib/ApplyLocale/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ApplyLocale = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
|
|
10
10
|
var _ApplyLocaleContext = require("./ApplyLocaleContext");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -47,7 +47,7 @@ const ApplyLocale = ({
|
|
|
47
47
|
locale,
|
|
48
48
|
timezone
|
|
49
49
|
}
|
|
50
|
-
}, (0,
|
|
50
|
+
}, (0, _ensureSingleChild.ensureSingleChild)(children));
|
|
51
51
|
};
|
|
52
52
|
exports.ApplyLocale = ApplyLocale;
|
|
53
53
|
ApplyLocale.defaultProps = {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.ApplyTextDirection = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
10
10
|
var _TextDirectionContext = require("../TextDirectionContext");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -41,7 +41,7 @@ DEPRECATED. Please use TextDirectionContext instead.
|
|
|
41
41
|
const ApplyTextDirection = props => {
|
|
42
42
|
const context = (0, _react.useContext)(_TextDirectionContext.TextDirectionContext);
|
|
43
43
|
const dir = props.dir || context;
|
|
44
|
-
const ElementType = (0,
|
|
44
|
+
const ElementType = (0, _getElementType.getElementType)(ApplyTextDirection, props);
|
|
45
45
|
return /*#__PURE__*/_react.default.createElement(_TextDirectionContext.TextDirectionContext.Provider, {
|
|
46
46
|
value: dir
|
|
47
47
|
}, /*#__PURE__*/_react.default.createElement(ElementType, {
|
package/lib/I18nPropTypes.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.I18nPropTypes = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _makeRequirable = require("@instructure/ui-prop-types/lib/makeRequirable.js");
|
|
8
8
|
/*
|
|
9
9
|
* The MIT License (MIT)
|
|
10
10
|
*
|
|
@@ -52,7 +52,7 @@ const iso8601 = function (props, propName, componentName, location) {
|
|
|
52
52
|
}
|
|
53
53
|
return null;
|
|
54
54
|
};
|
|
55
|
-
iso8601.isRequired = (0,
|
|
55
|
+
iso8601.isRequired = (0, _makeRequirable.makeRequirable)(iso8601);
|
|
56
56
|
const I18nPropTypes = exports.I18nPropTypes = {
|
|
57
57
|
iso8601: iso8601
|
|
58
58
|
};
|
package/lib/Locale.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Locale = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _canUseDOM = require("@instructure/ui-dom-utils/lib/canUseDOM.js");
|
|
8
8
|
/*
|
|
9
9
|
* The MIT License (MIT)
|
|
10
10
|
*
|
|
@@ -44,7 +44,7 @@ const Locale = exports.Locale = {
|
|
|
44
44
|
* Return the locale from the browser
|
|
45
45
|
* @returns {String} locale (defaults to 'en-US' if DOM cannot be accessed)
|
|
46
46
|
*/
|
|
47
|
-
browserLocale(nav, hasDOM =
|
|
47
|
+
browserLocale(nav, hasDOM = _canUseDOM.canUseDOM) {
|
|
48
48
|
if (nav) return nav.language;
|
|
49
49
|
if (!hasDOM) return defaultLocale;
|
|
50
50
|
const documentLanguage = window.document.documentElement.lang;
|
package/lib/bidirectional.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.bidirectional = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _decorator = require("@instructure/ui-decorator/lib/decorator.js");
|
|
12
12
|
var _TextDirectionContext = require("./TextDirectionContext");
|
|
13
13
|
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
14
14
|
const _excluded = ["forwardedRef"];
|
|
@@ -71,7 +71,7 @@ const _excluded = ["forwardedRef"];
|
|
|
71
71
|
* @module bidirectional
|
|
72
72
|
* @return The decorator that composes the bidirectional component.
|
|
73
73
|
*/
|
|
74
|
-
const bidirectional = exports.bidirectional = (0,
|
|
74
|
+
const bidirectional = exports.bidirectional = (0, _decorator.decorator)(ComposedComponent => {
|
|
75
75
|
class BidirectionalComponent extends _react.default.Component {
|
|
76
76
|
render() {
|
|
77
77
|
const _this$props = this.props,
|
package/lib/getTextDirection.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.getTextDirection = getTextDirection;
|
|
8
|
-
var
|
|
8
|
+
var _canUseDOM = require("@instructure/ui-dom-utils/lib/canUseDOM.js");
|
|
9
|
+
var _getComputedStyle = require("@instructure/ui-dom-utils/lib/getComputedStyle.js");
|
|
9
10
|
/*
|
|
10
11
|
* The MIT License (MIT)
|
|
11
12
|
*
|
|
@@ -41,11 +42,11 @@ const getDefaultDir = () => {
|
|
|
41
42
|
if (defaultDir) {
|
|
42
43
|
return defaultDir;
|
|
43
44
|
}
|
|
44
|
-
if (
|
|
45
|
+
if (_canUseDOM.canUseDOM) {
|
|
45
46
|
const htmlEl = document.documentElement;
|
|
46
47
|
dirAttribute = htmlEl.getAttribute('dir');
|
|
47
48
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/direction
|
|
48
|
-
defaultDir = dirAttribute || (0,
|
|
49
|
+
defaultDir = dirAttribute || (0, _getComputedStyle.getComputedStyle)(htmlEl).direction;
|
|
49
50
|
if (!observer) {
|
|
50
51
|
observer = new MutationObserver(() => {
|
|
51
52
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
|
|
@@ -74,9 +75,9 @@ const getDefaultDir = () => {
|
|
|
74
75
|
* @returns {String} 'ltr' or 'rtl' or 'auto' (or `undefined` if no DOM is present)
|
|
75
76
|
*/
|
|
76
77
|
function getTextDirection(element) {
|
|
77
|
-
if (
|
|
78
|
+
if (_canUseDOM.canUseDOM) {
|
|
78
79
|
if (typeof element === 'undefined' || element === document.documentElement) return getDefaultDir();
|
|
79
|
-
return element.getAttribute('dir') || (0,
|
|
80
|
+
return element.getAttribute('dir') || (0, _getComputedStyle.getComputedStyle)(element).direction;
|
|
80
81
|
}
|
|
81
82
|
return void 0;
|
|
82
83
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-i18n",
|
|
3
|
-
"version": "8.56.2
|
|
3
|
+
"version": "8.56.2",
|
|
4
4
|
"description": "Helper components and utilities for internationalization.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.56.2
|
|
27
|
-
"@instructure/ui-test-utils": "8.56.2
|
|
26
|
+
"@instructure/ui-babel-preset": "8.56.2",
|
|
27
|
+
"@instructure/ui-test-utils": "8.56.2",
|
|
28
28
|
"@types/hoist-non-react-statics": "^3.3.3",
|
|
29
29
|
"react-dom": "^18.2.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.23.2",
|
|
33
|
-
"@instructure/shared-types": "8.56.2
|
|
34
|
-
"@instructure/ui-decorator": "8.56.2
|
|
35
|
-
"@instructure/ui-dom-utils": "8.56.2
|
|
36
|
-
"@instructure/ui-prop-types": "8.56.2
|
|
37
|
-
"@instructure/ui-react-utils": "8.56.2
|
|
38
|
-
"@instructure/ui-utils": "8.56.2
|
|
33
|
+
"@instructure/shared-types": "8.56.2",
|
|
34
|
+
"@instructure/ui-decorator": "8.56.2",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.56.2",
|
|
36
|
+
"@instructure/ui-prop-types": "8.56.2",
|
|
37
|
+
"@instructure/ui-react-utils": "8.56.2",
|
|
38
|
+
"@instructure/ui-utils": "8.56.2",
|
|
39
39
|
"hoist-non-react-statics": "^3.3.2",
|
|
40
40
|
"moment-timezone": "^0.5.43",
|
|
41
41
|
"prop-types": "^15.8.1"
|