@ornikar/kitt-universal 13.2.0 → 13.2.1

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.
@@ -11,10 +11,10 @@ import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
11
11
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
12
12
  import { ArcIcon, UserIcon, CheckboxMark, EyeOffIcon, EyeIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon, RotateCCWIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
13
13
  export * from '@ornikar/kitt-icons';
14
- import { useWindowDimensions, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2 } from 'react-native';
15
- export { useWindowDimensions as useWindowSize } from 'react-native';
16
14
  import { Portal } from 'react-portal';
17
15
  import { CSSTransition } from 'react-transition-group';
16
+ import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
17
+ export { useWindowDimensions as useWindowSize } from 'react-native';
18
18
  import { parse } from 'twemoji-parser';
19
19
  import { parseNumber, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
20
20
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -2297,53 +2297,18 @@ function LoaderIcon(_ref) {
2297
2297
  });
2298
2298
  }
2299
2299
 
2300
- function matchWindowSize(_ref, _ref2) {
2301
- var width = _ref.width,
2302
- height = _ref.height;
2303
- var minWidth = _ref2.minWidth,
2304
- maxWidth = _ref2.maxWidth,
2305
- minHeight = _ref2.minHeight,
2306
- maxHeight = _ref2.maxHeight;
2307
- var hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
2308
- var hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
2309
- return hasWidthMatched && hasHeightMatched;
2310
- }
2311
-
2312
- /**
2313
- * Returns if a size matches based on dimensions passed as options.
2314
- *
2315
- * WARNING: Not SSR friendly.
2316
- */
2317
- function useMatchWindowSize(options) {
2318
- var _useWindowDimensions = useWindowDimensions(),
2319
- width = _useWindowDimensions.width,
2320
- height = _useWindowDimensions.height;
2321
- return matchWindowSize({
2322
- width: width,
2323
- height: height
2324
- }, options);
2325
- }
2326
-
2327
2300
  var _excluded$C = ["as", "onPress", "disabled", "icon", "stretch"];
2328
- function getCurrentStretchValue(isStretch, isMedium) {
2329
- // Stretch will follow the value passed from the component occurence if defined
2330
- if (isStretch) return isStretch;
2331
- return !isMedium ? true : undefined;
2332
- }
2333
-
2334
- // eslint-disable-next-line @typescript-eslint/ban-types
2335
-
2336
2301
  function ActionsItem(_ref) {
2337
2302
  var as = _ref.as,
2338
2303
  onPress = _ref.onPress,
2339
2304
  disabled = _ref.disabled,
2340
2305
  icon = _ref.icon,
2341
- stretch = _ref.stretch,
2306
+ _ref$stretch = _ref.stretch,
2307
+ stretch = _ref$stretch === void 0 ? {
2308
+ base: true,
2309
+ medium: false
2310
+ } : _ref$stretch,
2342
2311
  props = _objectWithoutProperties(_ref, _excluded$C);
2343
- var isMedium = useMatchWindowSize({
2344
- minWidth: KittBreakpoints.MEDIUM
2345
- });
2346
- var isCurrentStretch = getCurrentStretchValue(stretch, isMedium);
2347
2312
  var _useState = useState(false),
2348
2313
  _useState2 = _slicedToArray(_useState, 2),
2349
2314
  isLoading = _useState2[0],
@@ -2359,7 +2324,7 @@ function ActionsItem(_ref) {
2359
2324
  }, []);
2360
2325
  return /*#__PURE__*/jsx(View, {
2361
2326
  children: /*#__PURE__*/jsx(as, _objectSpread(_objectSpread({}, props), {}, {
2362
- stretch: isCurrentStretch,
2327
+ stretch: stretch,
2363
2328
  disabled: isLoading ? true : disabled,
2364
2329
  icon: isLoading ? /*#__PURE__*/jsx(LoaderIcon, {}) : icon,
2365
2330
  onPress: function handlePress(e) {
@@ -2431,14 +2396,24 @@ function getCurrentDirection(layout) {
2431
2396
  if (layout === 'column') return 'column';
2432
2397
  return 'row';
2433
2398
  }
2399
+ function getCurrentAlignSelf(layout) {
2400
+ if (!layout) return {
2401
+ base: 'stretch',
2402
+ medium: undefined
2403
+ };
2404
+ if (layout === 'column') return 'stretch';
2405
+ return undefined;
2406
+ }
2434
2407
  function Actions(_ref) {
2435
2408
  var children = _ref.children,
2436
2409
  layout = _ref.layout,
2437
2410
  props = _objectWithoutProperties(_ref, _excluded$B);
2438
2411
  var currentAlignItems = getCurrentLayout(layout);
2439
2412
  var currentDirection = getCurrentDirection(layout);
2413
+ var currentAlignSelf = getCurrentAlignSelf(layout);
2440
2414
  return /*#__PURE__*/jsx(Stack, _objectSpread(_objectSpread({
2441
2415
  alignItems: currentAlignItems,
2416
+ alignSelf: currentAlignSelf,
2442
2417
  direction: currentDirection,
2443
2418
  flexGrow: 1
2444
2419
  }, props), {}, {
@@ -8383,6 +8358,33 @@ function StyleWebWrapper(_ref) {
8383
8358
  }));
8384
8359
  }
8385
8360
 
8361
+ function matchWindowSize(_ref, _ref2) {
8362
+ var width = _ref.width,
8363
+ height = _ref.height;
8364
+ var minWidth = _ref2.minWidth,
8365
+ maxWidth = _ref2.maxWidth,
8366
+ minHeight = _ref2.minHeight,
8367
+ maxHeight = _ref2.maxHeight;
8368
+ var hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
8369
+ var hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
8370
+ return hasWidthMatched && hasHeightMatched;
8371
+ }
8372
+
8373
+ /**
8374
+ * Returns if a size matches based on dimensions passed as options.
8375
+ *
8376
+ * WARNING: Not SSR friendly.
8377
+ */
8378
+ function useMatchWindowSize(options) {
8379
+ var _useWindowDimensions = useWindowDimensions(),
8380
+ width = _useWindowDimensions.width,
8381
+ height = _useWindowDimensions.height;
8382
+ return matchWindowSize({
8383
+ width: width,
8384
+ height: height
8385
+ }, options);
8386
+ }
8387
+
8386
8388
  var _excluded$1 = ["children"];
8387
8389
  /**
8388
8390
  * Display children if match window size options