carbon-addons-iot-react 4.1.37 → 4.1.38

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.
@@ -17,7 +17,7 @@ import React__default, { useMemo, useCallback } from 'react';
17
17
  import PropTypes from 'prop-types';
18
18
  import { OverflowMenu, OverflowMenuItem, unstable_FeatureFlags } from '@carbon/react';
19
19
  import classnames from 'classnames';
20
- import { useLangDirection } from 'use-lang-direction';
20
+ import { useLangDirection } from '../../utils/useLangDirection.js';
21
21
  import { settings } from '../../constants/Settings.js';
22
22
  import { TimeRangeOptionsPropTypes } from '../../constants/CardPropTypes.js';
23
23
  import { CARD_ACTIONS } from '../../constants/LayoutConstants.js';
@@ -23,7 +23,7 @@ import { OrderedList, ListItem, FormGroup, RadioButtonGroup, RadioButton, Layer,
23
23
  import classnames from 'classnames';
24
24
  import { v4 } from 'uuid';
25
25
  import warning from 'warning';
26
- import { useLangDirection } from 'use-lang-direction';
26
+ import { useLangDirection } from '../../utils/useLangDirection.js';
27
27
  import TimePickerSpinner from '../TimePickerSpinner/TimePickerSpinner.js';
28
28
  import TimePickerDropdown from '../TimePicker/TimePickerDropdown.js';
29
29
  import { settings } from '../../constants/Settings.js';
@@ -17,7 +17,7 @@ import { OrderedList, ListItem, FormGroup, RadioButtonGroup, RadioButton, Layer,
17
17
  import classnames from 'classnames';
18
18
  import { v4 } from 'uuid';
19
19
  import warning from 'warning';
20
- import { useLangDirection } from 'use-lang-direction';
20
+ import { useLangDirection } from '../../utils/useLangDirection.js';
21
21
  import TimePickerSpinner from '../TimePickerSpinner/TimePickerSpinner.js';
22
22
  import { settings } from '../../constants/Settings.js';
23
23
  import dayjs, { DAYJS_INPUT_FORMATS } from '../../utils/dayjs.js';
@@ -16,7 +16,7 @@ import React__default, { useRef, useState, useMemo, useCallback, useLayoutEffect
16
16
  import { HeaderGlobalBar, OverflowMenuItem } from '@carbon/react';
17
17
  import PropTypes from 'prop-types';
18
18
  import ReactDOM__default from 'react-dom';
19
- import { useLangDirection } from 'use-lang-direction';
19
+ import { useLangDirection } from '../../utils/useLangDirection.js';
20
20
  import { OverflowMenu } from '../OverflowMenu/index.js';
21
21
  import { settings } from '../../constants/Settings.js';
22
22
  import HeaderAction from './HeaderAction/HeaderAction.js';
@@ -11,7 +11,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
11
11
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
12
12
  import React__default, { useMemo, useState } from 'react';
13
13
  import classnames from 'classnames';
14
- import { useLangDirection } from 'use-lang-direction';
14
+ import { useLangDirection } from '../../utils/useLangDirection.js';
15
15
  import Button from '../Button/Button.js';
16
16
  import Card from '../Card/Card.js';
17
17
  import { getUpdatedCardSize, getResizeHandles } from '../../utils/cardUtilityFunctions.js';
@@ -15,7 +15,7 @@ import React__default, { useState, useRef, useCallback, useEffect, useLayoutEffe
15
15
  import PropTypes from 'prop-types';
16
16
  import { Menu } from '@carbon/react';
17
17
  import classnames from 'classnames';
18
- import { useLangDirection } from 'use-lang-direction';
18
+ import { useLangDirection } from '../../utils/useLangDirection.js';
19
19
  import { settings } from '../../constants/Settings.js';
20
20
  import deprecate from '../../internal/deprecate.js';
21
21
  import { SplitMenuButton } from './SplitMenuButton.js';
@@ -34,8 +34,8 @@ import PropTypes from 'prop-types';
34
34
  import useDeepCompareEffect from 'use-deep-compare-effect';
35
35
  import { TableContainer, Tag, Table as Table$2 } from '@carbon/react';
36
36
  import classnames from 'classnames';
37
- import { useLangDirection } from 'use-lang-direction';
38
37
  import warning from 'warning';
38
+ import { useLangDirection } from '../../utils/useLangDirection.js';
39
39
  import { defaultFunction } from '../../utils/componentUtilityFunctions.js';
40
40
  import { settings } from '../../constants/Settings.js';
41
41
  import { WrapCellTextPropTypes } from '../../constants/SharedPropTypes.js';
@@ -27,7 +27,7 @@ import PropTypes from 'prop-types';
27
27
  import { TableHead as TableHead$2, TableRow, TableExpandHeader, Checkbox, OverflowMenuItem } from '@carbon/react';
28
28
  import classnames from 'classnames';
29
29
  import warning from 'warning';
30
- import { useLangDirection } from 'use-lang-direction';
30
+ import { useLangDirection } from '../../../utils/useLangDirection.js';
31
31
  import { PinColumnPropTypes, TableColumnsPropTypes, TableColumnGroupPropType, ActiveTableToolbarPropType, TableSortPropType, TableOrderingPropType, I18NPropTypes, defaultI18NPropTypes } from '../TablePropTypes.js';
32
32
  import TableCellRenderer from '../TableCellRenderer/TableCellRenderer.js';
33
33
  import { tableTranslateWithId } from '../../../utils/componentUtilityFunctions.js';
@@ -20,7 +20,7 @@ import React__default, { useMemo } from 'react';
20
20
  import PropTypes from 'prop-types';
21
21
  import { TableToolbar as TableToolbar$2, TableBatchActions, TableBatchAction, OverflowMenuItem, TableToolbarContent } from '@carbon/react';
22
22
  import classnames from 'classnames';
23
- import { useLangDirection } from 'use-lang-direction';
23
+ import { useLangDirection } from '../../../utils/useLangDirection.js';
24
24
  import { Tooltip } from '../../Tooltip/index.js';
25
25
  import { OverflowMenu } from '../../OverflowMenu/index.js';
26
26
  import Button from '../../Button/Button.js';
@@ -8,7 +8,7 @@ import 'core-js/modules/es.array.splice.js';
8
8
  import 'core-js/modules/es.object.to-string.js';
9
9
  import 'core-js/modules/es.string.includes.js';
10
10
  import * as React from 'react';
11
- import { useLangDirection } from 'use-lang-direction';
11
+ import { useLangDirection } from '../utils/useLangDirection.js';
12
12
 
13
13
  /**
14
14
  * constant override to fix the calculated result returned from getMenuOffset in carbon
package/es/index.js CHANGED
@@ -57,6 +57,7 @@ export { default as uiresources } from './components/SuiteHeader/util/uiresource
57
57
  export { default as cacheduiresources } from './components/SuiteHeader/util/cacheduiresources.js';
58
58
  export { default as Walkme } from './components/Walkme/Walkme.js';
59
59
  export { default as ReadOnlyValue } from './components/ReadOnlyValue/ReadOnlyValue.js';
60
+ export { useLangDirection } from './utils/useLangDirection.js';
60
61
  export { default as Dashboard } from './components/Dashboard/Dashboard.js';
61
62
  export { default as DashboardHeader } from './components/Dashboard/DashboardHeader.js';
62
63
  export { default as DashboardGrid } from './components/Dashboard/DashboardGrid.js';
@@ -0,0 +1,76 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import { useState, useRef, useEffect } from 'react';
3
+
4
+ /**
5
+ * React hook that returns the current language direction ('ltr' or 'rtl')
6
+ * from the HTML element's 'dir' attribute and updates when it changes.
7
+ *
8
+ * @returns {string} The current language direction ('ltr' or 'rtl')
9
+ */
10
+ function useLangDirection() {
11
+ // Create state and refs first to avoid conditional hook calls
12
+ var _useState = useState(null),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ direction = _useState2[0],
15
+ setDirection = _useState2[1];
16
+ var observer = useRef(null);
17
+ var isServerSide = useRef(typeof window === 'undefined' || typeof document === 'undefined');
18
+ useEffect(function () {
19
+ // Return early if in server environment
20
+ if (isServerSide.current) {
21
+ return;
22
+ }
23
+
24
+ // Target the HTML element
25
+ var element = document.getElementsByTagName('html')[0];
26
+
27
+ // Set initial direction
28
+ setDirection(element.getAttribute('dir') || 'ltr');
29
+
30
+ // Callback function to execute when mutations are observed
31
+ var callback = function callback(mutationsList) {
32
+ // Use traditional for loop for better compatibility
33
+ for (var i = 0; i < mutationsList.length; i += 1) {
34
+ var mutation = mutationsList[i];
35
+ // Check if the mutation was for the 'dir' attribute
36
+ if (mutation.type === 'attributes' && mutation.attributeName === 'dir' && mutation.oldValue !== element.getAttribute('dir')) {
37
+ // Update the direction state
38
+ setDirection(element.getAttribute('dir'));
39
+ }
40
+ }
41
+ };
42
+
43
+ // Disconnect any existing observer
44
+ if (observer.current) {
45
+ observer.current.disconnect();
46
+ }
47
+
48
+ // Configure the observer to watch for attribute changes
49
+ var config = {
50
+ attributes: true,
51
+ attributeOldValue: true,
52
+ attributeFilter: ['dir']
53
+ };
54
+
55
+ // Create a new MutationObserver
56
+ observer.current = new MutationObserver(callback);
57
+
58
+ // Start observing the HTML element
59
+ observer.current.observe(element, config);
60
+
61
+ // Cleanup function to disconnect the observer on unmount
62
+ // eslint-disable-next-line consistent-return
63
+ return function () {
64
+ if (observer.current) {
65
+ observer.current.disconnect();
66
+ }
67
+ };
68
+ }, []); // No dependencies needed as element is constant
69
+
70
+ // Return the current direction, defaulting to 'ltr' if not set or in server environment
71
+ return isServerSide.current ? 'ltr' : direction || 'ltr';
72
+ }
73
+
74
+ // Made with Bob
75
+
76
+ export { useLangDirection };
@@ -21,7 +21,7 @@ var React = require('react');
21
21
  var PropTypes = require('prop-types');
22
22
  var react = require('@carbon/react');
23
23
  var classnames = require('classnames');
24
- var useLangDirection = require('use-lang-direction');
24
+ var useLangDirection = require('../../utils/useLangDirection.js');
25
25
  var Settings = require('../../constants/Settings.js');
26
26
  var CardPropTypes = require('../../constants/CardPropTypes.js');
27
27
  var LayoutConstants = require('../../constants/LayoutConstants.js');
@@ -27,7 +27,7 @@ var react = require('@carbon/react');
27
27
  var classnames = require('classnames');
28
28
  var uuid = require('uuid');
29
29
  var warning = require('warning');
30
- var useLangDirection = require('use-lang-direction');
30
+ var useLangDirection = require('../../utils/useLangDirection.js');
31
31
  var TimePickerSpinner = require('../TimePickerSpinner/TimePickerSpinner.js');
32
32
  var TimePickerDropdown = require('../TimePicker/TimePickerDropdown.js');
33
33
  var Settings = require('../../constants/Settings.js');
@@ -21,7 +21,7 @@ var react = require('@carbon/react');
21
21
  var classnames = require('classnames');
22
22
  var uuid = require('uuid');
23
23
  var warning = require('warning');
24
- var useLangDirection = require('use-lang-direction');
24
+ var useLangDirection = require('../../utils/useLangDirection.js');
25
25
  var TimePickerSpinner = require('../TimePickerSpinner/TimePickerSpinner.js');
26
26
  var Settings = require('../../constants/Settings.js');
27
27
  var dayjs = require('../../utils/dayjs.js');
@@ -18,7 +18,7 @@ var React = require('react');
18
18
  var react = require('@carbon/react');
19
19
  var PropTypes = require('prop-types');
20
20
  var ReactDOM = require('react-dom');
21
- var useLangDirection = require('use-lang-direction');
21
+ var useLangDirection = require('../../utils/useLangDirection.js');
22
22
  var index = require('../OverflowMenu/index.js');
23
23
  var Settings = require('../../constants/Settings.js');
24
24
  var HeaderAction = require('./HeaderAction/HeaderAction.js');
@@ -13,7 +13,7 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
13
13
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
14
14
  var React = require('react');
15
15
  var classnames = require('classnames');
16
- var useLangDirection = require('use-lang-direction');
16
+ var useLangDirection = require('../../utils/useLangDirection.js');
17
17
  var Button = require('../Button/Button.js');
18
18
  var Card = require('../Card/Card.js');
19
19
  var cardUtilityFunctions = require('../../utils/cardUtilityFunctions.js');
@@ -17,7 +17,7 @@ var React = require('react');
17
17
  var PropTypes = require('prop-types');
18
18
  var react = require('@carbon/react');
19
19
  var classnames = require('classnames');
20
- var useLangDirection = require('use-lang-direction');
20
+ var useLangDirection = require('../../utils/useLangDirection.js');
21
21
  var Settings = require('../../constants/Settings.js');
22
22
  var deprecate = require('../../internal/deprecate.js');
23
23
  var SplitMenuButton = require('./SplitMenuButton.js');
@@ -38,8 +38,8 @@ var PropTypes = require('prop-types');
38
38
  var useDeepCompareEffect = require('use-deep-compare-effect');
39
39
  var react = require('@carbon/react');
40
40
  var classnames = require('classnames');
41
- var useLangDirection = require('use-lang-direction');
42
41
  var warning = require('warning');
42
+ var useLangDirection = require('../../utils/useLangDirection.js');
43
43
  var componentUtilityFunctions = require('../../utils/componentUtilityFunctions.js');
44
44
  var Settings = require('../../constants/Settings.js');
45
45
  var SharedPropTypes = require('../../constants/SharedPropTypes.js');
@@ -29,7 +29,7 @@ var PropTypes = require('prop-types');
29
29
  var react = require('@carbon/react');
30
30
  var classnames = require('classnames');
31
31
  var warning = require('warning');
32
- var useLangDirection = require('use-lang-direction');
32
+ var useLangDirection = require('../../../utils/useLangDirection.js');
33
33
  var TablePropTypes = require('../TablePropTypes.js');
34
34
  var TableCellRenderer = require('../TableCellRenderer/TableCellRenderer.js');
35
35
  var componentUtilityFunctions = require('../../../utils/componentUtilityFunctions.js');
@@ -22,7 +22,7 @@ var React = require('react');
22
22
  var PropTypes = require('prop-types');
23
23
  var react = require('@carbon/react');
24
24
  var classnames = require('classnames');
25
- var useLangDirection = require('use-lang-direction');
25
+ var useLangDirection = require('../../../utils/useLangDirection.js');
26
26
  var index$1 = require('../../Tooltip/index.js');
27
27
  var index = require('../../OverflowMenu/index.js');
28
28
  var Button = require('../../Button/Button.js');
@@ -10,7 +10,7 @@ require('core-js/modules/es.array.splice.js');
10
10
  require('core-js/modules/es.object.to-string.js');
11
11
  require('core-js/modules/es.string.includes.js');
12
12
  var React = require('react');
13
- var useLangDirection = require('use-lang-direction');
13
+ var useLangDirection = require('../utils/useLangDirection.js');
14
14
 
15
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
16
 
package/lib/index.js CHANGED
@@ -58,6 +58,7 @@ var uiresources = require('./components/SuiteHeader/util/uiresources.js');
58
58
  var cacheduiresources = require('./components/SuiteHeader/util/cacheduiresources.js');
59
59
  var Walkme = require('./components/Walkme/Walkme.js');
60
60
  var ReadOnlyValue = require('./components/ReadOnlyValue/ReadOnlyValue.js');
61
+ var useLangDirection = require('./utils/useLangDirection.js');
61
62
  var Dashboard = require('./components/Dashboard/Dashboard.js');
62
63
  var DashboardHeader = require('./components/Dashboard/DashboardHeader.js');
63
64
  var DashboardGrid = require('./components/Dashboard/DashboardGrid.js');
@@ -209,6 +210,7 @@ exports.uiresources = uiresources.default;
209
210
  exports.cacheduiresources = cacheduiresources;
210
211
  exports.Walkme = Walkme;
211
212
  exports.ReadOnlyValue = ReadOnlyValue;
213
+ exports.useLangDirection = useLangDirection.useLangDirection;
212
214
  exports.Dashboard = Dashboard;
213
215
  exports.DashboardHeader = DashboardHeader;
214
216
  exports.DashboardGrid = DashboardGrid.default;
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
+ var React = require('react');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
9
+
10
+ /**
11
+ * React hook that returns the current language direction ('ltr' or 'rtl')
12
+ * from the HTML element's 'dir' attribute and updates when it changes.
13
+ *
14
+ * @returns {string} The current language direction ('ltr' or 'rtl')
15
+ */
16
+ function useLangDirection() {
17
+ // Create state and refs first to avoid conditional hook calls
18
+ var _useState = React.useState(null),
19
+ _useState2 = _slicedToArray__default.default(_useState, 2),
20
+ direction = _useState2[0],
21
+ setDirection = _useState2[1];
22
+ var observer = React.useRef(null);
23
+ var isServerSide = React.useRef(typeof window === 'undefined' || typeof document === 'undefined');
24
+ React.useEffect(function () {
25
+ // Return early if in server environment
26
+ if (isServerSide.current) {
27
+ return;
28
+ }
29
+
30
+ // Target the HTML element
31
+ var element = document.getElementsByTagName('html')[0];
32
+
33
+ // Set initial direction
34
+ setDirection(element.getAttribute('dir') || 'ltr');
35
+
36
+ // Callback function to execute when mutations are observed
37
+ var callback = function callback(mutationsList) {
38
+ // Use traditional for loop for better compatibility
39
+ for (var i = 0; i < mutationsList.length; i += 1) {
40
+ var mutation = mutationsList[i];
41
+ // Check if the mutation was for the 'dir' attribute
42
+ if (mutation.type === 'attributes' && mutation.attributeName === 'dir' && mutation.oldValue !== element.getAttribute('dir')) {
43
+ // Update the direction state
44
+ setDirection(element.getAttribute('dir'));
45
+ }
46
+ }
47
+ };
48
+
49
+ // Disconnect any existing observer
50
+ if (observer.current) {
51
+ observer.current.disconnect();
52
+ }
53
+
54
+ // Configure the observer to watch for attribute changes
55
+ var config = {
56
+ attributes: true,
57
+ attributeOldValue: true,
58
+ attributeFilter: ['dir']
59
+ };
60
+
61
+ // Create a new MutationObserver
62
+ observer.current = new MutationObserver(callback);
63
+
64
+ // Start observing the HTML element
65
+ observer.current.observe(element, config);
66
+
67
+ // Cleanup function to disconnect the observer on unmount
68
+ // eslint-disable-next-line consistent-return
69
+ return function () {
70
+ if (observer.current) {
71
+ observer.current.disconnect();
72
+ }
73
+ };
74
+ }, []); // No dependencies needed as element is constant
75
+
76
+ // Return the current direction, defaulting to 'ltr' if not set or in server environment
77
+ return isServerSide.current ? 'ltr' : direction || 'ltr';
78
+ }
79
+
80
+ // Made with Bob
81
+
82
+ exports.useLangDirection = useLangDirection;
package/package.json CHANGED
@@ -209,7 +209,6 @@
209
209
  "styled-components": "^6.1.13",
210
210
  "thenby": "^1.3.4",
211
211
  "use-deep-compare-effect": "^1.2.0",
212
- "use-lang-direction": "^0.2.0",
213
212
  "use-resize-observer": "^8.0.0",
214
213
  "uuid": "^9.0.1",
215
214
  "warning": "^4.0.3"
@@ -345,11 +344,11 @@
345
344
  "whatwg-fetch": "^3.0.0"
346
345
  },
347
346
  "sideEffects": false,
348
- "version": "4.1.37",
347
+ "version": "4.1.38",
349
348
  "resolutions": {
350
349
  "chokidar": "3.3.1",
351
350
  "react-grid-layout": "1.2.2",
352
351
  "got": "11.8.5"
353
352
  },
354
- "gitHead": "9c201ce5da15331be1a6e9d83c7539b882bbf105"
353
+ "gitHead": "49dd0e1cf53ec9a7101d0c32bcbbb54ace5dfb97"
355
354
  }
@@ -2357,25 +2357,25 @@
2357
2357
  };
2358
2358
  var Button$2 = Button$1;
2359
2359
 
2360
- function _arrayLikeToArray$c(r, a) {
2360
+ function _arrayLikeToArray$b(r, a) {
2361
2361
  (null == a || a > r.length) && (a = r.length);
2362
2362
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2363
2363
  return n;
2364
2364
  }
2365
2365
 
2366
2366
  function _arrayWithoutHoles$2(r) {
2367
- if (Array.isArray(r)) return _arrayLikeToArray$c(r);
2367
+ if (Array.isArray(r)) return _arrayLikeToArray$b(r);
2368
2368
  }
2369
2369
 
2370
2370
  function _iterableToArray$2(r) {
2371
2371
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2372
2372
  }
2373
2373
 
2374
- function _unsupportedIterableToArray$c(r, a) {
2374
+ function _unsupportedIterableToArray$b(r, a) {
2375
2375
  if (r) {
2376
- if ("string" == typeof r) return _arrayLikeToArray$c(r, a);
2376
+ if ("string" == typeof r) return _arrayLikeToArray$b(r, a);
2377
2377
  var t = {}.toString.call(r).slice(8, -1);
2378
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$c(r, a) : void 0;
2378
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$b(r, a) : void 0;
2379
2379
  }
2380
2380
  }
2381
2381
 
@@ -2384,7 +2384,7 @@
2384
2384
  }
2385
2385
 
2386
2386
  function _toConsumableArray$2(r) {
2387
- return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$2();
2387
+ return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$b(r) || _nonIterableSpread$2();
2388
2388
  }
2389
2389
 
2390
2390
  function _arrayWithHoles$9(r) {
@@ -2424,7 +2424,7 @@
2424
2424
  }
2425
2425
 
2426
2426
  function _slicedToArray$9(r, e) {
2427
- return _arrayWithHoles$9(r) || _iterableToArrayLimit$9(r, e) || _unsupportedIterableToArray$c(r, e) || _nonIterableRest$9();
2427
+ return _arrayWithHoles$9(r) || _iterableToArrayLimit$9(r, e) || _unsupportedIterableToArray$b(r, e) || _nonIterableRest$9();
2428
2428
  }
2429
2429
 
2430
2430
  var $map$1 = arrayIteration.map;
@@ -2752,7 +2752,7 @@
2752
2752
  enabled: enabled$1.enableEnhancedFileUploader
2753
2753
  }];
