@ornikar/kitt-universal 31.1.0 → 31.1.2-canary.31eec21cbe0c2b92255fb1fa14d83757a05ea8b0.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.
@@ -20,5 +20,23 @@
20
20
  .kitt-u_enterActive_e1jmsjrm{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);opacity:1;-webkit-transition:all 300ms ease-in-out;transition:all 300ms ease-in-out;}
21
21
  .kitt-u_exit_e1mwnccz{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);opacity:1;}
22
22
  .kitt-u_exitActive_e1004d1h{-webkit-transform:translateY(8px);-ms-transform:translateY(8px);transform:translateY(8px);opacity:0;-webkit-transition:all 300ms ease-in-out;transition:all 300ms ease-in-out;}
23
- .kitt-u_displayUnderline_dch42t > *{-webkit-text-decoration:underline;text-decoration:underline;}.kitt-u_displayUnderline_dch42t > *:hover,.kitt-u_displayUnderline_dch42t > *:active,.kitt-hover .kitt-u_displayUnderline_dch42t > *{-webkit-text-decoration:none;text-decoration:none;}
24
- .kitt-u_displayUnderlineWhenHovered_d80w0t7 > *{-webkit-text-decoration:none;text-decoration:none;}.kitt-u_displayUnderlineWhenHovered_d80w0t7 > *:hover,.kitt-u_displayUnderlineWhenHovered_d80w0t7 > *:active,.kitt-hover .kitt-u_displayUnderlineWhenHovered_d80w0t7 > *{-webkit-text-decoration:underline;text-decoration:underline;}
23
+ /* overrides :global(a) in Link styles.module.css */
24
+ .TypographyLinkWebWrapper-module_displayUnderline__KxwMp > * {
25
+ text-decoration: underline;
26
+ }
27
+
28
+ .TypographyLinkWebWrapper-module_displayUnderline__KxwMp > *:hover,
29
+ .TypographyLinkWebWrapper-module_displayUnderline__KxwMp > *:active,
30
+ .TypographyLinkWebWrapper-module_kitt-hover__CyENw .TypographyLinkWebWrapper-module_displayUnderline__KxwMp > * {
31
+ text-decoration: none;
32
+ }
33
+
34
+ .TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl > * {
35
+ text-decoration: none;
36
+ }
37
+
38
+ .TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl > *:hover,
39
+ .TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl > *:active,
40
+ .TypographyLinkWebWrapper-module_kitt-hover__CyENw .TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl > * {
41
+ text-decoration: underline;
42
+ }
@@ -1,4 +1,4 @@
1
- import { useContext, createContext, forwardRef, useMemo, cloneElement, useRef, useEffect, useState, Children, useReducer, useCallback, Fragment as Fragment$1 } from 'react';
1
+ import { useContext, createContext, forwardRef, useMemo, cloneElement, useState, useRef, useCallback, useLayoutEffect, useEffect, Children, useReducer, Fragment as Fragment$1 } from 'react';
2
2
  import { View as View$1, ScrollView as ScrollView$1, Pressable as Pressable$1, Image as Image$1, FlatList as FlatList$1, SectionList as SectionList$1, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, Center as Center$1, useBreakpointValue as useBreakpointValue$1, useSx, Text, Input, NativeBaseProvider, extendTheme } from 'native-base';
3
3
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -3642,6 +3642,79 @@ function ButtonContent({
3642
3642
  });
3643
3643
  }
3644
3644
 
