@butternutbox/pawprint-native 1.1.3 → 1.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.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +326 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +362 -234
- package/dist/index.d.ts +362 -234
- package/dist/index.js +326 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/FloatingActionButton/FloatingActionButton.stories.tsx +304 -0
- package/src/components/molecules/FloatingActionButton/FloatingActionButton.tsx +445 -0
- package/src/components/molecules/FloatingActionButton/index.ts +7 -0
- package/src/components/molecules/Menu/Menu.stories.tsx +19 -55
- package/src/components/molecules/Menu/Menu.test.tsx +55 -1
- package/src/components/molecules/Menu/Menu.tsx +56 -31
- package/src/components/molecules/Menu/MenuItem.tsx +32 -39
- package/src/components/molecules/Menu/hooks/index.ts +1 -0
- package/src/components/molecules/Menu/hooks/useMenuTrigger.test.ts +48 -0
- package/src/components/molecules/Menu/hooks/useMenuTrigger.ts +40 -0
- package/src/components/molecules/Menu/index.ts +2 -1
- package/src/components/molecules/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
[34mCJS[39m Build start
|
|
8
8
|
[34mESM[39m Build start
|
|
9
9
|
[34mDTS[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
11
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m1.
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m564.54 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.10 MB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 6535ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m533.47 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.10 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 6536ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 17552ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m111.87 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m111.87 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9449ba4: Refactor Menu component to include anchor to the trigger, improve stylings and API
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
3
15
|
## 1.1.3
|
|
4
16
|
|
|
5
17
|
### 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" }) }));
|
|
@@ -10656,46 +10658,37 @@ var Tooltip = React66__default.default.forwardRef(
|
|
|
10656
10658
|
);
|
|
10657
10659
|
Tooltip.displayName = "Tooltip";
|
|
10658
10660
|
var parseTokenValue53 = (value) => parseFloat(value);
|
|
10659
|
-
var Row = styled51__default.default(reactNative.Pressable)(({ theme: theme2
|
|
10661
|
+
var Row = styled51__default.default(reactNative.Pressable)(({ theme: theme2 }) => {
|
|
10660
10662
|
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
10661
|
-
const { colour } = theme2.tokens.semantics;
|
|
10662
10663
|
return {
|
|
10663
10664
|
width: "100%",
|
|
10664
|
-
alignItems: "
|
|
10665
|
+
alignItems: "flex-start",
|
|
10665
10666
|
justifyContent: "center",
|
|
10666
10667
|
paddingVertical: parseTokenValue53(spacing.md),
|
|
10667
|
-
paddingHorizontal: parseTokenValue53(spacing.md)
|
|
10668
|
-
borderBottomWidth: divider ? 1 : 0,
|
|
10669
|
-
borderBottomColor: colour.border.divider
|
|
10668
|
+
paddingHorizontal: parseTokenValue53(spacing.md)
|
|
10670
10669
|
};
|
|
10671
10670
|
});
|
|
10672
10671
|
var MenuItem = React66__default.default.forwardRef((_a, ref) => {
|
|
10673
10672
|
var _b = _a, { variant = "action", onPress, children, divider = true } = _b, rest = __objRest(_b, ["variant", "onPress", "children", "divider"]);
|
|
10674
10673
|
const theme2 = react.useTheme();
|
|
10675
10674
|
const { colour, typography } = theme2.tokens.semantics;
|
|
10676
|
-
const labelColour = variant === "destructive" ? colour.text.error : colour.text.
|
|
10675
|
+
const labelColour = variant === "destructive" ? colour.text.error : colour.text.link.default;
|
|
10677
10676
|
const label = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
10678
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
color: labelColour,
|
|
10694
|
-
children: label
|
|
10695
|
-
}
|
|
10696
|
-
) : children
|
|
10697
|
-
})
|
|
10698
|
-
);
|
|
10677
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10679
|
+
Row,
|
|
10680
|
+
__spreadProps(__spreadValues({
|
|
10681
|
+
ref,
|
|
10682
|
+
onPress,
|
|
10683
|
+
accessible: true,
|
|
10684
|
+
accessibilityRole: "menuitem",
|
|
10685
|
+
accessibilityLabel: label
|
|
10686
|
+
}, rest), {
|
|
10687
|
+
children: label !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { token: typography.body.medium.md, color: labelColour, children: label }) : children
|
|
10688
|
+
})
|
|
10689
|
+
),
|
|
10690
|
+
divider && /* @__PURE__ */ jsxRuntime.jsx(Divider, {})
|
|
10691
|
+
] });
|
|
10699
10692
|
});
|
|
10700
10693
|
MenuItem.displayName = "Menu.Item";
|
|
10701
10694
|
var parseTokenValue54 = (value) => parseFloat(value);
|
|
@@ -10706,18 +10699,14 @@ var DismissLayer = styled51__default.default(reactNative.Pressable)({
|
|
|
10706
10699
|
right: 0,
|
|
10707
10700
|
bottom: 0
|
|
10708
10701
|
});
|
|
10709
|
-
var Anchor = styled51__default.default(reactNative.View)(
|
|
10710
|
-
|
|
10711
|
-
return __spreadValues({
|
|
10712
|
-
position: "absolute"
|
|
10713
|
-
}, align === "right" ? { right: inset } : { left: inset });
|
|
10702
|
+
var Anchor = styled51__default.default(reactNative.View)({
|
|
10703
|
+
position: "absolute"
|
|
10714
10704
|
});
|
|
10715
10705
|
var Card = styled51__default.default(reactNative.Pressable)(({ theme: theme2, width }) => {
|
|
10716
10706
|
const { borderRadius } = theme2.tokens.semantics.dimensions;
|
|
10717
10707
|
const { shadow, background } = theme2.tokens.semantics.colour;
|
|
10718
10708
|
return {
|
|
10719
10709
|
width,
|
|
10720
|
-
maxWidth: "90%",
|
|
10721
10710
|
borderRadius: parseTokenValue54(borderRadius.md),
|
|
10722
10711
|
overflow: "hidden",
|
|
10723
10712
|
backgroundColor: background.surface.default,
|
|
@@ -10735,12 +10724,25 @@ var Card = styled51__default.default(reactNative.Pressable)(({ theme: theme2, wi
|
|
|
10735
10724
|
var MenuRoot = ({
|
|
10736
10725
|
open,
|
|
10737
10726
|
onClose,
|
|
10727
|
+
anchor,
|
|
10738
10728
|
anchorOffset = 0,
|
|
10739
10729
|
align = "right",
|
|
10740
|
-
width =
|
|
10730
|
+
width = 280,
|
|
10741
10731
|
closeAccessibilityLabel = "Close menu",
|
|
10742
10732
|
children
|
|
10743
10733
|
}) => {
|
|
10734
|
+
const theme2 = react.useTheme();
|
|
10735
|
+
const { width: windowWidth } = reactNative.useWindowDimensions();
|
|
10736
|
+
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
10737
|
+
const [lastAnchor, setLastAnchor] = React66.useState(anchor);
|
|
10738
|
+
if (anchor && anchor !== lastAnchor) setLastAnchor(anchor);
|
|
10739
|
+
const shownAnchor = anchor != null ? anchor : lastAnchor;
|
|
10740
|
+
const position = shownAnchor ? __spreadValues({
|
|
10741
|
+
top: shownAnchor.y + shownAnchor.height + parseTokenValue54(spacing.xs)
|
|
10742
|
+
}, align === "right" ? { right: windowWidth - (shownAnchor.x + shownAnchor.width) } : { left: shownAnchor.x }) : {
|
|
10743
|
+
top: anchorOffset,
|
|
10744
|
+
[align]: parseTokenValue54(spacing.md)
|
|
10745
|
+
};
|
|
10744
10746
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10745
10747
|
reactNative.Modal,
|
|
10746
10748
|
{
|
|
@@ -10758,10 +10760,10 @@ var MenuRoot = ({
|
|
|
10758
10760
|
accessibilityLabel: closeAccessibilityLabel
|
|
10759
10761
|
}
|
|
10760
10762
|
),
|
|
10761
|
-
/* @__PURE__ */ jsxRuntime.jsx(Anchor, {
|
|
10763
|
+
/* @__PURE__ */ jsxRuntime.jsx(Anchor, { style: position, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10762
10764
|
Card,
|
|
10763
10765
|
{
|
|
10764
|
-
width,
|
|
10766
|
+
width: Math.min(width, windowWidth * 0.9),
|
|
10765
10767
|
onPress: () => {
|
|
10766
10768
|
},
|
|
10767
10769
|
accessible: false,
|
|
@@ -10777,6 +10779,25 @@ MenuRoot.displayName = "Menu";
|
|
|
10777
10779
|
var Menu2 = Object.assign(MenuRoot, {
|
|
10778
10780
|
Item: MenuItem
|
|
10779
10781
|
});
|
|
10782
|
+
var useMenuTrigger = () => {
|
|
10783
|
+
const triggerRef = React66.useRef(null);
|
|
10784
|
+
const [anchor, setAnchor] = React66.useState();
|
|
10785
|
+
const open = React66.useCallback(() => {
|
|
10786
|
+
var _a;
|
|
10787
|
+
(_a = triggerRef.current) == null ? void 0 : _a.measureInWindow(
|
|
10788
|
+
(x, y, width, height) => setAnchor({ x, y, width, height })
|
|
10789
|
+
);
|
|
10790
|
+
}, []);
|
|
10791
|
+
const close = React66.useCallback(() => setAnchor(void 0), []);
|
|
10792
|
+
const isOpen = anchor !== void 0;
|
|
10793
|
+
return {
|
|
10794
|
+
triggerRef,
|
|
10795
|
+
isOpen,
|
|
10796
|
+
open,
|
|
10797
|
+
close,
|
|
10798
|
+
menuProps: { open: isOpen, onClose: close, anchor }
|
|
10799
|
+
};
|
|
10800
|
+
};
|
|
10780
10801
|
var parseTokenValue55 = (value) => parseFloat(value);
|
|
10781
10802
|
var StyledInsightRoot = styled51__default.default(reactNative.View)(
|
|
10782
10803
|
({
|
|
@@ -12565,6 +12586,272 @@ var TabNavigation = Object.assign(TabNavigationRoot, {
|
|
|
12565
12586
|
Tab: TabNavigationTab,
|
|
12566
12587
|
Panel: TabNavigationPanel
|
|
12567
12588
|
});
|
|
12589
|
+
var parseTokenValue62 = (value) => parseFloat(value);
|
|
12590
|
+
var ICON_BUTTON_CONFIG = {
|
|
12591
|
+
chevronUp: { icon: KeyboardArrowUp_default, defaultVariant: "filled" },
|
|
12592
|
+
chevronRight: { icon: KeyboardArrowRight_default, defaultVariant: "filled" },
|
|
12593
|
+
close: { icon: Close_default, defaultVariant: "text" }
|
|
12594
|
+
};
|
|
12595
|
+
var ANIMATION_DELAY = 1500;
|
|
12596
|
+
var ANIMATION_ITERATIONS = 3;
|
|
12597
|
+
var SHINE_SWEEP = 1100;
|
|
12598
|
+
var SHINE_REST = 4900;
|
|
12599
|
+
var SHINE_BAND_RATIO = 0.4;
|
|
12600
|
+
var SHINE_OPACITY = 0.55;
|
|
12601
|
+
var NUDGE_STEP = 200;
|
|
12602
|
+
var NUDGE_REST = 3200;
|
|
12603
|
+
var NUDGE_DISTANCE = 3;
|
|
12604
|
+
var ShineOverlay = ({
|
|
12605
|
+
radius,
|
|
12606
|
+
highlight
|
|
12607
|
+
}) => {
|
|
12608
|
+
const reducedMotion = Animated10.useReducedMotion();
|
|
12609
|
+
const [width, setWidth] = React66__default.default.useState(0);
|
|
12610
|
+
const progress = Animated10.useSharedValue(0);
|
|
12611
|
+
const bandWidth = width * SHINE_BAND_RATIO;
|
|
12612
|
+
React66__default.default.useEffect(() => {
|
|
12613
|
+
if (reducedMotion || !width) return;
|
|
12614
|
+
progress.value = Animated10.withDelay(
|
|
12615
|
+
ANIMATION_DELAY,
|
|
12616
|
+
Animated10.withRepeat(
|
|
12617
|
+
Animated10.withSequence(
|
|
12618
|
+
Animated10.withTiming(1, {
|
|
12619
|
+
duration: SHINE_SWEEP,
|
|
12620
|
+
easing: Animated10.Easing.inOut(Animated10.Easing.ease)
|
|
12621
|
+
}),
|
|
12622
|
+
Animated10.withDelay(SHINE_REST, Animated10.withTiming(0, { duration: 0 }))
|
|
12623
|
+
),
|
|
12624
|
+
ANIMATION_ITERATIONS
|
|
12625
|
+
)
|
|
12626
|
+
);
|
|
12627
|
+
}, [progress, reducedMotion, width]);
|
|
12628
|
+
const bandStyle = Animated10.useAnimatedStyle(() => ({
|
|
12629
|
+
transform: [
|
|
12630
|
+
{
|
|
12631
|
+
translateX: -bandWidth * 1.5 + progress.value * (width + bandWidth * 2.5)
|
|
12632
|
+
},
|
|
12633
|
+
{ skewX: "-20deg" }
|
|
12634
|
+
]
|
|
12635
|
+
}));
|
|
12636
|
+
if (reducedMotion) return null;
|
|
12637
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12638
|
+
reactNative.View,
|
|
12639
|
+
{
|
|
12640
|
+
pointerEvents: "none",
|
|
12641
|
+
accessible: false,
|
|
12642
|
+
importantForAccessibility: "no-hide-descendants",
|
|
12643
|
+
onLayout: (e) => setWidth(e.nativeEvent.layout.width),
|
|
12644
|
+
style: [
|
|
12645
|
+
reactNative.StyleSheet.absoluteFill,
|
|
12646
|
+
{ borderRadius: radius, overflow: "hidden" }
|
|
12647
|
+
],
|
|
12648
|
+
children: width > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12649
|
+
Animated10__default.default.View,
|
|
12650
|
+
{
|
|
12651
|
+
style: [
|
|
12652
|
+
{ position: "absolute", top: 0, bottom: 0, width: bandWidth },
|
|
12653
|
+
bandStyle
|
|
12654
|
+
],
|
|
12655
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(Svg__default.default, { width: "100%", height: "100%", children: [
|
|
12656
|
+
/* @__PURE__ */ jsxRuntime.jsx(Svg.Defs, { children: /* @__PURE__ */ jsxRuntime.jsxs(Svg.LinearGradient, { id: "fabShine", x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
12657
|
+
/* @__PURE__ */ jsxRuntime.jsx(Svg.Stop, { offset: "0", stopColor: highlight, stopOpacity: 0 }),
|
|
12658
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12659
|
+
Svg.Stop,
|
|
12660
|
+
{
|
|
12661
|
+
offset: "0.5",
|
|
12662
|
+
stopColor: highlight,
|
|
12663
|
+
stopOpacity: SHINE_OPACITY
|
|
12664
|
+
}
|
|
12665
|
+
),
|
|
12666
|
+
/* @__PURE__ */ jsxRuntime.jsx(Svg.Stop, { offset: "1", stopColor: highlight, stopOpacity: 0 })
|
|
12667
|
+
] }) }),
|
|
12668
|
+
/* @__PURE__ */ jsxRuntime.jsx(Svg.Rect, { width: "100%", height: "100%", fill: "url(#fabShine)" })
|
|
12669
|
+
] })
|
|
12670
|
+
}
|
|
12671
|
+
)
|
|
12672
|
+
}
|
|
12673
|
+
);
|
|
12674
|
+
};
|
|
12675
|
+
var createNudgingIcon = (IconComponent, axis, direction) => {
|
|
12676
|
+
var _a;
|
|
12677
|
+
const NudgingIcon = (props) => {
|
|
12678
|
+
const reducedMotion = Animated10.useReducedMotion();
|
|
12679
|
+
const offset = Animated10.useSharedValue(0);
|
|
12680
|
+
React66__default.default.useEffect(() => {
|
|
12681
|
+
if (reducedMotion) return;
|
|
12682
|
+
const step = (to) => Animated10.withTiming(to, {
|
|
12683
|
+
duration: NUDGE_STEP,
|
|
12684
|
+
easing: Animated10.Easing.inOut(Animated10.Easing.ease)
|
|
12685
|
+
});
|
|
12686
|
+
const distance = NUDGE_DISTANCE * direction;
|
|
12687
|
+
offset.value = Animated10.withDelay(
|
|
12688
|
+
ANIMATION_DELAY,
|
|
12689
|
+
Animated10.withRepeat(
|
|
12690
|
+
Animated10.withSequence(
|
|
12691
|
+
step(distance),
|
|
12692
|
+
step(0),
|
|
12693
|
+
step(distance),
|
|
12694
|
+
step(0),
|
|
12695
|
+
Animated10.withDelay(NUDGE_REST, Animated10.withTiming(0, { duration: 0 }))
|
|
12696
|
+
),
|
|
12697
|
+
ANIMATION_ITERATIONS
|
|
12698
|
+
)
|
|
12699
|
+
);
|
|
12700
|
+
}, [offset, reducedMotion]);
|
|
12701
|
+
const nudgeStyle = Animated10.useAnimatedStyle(
|
|
12702
|
+
() => axis === "translateX" ? { transform: [{ translateX: offset.value }] } : { transform: [{ translateY: offset.value }] }
|
|
12703
|
+
);
|
|
12704
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Animated10__default.default.View, { style: nudgeStyle, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, __spreadValues({}, props)) });
|
|
12705
|
+
};
|
|
12706
|
+
NudgingIcon.displayName = `Nudging(${(_a = IconComponent.displayName) != null ? _a : "Icon"})`;
|
|
12707
|
+
return NudgingIcon;
|
|
12708
|
+
};
|
|
12709
|
+
var NUDGE_ICONS = {
|
|
12710
|
+
chevronUp: createNudgingIcon(KeyboardArrowUp_default, "translateY", -1),
|
|
12711
|
+
chevronRight: createNudgingIcon(KeyboardArrowRight_default, "translateX", 1)
|
|
12712
|
+
};
|
|
12713
|
+
var StyledRoot18 = styled51__default.default(reactNative.View)(
|
|
12714
|
+
({
|
|
12715
|
+
rootGap,
|
|
12716
|
+
rootPaddingH,
|
|
12717
|
+
rootPaddingV,
|
|
12718
|
+
rootBgColor,
|
|
12719
|
+
rootBorderWidth,
|
|
12720
|
+
rootBorderColor,
|
|
12721
|
+
rootBorderRadius,
|
|
12722
|
+
rootBoxShadow
|
|
12723
|
+
}) => ({
|
|
12724
|
+
flexDirection: "row",
|
|
12725
|
+
alignItems: "center",
|
|
12726
|
+
width: "100%",
|
|
12727
|
+
gap: rootGap,
|
|
12728
|
+
paddingHorizontal: rootPaddingH,
|
|
12729
|
+
paddingVertical: rootPaddingV,
|
|
12730
|
+
backgroundColor: rootBgColor,
|
|
12731
|
+
borderWidth: rootBorderWidth,
|
|
12732
|
+
borderColor: rootBorderColor,
|
|
12733
|
+
borderRadius: rootBorderRadius,
|
|
12734
|
+
boxShadow: rootBoxShadow
|
|
12735
|
+
})
|
|
12736
|
+
);
|
|
12737
|
+
var StyledIconContainer = styled51__default.default(reactNative.View)(({ containerSize, containerRadius, containerBgColor }) => ({
|
|
12738
|
+
alignItems: "center",
|
|
12739
|
+
justifyContent: "center",
|
|
12740
|
+
flexShrink: 0,
|
|
12741
|
+
width: containerSize,
|
|
12742
|
+
height: containerSize,
|
|
12743
|
+
borderRadius: containerRadius,
|
|
12744
|
+
backgroundColor: containerBgColor
|
|
12745
|
+
}));
|
|
12746
|
+
var StyledContent3 = styled51__default.default(reactNative.View)({
|
|
12747
|
+
flex: 1,
|
|
12748
|
+
minWidth: 0,
|
|
12749
|
+
alignItems: "flex-start",
|
|
12750
|
+
justifyContent: "center"
|
|
12751
|
+
});
|
|
12752
|
+
var FloatingActionButton = React66__default.default.forwardRef(
|
|
12753
|
+
(_a, ref) => {
|
|
12754
|
+
var _b = _a, {
|
|
12755
|
+
variant = "primary",
|
|
12756
|
+
icon = Gift_default,
|
|
12757
|
+
children,
|
|
12758
|
+
linkLabel,
|
|
12759
|
+
linkHref,
|
|
12760
|
+
onLinkPress,
|
|
12761
|
+
animation,
|
|
12762
|
+
iconButtonIcon,
|
|
12763
|
+
iconButtonLabel,
|
|
12764
|
+
iconButtonVariant,
|
|
12765
|
+
onIconButtonPress
|
|
12766
|
+
} = _b, rest = __objRest(_b, [
|
|
12767
|
+
"variant",
|
|
12768
|
+
"icon",
|
|
12769
|
+
"children",
|
|
12770
|
+
"linkLabel",
|
|
12771
|
+
"linkHref",
|
|
12772
|
+
"onLinkPress",
|
|
12773
|
+
"animation",
|
|
12774
|
+
"iconButtonIcon",
|
|
12775
|
+
"iconButtonLabel",
|
|
12776
|
+
"iconButtonVariant",
|
|
12777
|
+
"onIconButtonPress"
|
|
12778
|
+
]);
|
|
12779
|
+
const theme2 = react.useTheme();
|
|
12780
|
+
const { floatingActionButton } = theme2.tokens.components;
|
|
12781
|
+
const { colour, dimensions: dimensions3 } = theme2.tokens.semantics;
|
|
12782
|
+
const { shadow } = colour;
|
|
12783
|
+
const iconButton = ICON_BUTTON_CONFIG[iconButtonIcon];
|
|
12784
|
+
const iconButtonElement = /* @__PURE__ */ jsxRuntime.jsx(
|
|
12785
|
+
IconButton,
|
|
12786
|
+
{
|
|
12787
|
+
icon: animation === "nudge" && iconButtonIcon !== "close" ? NUDGE_ICONS[iconButtonIcon] : iconButton.icon,
|
|
12788
|
+
variant: iconButtonVariant != null ? iconButtonVariant : iconButton.defaultVariant,
|
|
12789
|
+
size: "md",
|
|
12790
|
+
"aria-label": iconButtonLabel,
|
|
12791
|
+
onPress: onIconButtonPress
|
|
12792
|
+
}
|
|
12793
|
+
);
|
|
12794
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12795
|
+
StyledRoot18,
|
|
12796
|
+
__spreadProps(__spreadValues({
|
|
12797
|
+
ref,
|
|
12798
|
+
rootGap: parseTokenValue62(floatingActionButton.spacing.gap),
|
|
12799
|
+
rootPaddingH: parseTokenValue62(
|
|
12800
|
+
floatingActionButton.spacing.horizontalPadding
|
|
12801
|
+
),
|
|
12802
|
+
rootPaddingV: parseTokenValue62(
|
|
12803
|
+
floatingActionButton.spacing.verticalPadding
|
|
12804
|
+
),
|
|
12805
|
+
rootBgColor: floatingActionButton.colour.background[variant],
|
|
12806
|
+
rootBorderWidth: parseTokenValue62(
|
|
12807
|
+
floatingActionButton.borderWidth.default
|
|
12808
|
+
),
|
|
12809
|
+
rootBorderColor: floatingActionButton.colour.border[variant],
|
|
12810
|
+
rootBorderRadius: parseTokenValue62(
|
|
12811
|
+
floatingActionButton.borderRadius.default
|
|
12812
|
+
),
|
|
12813
|
+
rootBoxShadow: `${shadow.md.offsetX} ${shadow.md.offsetY} ${shadow.md.blur} ${shadow.md.spread} ${shadow.md.color}`
|
|
12814
|
+
}, rest), {
|
|
12815
|
+
children: [
|
|
12816
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12817
|
+
StyledIconContainer,
|
|
12818
|
+
{
|
|
12819
|
+
containerSize: parseTokenValue62(
|
|
12820
|
+
theme2.tokens.primitives.dimension.sizing["44"]
|
|
12821
|
+
),
|
|
12822
|
+
containerRadius: parseTokenValue62(dimensions3.borderRadius.round),
|
|
12823
|
+
containerBgColor: variant === "secondary" ? colour.background.container.secondary : colour.background.container.default,
|
|
12824
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { icon, size: "xl", colour: "primary" })
|
|
12825
|
+
}
|
|
12826
|
+
),
|
|
12827
|
+
/* @__PURE__ */ jsxRuntime.jsxs(StyledContent3, { children: [
|
|
12828
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", size: "lg", weight: "medium", children }),
|
|
12829
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12830
|
+
Link,
|
|
12831
|
+
__spreadProps(__spreadValues({
|
|
12832
|
+
href: linkHref,
|
|
12833
|
+
onPress: onLinkPress,
|
|
12834
|
+
size: "md",
|
|
12835
|
+
weight: "medium"
|
|
12836
|
+
}, !linkHref && { accessibilityRole: "button" }), {
|
|
12837
|
+
children: linkLabel
|
|
12838
|
+
})
|
|
12839
|
+
)
|
|
12840
|
+
] }),
|
|
12841
|
+
iconButtonElement,
|
|
12842
|
+
animation === "shine" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12843
|
+
ShineOverlay,
|
|
12844
|
+
{
|
|
12845
|
+
radius: parseTokenValue62(floatingActionButton.borderRadius.default),
|
|
12846
|
+
highlight: theme2.tokens.primitives.colour.system.neutral["1"]
|
|
12847
|
+
}
|
|
12848
|
+
)
|
|
12849
|
+
]
|
|
12850
|
+
})
|
|
12851
|
+
);
|
|
12852
|
+
}
|
|
12853
|
+
);
|
|
12854
|
+
FloatingActionButton.displayName = "FloatingActionButton";
|
|
12568
12855
|
|
|
12569
12856
|
Object.defineProperty(exports, "tokens", {
|
|
12570
12857
|
enumerable: true,
|
|
@@ -12591,6 +12878,7 @@ exports.DatePicker = DatePicker;
|
|
|
12591
12878
|
exports.Divider = Divider;
|
|
12592
12879
|
exports.Drawer = Drawer;
|
|
12593
12880
|
exports.FilterTab = FilterTab;
|
|
12881
|
+
exports.FloatingActionButton = FloatingActionButton;
|
|
12594
12882
|
exports.Hint = Hint;
|
|
12595
12883
|
exports.Icon = Icon;
|
|
12596
12884
|
exports.IconButton = IconButton;
|
|
@@ -12657,6 +12945,7 @@ exports.slideOutAnimation = slideOutAnimation;
|
|
|
12657
12945
|
exports.theme = theme;
|
|
12658
12946
|
exports.useCopyField = useCopyField;
|
|
12659
12947
|
exports.useDrawerKeyboardAvoidance = useDrawerKeyboardAvoidance;
|
|
12948
|
+
exports.useMenuTrigger = useMenuTrigger;
|
|
12660
12949
|
exports.usePasswordField = usePasswordField;
|
|
12661
12950
|
exports.usePawprint = usePawprint;
|
|
12662
12951
|
exports.useSearchField = useSearchField;
|