2754
2754
 
2755
- function _arrayLikeToArray$b(r, a) {
2755
+ function _arrayLikeToArray$a(r, a) {
2756
2756
  (null == a || a > r.length) && (a = r.length);
2757
2757
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2758
2758
  return n;
@@ -2774,10 +2774,10 @@
2774
2774
  writable: false
2775
2775
  }), e;
2776
2776
  }
2777
- function _createForOfIteratorHelper$2(r, e) {
2777
+ function _createForOfIteratorHelper$1(r, e) {
2778
2778
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2779
2779
  if (!t) {
2780
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$b(r)) || e) {
2780
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$a(r)) || e) {
2781
2781
  t && (r = t);
2782
2782
  var n = 0,
2783
2783
  F = function () {};
@@ -2850,7 +2850,7 @@
2850
2850
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2851
2851
  }
2852
2852
  function _slicedToArray$8(r, e) {
2853
- return _arrayWithHoles$8(r) || _iterableToArrayLimit$8(r, e) || _unsupportedIterableToArray$b(r, e) || _nonIterableRest$8();
2853
+ return _arrayWithHoles$8(r) || _iterableToArrayLimit$8(r, e) || _unsupportedIterableToArray$a(r, e) || _nonIterableRest$8();
2854
2854
  }
2855
2855
  function _toPrimitive$2(t, r) {
2856
2856
  if ("object" != typeof t || !t) return t;
@@ -2866,11 +2866,11 @@
2866
2866
  var i = _toPrimitive$2(t, "string");
2867
2867
  return "symbol" == typeof i ? i : i + "";
2868
2868
  }