3645
+ function ButtonGauge({
3646
+ duration,
3647
+ running,
3648
+ onEnded
3649
+ }) {
3650
+ const [translate, setTranslate] = useState(100);
3651
+ const startTimeRef = useRef(0);
3652
+ const pauseTimeRef = useRef(0);
3653
+ const rafRef = useRef(undefined);
3654
+ const distance = 100;
3655
+ const draw = useCallback(timestamp => {
3656
+ const timeElapsedSinceStart = timestamp - startTimeRef.current;
3657
+ // Since the time between frame is not reliable and regular, we have to
3658
+ // limit the progress to prevent overflows
3659
+ const safeProgress = Math.min(distance * timeElapsedSinceStart / duration, distance);
3660
+ setTranslate(safeProgress);
3661
+ if (safeProgress < distance) {
3662
+ if (!rafRef) return;
3663
+ rafRef.current = requestAnimationFrame(draw);
3664
+ return;
3665
+ }
3666
+ onEnded();
3667
+ if (rafRef.current) {
3668
+ cancelAnimationFrame(rafRef.current);
3669
+ }
3670
+ },
3671
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3672
+ []);
3673
+ useLayoutEffect(() => {
3674
+ if (running) {
3675
+ // Resuming from pause
3676
+ if (pauseTimeRef.current > 0) {
3677
+ startTimeRef.current += global.performance.now() - pauseTimeRef.current;
3678
+ draw(global.performance.now());
3679
+ return;
3680
+ }
3681
+
3682
+ // First launch
3683
+ startTimeRef.current = global.performance.now();
3684
+ draw(startTimeRef.current);
3685
+ }
3686
+
3687
+ // On pause
3688
+ if (!running && rafRef.current) {
3689
+ pauseTimeRef.current = global.performance.now();
3690
+ cancelAnimationFrame(rafRef.current);
3691
+ }
3692
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3693
+ }, [running]);
3694
+ useEffect(() => {
3695
+ return () => {
3696
+ if (rafRef.current) {
3697
+ cancelAnimationFrame(rafRef.current);
3698
+ }
3699
+ };
3700
+ }, []);
3701
+ return /*#__PURE__*/jsx(View, {
3702
+ position: "absolute",
3703
+ left: 0,
3704
+ right: 0,
3705
+ top: 0,
3706
+ bottom: 0,
3707
+ overflow: "hidden",
3708
+ alignItems: "flex-end",
3709
+ borderRadius: "kitt.button.borderRadius",
3710
+ children: /*#__PURE__*/jsx(View, {
3711
+ width: `${translate}%`,
3712
+ height: "100%",
3713
+ backgroundColor: "kitt.palettes.deepPurple['white-alpha.20']"
3714
+ })
3715
+ });
3716
+ }
3717
+
3645
3718
  function ButtonPadding({
3646
3719
  children,
3647
3720
  size,
@@ -3714,6 +3787,7 @@ const Button = /*#__PURE__*/forwardRef(({
3714
3787
  hrefAttrs,
3715
3788
  withBadge,
3716
3789
  badgeCount,
3790
+ timerAttrs,
3717
3791
  accessibilityRole = 'button',
3718
3792
  innerSpacing = 'center',
3719
3793
  isHoveredInternal,
@@ -3758,7 +3832,7 @@ const Button = /*#__PURE__*/forwardRef(({
3758
3832
  isHovered,
3759
3833
  isPressed,
3760
3834
  isFocused
3761
- }) => /*#__PURE__*/jsx(AnimatedContainer$2, {
3835
+ }) => /*#__PURE__*/jsxs(AnimatedContainer$2, {
3762
3836
  animatedStyles: animatedStyles,
3763
3837
  type: type,
3764
3838
  isHovered: isHovered || isHoveredInternal,
@@ -3768,7 +3842,9 @@ const Button = /*#__PURE__*/forwardRef(({
3768
3842
  size: size,
3769
3843
  isIconOnly: isIconOnly,
3770
3844
  isStretch: stretch,
3771
- children: /*#__PURE__*/jsxs(ButtonPadding, {
3845
+ children: [timerAttrs ? /*#__PURE__*/jsx(ButtonGauge, {
3846
+ ...timerAttrs
3847
+ }) : null, /*#__PURE__*/jsxs(ButtonPadding, {
3772
3848
  size: size,
3773
3849
  isIconOnly: isIconOnly,
3774
3850
  children: [/*#__PURE__*/jsx(ButtonContent, {
@@ -3790,7 +3866,7 @@ const Button = /*#__PURE__*/forwardRef(({
3790
3866
  isHovered: isHovered,
3791
3867
  isPressed: isPressed
3792
3868
  })]
3793
- })
3869
+ })]
3794
3870
  })
3795
3871
  });
3796
3872
  });
@@ -13210,15 +13286,15 @@ function TypographyEmoji({
13210
13286
  });
13211
13287
  }
13212
13288
 
13213
- // overrides :global(a) in Link styles.module.css
13214
- const displayUnderline = "kitt-u_displayUnderline_dch42t";
13215
- const displayUnderlineWhenHovered = "kitt-u_displayUnderlineWhenHovered_d80w0t7";
13289
+ const styles = {"displayUnderline":"TypographyLinkWebWrapper-module_displayUnderline__KxwMp","kitt-hover":"TypographyLinkWebWrapper-module_kitt-hover__CyENw","displayUnderlineWhenHovered":"TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl"};
13290
+
13216
13291
  function TypographyLinkWebWrapper({
13217
13292
  children,
13218
13293
  hasNoUnderline
13219
13294
  }) {
13295
+ const className = hasNoUnderline ? `${styles.displayUnderline} ${styles.displayUnderlineWhenHovered}` : styles.displayUnderline;
13220
13296
  return /*#__PURE__*/jsx("span", {
13221
- className: (displayUnderline ) + " " + ((hasNoUnderline ? displayUnderlineWhenHovered : undefined) || ""),
13297
+ className: className,
13222
13298
  children: children
13223
13299
  });
13224
13300
  }