@ornikar/kitt-universal 13.2.0 → 13.3.0

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.
@@ -6,9 +6,9 @@ const react = require('react');
6
6
  const nativeBase = require('native-base');
7
7
  const jsxRuntime = require('react/jsx-runtime');
8
8
  const kittIcons = require('@ornikar/kitt-icons');
9
- const reactNative = require('react-native');
10
9
  const reactPortal = require('react-portal');
11
10
  const reactTransitionGroup = require('react-transition-group');
11
+ const reactNative = require('react-native');
12
12
  const twemojiParser = require('twemoji-parser');
13
13
  const libphonenumberJs = require('libphonenumber-js');
14
14
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
@@ -2299,56 +2299,17 @@ function LoaderIcon({
2299
2299
  });
2300
2300
  }
2301
2301
 
2302
- function matchWindowSize({
2303
- width,
2304
- height
2305
- }, {
2306
- minWidth,
2307
- maxWidth,
2308
- minHeight,
2309
- maxHeight
2310
- }) {
2311
- const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
2312
- const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
2313
- return hasWidthMatched && hasHeightMatched;
2314
- }
2315
-
2316
- /**
2317
- * Returns if a size matches based on dimensions passed as options.
2318
- *
2319
- * WARNING: Not SSR friendly.
2320
- */
2321
- function useMatchWindowSize(options) {
2322
- const {
2323
- width,
2324
- height
2325
- } = reactNative.useWindowDimensions();
2326
- return matchWindowSize({
2327
- width,
2328
- height
2329
- }, options);
2330
- }
2331
-
2332
- function getCurrentStretchValue(isStretch, isMedium) {
2333
- // Stretch will follow the value passed from the component occurence if defined
2334
- if (isStretch) return isStretch;
2335
- return !isMedium ? true : undefined;
2336
- }
2337
-
2338
- // eslint-disable-next-line @typescript-eslint/ban-types
2339
-
2340
2302
  function ActionsItem({
2341
2303
  as,
2342
2304
  onPress,
2343
2305
  disabled,
2344
2306
  icon,
2345
- stretch,
2307
+ stretch = {
2308
+ base: true,
2309
+ medium: false
2310
+ },
2346
2311
  ...props
2347
2312
  }) {
2348
- const isMedium = useMatchWindowSize({
2349
- minWidth: KittBreakpoints.MEDIUM
2350
- });
2351
- const isCurrentStretch = getCurrentStretchValue(stretch, isMedium);
2352
2313
  const [isLoading, setIsLoading] = react.useState(false);
2353
2314
  const mountedRef = react.useRef(false);
2354
2315
 
@@ -2362,7 +2323,7 @@ function ActionsItem({
2362
2323
  return /*#__PURE__*/jsxRuntime.jsx(View, {
2363
2324
  children: /*#__PURE__*/jsxRuntime.jsx(as, {
2364
2325
  ...props,
2365
- stretch: isCurrentStretch,
2326
+ stretch: stretch,
2366
2327
  disabled: isLoading ? true : disabled,
2367
2328
  icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
2368
2329
  onPress: e => {
@@ -2411,6 +2372,14 @@ function getCurrentDirection(layout) {
2411
2372
  if (layout === 'column') return 'column';
2412
2373
  return 'row';
2413
2374
  }
2375
+ function getCurrentAlignSelf(layout) {
2376
+ if (!layout) return {
2377
+ base: 'stretch',
2378
+ medium: undefined
2379
+ };
2380
+ if (layout === 'column') return 'stretch';
2381
+ return undefined;
2382
+ }
2414
2383
  function Actions({
2415
2384
  children,
2416
2385
  layout,
@@ -2418,8 +2387,10 @@ function Actions({
2418
2387
  }) {
2419
2388
  const currentAlignItems = getCurrentLayout(layout);
2420
2389
  const currentDirection = getCurrentDirection(layout);
2390
+ const currentAlignSelf = getCurrentAlignSelf(layout);
2421
2391
  return /*#__PURE__*/jsxRuntime.jsx(Stack, {
2422
2392
  alignItems: currentAlignItems,
2393
+ alignSelf: currentAlignSelf,
2423
2394
  direction: currentDirection,
2424
2395
  flexGrow: 1,
2425
2396
  ...props,
@@ -8373,6 +8344,36 @@ function StyleWebWrapper({
8373
8344
  });
8374
8345
  }
8375
8346
 
8347
+ function matchWindowSize({
8348
+ width,
8349
+ height
8350
+ }, {
8351
+ minWidth,
8352
+ maxWidth,
8353
+ minHeight,
8354
+ maxHeight
8355
+ }) {
8356
+ const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
8357
+ const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
8358
+ return hasWidthMatched && hasHeightMatched;
8359
+ }
8360
+
8361
+ /**
8362
+ * Returns if a size matches based on dimensions passed as options.
8363
+ *
8364
+ * WARNING: Not SSR friendly.
8365
+ */
8366
+ function useMatchWindowSize(options) {
8367
+ const {
8368
+ width,
8369
+ height
8370
+ } = reactNative.useWindowDimensions();
8371
+ return matchWindowSize({
8372
+ width,
8373
+ height
8374
+ }, options);
8375
+ }
8376
+
8376
8377
  /**
8377
8378
  * Display children if match window size options
8378
8379
  *