2869
- function _unsupportedIterableToArray$b(r, a) {
2869
+ function _unsupportedIterableToArray$a(r, a) {
2870
2870
  if (r) {
2871
- if ("string" == typeof r) return _arrayLikeToArray$b(r, a);
2871
+ if ("string" == typeof r) return _arrayLikeToArray$a(r, a);
2872
2872
  var t = {}.toString.call(r).slice(8, -1);
2873
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$b(r, a) : void 0;
2873
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$a(r, a) : void 0;
2874
2874
  }
2875
2875
  }
2876
2876
 
@@ -2961,7 +2961,7 @@
2961
2961
  }, {
2962
2962
  key: "mergeWithScope",
2963
2963
  value: function mergeWithScope(scope) {
2964
- var _iterator = _createForOfIteratorHelper$2(scope.flags),
2964
+ var _iterator = _createForOfIteratorHelper$1(scope.flags),
2965
2965
  _step;
2966
2966
  try {
2967
2967
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -9719,154 +9719,78 @@
9719
9719
  }
9720
9720
  });
9721
9721
 
9722
- var interopRequireDefault = createCommonjsModule(function (module) {
9723
- function _interopRequireDefault(e) {
9724
- return e && e.__esModule ? e : {
9725
- "default": e
9726
- };
9727
- }
9728
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
9729
- });
9730
-
9731
- var arrayWithHoles = createCommonjsModule(function (module) {
9732
- function _arrayWithHoles(r) {
9733
- if (Array.isArray(r)) return r;
9734
- }
9735
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
9736
- });
9737
-
9738
- var iterableToArrayLimit = createCommonjsModule(function (module) {
9739
- function _iterableToArrayLimit(r, l) {
9740
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
9741
- if (null != t) {
9742
- var e,
9743
- n,
9744
- i,
9745
- u,
9746
- a = [],
9747
- f = !0,
9748
- o = !1;
9749
- try {
9750
- if (i = (t = t.call(r)).next, 0 === l) {
9751
- if (Object(t) !== t) return;
9752
- f = !1;
9753
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
9754
- } catch (r) {
9755
- o = !0, n = r;
9756
- } finally {
9757
- try {
9758
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
9759
- } finally {
9760
- if (o) throw n;
9761
- }
9762
- }
9763
- return a;
9764
- }
9765
- }
9766
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
9767
- });
9768
-
9769
- var arrayLikeToArray = createCommonjsModule(function (module) {
9770
- function _arrayLikeToArray(r, a) {
9771
- (null == a || a > r.length) && (a = r.length);
9772
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
9773
- return n;
9774
- }
9775
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
9776
- });
9777
-
9778
- var unsupportedIterableToArray = createCommonjsModule(function (module) {
9779
- function _unsupportedIterableToArray(r, a) {
9780
- if (r) {
9781
- if ("string" == typeof r) return arrayLikeToArray(r, a);
9782
- var t = {}.toString.call(r).slice(8, -1);
9783
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
9784
- }
9785
- }
9786
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
9787
- });
9788
-
9789
- var nonIterableRest = createCommonjsModule(function (module) {
9790
- function _nonIterableRest() {
9791
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9792
- }
9793
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
9794
- });
9795
-
9796
- var slicedToArray = createCommonjsModule(function (module) {
9797
- function _slicedToArray(r, e) {
9798
- return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
9799
- }
9800
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
9801
- });
9802
-
9803
- var useLangDirection_2 = useLangDirection;
9804
-
9805
- var _slicedToArray2 = interopRequireDefault(slicedToArray);
9806
-
9807
-
9808
-
9809
- function _createForOfIteratorHelper$1(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray$a(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9810
-
9811
- function _unsupportedIterableToArray$a(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$a(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$a(o, minLen); }
9812
-
9813
- function _arrayLikeToArray$a(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
9814
-
9722
+ /**
9723
+ * React hook that returns the current language direction ('ltr' or 'rtl')
9724
+ * from the HTML element's 'dir' attribute and updates when it changes.
9725
+ *
9726
+ * @returns {string} The current language direction ('ltr' or 'rtl')
9727
+ */
9815
9728
  function useLangDirection() {
9816
- // Default target
9817
- var element = document.getElementsByTagName('html')[0]; // Read and set initial direction from default
9729
+ // Create state and refs first to avoid conditional hook calls
9730
+ var _useState = React$1.useState(null),
9731
+ _useState2 = _slicedToArray$9(_useState, 2),
9732
+ direction = _useState2[0],
9733
+ setDirection = _useState2[1];
9734
+ var observer = React$1.useRef(null);
9735
+ var isServerSide = React$1.useRef(typeof window === 'undefined' || typeof document === 'undefined');
9736
+ React$1.useEffect(function () {
9737
+ // Return early if in server environment
9738
+ if (isServerSide.current) {
9739
+ return;
9740
+ }
9818
9741
 
9819
- var _useState = (0, React$1.useState)(element.getAttribute('dir')),
9820
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
9821
- direction = _useState2[0],
9822
- setDirection = _useState2[1]; // Store obsever as ref so we can ensure we are cleaning all obvservers up
9742
+ // Target the HTML element
9743
+ var element = document.getElementsByTagName('html')[0];
9823
9744
 
9745
+ // Set initial direction
9746
+ setDirection(element.getAttribute('dir') || 'ltr');
9824
9747
 
9825
- var observer = (0, React$1.useRef)(null);
9826
- (0, React$1.useEffect)(function () {
9827
9748
  // Callback function to execute when mutations are observed
9828
9749
  var callback = function callback(mutationsList) {
9829
- // Use traditional 'for loops' for IE 11
9830
- var _iterator = _createForOfIteratorHelper$1(mutationsList),
9831
- _step;
9832
-
9833
- try {
9834
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
9835
- var mutation = _step.value;
9836
-
9837
- // Check if mutation was our dir attribute
9838
- if (mutation.type === 'attributes' && mutation.attributeName === 'dir' && mutation.oldValue !== element.getAttribute('dir')) {
9839
- // Set the new direction
9840
- setDirection(element.getAttribute('dir'));
9841
- }
9750
+ // Use traditional for loop for better compatibility
9751
+ for (var i = 0; i < mutationsList.length; i += 1) {
9752
+ var mutation = mutationsList[i];
9753
+ // Check if the mutation was for the 'dir' attribute
9754
+ if (mutation.type === 'attributes' && mutation.attributeName === 'dir' && mutation.oldValue !== element.getAttribute('dir')) {
9755
+ // Update the direction state
9756
+ setDirection(element.getAttribute('dir'));
9842
9757
  }
9843
- } catch (err) {
9844
- _iterator.e(err);
9845
- } finally {
9846
- _iterator.f();
9847
9758
  }
9848
- }; // Disconnect any old observers
9849
-
9759
+ };
9850
9760
 
9851
- if (observer.current) observer.current.disconnect(); // Options for the observer (which mutations to observe)
9761
+ // Disconnect any existing observer
9762
+ if (observer.current) {
9763
+ observer.current.disconnect();
9764
+ }
9852
9765
 
9766
+ // Configure the observer to watch for attribute changes
9853
9767
  var config = {
9854
- attributes: true
9855
- }; // Create an observer instance linked to the callback function
9768
+ attributes: true,
9769
+ attributeOldValue: true,
9770
+ attributeFilter: ['dir']
9771
+ };
9856
9772
 
9773
+ // Create a new MutationObserver
9857
9774
  observer.current = new MutationObserver(callback);
9858
- var currentObserver = observer.current; // Start observing the target node for configured mutations
9859
9775
 
9860
- currentObserver.observe(element, config); // Disconnect on unmount
9776
+ // Start observing the HTML element
9777
+ observer.current.observe(element, config);
9861
9778
 
9779
+ // Cleanup function to disconnect the observer on unmount
9780
+ // eslint-disable-next-line consistent-return
9862
9781
  return function () {
9863
- currentObserver.disconnect();
9782
+ if (observer.current) {
9783
+ observer.current.disconnect();
9784
+ }
9864
9785
  };
9865
- }, [element, direction]); // Return the element direction value
9786
+ }, []); // No dependencies needed as element is constant
9866
9787
 
9867
- return direction || 'ltr';
9788
+ // Return the current direction, defaulting to 'ltr' if not set or in server environment
9789
+ return isServerSide.current ? 'ltr' : direction || 'ltr';
9868
9790
  }
9869
9791
 
9792
+ // Made with Bob
9793
+
9870
9794
  /**
9871
9795
  * constant override to fix the calculated result returned from getMenuOffset in carbon
9872
9796
  */
@@ -9965,7 +9889,7 @@
9965
9889
  flyoutAlignment = _React$useState8[0].flyoutAlignment,
9966
9890
  setDirections = _React$useState8[1];
9967
9891
  var previousDirection = React__namespace.useRef();
9968
- var langDir = useLangDirection_2();
9892
+ var langDir = useLangDirection();
9969
9893
  React__namespace.useEffect(function () {
9970
9894
  previousDirection.current = direction;
9971
9895
  setAdjustedDirection(direction);
@@ -213642,7 +213566,7 @@ ${formatRule(Codicon.menuSubmenu)}
213642
213566
  return id === columnGroupId;
213643
213567
  });
213644
213568
  });
213645
- var langDir = useLangDirection_2();
213569
+ var langDir = useLangDirection();
213646
213570
  return /*#__PURE__*/React$1.createElement(react.TableHead, {
213647
213571
  className: classnames(_defineProperty$c({
213648
213572
  lightweight: lightweight
@@ -216898,7 +216822,7 @@ ${formatRule(Codicon.menuSubmenu)}
216898
216822
  testID = _ref.testID,
216899
216823
  testId = _ref.testId;
216900
216824
  var shouldShowBatchActions = hasRowSelection === 'multi' && totalSelected > 0;
216901
- var langDir = useLangDirection_2();
216825
+ var langDir = useLangDirection();
216902
216826
  var _useDynamicOverflowMe = useDynamicOverflowMenuItems$1({
216903
216827
  actions: toolbarActions,
216904
216828
  className: "".concat(iotPrefix$24, "--table-toolbar-aggregations__overflow-menu-content"),
@@ -225202,7 +225126,7 @@ ${formatRule(Codicon.menuSubmenu)}
225202
225126
  var _view$pagination = view.pagination,
225203
225127
  maxPages = _view$pagination.maxPages,
225204
225128
  paginationProps = _objectWithoutProperties$3(_view$pagination, _excluded4$1);
225205
- var langDir = useLangDirection_2();
225129
+ var langDir = useLangDirection();
225206
225130
  var hasMultiSelect = options.hasRowSelection === 'multi';
225207
225131
  var hasSingleSelect = options.hasRowSelection === 'single';
225208
225132
  var _useState = React$1.useState(function () {
@@ -259047,7 +258971,7 @@ React keys must be passed directly to JSX without using spread:
259047
258971
  warning_1(false, 'The `DateTimePickerV2` is an experimental component and could be lacking unit test and documentation. Be aware that minor version bumps could introduce breaking changes. For the reasons listed above use of this component in production is highly discouraged') ;
259048
258972
  }
259049
258973
  }, []);
259050
- var langDir = useLangDirection_2();
258974
+ var langDir = useLangDirection();
259051
258975
  var mergedI18n = React$1.useMemo(function () {
259052
258976
  return _objectSpread$1r(_objectSpread$1r({}, defaultProps$1L.i18n), i18n);
259053
258977
  }, [i18n]);
@@ -264343,7 +264267,7 @@ React keys must be passed directly to JSX without using spread:
264343
264267
  renderDateDropdownInPortal = _ref.renderDateDropdownInPortal,
264344
264268
  id = _ref.id;
264345
264269
  var mergedI18n = _objectSpread$1n(_objectSpread$1n({}, defaultProps$1I.i18n), i18n);
264346
- var langDir = useLangDirection_2();
264270
+ var langDir = useLangDirection();
264347
264271
  var overflowMenuPosition = React$1.useMemo(function () {
264348
264272
  return langDir === 'ltr';
264349
264273
  }, [langDir]);
@@ -271377,7 +271301,7 @@ React keys must be passed directly to JSX without using spread:
271377
271301
  warning_1(false, 'The `DateTimePickerV2` is an experimental component and could be lacking unit test and documentation. Be aware that minor version bumps could introduce breaking changes. For the reasons listed above use of this component in production is highly discouraged') ;
271378
271302
  }
271379
271303
  }, []);
271380
- var langDir = useLangDirection_2();
271304
+ var langDir = useLangDirection();
271381
271305
  var mergedI18n = React$1.useMemo(function () {
271382
271306
  return _objectSpread$1g(_objectSpread$1g({}, defaultProps$1z.i18n), i18n);
271383
271307
  }, [i18n]);
@@ -275717,7 +275641,7 @@ React keys must be passed directly to JSX without using spread:
275717
275641
  var mergedI18n = React$1.useMemo(function () {
275718
275642
  return _objectSpread$1b(_objectSpread$1b({}, defaultProps$1q.i18n), i18n);
275719
275643
  }, [i18n]);
275720
- var langDir = useLangDirection_2();
275644
+ var langDir = useLangDirection();
275721
275645
  var checkForOverflow = React$1.useCallback(function () {
275722
275646
  /* istanbul ignore else */
275723
275647
  if (overFlowContainerRef.current) {
@@ -325447,7 +325371,7 @@ React keys must be passed directly to JSX without using spread:
325447
325371
  shadowBlockerConf = _useState6[0],
325448
325372
  setShadowBlockerConf = _useState6[1];
325449
325373
  var buttonRef = React$1.useRef(null);
325450
- var langDir = useLangDirection_2();
325374
+ var langDir = useLangDirection();
325451
325375
  var handleResize = React$1.useCallback(function () {
325452
325376
  /* istanbul ignore else */
325453
325377
  if (buttonRef.current) {
@@ -329036,7 +328960,7 @@ React keys must be passed directly to JSX without using spread:
329036
328960
  var mergedI18n = React$1.useMemo(function () {
329037
328961
  return _objectSpread$7(_objectSpread$7({}, defaultProps$8.i18n), i18n);
329038
328962
  }, [i18n]);
329039
- var langDir = useLangDirection_2();
328963
+ var langDir = useLangDirection();
329040
328964
  // Checks size property against new size naming convention and reassigns to closest supported size if necessary.
329041
328965
  var newSize = getUpdatedCardSize(size);
329042
328966
  var BASE_CLASS_NAME = "".concat(iotPrefix$7, "--map");
@@ -370916,6 +370840,7 @@ ${tagToString(tag)}`;
370916
370840
  exports.uiresources = getUiResourcesData$1;
370917
370841
  exports.useDNDProviderElement = useDNDProviderElement;
370918
370842
  exports.useHotspotEditorState = useHotspotEditorState;
370843
+ exports.useLangDirection = useLangDirection;
370919
370844
  exports.useResize = useResize;
370920
370845
  exports.useSuiteHeaderData = useSuiteHeaderData$1;
370921
370846
  exports.useUiResources = useUiResources$1;