@ornikar/kitt-universal 31.1.1 → 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
+ }
@@ -3651,6 +3651,79 @@ function ButtonContent({
3651
3651
  });
3652
3652
  }
3653
3653
 
3654
+ function ButtonGauge({
3655
+ duration,
3656
+ running,
3657
+ onEnded
3658
+ }) {
3659
+ const [translate, setTranslate] = react.useState(100);
3660
+ const startTimeRef = react.useRef(0);
3661
+ const pauseTimeRef = react.useRef(0);
3662
+ const rafRef = react.useRef(undefined);
3663
+ const distance = 100;
3664
+ const draw = react.useCallback(timestamp => {
3665
+ const timeElapsedSinceStart = timestamp - startTimeRef.current;
3666
+ // Since the time between frame is not reliable and regular, we have to
3667
+ // limit the progress to prevent overflows
3668
+ const safeProgress = Math.min(distance * timeElapsedSinceStart / duration, distance);
3669
+ setTranslate(safeProgress);
3670
+ if (safeProgress < distance) {
3671
+ if (!rafRef) return;
3672
+ rafRef.current = requestAnimationFrame(draw);
3673
+ return;
3674
+ }
3675
+ onEnded();
3676
+ if (rafRef.current) {
3677
+ cancelAnimationFrame(rafRef.current);
3678
+ }
3679
+ },
3680
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3681
+ []);
3682
+ react.useLayoutEffect(() => {
3683
+ if (running) {
3684
+ // Resuming from pause
3685
+ if (pauseTimeRef.current > 0) {
3686
+ startTimeRef.current += global.performance.now() - pauseTimeRef.current;
3687
+ draw(global.performance.now());
3688
+ return;
3689
+ }
3690
+
3691
+ // First launch
3692
+ startTimeRef.current = global.performance.now();
3693
+ draw(startTimeRef.current);
3694
+ }
3695
+
3696
+ // On pause
3697
+ if (!running && rafRef.current) {
3698
+ pauseTimeRef.current = global.performance.now();
3699
+ cancelAnimationFrame(rafRef.current);
3700
+ }
3701
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3702
+ }, [running]);
3703
+ react.useEffect(() => {
3704
+ return () => {
3705
+ if (rafRef.current) {
3706
+ cancelAnimationFrame(rafRef.current);
3707
+ }
3708
+ };
3709
+ }, []);
3710
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
3711
+ position: "absolute",
3712
+ left: 0,
3713
+ right: 0,
3714
+ top: 0,
3715
+ bottom: 0,
3716
+ overflow: "hidden",
3717
+ alignItems: "flex-end",
3718
+ borderRadius: "kitt.button.borderRadius",
3719
+ children: /*#__PURE__*/jsxRuntime.jsx(View, {
3720
+ width: `${translate}%`,
3721
+ height: "100%",
3722
+ backgroundColor: "kitt.palettes.deepPurple['white-alpha.20']"
3723
+ })
3724
+ });
3725
+ }
3726
+
3654
3727
  function ButtonPadding({
3655
3728
  children,
3656
3729
  size,
@@ -3723,6 +3796,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
3723
3796
  hrefAttrs,
3724
3797
  withBadge,
3725
3798
  badgeCount,
3799
+ timerAttrs,
3726
3800
  accessibilityRole = 'button',
3727
3801
  innerSpacing = 'center',
3728
3802
  isHoveredInternal,
@@ -3767,7 +3841,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
3767
3841
  isHovered,
3768
3842
  isPressed,
3769
3843
  isFocused
3770
- }) => /*#__PURE__*/jsxRuntime.jsx(AnimatedContainer$2, {
3844
+ }) => /*#__PURE__*/jsxRuntime.jsxs(AnimatedContainer$2, {
3771
3845
  animatedStyles: animatedStyles,
3772
3846
  type: type,
3773
3847
  isHovered: isHovered || isHoveredInternal,
@@ -3777,7 +3851,9 @@ const Button = /*#__PURE__*/react.forwardRef(({
3777
3851
  size: size,
3778
3852
  isIconOnly: isIconOnly,
3779
3853
  isStretch: stretch,
3780
- children: /*#__PURE__*/jsxRuntime.jsxs(ButtonPadding, {
3854
+ children: [timerAttrs ? /*#__PURE__*/jsxRuntime.jsx(ButtonGauge, {
3855
+ ...timerAttrs
3856
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs(ButtonPadding, {
3781
3857
  size: size,
3782
3858
  isIconOnly: isIconOnly,
3783
3859
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
@@ -3799,7 +3875,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
3799
3875
  isHovered: isHovered,
3800
3876
  isPressed: isPressed
3801
3877
  })]
3802
- })
3878
+ })]
3803
3879
  })
3804
3880
  });
3805
3881
  });
@@ -13219,15 +13295,15 @@ function TypographyEmoji({
13219
13295
  });
13220
13296
  }
13221
13297
 
13222
- // overrides :global(a) in Link styles.module.css
13223
- const displayUnderline = "kitt-u_displayUnderline_dch42t";
13224
- const displayUnderlineWhenHovered = "kitt-u_displayUnderlineWhenHovered_d80w0t7";
13298
+ const styles = {"displayUnderline":"TypographyLinkWebWrapper-module_displayUnderline__KxwMp","kitt-hover":"TypographyLinkWebWrapper-module_kitt-hover__CyENw","displayUnderlineWhenHovered":"TypographyLinkWebWrapper-module_displayUnderlineWhenHovered__5V5Cl"};
13299
+
13225
13300
  function TypographyLinkWebWrapper({
13226
13301
  children,
13227
13302
  hasNoUnderline
13228
13303
  }) {
13304
+ const className = hasNoUnderline ? `${styles.displayUnderline} ${styles.displayUnderlineWhenHovered}` : styles.displayUnderline;
13229
13305
  return /*#__PURE__*/jsxRuntime.jsx("span", {
13230
- className: (displayUnderline ) + " " + ((hasNoUnderline ? displayUnderlineWhenHovered : undefined) || ""),
13306
+ className: className,
13231
13307
  children: children
13232
13308
  });
13233
13309
  }