@forgedevstack/bear 1.2.0 → 1.2.2
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/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- 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 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),e=require("react"),v=require("../../utils/cn.cjs"),x=require("../Typography/Typography.cjs"),a=require("./AnimatedCounter.const.cjs"),T=require("./AnimatedCounter.utils.cjs"),M=({value:o,from:t=0,duration:l=a.DEFAULT_DURATION,decimals:b=a.DEFAULT_DECIMALS,prefix:E="",suffix:q="",separator:C=a.DEFAULT_SEPARATOR,easing:F=a.DEFAULT_EASING,animateOnView:u=!0,typographyProps:n,testId:N,className:D,...I})=>{const[_,R]=e.useState(t),[d,U]=e.useState(!u),A=e.useRef(null),m=T.EASING_FUNCTIONS[F],i=e.useCallback(()=>{const s=performance.now(),r=o-t,c=h=>{const j=h-s,f=Math.min(j/l,1);R(t+r*m(f)),f<1&&requestAnimationFrame(c)};requestAnimationFrame(c)},[o,t,l,m]);e.useEffect(()=>{if(!u){i();return}const s=A.current;if(!s)return;const r=new IntersectionObserver(([c])=>{c.isIntersecting&&!d&&(U(!0),i())},{threshold:.1});return r.observe(s),()=>r.disconnect()},[u,i,d]);const L=`${E}${T.formatNumber(_,b,C)}${q}`;return S.jsx(x.Typography,{variant:"h3",component:"span",...n,className:v.cn("Bear-AnimatedCounter bear-tabular-nums",n==null?void 0:n.className,D),"data-testid":N,children:S.jsx("span",{ref:A,...I,children:L})})};exports.AnimatedCounter=M;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=2e3,E=0,T=",",D="easeOut";exports.DEFAULT_DECIMALS=E;exports.DEFAULT_DURATION=A;exports.DEFAULT_EASING=D;exports.DEFAULT_SEPARATOR=T;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as v, useCallback as $, useEffect as k } from "react";
|
|
3
|
+
import { cn as p } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as q } from "../Typography/Typography.js";
|
|
5
|
+
import { DEFAULT_DURATION as x, DEFAULT_DECIMALS as G, DEFAULT_SEPARATOR as M, DEFAULT_EASING as O } from "./AnimatedCounter.const.js";
|
|
6
|
+
import { EASING_FUNCTIONS as j, formatNumber as B } from "./AnimatedCounter.utils.js";
|
|
7
|
+
const V = ({
|
|
8
|
+
value: c,
|
|
9
|
+
from: e = 0,
|
|
10
|
+
duration: i = x,
|
|
11
|
+
decimals: E = G,
|
|
12
|
+
prefix: F = "",
|
|
13
|
+
suffix: N = "",
|
|
14
|
+
separator: S = M,
|
|
15
|
+
easing: T = O,
|
|
16
|
+
animateOnView: a = !0,
|
|
17
|
+
typographyProps: t,
|
|
18
|
+
testId: b,
|
|
19
|
+
className: D,
|
|
20
|
+
...I
|
|
21
|
+
}) => {
|
|
22
|
+
const [U, C] = d(e), [m, L] = d(!a), u = v(null), f = j[T], o = $(() => {
|
|
23
|
+
const n = performance.now(), r = c - e, s = (R) => {
|
|
24
|
+
const h = R - n, l = Math.min(h / i, 1);
|
|
25
|
+
C(e + r * f(l)), l < 1 && requestAnimationFrame(s);
|
|
26
|
+
};
|
|
27
|
+
requestAnimationFrame(s);
|
|
28
|
+
}, [c, e, i, f]);
|
|
29
|
+
k(() => {
|
|
30
|
+
if (!a) {
|
|
31
|
+
o();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const n = u.current;
|
|
35
|
+
if (!n) return;
|
|
36
|
+
const r = new IntersectionObserver(
|
|
37
|
+
([s]) => {
|
|
38
|
+
s.isIntersecting && !m && (L(!0), o());
|
|
39
|
+
},
|
|
40
|
+
{ threshold: 0.1 }
|
|
41
|
+
);
|
|
42
|
+
return r.observe(n), () => r.disconnect();
|
|
43
|
+
}, [a, o, m]);
|
|
44
|
+
const _ = `${F}${B(U, E, S)}${N}`;
|
|
45
|
+
return /* @__PURE__ */ A(
|
|
46
|
+
q,
|
|
47
|
+
{
|
|
48
|
+
variant: "h3",
|
|
49
|
+
component: "span",
|
|
50
|
+
...t,
|
|
51
|
+
className: p("Bear-AnimatedCounter bear-tabular-nums", t == null ? void 0 : t.className, D),
|
|
52
|
+
"data-testid": b,
|
|
53
|
+
children: /* @__PURE__ */ A("span", { ref: u, ...I, children: _ })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
V as AnimatedCounter
|
|
59
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { TypographyProps } from '../Typography/Typography.types';
|
|
3
|
+
export interface AnimatedCounterProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
4
|
+
/** Target value to count to */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Starting value */
|
|
7
|
+
from?: number;
|
|
8
|
+
/** Animation duration in ms */
|
|
9
|
+
duration?: number;
|
|
10
|
+
/** Decimal places */
|
|
11
|
+
decimals?: number;
|
|
12
|
+
/** Prefix string (e.g. '$') */
|
|
13
|
+
prefix?: string;
|
|
14
|
+
/** Suffix string (e.g. '%') */
|
|
15
|
+
suffix?: string;
|
|
16
|
+
/** Thousand separator */
|
|
17
|
+
separator?: string;
|
|
18
|
+
/** Easing function */
|
|
19
|
+
easing?: 'linear' | 'easeOut' | 'easeInOut';
|
|
20
|
+
/** Start animation when element enters viewport */
|
|
21
|
+
animateOnView?: boolean;
|
|
22
|
+
/** Typography props for the number */
|
|
23
|
+
typographyProps?: Partial<TypographyProps>;
|
|
24
|
+
/** Test ID */
|
|
25
|
+
testId?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={linear:e=>e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2};function s(e,r,a){const n=e.toFixed(r),[i,t]=n.split("."),o=i.replace(/\B(?=(\d{3})+(?!\d))/g,a);return t?`${o}.${t}`:o}exports.EASING_FUNCTIONS=c;exports.formatNumber=s;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const EASING_FUNCTIONS: {
|
|
2
|
+
readonly linear: (t: number) => number;
|
|
3
|
+
readonly easeOut: (t: number) => number;
|
|
4
|
+
readonly easeInOut: (t: number) => number;
|
|
5
|
+
};
|
|
6
|
+
export declare function formatNumber(num: number, decimals: number, separator: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
linear: (e) => e,
|
|
3
|
+
easeOut: (e) => 1 - Math.pow(1 - e, 3),
|
|
4
|
+
easeInOut: (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2
|
|
5
|
+
};
|
|
6
|
+
function s(e, o, a) {
|
|
7
|
+
const r = e.toFixed(o), [c, t] = r.split("."), n = c.replace(/\B(?=(\d{3})+(?!\d))/g, a);
|
|
8
|
+
return t ? `${n}.${t}` : n;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
i as EASING_FUNCTIONS,
|
|
12
|
+
s as formatNumber
|
|
13
|
+
};
|
|
@@ -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/jsx-runtime"),a=require("react"),x=require("../../utils/cn.cjs"),D=require("../Portal/Portal.cjs"),V=require("./Autocomplete.utils.cjs"),M=require("./Autocomplete.const.cjs"),C=({options:z,value:b="",onChange:i,onSelect:g,placeholder:I="Start typing...",label:k,helperText:v,error:u,disabled:f=!1,freeSolo:j=!1,loading:E=!1,filterOptions:q=V.defaultFilter,className:_,testId:B})=>{const[c,s]=a.useState(!1),[n,m]=a.useState(-1),[l,T]=a.useState({top:0,left:0,width:0}),N=a.useRef(null),P=a.useRef(null),h=a.useRef(null),A=a.useRef(null),w=a.useRef(null),o=q(z,b),y=c&&!f&&o.length>0,p=c&&!f&&o.length===0&&!!b&&!E;a.useEffect(()=>{if(!y&&!p)return;const e=()=>{var d;const r=(d=P.current)==null?void 0:d.getBoundingClientRect();r&&T({top:r.bottom+4,left:Math.max(8,Math.min(r.left,window.innerWidth-r.width-8)),width:r.width})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[y,p]),a.useEffect(()=>{if(!c)return;const e=r=>{var R,O;const d=r.target;(R=N.current)!=null&&R.contains(d)||(O=h.current)!=null&&O.contains(d)||s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]),a.useEffect(()=>{m(-1)},[b]),a.useEffect(()=>{if(n>=0&&w.current){const e=w.current.children[n];e&&e.scrollIntoView({block:"nearest"})}},[n]);const U=e=>{const r=e.target.value;i==null||i(r),s(!0)},L=e=>{var r;i==null||i(e.label),g==null||g(e),s(!1),(r=A.current)==null||r.blur()},W=e=>{if(!c){(e.key==="ArrowDown"||e.key==="ArrowUp")&&(s(!0),e.preventDefault());return}switch(e.key){case"ArrowDown":e.preventDefault(),m(r=>r<o.length-1?r+1:0);break;case"ArrowUp":e.preventDefault(),m(r=>r>0?r-1:o.length-1);break;case"Enter":e.preventDefault(),n>=0&&o[n]?L(o[n]):j&&b&&s(!1);break;case"Escape":s(!1);break}};return t.jsxs("div",{className:x.cn("bear-w-full bear-relative",_),ref:N,"data-testid":B,children:[k&&t.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5",children:k}),t.jsxs("div",{className:"bear-relative",ref:P,children:[t.jsx("input",{ref:A,type:"text",value:b,onChange:U,onFocus:()=>s(!0),onKeyDown:W,placeholder:I,disabled:f,className:x.cn("bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border","bear-bg-white dark:bear-bg-gray-900","bear-text-sm bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400","bear-transition-colors bear-outline-none",u?"bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20":"bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",f&&"bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800")}),t.jsx("div",{className:"bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2",children:E?t.jsxs("svg",{className:"bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400",viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"bear-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):t.jsx("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]}),y&&t.jsx(D.Portal,{children:t.jsx("div",{ref:h,className:"bear-fixed bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-shadow-lg bear-bg-white dark:bear-bg-gray-800",style:{top:l.top,left:l.left,width:l.width,zIndex:M.AUTOCOMPLETE_PANEL_Z},children:t.jsx("div",{ref:w,className:"bear-max-h-60 bear-overflow-auto bear-py-1",children:o.map((e,r)=>t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>L(e),className:x.cn("bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors","bear-text-gray-900 dark:bear-text-white",r===n?"bear-bg-amber-50 dark:bear-bg-amber-900/20":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),children:[t.jsx("div",{className:"bear-font-medium",children:e.label}),e.description&&t.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-mt-0.5",children:e.description})]},e.value))})})}),p&&t.jsx(D.Portal,{children:t.jsx("div",{ref:h,className:"bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",style:{top:l.top,left:l.left,width:l.width,zIndex:M.AUTOCOMPLETE_PANEL_Z},children:j?"Press Enter to use this value":"No results found"})}),(v||u)&&t.jsx("p",{className:x.cn("bear-mt-1.5 bear-text-xs",u?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:u||v})]})};exports.Autocomplete=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=11e3;exports.AUTOCOMPLETE_PANEL_Z=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AUTOCOMPLETE_PANEL_Z = 11000;
|
|
@@ -1,130 +1,168 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as c, useEffect as h } from "react";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
import { Portal as B } from "../Portal/Portal.js";
|
|
5
|
+
import { defaultFilter as T } from "./Autocomplete.utils.js";
|
|
6
|
+
import { AUTOCOMPLETE_PANEL_Z as W } from "./Autocomplete.const.js";
|
|
7
|
+
const Y = ({
|
|
8
|
+
options: j,
|
|
9
|
+
value: b = "",
|
|
10
|
+
onChange: o,
|
|
11
|
+
onSelect: w,
|
|
12
|
+
placeholder: U = "Start typing...",
|
|
13
|
+
label: E,
|
|
14
|
+
helperText: L,
|
|
15
|
+
error: u,
|
|
16
|
+
disabled: f = !1,
|
|
17
|
+
freeSolo: P = !1,
|
|
18
|
+
loading: A = !1,
|
|
19
|
+
filterOptions: V = T,
|
|
20
|
+
className: F,
|
|
21
|
+
testId: H
|
|
20
22
|
}) => {
|
|
21
|
-
const [
|
|
22
|
-
|
|
23
|
+
const [l, a] = N(!1), [n, p] = N(-1), [i, K] = N({ top: 0, left: 0, width: 0 }), D = c(null), z = c(null), y = c(null), I = c(null), x = c(null), s = V(j, b), k = l && !f && s.length > 0, v = l && !f && s.length === 0 && !!b && !A;
|
|
24
|
+
h(() => {
|
|
25
|
+
if (!k && !v) return;
|
|
26
|
+
const e = () => {
|
|
27
|
+
var d;
|
|
28
|
+
const r = (d = z.current) == null ? void 0 : d.getBoundingClientRect();
|
|
29
|
+
r && K({
|
|
30
|
+
top: r.bottom + 4,
|
|
31
|
+
left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
|
|
32
|
+
width: r.width
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
36
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
37
|
+
};
|
|
38
|
+
}, [k, v]), h(() => {
|
|
39
|
+
if (!l) return;
|
|
23
40
|
const e = (r) => {
|
|
24
|
-
|
|
41
|
+
var M, O;
|
|
42
|
+
const d = r.target;
|
|
43
|
+
(M = D.current) != null && M.contains(d) || (O = y.current) != null && O.contains(d) || a(!1);
|
|
25
44
|
};
|
|
26
45
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
27
|
-
}, []),
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
if (
|
|
31
|
-
const e =
|
|
46
|
+
}, [l]), h(() => {
|
|
47
|
+
p(-1);
|
|
48
|
+
}, [b]), h(() => {
|
|
49
|
+
if (n >= 0 && x.current) {
|
|
50
|
+
const e = x.current.children[n];
|
|
32
51
|
e && e.scrollIntoView({ block: "nearest" });
|
|
33
52
|
}
|
|
34
|
-
}, [
|
|
35
|
-
const
|
|
53
|
+
}, [n]);
|
|
54
|
+
const _ = (e) => {
|
|
36
55
|
const r = e.target.value;
|
|
37
|
-
|
|
38
|
-
},
|
|
56
|
+
o == null || o(r), a(!0);
|
|
57
|
+
}, R = (e) => {
|
|
39
58
|
var r;
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
if (!
|
|
43
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (
|
|
59
|
+
o == null || o(e.label), w == null || w(e), a(!1), (r = I.current) == null || r.blur();
|
|
60
|
+
}, C = (e) => {
|
|
61
|
+
if (!l) {
|
|
62
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (a(!0), e.preventDefault());
|
|
44
63
|
return;
|
|
45
64
|
}
|
|
46
65
|
switch (e.key) {
|
|
47
66
|
case "ArrowDown":
|
|
48
|
-
e.preventDefault(),
|
|
67
|
+
e.preventDefault(), p(
|
|
49
68
|
(r) => r < s.length - 1 ? r + 1 : 0
|
|
50
69
|
);
|
|
51
70
|
break;
|
|
52
71
|
case "ArrowUp":
|
|
53
|
-
e.preventDefault(),
|
|
72
|
+
e.preventDefault(), p(
|
|
54
73
|
(r) => r > 0 ? r - 1 : s.length - 1
|
|
55
74
|
);
|
|
56
75
|
break;
|
|
57
76
|
case "Enter":
|
|
58
|
-
e.preventDefault(),
|
|
77
|
+
e.preventDefault(), n >= 0 && s[n] ? R(s[n]) : P && b && a(!1);
|
|
59
78
|
break;
|
|
60
79
|
case "Escape":
|
|
61
|
-
|
|
80
|
+
a(!1);
|
|
62
81
|
break;
|
|
63
82
|
}
|
|
64
83
|
};
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ m("div", { className: g("bear-w-full bear-relative", F), ref: D, "data-testid": H, children: [
|
|
85
|
+
E && /* @__PURE__ */ t("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5", children: E }),
|
|
86
|
+
/* @__PURE__ */ m("div", { className: "bear-relative", ref: z, children: [
|
|
87
|
+
/* @__PURE__ */ t(
|
|
69
88
|
"input",
|
|
70
89
|
{
|
|
71
|
-
ref:
|
|
90
|
+
ref: I,
|
|
72
91
|
type: "text",
|
|
73
|
-
value:
|
|
74
|
-
onChange:
|
|
75
|
-
onFocus: () =>
|
|
76
|
-
onKeyDown:
|
|
77
|
-
placeholder:
|
|
78
|
-
disabled:
|
|
79
|
-
className:
|
|
92
|
+
value: b,
|
|
93
|
+
onChange: _,
|
|
94
|
+
onFocus: () => a(!0),
|
|
95
|
+
onKeyDown: C,
|
|
96
|
+
placeholder: U,
|
|
97
|
+
disabled: f,
|
|
98
|
+
className: g(
|
|
80
99
|
"bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border",
|
|
81
100
|
"bear-bg-white dark:bear-bg-gray-900",
|
|
82
101
|
"bear-text-sm bear-text-gray-900 dark:bear-text-white",
|
|
83
102
|
"placeholder:bear-text-gray-400",
|
|
84
103
|
"bear-transition-colors bear-outline-none",
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
u ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",
|
|
105
|
+
f && "bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
87
106
|
)
|
|
88
107
|
}
|
|
89
108
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
] }) : /* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ t("div", { className: "bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2", children: A ? /* @__PURE__ */ m("svg", { className: "bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400", viewBox: "0 0 24 24", fill: "none", children: [
|
|
110
|
+
/* @__PURE__ */ t("circle", { className: "bear-opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
111
|
+
/* @__PURE__ */ t("path", { className: "bear-opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
112
|
+
] }) : /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) })
|
|
94
113
|
] }),
|
|
95
|
-
|
|
114
|
+
k && /* @__PURE__ */ t(B, { children: /* @__PURE__ */ t(
|
|
96
115
|
"div",
|
|
97
116
|
{
|
|
98
117
|
ref: y,
|
|
99
|
-
className: "bear-
|
|
100
|
-
|
|
118
|
+
className: "bear-fixed bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-shadow-lg bear-bg-white dark:bear-bg-gray-800",
|
|
119
|
+
style: {
|
|
120
|
+
top: i.top,
|
|
121
|
+
left: i.left,
|
|
122
|
+
width: i.width,
|
|
123
|
+
zIndex: W
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ t("div", { ref: x, className: "bear-max-h-60 bear-overflow-auto bear-py-1", children: s.map((e, r) => /* @__PURE__ */ m(
|
|
101
126
|
"button",
|
|
102
127
|
{
|
|
103
128
|
type: "button",
|
|
104
129
|
disabled: e.disabled,
|
|
105
|
-
onClick: () =>
|
|
106
|
-
className:
|
|
130
|
+
onClick: () => R(e),
|
|
131
|
+
className: g(
|
|
107
132
|
"bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors",
|
|
108
133
|
"bear-text-gray-900 dark:bear-text-white",
|
|
109
|
-
r ===
|
|
134
|
+
r === n ? "bear-bg-amber-50 dark:bear-bg-amber-900/20" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",
|
|
110
135
|
e.disabled && "bear-opacity-50 bear-cursor-not-allowed"
|
|
111
136
|
),
|
|
112
137
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
e.description && /* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ t("div", { className: "bear-font-medium", children: e.label }),
|
|
139
|
+
e.description && /* @__PURE__ */ t("div", { className: "bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-mt-0.5", children: e.description })
|
|
115
140
|
]
|
|
116
141
|
},
|
|
117
142
|
e.value
|
|
118
|
-
))
|
|
143
|
+
)) })
|
|
144
|
+
}
|
|
145
|
+
) }),
|
|
146
|
+
v && /* @__PURE__ */ t(B, { children: /* @__PURE__ */ t(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: y,
|
|
150
|
+
className: "bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",
|
|
151
|
+
style: {
|
|
152
|
+
top: i.top,
|
|
153
|
+
left: i.left,
|
|
154
|
+
width: i.width,
|
|
155
|
+
zIndex: W
|
|
156
|
+
},
|
|
157
|
+
children: P ? "Press Enter to use this value" : "No results found"
|
|
119
158
|
}
|
|
120
|
-
),
|
|
121
|
-
|
|
122
|
-
(w || n) && /* @__PURE__ */ a("p", { className: c(
|
|
159
|
+
) }),
|
|
160
|
+
(L || u) && /* @__PURE__ */ t("p", { className: g(
|
|
123
161
|
"bear-mt-1.5 bear-text-xs",
|
|
124
|
-
|
|
125
|
-
), children:
|
|
162
|
+
u ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
163
|
+
), children: u || L })
|
|
126
164
|
] });
|
|
127
165
|
};
|
|
128
166
|
export {
|
|
129
|
-
|
|
167
|
+
Y as Autocomplete
|
|
130
168
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),S=require("react-dom"),s=require("../../utils/cn.cjs"),q=require("../Icon/index.cjs"),h=300,E={sm:"bear-max-h-[40%]",md:"bear-max-h-[60%]",lg:"bear-max-h-[80%]",full:"bear-max-h-[95%]"},I=({isOpen:l,onClose:b,title:n,children:x,size:v="md",showCloseButton:d=!0,closeOnBackdrop:y=!0,closeOnEscape:u=!0,showHandle:k=!0,enableScroll:g=!0,isSticky:j=!1,className:w})=>{const[a,c]=r.useState(l),[m,o]=r.useState(!1),[p,f]=r.useState(!1);r.useEffect(()=>{if(l){c(!0),o(!1);const t=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(t)}if(a){f(!1),o(!0);const t=setTimeout(()=>{c(!1),o(!1)},h);return()=>clearTimeout(t)}},[l,a]);const i=r.useCallback(t=>{u&&t.key==="Escape"&&b()},[u,b]);if(r.useEffect(()=>(a&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}),[a,i]),!a)return null;const N=e.jsxs("div",{className:"bear-fixed bear-inset-0 bear-z-[11000] bear-flex bear-items-end bear-justify-center",children:[e.jsx("div",{className:s.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",m?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${h}ms`},onClick:y?b:void 0,"aria-hidden":"true"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":n?"bottom-sheet-title":void 0,className:s.cn("Bear-BottomSheet bear-relative bear-w-full bear-rounded-t-2xl bear-shadow-2xl bear-transition-transform bear-duration-300","bear-flex bear-flex-col bear-min-h-0 bear-overflow-hidden","bear-bg-white dark:bear-bg-neutral-900 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700",E[v],p&&!m?"bear-translate-y-0":"bear-translate-y-full",w),children:[k&&e.jsx("div",{className:"bear-flex bear-justify-center bear-pt-2 bear-pb-1",children:e.jsx("div",{className:"bear-w-12 bear-h-1 bear-rounded-full bear-bg-neutral-300 dark:bear-bg-neutral-600","aria-hidden":!0})}),(n||d)&&e.jsxs("div",{className:s.cn("bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700 bear-shrink-0",j&&"bear-sticky bear-top-0 bear-z-10 bear-bg-white dark:bear-bg-neutral-900"),children:[n&&e.jsx("h2",{id:"bottom-sheet-title",className:"bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",children:n}),d&&e.jsx("button",{onClick:b,className:"bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors","aria-label":"Close",children:e.jsx(q.XIcon,{className:"bear-w-5 bear-h-5"})})]}),e.jsx("div",{className:s.cn("bear-flex-1 bear-min-h-0 bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",g?"bear-overflow-y-auto":"bear-overflow-hidden"),children:x})]})]});return S.createPortal(N,document.body)};exports.BottomSheet=I;
|