@butternutbox/pawprint-native 1.1.3 → 1.2.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.
@@ -7,12 +7,12 @@
7
7
  CJS Build start
8
8
  ESM Build start
9
9
  DTS Build start
10
- CJS dist/index.cjs 554.16 KB
11
- CJS dist/index.cjs.map 1.08 MB
12
- CJS ⚡️ Build success in 8241ms
13
- ESM dist/index.js 523.89 KB
14
- ESM dist/index.js.map 1.08 MB
15
- ESM ⚡️ Build success in 8243ms
16
- DTS ⚡️ Build success in 21494ms
17
- DTS dist/index.d.cts 104.18 KB
18
- DTS dist/index.d.ts 104.18 KB
10
+ CJS dist/index.cjs 563.58 KB
11
+ CJS dist/index.cjs.map 1.10 MB
12
+ CJS ⚡️ Build success in 6123ms
13
+ ESM dist/index.js 532.63 KB
14
+ ESM dist/index.js.map 1.10 MB
15
+ ESM ⚡️ Build success in 6123ms
16
+ DTS ⚡️ Build success in 15381ms
17
+ DTS dist/index.d.cts 108.40 KB
18
+ DTS dist/index.d.ts 108.40 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7c1b5bd: `FloatingActionButton`: add new molecule on web and native. A floating pill with a leading icon (default `Gift`), message copy, a required link (`linkLabel` plus `linkHref` and/or the link handler, to navigate or trigger an action) and a required `md` icon button (`chevronUp`, `chevronRight` or `close`; `filled`, `outlined` or `text` via `iconButtonVariant`, defaulting to `filled` for the chevrons and `text` for `close`). `primary` and `secondary` variants use the `floatingActionButton` component tokens. Optional `animation` prop (off by default): `shine` sweeps a soft highlight across the pill and `nudge` moves the chevron towards its direction; both run 3 times then stop, and respect reduced motion. On web it has a max width of 374px; on native it fills its container. Positioning is left to the consumer.
8
+
3
9
  ## 1.1.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -553,6 +553,7 @@ var Gift = (props, ref) => {
553
553
  };
554
554
  var ForwardRef29 = React66.forwardRef(Gift);
555
555
  ForwardRef29.category = "core";
