@forgedevstack/bear 1.3.3 → 1.3.5
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/README.md +100 -290
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.d.ts +1 -6
- package/dist/components/Alert/Alert.const.js +10 -30
- package/dist/components/Alert/Alert.js +49 -54
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +67 -84
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +72 -64
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +122 -112
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.js +37 -36
- package/dist/components/Chart/Chart.types.d.ts +2 -0
- package/dist/components/Chart/Chart.utils.cjs +1 -1
- package/dist/components/Chart/Chart.utils.d.ts +2 -0
- package/dist/components/Chart/Chart.utils.js +32 -31
- package/dist/components/Chart/FunnelChart.cjs +1 -1
- package/dist/components/Chart/FunnelChart.js +29 -28
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.js +45 -44
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.js +52 -51
- package/dist/components/Chart/RadarChart.cjs +1 -1
- package/dist/components/Chart/RadarChart.js +63 -62
- package/dist/components/Chart/index.d.ts +1 -1
- package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
- package/dist/components/ChipGroup/ChipGroup.const.d.ts +2 -0
- package/dist/components/ChipGroup/ChipGroup.const.js +6 -4
- package/dist/components/ChipGroup/ChipGroup.js +52 -48
- package/dist/components/CommandPalette/CommandItem.cjs +1 -0
- package/dist/components/CommandPalette/CommandItem.d.ts +6 -0
- package/dist/components/CommandPalette/CommandItem.js +39 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +129 -144
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +72 -66
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.d.ts +5 -0
- package/dist/components/EmptyState/EmptyState.const.js +30 -15
- package/dist/components/EmptyState/EmptyState.js +35 -35
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -2
- package/dist/components/HoverCard/HoverCard.cjs +4 -3
- package/dist/components/HoverCard/HoverCard.const.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.const.js +5 -0
- package/dist/components/HoverCard/HoverCard.js +62 -56
- package/dist/components/HoverCard/HoverCard.types.d.ts +7 -0
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.const.cjs +1 -0
- package/dist/components/Menu/Menu.const.d.ts +2 -0
- package/dist/components/Menu/Menu.const.js +7 -0
- package/dist/components/Menu/Menu.d.ts +3 -9
- package/dist/components/Menu/Menu.js +57 -89
- package/dist/components/Menu/Menu.types.d.ts +8 -1
- package/dist/components/Menu/MenuDivider.cjs +1 -0
- package/dist/components/Menu/MenuDivider.d.ts +6 -0
- package/dist/components/Menu/MenuDivider.js +7 -0
- package/dist/components/Menu/MenuItem.cjs +1 -0
- package/dist/components/Menu/MenuItem.d.ts +6 -0
- package/dist/components/Menu/MenuItem.js +46 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -0
- package/dist/components/Modal/Modal.const.js +15 -12
- package/dist/components/Modal/Modal.js +62 -59
- package/dist/components/Modal/Modal.types.d.ts +7 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.cjs +1 -1
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.js +10 -9
- package/dist/components/OverlayPortal/OverlayPortal.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.d.ts +4 -0
- package/dist/components/OverlayPortal/OverlayPortal.const.js +21 -5
- package/dist/components/OverlayPortal/OverlayPortal.js +44 -38
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.const.cjs +1 -0
- package/dist/components/Popover/Popover.const.d.ts +15 -1
- package/dist/components/Popover/Popover.const.js +24 -0
- package/dist/components/Popover/Popover.js +77 -73
- package/dist/components/Popover/Popover.types.d.ts +7 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.cjs +1 -1
- package/dist/components/Select/Select.const.d.ts +1 -0
- package/dist/components/Select/Select.const.js +7 -6
- package/dist/components/Select/Select.js +101 -96
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +1 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -1
- package/dist/components/Toast/Toast.const.d.ts +2 -0
- package/dist/components/Toast/Toast.const.js +11 -8
- package/dist/components/Toast/Toast.context.cjs +1 -0
- package/dist/components/Toast/Toast.context.d.ts +3 -0
- package/dist/components/Toast/Toast.context.js +11 -0
- package/dist/components/Toast/Toast.d.ts +4 -3
- package/dist/components/Toast/Toast.icons.cjs +1 -0
- package/dist/components/Toast/Toast.icons.d.ts +4 -0
- package/dist/components/Toast/Toast.icons.js +29 -0
- package/dist/components/Toast/Toast.js +32 -160
- package/dist/components/Toast/ToastContainer.cjs +1 -0
- package/dist/components/Toast/ToastContainer.d.ts +3 -0
- package/dist/components/Toast/ToastContainer.js +39 -0
- package/dist/components/Toast/ToastItem.cjs +1 -0
- package/dist/components/Toast/ToastItem.d.ts +5 -0
- package/dist/components/Toast/ToastItem.js +86 -0
- package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.d.ts +15 -0
- package/dist/components/ToggleGroup/ToggleGroup.const.js +33 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.context.js +5 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +89 -0
- package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +48 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroupItem.js +50 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.cjs +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.d.ts +1 -0
- package/dist/components/ToggleGroup/hooks/useToggleGroupContext.js +6 -0
- package/dist/components/ToggleGroup/index.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.const.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.const.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.const.js +13 -0
- package/dist/components/Tooltip/Tooltip.js +59 -61
- package/dist/components/Tooltip/Tooltip.types.d.ts +7 -0
- package/dist/components/Transition/Transition.cjs +1 -1
- package/dist/components/Transition/Transition.const.cjs +1 -1
- package/dist/components/Transition/Transition.const.js +26 -8
- package/dist/components/Transition/Transition.js +77 -74
- package/dist/components/Transition/Transition.types.d.ts +8 -2
- package/dist/components/Typography/Typography.const.cjs +1 -1
- package/dist/components/Typography/Typography.const.js +2 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +429 -419
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.js +85 -86
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +3 -0
- package/dist/constants/numbers.const.js +37 -34
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +6 -4
- package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +3 -0
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +17 -14
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
- package/dist/hooks/useFocusTrap/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.js +41 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.types.d.ts +8 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.cjs +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.d.ts +1 -0
- package/dist/hooks/useFocusTrap/useFocusTrap.utils.js +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +580 -568
- package/dist/styles/_alerts.css +85 -4
- package/dist/styles/_drawer.css +60 -0
- package/dist/styles/_effects.css +33 -0
- package/dist/styles.css +231 -4
- package/package.json +3 -5
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useCallback as Z, useMemo as j } from "react";
|
|
3
|
+
import { cn as z } from "../../utils/cn.js";
|
|
4
|
+
import { resolveBearId as K } from "../../utils/generateBearId.utils.js";
|
|
5
|
+
import { useBearId as q } from "../../utils/useBearId.js";
|
|
6
|
+
import { ToggleGroupContext as W } from "./ToggleGroup.context.js";
|
|
7
|
+
import { TOGGLE_GROUP_TYPE_SINGLE as f, TOGGLE_GROUP_ORIENTATION_HORIZONTAL as y, TOGGLE_GROUP_DEFAULT_SIZE as J, TOGGLE_GROUP_DEFAULT_VARIANT as Q, COMPONENT_NAME_TOGGLE_GROUP as X, TOGGLE_GROUP_TYPE_MULTIPLE as $, ORIENTATION_CLASS_MAP as C } from "./ToggleGroup.const.js";
|
|
8
|
+
import { ONE as m, ZERO as V } from "../../constants/numbers.const.js";
|
|
9
|
+
import { EMPTY_STRING as G } from "../../constants/generals.const.js";
|
|
10
|
+
const dr = (N) => {
|
|
11
|
+
const {
|
|
12
|
+
type: o = f,
|
|
13
|
+
value: O,
|
|
14
|
+
defaultValue: p,
|
|
15
|
+
onChange: l,
|
|
16
|
+
onValueChange: n,
|
|
17
|
+
orientation: T = y,
|
|
18
|
+
size: E = J,
|
|
19
|
+
variant: _ = Q,
|
|
20
|
+
disabled: c = !1,
|
|
21
|
+
fullWidth: b = !1,
|
|
22
|
+
className: P,
|
|
23
|
+
children: R,
|
|
24
|
+
id: w,
|
|
25
|
+
testId: x,
|
|
26
|
+
...U
|
|
27
|
+
} = N, S = q(X), k = K(w, S), [M, D] = L(() => o === f ? p ?? G : G), [h, B] = L(() => o === $ ? p ?? [] : []), a = O !== void 0, s = a ? O : o === f ? M : h, g = Z(
|
|
28
|
+
(r) => {
|
|
29
|
+
if (!c)
|
|
30
|
+
if (o === f) {
|
|
31
|
+
const e = s === r ? G : r;
|
|
32
|
+
a || D(e), l == null || l(e), n == null || n(e);
|
|
33
|
+
} else {
|
|
34
|
+
const e = Array.isArray(s) ? s : [], t = e.includes(r) ? e.filter((i) => i !== r) : [...e, r];
|
|
35
|
+
a || B(t), l == null || l(t), n == null || n(t);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
[c, o, s, a, l, n]
|
|
39
|
+
), v = j(
|
|
40
|
+
() => ({
|
|
41
|
+
type: o,
|
|
42
|
+
value: s,
|
|
43
|
+
onItemToggle: g,
|
|
44
|
+
size: E,
|
|
45
|
+
variant: _,
|
|
46
|
+
disabled: c
|
|
47
|
+
}),
|
|
48
|
+
[o, s, g, E, _, c]
|
|
49
|
+
), F = (r) => {
|
|
50
|
+
var A;
|
|
51
|
+
const e = r.target;
|
|
52
|
+
if (!e || e.getAttribute("role") !== "radio") return;
|
|
53
|
+
const t = Array.from(
|
|
54
|
+
r.currentTarget.querySelectorAll('button[role="radio"]:not([disabled])')
|
|
55
|
+
), i = t.indexOf(e);
|
|
56
|
+
if (i === -1) return;
|
|
57
|
+
const u = T === y, H = u && r.key === "ArrowRight" || !u && r.key === "ArrowDown", Y = u && r.key === "ArrowLeft" || !u && r.key === "ArrowUp";
|
|
58
|
+
let d = i;
|
|
59
|
+
if (H) d = (i + m) % t.length;
|
|
60
|
+
else if (Y) d = (i - m + t.length) % t.length;
|
|
61
|
+
else if (r.key === "Home") d = V;
|
|
62
|
+
else if (r.key === "End") d = t.length - m;
|
|
63
|
+
else return;
|
|
64
|
+
r.preventDefault(), (A = t[d]) == null || A.focus();
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ I(W.Provider, { value: v, children: /* @__PURE__ */ I(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
id: k,
|
|
70
|
+
"data-testid": x,
|
|
71
|
+
role: "group",
|
|
72
|
+
"aria-orientation": T,
|
|
73
|
+
onKeyDown: F,
|
|
74
|
+
className: z(
|
|
75
|
+
"Bear-ToggleGroup",
|
|
76
|
+
"inline-flex max-w-full items-center gap-1 rounded-lg border border-[var(--bear-border-subtle)] bg-[var(--bear-surface-base)] p-1",
|
|
77
|
+
C[T],
|
|
78
|
+
b && "w-full justify-stretch",
|
|
79
|
+
c && "opacity-60 cursor-not-allowed",
|
|
80
|
+
P
|
|
81
|
+
),
|
|
82
|
+
...U,
|
|
83
|
+
children: R
|
|
84
|
+
}
|
|
85
|
+
) });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
dr as ToggleGroup
|
|
89
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export type ToggleGroupType = 'single' | 'multiple';
|
|
3
|
+
export type ToggleGroupOrientation = 'horizontal' | 'vertical';
|
|
4
|
+
export type ToggleGroupSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type ToggleGroupVariant = 'subtle' | 'outline' | 'filled';
|
|
6
|
+
export interface ToggleGroupContextValue {
|
|
7
|
+
type: ToggleGroupType;
|
|
8
|
+
value: string | string[];
|
|
9
|
+
onItemToggle: (itemValue: string) => void;
|
|
10
|
+
size: ToggleGroupSize;
|
|
11
|
+
variant: ToggleGroupVariant;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ToggleGroupSingleProps {
|
|
15
|
+
type?: 'single';
|
|
16
|
+
value?: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
onValueChange?: (value: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ToggleGroupMultipleProps {
|
|
22
|
+
type: 'multiple';
|
|
23
|
+
value?: string[];
|
|
24
|
+
defaultValue?: string[];
|
|
25
|
+
onChange?: (value: string[]) => void;
|
|
26
|
+
onValueChange?: (value: string[]) => void;
|
|
27
|
+
}
|
|
28
|
+
export type ToggleGroupBaseProps = {
|
|
29
|
+
orientation?: ToggleGroupOrientation;
|
|
30
|
+
size?: ToggleGroupSize;
|
|
31
|
+
variant?: ToggleGroupVariant;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
fullWidth?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
id?: string;
|
|
37
|
+
testId?: string;
|
|
38
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>;
|
|
39
|
+
export type ToggleGroupProps = ToggleGroupBaseProps & (ToggleGroupSingleProps | ToggleGroupMultipleProps);
|
|
40
|
+
export interface ToggleGroupItemProps extends HTMLAttributes<HTMLButtonElement> {
|
|
41
|
+
value: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
className?: string;
|
|
45
|
+
id?: string;
|
|
46
|
+
testId?: string;
|
|
47
|
+
ariaLabel?: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),f=require("../../utils/cn.cjs");require("react");const m=require("../../utils/generateBearId.utils.cjs"),p=require("../../utils/useBearId.cjs"),P=require("./hooks/useToggleGroupContext.cjs"),s=require("./ToggleGroup.const.cjs"),y=require("../Button/Button.cjs"),R=l=>{const{value:r,disabled:u=!1,children:d,className:c,id:_,testId:G,ariaLabel:T,onClick:i,...g}=l,A=p.useBearId(s.COMPONENT_NAME_TOGGLE_GROUP_ITEM),E=m.resolveBearId(_,A),e=P.useToggleGroupContext(),t=e?e.type===s.TOGGLE_GROUP_TYPE_SINGLE?e.value===r:Array.isArray(e.value)&&e.value.includes(r):!1,n=u||!!(e!=null&&e.disabled),I=(e==null?void 0:e.size)??s.TOGGLE_GROUP_DEFAULT_SIZE,S=(e==null?void 0:e.variant)??s.TOGGLE_GROUP_DEFAULT_VARIANT,b=L=>{!n&&e&&e.onItemToggle(r),i==null||i(L)},a=s.VARIANT_CLASS_MAP[S]??s.VARIANT_CLASS_MAP[s.TOGGLE_GROUP_DEFAULT_VARIANT],v=s.SIZE_CLASS_MAP[I]??s.SIZE_CLASS_MAP[s.TOGGLE_GROUP_DEFAULT_SIZE],o=(e==null?void 0:e.type)===s.TOGGLE_GROUP_TYPE_SINGLE;return O.jsx(y.Button,{type:"button",id:E,testId:G,role:o?"radio":"button","aria-checked":o?t:void 0,"aria-pressed":o?void 0:t,"aria-label":T,disabled:n,onClick:b,variant:"ghost",className:f.cn("Bear-ToggleGroup__item","inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--bear-primary-500)] focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50 select-none cursor-pointer",v,t?a.active:a.base,c),...g,children:d})};exports.ToggleGroupItem=R;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { cn as N } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { resolveBearId as P } from "../../utils/generateBearId.utils.js";
|
|
5
|
+
import { useBearId as R } from "../../utils/useBearId.js";
|
|
6
|
+
import { useToggleGroupContext as U } from "./hooks/useToggleGroupContext.js";
|
|
7
|
+
import { COMPONENT_NAME_TOGGLE_GROUP_ITEM as B, TOGGLE_GROUP_TYPE_SINGLE as n, TOGGLE_GROUP_DEFAULT_SIZE as l, TOGGLE_GROUP_DEFAULT_VARIANT as d, VARIANT_CLASS_MAP as m, SIZE_CLASS_MAP as c } from "./ToggleGroup.const.js";
|
|
8
|
+
import { Button as C } from "../Button/Button.js";
|
|
9
|
+
const Z = (u) => {
|
|
10
|
+
const {
|
|
11
|
+
value: i,
|
|
12
|
+
disabled: f = !1,
|
|
13
|
+
children: p,
|
|
14
|
+
className: _,
|
|
15
|
+
id: v,
|
|
16
|
+
testId: b,
|
|
17
|
+
ariaLabel: G,
|
|
18
|
+
onClick: r,
|
|
19
|
+
...T
|
|
20
|
+
} = u, g = R(B), A = P(v, g), e = U(), s = e ? e.type === n ? e.value === i : Array.isArray(e.value) && e.value.includes(i) : !1, t = f || !!(e != null && e.disabled), E = (e == null ? void 0 : e.size) ?? l, I = (e == null ? void 0 : e.variant) ?? d, S = (L) => {
|
|
21
|
+
!t && e && e.onItemToggle(i), r == null || r(L);
|
|
22
|
+
}, a = m[I] ?? m[d], y = c[E] ?? c[l], o = (e == null ? void 0 : e.type) === n;
|
|
23
|
+
return /* @__PURE__ */ O(
|
|
24
|
+
C,
|
|
25
|
+
{
|
|
26
|
+
type: "button",
|
|
27
|
+
id: A,
|
|
28
|
+
testId: b,
|
|
29
|
+
role: o ? "radio" : "button",
|
|
30
|
+
"aria-checked": o ? s : void 0,
|
|
31
|
+
"aria-pressed": o ? void 0 : s,
|
|
32
|
+
"aria-label": G,
|
|
33
|
+
disabled: t,
|
|
34
|
+
onClick: S,
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
className: N(
|
|
37
|
+
"Bear-ToggleGroup__item",
|
|
38
|
+
"inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--bear-primary-500)] focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50 select-none cursor-pointer",
|
|
39
|
+
y,
|
|
40
|
+
s ? a.active : a.base,
|
|
41
|
+
_
|
|
42
|
+
),
|
|
43
|
+
...T,
|
|
44
|
+
children: p
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
Z as ToggleGroupItem
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../ToggleGroup.context.cjs"),o=()=>e.useContext(t.ToggleGroupContext);exports.useToggleGroupContext=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useToggleGroupContext: () => import('..').ToggleGroupContextValue | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ToggleGroup } from './ToggleGroup';
|
|
2
|
+
export { ToggleGroupItem } from './ToggleGroupItem';
|
|
3
|
+
export { useToggleGroupContext } from './hooks/useToggleGroupContext';
|
|
4
|
+
export type { ToggleGroupProps, ToggleGroupItemProps, ToggleGroupType, ToggleGroupOrientation, ToggleGroupSize, ToggleGroupVariant, ToggleGroupContextValue, } from './ToggleGroup.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),F=require("react-dom"),B=require("../../utils/cn.cjs"),G=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs"),e=require("./Tooltip.const.cjs"),a=require("../../constants/numbers.const.cjs"),q=p=>{const{content:L,children:b,position:g,placement:m,delay:x=e.TOOLTIP_DEFAULT_DELAY,className:R,disabled:w=!1,openEffect:y,closeEffect:N,effect:S}=p,T=m||g||e.TOOLTIP_POSITION_TOP,[n,u]=o.useState(!1),[f,A]=o.useState({x:a.ZERO,y:a.ZERO}),l=o.useRef(null),O=o.useRef(null),s=o.useRef(),c=o.useCallback(()=>{if(!l.current||!O.current)return;const t=l.current.getBoundingClientRect(),r=O.current.getBoundingClientRect(),I=t.left+(t.width-r.width)/a.TWO,_=t.top+(t.height-r.height)/a.TWO,E={[e.TOOLTIP_POSITION_TOP]:{x:I,y:t.top-r.height-e.TOOLTIP_SPACING},[e.TOOLTIP_POSITION_BOTTOM]:{x:I,y:t.bottom+e.TOOLTIP_SPACING},[e.TOOLTIP_POSITION_LEFT]:{x:t.left-r.width-e.TOOLTIP_SPACING,y:_},[e.TOOLTIP_POSITION_RIGHT]:{x:t.right+e.TOOLTIP_SPACING,y:_}},h=E[T]??E[e.TOOLTIP_POSITION_TOP],M=Math.max(e.TOOLTIP_VIEWPORT_PADDING,Math.min(h.x,window.innerWidth-r.width-e.TOOLTIP_VIEWPORT_PADDING)),D=Math.max(e.TOOLTIP_VIEWPORT_PADDING,Math.min(h.y,window.innerHeight-r.height-e.TOOLTIP_VIEWPORT_PADDING));A({x:M,y:D})},[T]),P=()=>{w||(s.current=setTimeout(()=>{u(!0)},x))},d=()=>{s.current&&clearTimeout(s.current),u(!1)};o.useEffect(()=>{n&&c()},[n,c]),o.useEffect(()=>{if(!n)return;const t=()=>{requestAnimationFrame(()=>c())};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[n,c]),o.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const{openEffect:C}=G.resolveOverlayEffects({openEffect:y,closeEffect:N,effect:S},"fade"),v=e.TOOLTIP_EFFECT_CLASS_MAP[C]??e.TOOLTIP_EFFECT_CLASS_MAP.fade;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:l,onMouseEnter:P,onMouseLeave:d,onFocus:P,onBlur:d,className:"Bear-Tooltip__trigger bear-inline-block",children:b}),n&&F.createPortal(i.jsx("div",{ref:O,role:"tooltip",style:{left:f.x,top:f.y},className:B.cn("bear-fixed bear-z-[11000]","Bear-Tooltip",`Bear-Tooltip--${T}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg",v,R),children:i.jsx("span",{className:"Bear-Tooltip__content",children:L})}),document.body)]})};exports.Tooltip=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants/numbers.const.cjs"),O=require("../OverlayPortal/OverlayPortal.const.cjs"),I=O.OVERLAY_EFFECT_CLASS_MAP,_=T.TWO_HUNDRED,P=T.EIGHT,L=T.EIGHT,t="top",o="bottom",E="left",S="right";exports.TOOLTIP_DEFAULT_DELAY=_;exports.TOOLTIP_EFFECT_CLASS_MAP=I;exports.TOOLTIP_POSITION_BOTTOM=o;exports.TOOLTIP_POSITION_LEFT=E;exports.TOOLTIP_POSITION_RIGHT=S;exports.TOOLTIP_POSITION_TOP=t;exports.TOOLTIP_SPACING=P;exports.TOOLTIP_VIEWPORT_PADDING=L;
|
|
@@ -1 +1,9 @@
|
|
|
1
1
|
export declare const T_O_O_L_T_I_P_ROOT_CLASS = "Bear-Tooltip";
|
|
2
|
+
export declare const TOOLTIP_EFFECT_CLASS_MAP: Record<string, string>;
|
|
3
|
+
export declare const TOOLTIP_DEFAULT_DELAY = 200;
|
|
4
|
+
export declare const TOOLTIP_SPACING = 8;
|
|
5
|
+
export declare const TOOLTIP_VIEWPORT_PADDING = 8;
|
|
6
|
+
export declare const TOOLTIP_POSITION_TOP = "top";
|
|
7
|
+
export declare const TOOLTIP_POSITION_BOTTOM = "bottom";
|
|
8
|
+
export declare const TOOLTIP_POSITION_LEFT = "left";
|
|
9
|
+
export declare const TOOLTIP_POSITION_RIGHT = "right";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TWO_HUNDRED as O, EIGHT as T } from "../../constants/numbers.const.js";
|
|
2
|
+
import { OVERLAY_EFFECT_CLASS_MAP as I } from "../OverlayPortal/OverlayPortal.const.js";
|
|
3
|
+
const o = I, t = O, L = T, E = T, A = "top", S = "bottom", c = "left", n = "right";
|
|
4
|
+
export {
|
|
5
|
+
t as TOOLTIP_DEFAULT_DELAY,
|
|
6
|
+
o as TOOLTIP_EFFECT_CLASS_MAP,
|
|
7
|
+
S as TOOLTIP_POSITION_BOTTOM,
|
|
8
|
+
c as TOOLTIP_POSITION_LEFT,
|
|
9
|
+
n as TOOLTIP_POSITION_RIGHT,
|
|
10
|
+
A as TOOLTIP_POSITION_TOP,
|
|
11
|
+
L as TOOLTIP_SPACING,
|
|
12
|
+
E as TOOLTIP_VIEWPORT_PADDING
|
|
13
|
+
};
|
|
@@ -1,78 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { cn as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
r = Math.max(8, Math.min(r, window.innerWidth - t.width - 8)), o = Math.max(8, Math.min(o, window.innerHeight - t.height - 8)), E({ x: r, y: o });
|
|
33
|
-
}, [c]), g = () => {
|
|
34
|
-
B || (n.current = setTimeout(() => {
|
|
1
|
+
import { jsxs as j, Fragment as k, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I, useRef as d, useCallback as H, useEffect as u } from "react";
|
|
3
|
+
import { createPortal as Y } from "react-dom";
|
|
4
|
+
import { cn as q } from "../../utils/cn.js";
|
|
5
|
+
import { resolveOverlayEffects as U } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
|
|
6
|
+
import { TOOLTIP_DEFAULT_DELAY as X, TOOLTIP_POSITION_RIGHT as Z, TOOLTIP_SPACING as i, TOOLTIP_POSITION_LEFT as $, TOOLTIP_POSITION_BOTTOM as J, TOOLTIP_POSITION_TOP as T, TOOLTIP_VIEWPORT_PADDING as s, TOOLTIP_EFFECT_CLASS_MAP as _ } from "./Tooltip.const.js";
|
|
7
|
+
import { ZERO as w, TWO as L } from "../../constants/numbers.const.js";
|
|
8
|
+
const ie = (x) => {
|
|
9
|
+
const {
|
|
10
|
+
content: y,
|
|
11
|
+
children: v,
|
|
12
|
+
position: R,
|
|
13
|
+
placement: M,
|
|
14
|
+
delay: N = X,
|
|
15
|
+
className: B,
|
|
16
|
+
disabled: C = !1,
|
|
17
|
+
openEffect: S,
|
|
18
|
+
closeEffect: A,
|
|
19
|
+
effect: F
|
|
20
|
+
} = x, c = M || R || T, [o, m] = I(!1), [p, D] = I({ x: w, y: w }), a = d(null), l = d(null), r = d(), n = H(() => {
|
|
21
|
+
if (!a.current || !l.current) return;
|
|
22
|
+
const e = a.current.getBoundingClientRect(), t = l.current.getBoundingClientRect(), g = e.left + (e.width - t.width) / L, P = e.top + (e.height - t.height) / L, b = {
|
|
23
|
+
[T]: { x: g, y: e.top - t.height - i },
|
|
24
|
+
[J]: { x: g, y: e.bottom + i },
|
|
25
|
+
[$]: { x: e.left - t.width - i, y: P },
|
|
26
|
+
[Z]: { x: e.right + i, y: P }
|
|
27
|
+
}, E = b[c] ?? b[T], V = Math.max(s, Math.min(E.x, window.innerWidth - t.width - s)), W = Math.max(s, Math.min(E.y, window.innerHeight - t.height - s));
|
|
28
|
+
D({ x: V, y: W });
|
|
29
|
+
}, [c]), O = () => {
|
|
30
|
+
C || (r.current = setTimeout(() => {
|
|
35
31
|
m(!0);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
32
|
+
}, N));
|
|
33
|
+
}, h = () => {
|
|
34
|
+
r.current && clearTimeout(r.current), m(!1);
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
if (!
|
|
36
|
+
u(() => {
|
|
37
|
+
o && n();
|
|
38
|
+
}, [o, n]), u(() => {
|
|
39
|
+
if (!o) return;
|
|
44
40
|
const e = () => {
|
|
45
|
-
requestAnimationFrame(() =>
|
|
41
|
+
requestAnimationFrame(() => n());
|
|
46
42
|
};
|
|
47
43
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
48
44
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
49
45
|
};
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
}, [])
|
|
53
|
-
|
|
46
|
+
}, [o, n]), u(() => () => {
|
|
47
|
+
r.current && clearTimeout(r.current);
|
|
48
|
+
}, []);
|
|
49
|
+
const { openEffect: z } = U({ openEffect: S, closeEffect: A, effect: F }, "fade"), G = _[z] ?? _.fade;
|
|
50
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
51
|
+
/* @__PURE__ */ f(
|
|
54
52
|
"div",
|
|
55
53
|
{
|
|
56
|
-
ref:
|
|
57
|
-
onMouseEnter:
|
|
58
|
-
onMouseLeave:
|
|
59
|
-
onFocus:
|
|
60
|
-
onBlur:
|
|
54
|
+
ref: a,
|
|
55
|
+
onMouseEnter: O,
|
|
56
|
+
onMouseLeave: h,
|
|
57
|
+
onFocus: O,
|
|
58
|
+
onBlur: h,
|
|
61
59
|
className: "Bear-Tooltip__trigger bear-inline-block",
|
|
62
60
|
children: v
|
|
63
61
|
}
|
|
64
62
|
),
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
63
|
+
o && Y(
|
|
64
|
+
/* @__PURE__ */ f(
|
|
67
65
|
"div",
|
|
68
66
|
{
|
|
69
|
-
ref:
|
|
67
|
+
ref: l,
|
|
70
68
|
role: "tooltip",
|
|
71
69
|
style: {
|
|
72
|
-
left:
|
|
73
|
-
top:
|
|
70
|
+
left: p.x,
|
|
71
|
+
top: p.y
|
|
74
72
|
},
|
|
75
|
-
className:
|
|
73
|
+
className: q(
|
|
76
74
|
"bear-fixed bear-z-[11000]",
|
|
77
75
|
"Bear-Tooltip",
|
|
78
76
|
`Bear-Tooltip--${c}`,
|
|
@@ -80,10 +78,10 @@ const V = ({
|
|
|
80
78
|
"bear-bg-gray-800 bear-text-white bear-text-sm",
|
|
81
79
|
"bear-border bear-border-gray-700",
|
|
82
80
|
"bear-shadow-lg",
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
G,
|
|
82
|
+
B
|
|
85
83
|
),
|
|
86
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ f("span", { className: "Bear-Tooltip__content", children: y })
|
|
87
85
|
}
|
|
88
86
|
),
|
|
89
87
|
document.body
|
|
@@ -91,5 +89,5 @@ const V = ({
|
|
|
91
89
|
] });
|
|
92
90
|
};
|
|
93
91
|
export {
|
|
94
|
-
|
|
92
|
+
ie as Tooltip
|
|
95
93
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { OverlayMotionEffect, OverlayEffectConfig } from '../../hooks/useFixedAnchorPosition';
|
|
2
3
|
export interface TooltipProps {
|
|
3
4
|
testId?: string;
|
|
4
5
|
id?: string;
|
|
@@ -16,4 +17,10 @@ export interface TooltipProps {
|
|
|
16
17
|
className?: string;
|
|
17
18
|
/** Whether tooltip is disabled */
|
|
18
19
|
disabled?: boolean;
|
|
20
|
+
/** Transition effect when opening */
|
|
21
|
+
openEffect?: OverlayMotionEffect;
|
|
22
|
+
/** Transition effect when closing */
|
|
23
|
+
closeEffect?: OverlayMotionEffect;
|
|
24
|
+
/** Config for open and close transition effects */
|
|
25
|
+
effect?: OverlayEffectConfig;
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),g=require("../../utils/cn.cjs"),q=require("./Transition.const.cjs"),U=({show:u,name:y="fade",duration:r=q.DEFAULT_DURATION,delay:a=0,easing:F=q.DEFAULT_EASING,enterFrom:n,enterTo:l,leaveFrom:o,leaveTo:I,unmountOnHide:v=!0,onEnter:m,onEntered:d,onLeave:c,onLeft:S,children:M,className:N,style:A,nodeRef:R,elementProps:b,as:x="div"})=>{const[P,i]=t.useState(u),[D,T]=t.useState(u?"enter":"exit-active"),f=t.useRef(null),$=t.useRef(!1);if(t.useEffect(()=>{if(f.current&&clearTimeout(f.current),!(!$.current&&($.current=!0,!u)))return u?(i(!0),T("enter"),m==null||m(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{T("enter-active"),f.current=setTimeout(()=>{T("idle"),d==null||d()},r+a)})})):(T("exit"),c==null||c(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{T("exit-active"),f.current=setTimeout(()=>{v&&i(!1),S==null||S()},r+a)})})),()=>{f.current&&clearTimeout(f.current)}},[u]),!P&&v)return null;const e=q.TRANSITION_PRESETS[y];let s={transition:`all ${r}ms ${F} ${a}ms`};switch(D){case"enter":s={...s,...n??(e==null?void 0:e.enter)};break;case"enter-active":case"idle":s={...s,...l??(e==null?void 0:e.enterActive)};break;case"exit":s={...s,...o??(e==null?void 0:e.exit)};break;case"exit-active":s={...s,...I??(e==null?void 0:e.exitActive)};break}return t.createElement(x,{ref:R,className:g.cn(N),style:{...A,...s},...b},M)},_=({children:u,initial:y,animate:r,exit:a,transition:F={},whileHover:n,whileTap:l,inView:o=!0,as:I="div",className:v,testId:m})=>{const[d,c]=t.useState(y??{}),[S,M]=t.useState(!1),[N,A]=t.useState(!1),R=t.useRef(!1),{duration:b=300,delay:x=0,easing:P=q.DEFAULT_EASING}=F;t.useEffect(()=>{R.current?o&&r?c(r):!o&&a&&c(a):(R.current=!0,requestAnimationFrame(()=>{o&&r&&c(r)}))},[o]);let i={...d,transition:`all ${b}ms ${P} ${x}ms`};return N&&l?i={...i,...l}:S&&n&&(i={...i,...n}),t.createElement(I,{className:g.cn(v),style:i,"data-testid":m,onMouseEnter:n?()=>M(!0):void 0,onMouseLeave:n?()=>{M(!1),A(!1)}:void 0,onMouseDown:l?()=>A(!0):void 0,onMouseUp:l?()=>A(!1):void 0},u)};exports.Motion=_;exports.Transition=U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=300,e="cubic-bezier(0.4, 0, 0.2, 1)",r={fade:{enter:{opacity:0},enterActive:{opacity:1},exit:{opacity:1},exitActive:{opacity:0}},"slide-up":{enter:{opacity:0,transform:"translateY(16px)"},enterActive:{opacity:1,transform:"translateY(0)"},exit:{opacity:1,transform:"translateY(0)"},exitActive:{opacity:0,transform:"translateY(16px)"}},"slide-down":{enter:{opacity:0,transform:"translateY(-16px)"},enterActive:{opacity:1,transform:"translateY(0)"},exit:{opacity:1,transform:"translateY(0)"},exitActive:{opacity:0,transform:"translateY(-16px)"}},"slide-left":{enter:{opacity:0,transform:"translateX(-16px)"},enterActive:{opacity:1,transform:"translateX(0)"},exit:{opacity:1,transform:"translateX(0)"},exitActive:{opacity:0,transform:"translateX(-16px)"}},"slide-right":{enter:{opacity:0,transform:"translateX(16px)"},enterActive:{opacity:1,transform:"translateX(0)"},exit:{opacity:1,transform:"translateX(0)"},exitActive:{opacity:0,transform:"translateX(16px)"}},scale:{enter:{opacity:0,transform:"scale(0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=300,e="cubic-bezier(0.4, 0, 0.2, 1)",r={fade:{enter:{opacity:0},enterActive:{opacity:1},exit:{opacity:1},exitActive:{opacity:0}},"slide-up":{enter:{opacity:0,transform:"translateY(16px)"},enterActive:{opacity:1,transform:"translateY(0)"},exit:{opacity:1,transform:"translateY(0)"},exitActive:{opacity:0,transform:"translateY(16px)"}},"slide-down":{enter:{opacity:0,transform:"translateY(-16px)",transformOrigin:"top center"},enterActive:{opacity:1,transform:"translateY(0)",transformOrigin:"top center"},exit:{opacity:1,transform:"translateY(0)",transformOrigin:"top center"},exitActive:{opacity:0,transform:"translateY(-16px)",transformOrigin:"top center"}},"slide-left":{enter:{opacity:0,transform:"translateX(-16px)"},enterActive:{opacity:1,transform:"translateX(0)"},exit:{opacity:1,transform:"translateX(0)"},exitActive:{opacity:0,transform:"translateX(-16px)"}},"slide-right":{enter:{opacity:0,transform:"translateX(16px)"},enterActive:{opacity:1,transform:"translateX(0)"},exit:{opacity:1,transform:"translateX(0)"},exitActive:{opacity:0,transform:"translateX(16px)"}},scale:{enter:{opacity:0,transform:"scale(0.96)",transformOrigin:"top center"},enterActive:{opacity:1,transform:"scale(1)",transformOrigin:"top center"},exit:{opacity:1,transform:"scale(1)",transformOrigin:"top center"},exitActive:{opacity:0,transform:"scale(0.96)",transformOrigin:"top center"}},"scale-y":{enter:{opacity:0,transform:"scaleY(0.02)",transformOrigin:"top center"},enterActive:{opacity:1,transform:"scaleY(1)",transformOrigin:"top center"},exit:{opacity:1,transform:"scaleY(1)",transformOrigin:"top center"},exitActive:{opacity:0,transform:"scaleY(0.02)",transformOrigin:"top center"}},fold:{enter:{opacity:0,transform:"scaleY(0.02)",transformOrigin:"top center"},enterActive:{opacity:1,transform:"scaleY(1)",transformOrigin:"top center"},exit:{opacity:1,transform:"scaleY(1)",transformOrigin:"top center"},exitActive:{opacity:0,transform:"scaleY(0.02)",transformOrigin:"top center"}},elastic:{enter:{opacity:0,transform:"scale(1.12)",transformOrigin:"top center"},enterActive:{opacity:1,transform:"scale(1)",transformOrigin:"top center"},exit:{opacity:1,transform:"scale(1)",transformOrigin:"top center"},exitActive:{opacity:0,transform:"scale(1.12)",transformOrigin:"top center"}},reveal:{enter:{maxHeight:0,overflow:"hidden",opacity:0},enterActive:{maxHeight:"24rem",overflow:"hidden",opacity:1},exit:{maxHeight:"24rem",overflow:"hidden",opacity:1},exitActive:{maxHeight:0,overflow:"hidden",opacity:0}},expand:{enter:{maxHeight:0,overflow:"hidden",opacity:0,transformOrigin:"top center"},enterActive:{maxHeight:"24rem",overflow:"hidden",opacity:1,transformOrigin:"top center"},exit:{maxHeight:"24rem",overflow:"hidden",opacity:1,transformOrigin:"top center"},exitActive:{maxHeight:0,overflow:"hidden",opacity:0,transformOrigin:"top center"}},"scale-x":{enter:{opacity:0,transform:"scaleX(0)"},enterActive:{opacity:1,transform:"scaleX(1)"},exit:{opacity:1,transform:"scaleX(1)"},exitActive:{opacity:0,transform:"scaleX(0)"}},rotate:{enter:{opacity:0,transform:"rotate(-90deg)"},enterActive:{opacity:1,transform:"rotate(0)"},exit:{opacity:1,transform:"rotate(0)"},exitActive:{opacity:0,transform:"rotate(90deg)"}},flip:{enter:{opacity:0,transform:"perspective(400px) rotateY(-90deg)"},enterActive:{opacity:1,transform:"perspective(400px) rotateY(0)"},exit:{opacity:1,transform:"perspective(400px) rotateY(0)"},exitActive:{opacity:0,transform:"perspective(400px) rotateY(90deg)"}},collapse:{enter:{height:"0px",overflow:"hidden",opacity:0},enterActive:{height:"auto",overflow:"hidden",opacity:1},exit:{height:"auto",overflow:"hidden",opacity:1},exitActive:{height:"0px",overflow:"hidden",opacity:0}}};exports.DEFAULT_DURATION=t;exports.DEFAULT_EASING=e;exports.TRANSITION_PRESETS=r;
|
|
@@ -12,10 +12,10 @@ const t = 300, e = "cubic-bezier(0.4, 0, 0.2, 1)", r = {
|
|
|
12
12
|
exitActive: { opacity: 0, transform: "translateY(16px)" }
|
|
13
13
|
},
|
|
14
14
|
"slide-down": {
|
|
15
|
-
enter: { opacity: 0, transform: "translateY(-16px)" },
|
|
16
|
-
enterActive: { opacity: 1, transform: "translateY(0)" },
|
|
17
|
-
exit: { opacity: 1, transform: "translateY(0)" },
|
|
18
|
-
exitActive: { opacity: 0, transform: "translateY(-16px)" }
|
|
15
|
+
enter: { opacity: 0, transform: "translateY(-16px)", transformOrigin: "top center" },
|
|
16
|
+
enterActive: { opacity: 1, transform: "translateY(0)", transformOrigin: "top center" },
|
|
17
|
+
exit: { opacity: 1, transform: "translateY(0)", transformOrigin: "top center" },
|
|
18
|
+
exitActive: { opacity: 0, transform: "translateY(-16px)", transformOrigin: "top center" }
|
|
19
19
|
},
|
|
20
20
|
"slide-left": {
|
|
21
21
|
enter: { opacity: 0, transform: "translateX(-16px)" },
|
|
@@ -30,10 +30,10 @@ const t = 300, e = "cubic-bezier(0.4, 0, 0.2, 1)", r = {
|
|
|
30
30
|
exitActive: { opacity: 0, transform: "translateX(16px)" }
|
|
31
31
|
},
|
|
32
32
|
scale: {
|
|
33
|
-
enter: { opacity: 0, transform: "scale(0.
|
|
34
|
-
enterActive: { opacity: 1, transform: "scale(1)" },
|
|
35
|
-
exit: { opacity: 1, transform: "scale(1)" },
|
|
36
|
-
exitActive: { opacity: 0, transform: "scale(0.
|
|
33
|
+
enter: { opacity: 0, transform: "scale(0.96)", transformOrigin: "top center" },
|
|
34
|
+
enterActive: { opacity: 1, transform: "scale(1)", transformOrigin: "top center" },
|
|
35
|
+
exit: { opacity: 1, transform: "scale(1)", transformOrigin: "top center" },
|
|
36
|
+
exitActive: { opacity: 0, transform: "scale(0.96)", transformOrigin: "top center" }
|
|
37
37
|
},
|
|
38
38
|
"scale-y": {
|
|
39
39
|
enter: { opacity: 0, transform: "scaleY(0.02)", transformOrigin: "top center" },
|
|
@@ -47,6 +47,24 @@ const t = 300, e = "cubic-bezier(0.4, 0, 0.2, 1)", r = {
|
|
|
47
47
|
exit: { opacity: 1, transform: "scaleY(1)", transformOrigin: "top center" },
|
|
48
48
|
exitActive: { opacity: 0, transform: "scaleY(0.02)", transformOrigin: "top center" }
|
|
49
49
|
},
|
|
50
|
+
elastic: {
|
|
51
|
+
enter: { opacity: 0, transform: "scale(1.12)", transformOrigin: "top center" },
|
|
52
|
+
enterActive: { opacity: 1, transform: "scale(1)", transformOrigin: "top center" },
|
|
53
|
+
exit: { opacity: 1, transform: "scale(1)", transformOrigin: "top center" },
|
|
54
|
+
exitActive: { opacity: 0, transform: "scale(1.12)", transformOrigin: "top center" }
|
|
55
|
+
},
|
|
56
|
+
reveal: {
|
|
57
|
+
enter: { maxHeight: 0, overflow: "hidden", opacity: 0 },
|
|
58
|
+
enterActive: { maxHeight: "24rem", overflow: "hidden", opacity: 1 },
|
|
59
|
+
exit: { maxHeight: "24rem", overflow: "hidden", opacity: 1 },
|
|
60
|
+
exitActive: { maxHeight: 0, overflow: "hidden", opacity: 0 }
|
|
61
|
+
},
|
|
62
|
+
expand: {
|
|
63
|
+
enter: { maxHeight: 0, overflow: "hidden", opacity: 0, transformOrigin: "top center" },
|
|
64
|
+
enterActive: { maxHeight: "24rem", overflow: "hidden", opacity: 1, transformOrigin: "top center" },
|
|
65
|
+
exit: { maxHeight: "24rem", overflow: "hidden", opacity: 1, transformOrigin: "top center" },
|
|
66
|
+
exitActive: { maxHeight: 0, overflow: "hidden", opacity: 0, transformOrigin: "top center" }
|
|
67
|
+
},
|
|
50
68
|
"scale-x": {
|
|
51
69
|
enter: { opacity: 0, transform: "scaleX(0)" },
|
|
52
70
|
enterActive: { opacity: 1, transform: "scaleX(1)" },
|