556
+ var Gift_default = ForwardRef29;
556
557
  var HelpOutline = (props, ref) => {
557
558
  var _a, _b;
558
559
  return /* @__PURE__ */ jsxRuntime.jsx(Svg__default.default, __spreadProps2(__spreadValues2(__spreadProps2(__spreadValues2({ xmlns: "http://www.w3.org/2000/svg", width: (_a = props.width) != null ? _a : 24, height: (_b = props.height) != null ? _b : 24 }, { fill: props.color || "currentColor" }), { viewBox: "0 0 24 24", ref }), props), { children: /* @__PURE__ */ jsxRuntime.jsx(Svg.Path, { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m-1-4h2v2h-2zm1.61-9.96c-2.06-.3-3.88.97-4.43 2.79-.18.58.26 1.17.87 1.17h.2c.41 0 .74-.29.88-.67.32-.89 1.27-1.5 2.3-1.28.95.2 1.65 1.13 1.57 2.1-.1 1.34-1.62 1.63-2.45 2.88 0 .01-.01.01-.01.02-.01.02-.02.03-.03.05-.09.15-.18.32-.25.5-.01.03-.03.05-.04.08-.01.02-.01.04-.02.07-.12.34-.2.75-.2 1.25h2c0-.42.11-.77.28-1.07.02-.03.03-.06.05-.09.08-.14.18-.27.28-.39.01-.01.02-.03.03-.04.1-.12.21-.23.33-.34.96-.91 2.26-1.65 1.99-3.56-.24-1.74-1.61-3.21-3.35-3.47" }) }));
@@ -623,6 +624,7 @@ var KeyboardArrowUp = (props, ref) => {
623
624
  };
624
625
  var ForwardRef39 = React66.forwardRef(KeyboardArrowUp);
625
626
  ForwardRef39.category = "core";
627
+ var KeyboardArrowUp_default = ForwardRef39;
626
628
  var KeyboardDoubleArrowDown = (props, ref) => {
627
629
  var _a, _b;
628
630
  return /* @__PURE__ */ jsxRuntime.jsx(Svg__default.default, __spreadProps2(__spreadValues2(__spreadProps2(__spreadValues2({ xmlns: "http://www.w3.org/2000/svg", width: (_a = props.width) != null ? _a : 24, height: (_b = props.height) != null ? _b : 24 }, { fill: props.color || "currentColor" }), { viewBox: "0 0 24 24", ref }), props), { children: /* @__PURE__ */ jsxRuntime.jsx(Svg.Path, { fillRule: "evenodd", d: "M6.702 12.282a.996.996 0 0 1 1.41 0l3.88 3.88 3.88-3.87a.996.996 0 0 1 1.41 0c.39.39.39 1.02.01 1.4l-4.59 4.59a.996.996 0 0 1-1.41 0l-4.59-4.59a.996.996 0 0 1 0-1.41m-.01-6.59a.995.995 0 0 1 1.41 0l3.89 3.88 3.88-3.87a.996.996 0 0 1 1.41 0c.39.39.39 1.02 0 1.4l-4.59 4.59a.997.997 0 0 1-1.41 0l-4.59-4.59a.995.995 0 0 1 0-1.41", clipRule: "evenodd" }) }));
@@ -12565,6 +12567,272 @@ var TabNavigation = Object.assign(TabNavigationRoot, {
12565
12567
  Tab: TabNavigationTab,
12566
12568
  Panel: TabNavigationPanel
12567
12569
  });
12570
+ var parseTokenValue62 = (value) => parseFloat(value);
12571
+ var ICON_BUTTON_CONFIG = {
12572
+ chevronUp: { icon: KeyboardArrowUp_default, defaultVariant: "filled" },
12573
+ chevronRight: { icon: KeyboardArrowRight_default, defaultVariant: "filled" },
12574
+ close: { icon: Close_default, defaultVariant: "text" }
12575
+ };
12576
+ var ANIMATION_DELAY = 1500;
12577
+ var ANIMATION_ITERATIONS = 3;
12578
+ var SHINE_SWEEP = 1100;
12579
+ var SHINE_REST = 4900;
12580
+ var SHINE_BAND_RATIO = 0.4;
12581
+ var SHINE_OPACITY = 0.55;
12582
+ var NUDGE_STEP = 200;
12583
+ var NUDGE_REST = 3200;
12584
+ var NUDGE_DISTANCE = 3;
12585
+ var ShineOverlay = ({
12586
+ radius,
12587
+ highlight
12588
+ }) => {
12589
+ const reducedMotion = Animated10.useReducedMotion();
12590
+ const [width, setWidth] = React66__default.default.useState(0);
12591
+ const progress = Animated10.useSharedValue(0);
12592
+ const bandWidth = width * SHINE_BAND_RATIO;
12593
+ React66__default.default.useEffect(() => {
12594
+ if (reducedMotion || !width) return;
12595
+ progress.value = Animated10.withDelay(
12596
+ ANIMATION_DELAY,
12597
+ Animated10.withRepeat(
12598
+ Animated10.withSequence(
12599
+ Animated10.withTiming(1, {
12600
+ duration: SHINE_SWEEP,
12601
+ easing: Animated10.Easing.inOut(Animated10.Easing.ease)
12602
+ }),
12603
+ Animated10.withDelay(SHINE_REST, Animated10.withTiming(0, { duration: 0 }))
12604
+ ),
12605
+ ANIMATION_ITERATIONS
12606
+ )
12607
+ );
12608
+ }, [progress, reducedMotion, width]);
12609
+ const bandStyle = Animated10.useAnimatedStyle(() => ({
12610
+ transform: [
12611
+ {
12612
+ translateX: -bandWidth * 1.5 + progress.value * (width + bandWidth * 2.5)
12613
+ },
12614
+ { skewX: "-20deg" }
12615
+ ]
12616
+ }));
12617
+ if (reducedMotion) return null;
12618
+ return /* @__PURE__ */ jsxRuntime.jsx(
12619
+ reactNative.View,
12620
+ {
12621
+ pointerEvents: "none",
12622
+ accessible: false,
12623
+ importantForAccessibility: "no-hide-descendants",
12624
+ onLayout: (e) => setWidth(e.nativeEvent.layout.width),
12625
+ style: [
12626
+ reactNative.StyleSheet.absoluteFill,
12627
+ { borderRadius: radius, overflow: "hidden" }
12628
+ ],
12629
+ children: width > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12630
+ Animated10__default.default.View,
12631
+ {
12632
+ style: [
12633
+ { position: "absolute", top: 0, bottom: 0, width: bandWidth },
12634
+ bandStyle
12635
+ ],
12636
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Svg__default.default, { width: "100%", height: "100%", children: [
12637
+ /* @__PURE__ */ jsxRuntime.jsx(Svg.Defs, { children: /* @__PURE__ */ jsxRuntime.jsxs(Svg.LinearGradient, { id: "fabShine", x1: "0", y1: "0", x2: "1", y2: "0", children: [
12638
+ /* @__PURE__ */ jsxRuntime.jsx(Svg.Stop, { offset: "0", stopColor: highlight, stopOpacity: 0 }),
12639
+ /* @__PURE__ */ jsxRuntime.jsx(
12640
+ Svg.Stop,
12641
+ {
12642
+ offset: "0.5",
12643
+ stopColor: highlight,
12644
+ stopOpacity: SHINE_OPACITY
12645
+ }
12646
+ ),
12647
+ /* @__PURE__ */ jsxRuntime.jsx(Svg.Stop, { offset: "1", stopColor: highlight, stopOpacity: 0 })
12648
+ ] }) }),
12649
+ /* @__PURE__ */ jsxRuntime.jsx(Svg.Rect, { width: "100%", height: "100%", fill: "url(#fabShine)" })
12650
+ ] })
12651
+ }
12652
+ )
12653
+ }
12654
+ );
12655
+ };
12656
+ var createNudgingIcon = (IconComponent, axis, direction) => {
12657
+ var _a;
12658
+ const NudgingIcon = (props) => {
12659
+ const reducedMotion = Animated10.useReducedMotion();
12660
+ const offset = Animated10.useSharedValue(0);
12661
+ React66__default.default.useEffect(() => {
12662
+ if (reducedMotion) return;
12663
+ const step = (to) => Animated10.withTiming(to, {
12664
+ duration: NUDGE_STEP,
12665
+ easing: Animated10.Easing.inOut(Animated10.Easing.ease)
12666
+ });
12667
+ const distance = NUDGE_DISTANCE * direction;
12668
+ offset.value = Animated10.withDelay(
12669
+ ANIMATION_DELAY,
12670
+ Animated10.withRepeat(
12671
+ Animated10.withSequence(
12672
+ step(distance),
12673
+ step(0),
12674
+ step(distance),
12675
+ step(0),
12676
+ Animated10.withDelay(NUDGE_REST, Animated10.withTiming(0, { duration: 0 }))
12677
+ ),
12678
+ ANIMATION_ITERATIONS
12679
+ )
12680
+ );
12681
+ }, [offset, reducedMotion]);
12682
+ const nudgeStyle = Animated10.useAnimatedStyle(
12683
+ () => axis === "translateX" ? { transform: [{ translateX: offset.value }] } : { transform: [{ translateY: offset.value }] }
12684
+ );
12685
+ return /* @__PURE__ */ jsxRuntime.jsx(Animated10__default.default.View, { style: nudgeStyle, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, __spreadValues({}, props)) });
12686
+ };
12687
+ NudgingIcon.displayName = `Nudging(${(_a = IconComponent.displayName) != null ? _a : "Icon"})`;
12688
+ return NudgingIcon;
12689
+ };
12690
+ var NUDGE_ICONS = {
12691
+ chevronUp: createNudgingIcon(KeyboardArrowUp_default, "translateY", -1),
12692
+ chevronRight: createNudgingIcon(KeyboardArrowRight_default, "translateX", 1)
12693
+ };
12694
+ var StyledRoot18 = styled51__default.default(reactNative.View)(
12695
+ ({
12696
+ rootGap,
12697
+ rootPaddingH,
12698
+ rootPaddingV,
12699
+ rootBgColor,
12700
+ rootBorderWidth,
12701
+ rootBorderColor,
12702
+ rootBorderRadius,
12703
+ rootBoxShadow
12704
+ }) => ({
12705
+ flexDirection: "row",
12706
+ alignItems: "center",
12707
+ width: "100%",
12708
+ gap: rootGap,
12709
+ paddingHorizontal: rootPaddingH,
12710
+ paddingVertical: rootPaddingV,
12711
+ backgroundColor: rootBgColor,
12712
+ borderWidth: rootBorderWidth,
12713
+ borderColor: rootBorderColor,
12714
+ borderRadius: rootBorderRadius,
12715
+ boxShadow: rootBoxShadow
12716
+ })
12717
+ );
12718
+ var StyledIconContainer = styled51__default.default(reactNative.View)(({ containerSize, containerRadius, containerBgColor }) => ({
12719
+ alignItems: "center",
12720
+ justifyContent: "center",
12721
+ flexShrink: 0,
12722
+ width: containerSize,
12723
+ height: containerSize,
12724
+ borderRadius: containerRadius,
12725
+ backgroundColor: containerBgColor
12726
+ }));
12727
+ var StyledContent3 = styled51__default.default(reactNative.View)({
12728
+ flex: 1,
12729
+ minWidth: 0,
12730
+ alignItems: "flex-start",
12731
+ justifyContent: "center"
12732
+ });
12733
+ var FloatingActionButton = React66__default.default.forwardRef(
12734
+ (_a, ref) => {
12735
+ var _b = _a, {
12736
+ variant = "primary",
12737
+ icon = Gift_default,
12738
+ children,
12739
+ linkLabel,
12740
+ linkHref,
12741
+ onLinkPress,
12742
+ animation,
12743
+ iconButtonIcon,
12744
+ iconButtonLabel,
12745
+ iconButtonVariant,
12746
+ onIconButtonPress
12747
+ } = _b, rest = __objRest(_b, [
12748
+ "variant",
12749
+ "icon",
12750
+ "children",
12751
+ "linkLabel",
12752
+ "linkHref",
12753
+ "onLinkPress",
12754
+ "animation",
12755
+ "iconButtonIcon",
12756
+ "iconButtonLabel",
12757
+ "iconButtonVariant",
12758
+ "onIconButtonPress"
12759
+ ]);
12760
+ const theme2 = react.useTheme();
12761
+ const { floatingActionButton } = theme2.tokens.components;
12762
+ const { colour, dimensions: dimensions3 } = theme2.tokens.semantics;
12763
+ const { shadow } = colour;
12764
+ const iconButton = ICON_BUTTON_CONFIG[iconButtonIcon];
12765
+ const iconButtonElement = /* @__PURE__ */ jsxRuntime.jsx(
12766
+ IconButton,
12767
+ {
12768
+ icon: animation === "nudge" && iconButtonIcon !== "close" ? NUDGE_ICONS[iconButtonIcon] : iconButton.icon,
12769
+ variant: iconButtonVariant != null ? iconButtonVariant : iconButton.defaultVariant,
12770
+ size: "md",
12771
+ "aria-label": iconButtonLabel,
12772
+ onPress: onIconButtonPress
12773
+ }
12774
+ );
12775
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12776
+ StyledRoot18,
12777
+ __spreadProps(__spreadValues({
12778
+ ref,
12779
+ rootGap: parseTokenValue62(floatingActionButton.spacing.gap),
12780
+ rootPaddingH: parseTokenValue62(
12781
+ floatingActionButton.spacing.horizontalPadding
12782
+ ),
12783
+ rootPaddingV: parseTokenValue62(
12784
+ floatingActionButton.spacing.verticalPadding
12785
+ ),
12786
+ rootBgColor: floatingActionButton.colour.background[variant],
12787
+ rootBorderWidth: parseTokenValue62(
12788
+ floatingActionButton.borderWidth.default
12789
+ ),
12790
+ rootBorderColor: floatingActionButton.colour.border[variant],
12791
+ rootBorderRadius: parseTokenValue62(
12792
+ floatingActionButton.borderRadius.default
12793
+ ),
12794
+ rootBoxShadow: `${shadow.md.offsetX} ${shadow.md.offsetY} ${shadow.md.blur} ${shadow.md.spread} ${shadow.md.color}`
12795
+ }, rest), {
12796
+ children: [
12797
+ /* @__PURE__ */ jsxRuntime.jsx(
12798
+ StyledIconContainer,
12799
+ {
12800
+ containerSize: parseTokenValue62(
12801
+ theme2.tokens.primitives.dimension.sizing["44"]
12802
+ ),
12803
+ containerRadius: parseTokenValue62(dimensions3.borderRadius.round),
12804
+ containerBgColor: variant === "secondary" ? colour.background.container.secondary : colour.background.container.default,
12805
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon, size: "xl", colour: "primary" })
12806
+ }
12807
+ ),
12808
+ /* @__PURE__ */ jsxRuntime.jsxs(StyledContent3, { children: [
12809
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", size: "lg", weight: "medium", children }),
12810
+ /* @__PURE__ */ jsxRuntime.jsx(
12811
+ Link,
12812
+ __spreadProps(__spreadValues({
12813
+ href: linkHref,
12814
+ onPress: onLinkPress,
12815
+ size: "md",
12816
+ weight: "medium"
12817
+ }, !linkHref && { accessibilityRole: "button" }), {
12818
+ children: linkLabel
12819
+ })
12820
+ )
12821
+ ] }),
12822
+ iconButtonElement,
12823
+ animation === "shine" && /* @__PURE__ */ jsxRuntime.jsx(
12824
+ ShineOverlay,
12825
+ {
12826
+ radius: parseTokenValue62(floatingActionButton.borderRadius.default),
12827
+ highlight: theme2.tokens.primitives.colour.system.neutral["1"]
12828
+ }
12829
+ )
12830
+ ]
12831
+ })
12832
+ );
12833
+ }
12834
+ );
12835
+ FloatingActionButton.displayName = "FloatingActionButton";
12568
12836
 
12569
12837
  Object.defineProperty(exports, "tokens", {
12570
12838
  enumerable: true,
@@ -12591,6 +12859,7 @@ exports.DatePicker = DatePicker;
12591
12859
  exports.Divider = Divider;
12592
12860
  exports.Drawer = Drawer;
12593
12861
  exports.FilterTab = FilterTab;
12862
+ exports.FloatingActionButton = FloatingActionButton;
12594
12863
  exports.Hint = Hint;
12595
12864
  exports.Icon = Icon;
12596
12865
  exports.IconButton = IconButton;