@forgedevstack/bear 1.0.8 → 1.0.9
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/ActivityItem/ActivityItem.cjs +1 -1
- package/dist/components/ActivityItem/ActivityItem.js +1 -0
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.js +3 -2
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +3 -2
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +15 -14
- package/dist/components/BearLogo/EmberLogo.cjs +1 -1
- package/dist/components/BearLogo/EmberLogo.js +3 -2
- package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.js +3 -2
- package/dist/components/Carousel/Carousel.cjs +1 -1
- package/dist/components/Carousel/Carousel.const.cjs +1 -0
- package/dist/components/Carousel/Carousel.const.d.ts +12 -0
- package/dist/components/Carousel/Carousel.const.js +9 -0
- package/dist/components/Carousel/Carousel.d.ts +14 -3
- package/dist/components/Carousel/Carousel.js +222 -75
- package/dist/components/Carousel/Carousel.types.d.ts +32 -2
- package/dist/components/Carousel/index.d.ts +1 -1
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.js +3 -2
- package/dist/components/CodeEditor/CodeEditor.cjs +5 -0
- package/dist/components/CodeEditor/CodeEditor.const.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.const.d.ts +21 -0
- package/dist/components/CodeEditor/CodeEditor.const.js +119 -0
- package/dist/components/CodeEditor/CodeEditor.d.ts +22 -0
- package/dist/components/CodeEditor/CodeEditor.js +250 -0
- package/dist/components/CodeEditor/CodeEditor.types.d.ts +80 -0
- package/dist/components/CodeEditor/CodeEditor.utils.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.utils.d.ts +6 -0
- package/dist/components/CodeEditor/CodeEditor.utils.js +75 -0
- package/dist/components/CodeEditor/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -1
- package/dist/components/Columns/Columns.js +9 -8
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +27 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +35 -0
- package/dist/components/CountdownTimer/CountdownTimer.d.ts +7 -0
- package/dist/components/CountdownTimer/CountdownTimer.js +115 -0
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +56 -0
- package/dist/components/CountdownTimer/index.d.ts +2 -0
- package/dist/components/Cropper/Cropper.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.d.ts +31 -0
- package/dist/components/Cropper/Cropper.const.js +33 -0
- package/dist/components/Cropper/Cropper.d.ts +21 -0
- package/dist/components/Cropper/Cropper.js +362 -0
- package/dist/components/Cropper/Cropper.types.d.ts +72 -0
- package/dist/components/Cropper/index.d.ts +2 -0
- package/dist/components/DataTable/DataTable.cjs +1 -1
- package/dist/components/DataTable/DataTable.js +5 -4
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +15 -14
- package/dist/components/Dock/Dock.cjs +1 -0
- package/dist/components/Dock/Dock.const.cjs +1 -0
- package/dist/components/Dock/Dock.const.d.ts +25 -0
- package/dist/components/Dock/Dock.const.js +22 -0
- package/dist/components/Dock/Dock.d.ts +7 -0
- package/dist/components/Dock/Dock.js +144 -0
- package/dist/components/Dock/Dock.types.d.ts +42 -0
- package/dist/components/Dock/index.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.js +7 -6
- package/dist/components/GradientText/GradientText.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.d.ts +15 -0
- package/dist/components/GradientText/GradientText.const.js +36 -0
- package/dist/components/GradientText/GradientText.d.ts +7 -0
- package/dist/components/GradientText/GradientText.js +52 -0
- package/dist/components/GradientText/GradientText.types.d.ts +27 -0
- package/dist/components/GradientText/index.d.ts +2 -0
- package/dist/components/Highlight/Highlight.cjs +1 -1
- package/dist/components/Highlight/Highlight.const.cjs +1 -0
- package/dist/components/Highlight/Highlight.const.d.ts +8 -0
- package/dist/components/Highlight/Highlight.const.js +15 -0
- package/dist/components/Highlight/Highlight.d.ts +4 -0
- package/dist/components/Highlight/Highlight.js +32 -24
- package/dist/components/Highlight/Highlight.types.d.ts +9 -1
- package/dist/components/Highlight/index.d.ts +1 -1
- package/dist/components/Icon/Icon.cjs +1 -1
- package/dist/components/Icon/Icon.js +17 -16
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +12 -11
- package/dist/components/Kbd/Kbd.cjs +1 -1
- package/dist/components/Kbd/Kbd.js +17 -16
- package/dist/components/Map/Map.cjs +1 -0
- package/dist/components/Map/Map.const.cjs +1 -0
- package/dist/components/Map/Map.const.d.ts +20 -0
- package/dist/components/Map/Map.const.js +26 -0
- package/dist/components/Map/Map.d.ts +20 -0
- package/dist/components/Map/Map.js +259 -0
- package/dist/components/Map/Map.types.d.ts +81 -0
- package/dist/components/Map/index.d.ts +2 -0
- package/dist/components/Marquee/Marquee.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.d.ts +11 -0
- package/dist/components/Marquee/Marquee.const.js +12 -0
- package/dist/components/Marquee/Marquee.d.ts +7 -0
- package/dist/components/Marquee/Marquee.js +106 -0
- package/dist/components/Marquee/Marquee.types.d.ts +32 -0
- package/dist/components/Marquee/index.d.ts +2 -0
- package/dist/components/Masonry/Masonry.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.d.ts +9 -0
- package/dist/components/Masonry/Masonry.const.js +9 -0
- package/dist/components/Masonry/Masonry.d.ts +7 -0
- package/dist/components/Masonry/Masonry.js +51 -0
- package/dist/components/Masonry/Masonry.types.d.ts +21 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +23 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.js +33 -0
- package/dist/components/NavigableSelect/NavigableSelect.d.ts +7 -0
- package/dist/components/NavigableSelect/NavigableSelect.js +361 -0
- package/dist/components/NavigableSelect/NavigableSelect.types.d.ts +56 -0
- package/dist/components/NavigableSelect/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +3 -2
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +3 -2
- package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +3 -2
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +13 -12
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +3 -2
- package/dist/components/Spotlight/Spotlight.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.d.ts +18 -0
- package/dist/components/Spotlight/Spotlight.const.js +9 -0
- package/dist/components/Spotlight/Spotlight.d.ts +7 -0
- package/dist/components/Spotlight/Spotlight.js +220 -0
- package/dist/components/Spotlight/Spotlight.types.d.ts +51 -0
- package/dist/components/Spotlight/index.d.ts +2 -0
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.js +9 -8
- package/dist/components/Statistic/Statistic.cjs +1 -1
- package/dist/components/Statistic/Statistic.js +7 -6
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.js +11 -10
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +16 -15
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +13 -12
- package/dist/components/Transition/Transition.cjs +1 -0
- package/dist/components/Transition/Transition.const.cjs +1 -0
- package/dist/components/Transition/Transition.const.d.ts +15 -0
- package/dist/components/Transition/Transition.const.js +73 -0
- package/dist/components/Transition/Transition.d.ts +37 -0
- package/dist/components/Transition/Transition.js +107 -0
- package/dist/components/Transition/Transition.types.d.ts +69 -0
- package/dist/components/Transition/index.d.ts +2 -0
- package/dist/components/Typewriter/Typewriter.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.d.ts +22 -0
- package/dist/components/Typewriter/Typewriter.const.js +11 -0
- package/dist/components/Typewriter/Typewriter.d.ts +7 -0
- package/dist/components/Typewriter/Typewriter.js +88 -0
- package/dist/components/Typewriter/Typewriter.types.d.ts +32 -0
- package/dist/components/Typewriter/index.d.ts +2 -0
- package/dist/components/Watermark/Watermark.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.d.ts +30 -0
- package/dist/components/Watermark/Watermark.const.js +18 -0
- package/dist/components/Watermark/Watermark.d.ts +7 -0
- package/dist/components/Watermark/Watermark.js +96 -0
- package/dist/components/Watermark/Watermark.types.d.ts +35 -0
- package/dist/components/Watermark/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +27 -1
- package/dist/components/index.js +231 -204
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +24 -19
- package/dist/hooks/useAnimate.cjs +1 -0
- package/dist/hooks/useAnimate.d.ts +61 -0
- package/dist/hooks/useAnimate.js +125 -0
- package/dist/hooks/useResponsive.cjs +1 -0
- package/dist/hooks/useResponsive.d.ts +35 -0
- package/dist/hooks/useResponsive.js +74 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +324 -290
- package/dist/styles.css +1 -1
- package/dist/utils/createSlots.cjs +1 -0
- package/dist/utils/createSlots.d.ts +70 -0
- package/dist/utils/createSlots.js +65 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +4 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../utils/cn.cjs");require("react");const v=({title:u,value:t,prefix:b,suffix:l,icon:n,trend:r,description:c,loading:h=!1,precision:d=0,className:x,size:s="md",variant:m="default"})=>{const j=typeof t=="number"?t.toLocaleString(void 0,{minimumFractionDigits:d,maximumFractionDigits:d}):t,i={sm:{value:"bear-text-xl",title:"bear-text-xs",icon:"bear-w-8 bear-h-8"},md:{value:"bear-text-3xl",title:"bear-text-sm",icon:"bear-w-10 bear-h-10"},lg:{value:"bear-text-4xl",title:"bear-text-base",icon:"bear-w-12 bear-h-12"}},o={default:"",card:"bear-bg-zinc-800 bear-rounded-xl bear-p-4 bear-border bear-border-zinc-700",minimal:""};return h?e.jsx("div",{className:a.cn(o[m],x),children:e.jsxs("div",{className:"bear-animate-pulse",children:[e.jsx("div",{className:"bear-h-4 bear-w-20 bear-bg-zinc-700 bear-rounded bear-mb-2"}),e.jsx("div",{className:"bear-h-8 bear-w-32 bear-bg-zinc-700 bear-rounded"})]})}):e.jsxs("div",{className:a.cn("bear-flex bear-items-start bear-gap-3",o[m],x),children:[n&&e.jsx("div",{className:a.cn("bear-flex bear-items-center bear-justify-center bear-rounded-lg bear-bg-pink-500/20 bear-text-pink-400",i[s].icon),children:n}),e.jsxs("div",{children:[e.jsx("div",{className:a.cn("bear-text-zinc-400 bear-mb-1",i[s].title),children:u}),e.jsxs("div",{className:a.cn("bear-font-bold bear-text-white bear-flex bear-items-baseline bear-gap-1",i[s].value),children:[b&&e.jsx("span",{className:"bear-text-zinc-400",children:b}),j,l&&e.jsx("span",{className:"bear-text-zinc-400 bear-text-lg",children:l})]}),r&&e.jsxs("div",{className:a.cn("bear-flex bear-items-center bear-gap-1 bear-mt-1 bear-text-sm",r.isUpward!==!1?"bear-text-green-400":"bear-text-red-400"),children:[e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:r.isUpward!==!1?"M5 10l7-7m0 0l7 7m-7-7v18":"M19 14l-7 7m0 0l-7-7m7 7V3"})}),Math.abs(r.value),"%"]}),c&&e.jsx("div",{className:"bear-text-xs bear-text-zinc-500 bear-mt-1",children:c})]})]})};exports.Statistic=v;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import { cn as a } from "../../utils/cn.js";
|
|
3
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
const w = ({
|
|
4
5
|
title: u,
|
|
5
6
|
value: b,
|
|
6
7
|
prefix: l,
|
|
7
8
|
suffix: n,
|
|
8
9
|
icon: c,
|
|
9
10
|
trend: t,
|
|
10
|
-
description:
|
|
11
|
+
description: m,
|
|
11
12
|
loading: v = !1,
|
|
12
|
-
precision:
|
|
13
|
+
precision: d = 0,
|
|
13
14
|
className: o,
|
|
14
15
|
size: i = "md",
|
|
15
16
|
variant: x = "default"
|
|
16
17
|
}) => {
|
|
17
|
-
const g = typeof b == "number" ? b.toLocaleString(void 0, { minimumFractionDigits:
|
|
18
|
+
const g = typeof b == "number" ? b.toLocaleString(void 0, { minimumFractionDigits: d, maximumFractionDigits: d }) : b, s = {
|
|
18
19
|
sm: { value: "bear-text-xl", title: "bear-text-xs", icon: "bear-w-8 bear-h-8" },
|
|
19
20
|
md: { value: "bear-text-3xl", title: "bear-text-sm", icon: "bear-w-10 bear-h-10" },
|
|
20
21
|
lg: { value: "bear-text-4xl", title: "bear-text-base", icon: "bear-w-12 bear-h-12" }
|
|
@@ -46,10 +47,10 @@ const N = ({
|
|
|
46
47
|
Math.abs(t.value),
|
|
47
48
|
"%"
|
|
48
49
|
] }),
|
|
49
|
-
|
|
50
|
+
m && /* @__PURE__ */ e("div", { className: "bear-text-xs bear-text-zinc-500 bear-mt-1", children: m })
|
|
50
51
|
] })
|
|
51
52
|
] });
|
|
52
53
|
};
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
w as Statistic
|
|
55
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),e=require("../../utils/cn.cjs");require("react");const g="Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor-pointer",h="bear-opacity-50 bear-cursor-not-allowed",C="Bear-Switch__track bear-relative bear-inline-flex bear-items-center bear-shrink-0 bear-rounded-full bear-transition-colors bear-duration-200 focus-within:bear-ring-2 focus-within:bear-ring-pink-500 focus-within:bear-ring-offset-2 focus-within:bear-ring-offset-white dark:focus-within:bear-ring-offset-zinc-900",p="bear-bg-pink-500",E="bear-bg-gray-300 dark:bear-bg-gray-600",A="Bear-Switch__thumb bear-absolute bear-top-0.5 bear-left-0.5 bear-rounded-full bear-bg-white bear-shadow bear-transition-transform bear-duration-200 bear-flex bear-items-center bear-justify-center",y="Bear-Switch__label bear-text-sm bear-text-gray-700 dark:bear-text-gray-300",l="Bear-Switch__icon bear-flex bear-items-center bear-justify-center",j={sm:{track:"bear-w-8 bear-h-4",thumb:"bear-w-3 bear-h-3",translate:"bear-translate-x-4",iconSize:8},md:{track:"bear-w-11 bear-h-6",thumb:"bear-w-5 bear-h-5",translate:"bear-translate-x-5",iconSize:12},lg:{track:"bear-w-14 bear-h-7",thumb:"bear-w-6 bear-h-6",translate:"bear-translate-x-7",iconSize:16}},T=({label:o,checked:a=!1,onCheckedChange:t,size:u="md",disabled:s=!1,uncheckedIcon:n,checkedIcon:b,showIconsInThumb:S=!1,className:f,testId:x,id:_,...m})=>{const w=()=>{s||t==null||t(!a)},i=j[u],c=n||b;return r.jsxs("label",{id:_,"data-testid":x,className:e.cn(g,s&&h,f),children:[r.jsx("input",{type:"checkbox",checked:a,onChange:w,disabled:s,className:"bear-sr-only",...m}),r.jsxs("span",{className:e.cn(C,a?p:E,i.track),children:[c&&!S&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:e.cn(l,"bear-absolute bear-left-1",a?"bear-text-white":"bear-text-transparent","bear-transition-colors bear-duration-200"),children:b}),r.jsx("span",{className:e.cn(l,"bear-absolute bear-right-1",a?"bear-text-transparent":"bear-text-gray-600 dark:bear-text-gray-400","bear-transition-colors bear-duration-200"),children:n})]}),r.jsx("span",{className:e.cn(A,a&&i.translate,i.thumb),children:c&&S&&r.jsx("span",{className:e.cn(l,a?"bear-text-pink-500":"bear-text-gray-400"),children:a?b:n})})]}),o&&r.jsx("span",{className:y,children:o})]})};exports.Switch=T;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsxs as o, jsx as r, Fragment as
|
|
1
|
+
import { jsxs as o, jsx as r, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
3
4
|
const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor-pointer", g = "bear-opacity-50 bear-cursor-not-allowed", E = "Bear-Switch__track bear-relative bear-inline-flex bear-items-center bear-shrink-0 bear-rounded-full bear-transition-colors bear-duration-200 focus-within:bear-ring-2 focus-within:bear-ring-pink-500 focus-within:bear-ring-offset-2 focus-within:bear-ring-offset-white dark:focus-within:bear-ring-offset-zinc-900", A = "bear-bg-pink-500", y = "bear-bg-gray-300 dark:bear-bg-gray-600", T = "Bear-Switch__thumb bear-absolute bear-top-0.5 bear-left-0.5 bear-rounded-full bear-bg-white bear-shadow bear-transition-transform bear-duration-200 bear-flex bear-items-center bear-justify-center", H = "Bear-Switch__label bear-text-sm bear-text-gray-700 dark:bear-text-gray-300", l = "Bear-Switch__icon bear-flex bear-items-center bear-justify-center", L = {
|
|
4
5
|
sm: {
|
|
5
6
|
track: "bear-w-8 bear-h-4",
|
|
@@ -19,7 +20,7 @@ const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor
|
|
|
19
20
|
translate: "bear-translate-x-7",
|
|
20
21
|
iconSize: 16
|
|
21
22
|
}
|
|
22
|
-
},
|
|
23
|
+
}, W = ({
|
|
23
24
|
label: S,
|
|
24
25
|
checked: a = !1,
|
|
25
26
|
onCheckedChange: t,
|
|
@@ -30,16 +31,16 @@ const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor
|
|
|
30
31
|
showIconsInThumb: c = !1,
|
|
31
32
|
className: m,
|
|
32
33
|
testId: u,
|
|
33
|
-
id:
|
|
34
|
-
...
|
|
34
|
+
id: p,
|
|
35
|
+
...w
|
|
35
36
|
}) => {
|
|
36
|
-
const
|
|
37
|
+
const x = () => {
|
|
37
38
|
s || t == null || t(!a);
|
|
38
39
|
}, i = L[_], f = b || n;
|
|
39
40
|
return /* @__PURE__ */ o(
|
|
40
41
|
"label",
|
|
41
42
|
{
|
|
42
|
-
id:
|
|
43
|
+
id: p,
|
|
43
44
|
"data-testid": u,
|
|
44
45
|
className: e(
|
|
45
46
|
C,
|
|
@@ -52,10 +53,10 @@ const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor
|
|
|
52
53
|
{
|
|
53
54
|
type: "checkbox",
|
|
54
55
|
checked: a,
|
|
55
|
-
onChange:
|
|
56
|
+
onChange: x,
|
|
56
57
|
disabled: s,
|
|
57
58
|
className: "bear-sr-only",
|
|
58
|
-
...
|
|
59
|
+
...w
|
|
59
60
|
}
|
|
60
61
|
),
|
|
61
62
|
/* @__PURE__ */ o(
|
|
@@ -67,7 +68,7 @@ const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor
|
|
|
67
68
|
i.track
|
|
68
69
|
),
|
|
69
70
|
children: [
|
|
70
|
-
f && !c && /* @__PURE__ */ o(
|
|
71
|
+
f && !c && /* @__PURE__ */ o(h, { children: [
|
|
71
72
|
/* @__PURE__ */ r("span", { className: e(
|
|
72
73
|
l,
|
|
73
74
|
"bear-absolute bear-left-1",
|
|
@@ -104,5 +105,5 @@ const C = "Bear-Switch bear-inline-flex bear-items-center bear-gap-3 bear-cursor
|
|
|
104
105
|
);
|
|
105
106
|
};
|
|
106
107
|
export {
|
|
107
|
-
|
|
108
|
+
W as Switch
|
|
108
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("../../../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("../../../../utils/cn.cjs");require("react");const e=require("../../TimePicker.constants.cjs"),O=({selectedHour:r,setSelectedHour:I,selectedMinute:_,setSelectedMinute:a,period:l,setPeriod:C,format:T,hours:n,minutes:N,timeValue:P,clearable:d,onChange:S,onConfirm:t,onClose:m,translations:A})=>{const c={...e.TIMEPICKER_DEFAULT_TRANSLATIONS,...A};return s.jsxs("div",{className:e.TIMEPICKER_DROPDOWN_CLASSES,children:[s.jsxs("div",{className:"Bear-TimePicker__columns bear-flex bear-gap-2 bear-mb-3",children:[s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.hour}),s.jsx("div",{className:e.TIMEPICKER_COLUMN_CLASSES,children:n.map(E=>s.jsx("button",{onClick:()=>I(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,r===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E.toString().padStart(2,"0")},E))})]}),s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.minute}),s.jsx("div",{className:e.TIMEPICKER_COLUMN_CLASSES,children:N.map(E=>s.jsx("button",{onClick:()=>a(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,_===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E.toString().padStart(2,"0")},E))})]}),T==="12h"&&s.jsxs("div",{className:"Bear-TimePicker__column bear-flex-1",children:[s.jsx("div",{className:e.TIMEPICKER_COLUMN_HEADER_CLASSES,children:c.period}),s.jsx("div",{className:"bear-space-y-1",children:["AM","PM"].map(E=>s.jsx("button",{onClick:()=>C(E),className:i.cn(e.TIMEPICKER_OPTION_CLASSES,"bear-py-2",l===E?e.TIMEPICKER_OPTION_ACTIVE_CLASSES:e.TIMEPICKER_OPTION_INACTIVE_CLASSES),children:E},E))})]})]}),s.jsxs("div",{className:e.TIMEPICKER_FOOTER_CLASSES,children:[d&&P&&s.jsx("button",{onClick:()=>{S==null||S(null),m()},className:e.TIMEPICKER_CLEAR_BUTTON_CLASSES,children:c.cancel}),s.jsx("button",{onClick:t,className:e.TIMEPICKER_CONFIRM_BUTTON_CLASSES,children:c.ok})]})]})};exports.TimePickerColumnsDropdown=O;
|
package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsxs as a, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { cn as r } from "../../../../utils/cn.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
import { TIMEPICKER_DROPDOWN_CLASSES as u, TIMEPICKER_DEFAULT_TRANSLATIONS as L, TIMEPICKER_COLUMN_HEADER_CLASSES as s, TIMEPICKER_COLUMN_CLASSES as d, TIMEPICKER_OPTION_ACTIVE_CLASSES as m, TIMEPICKER_OPTION_INACTIVE_CLASSES as E, TIMEPICKER_OPTION_CLASSES as n, TIMEPICKER_FOOTER_CLASSES as h, TIMEPICKER_CLEAR_BUTTON_CLASSES as p, TIMEPICKER_CONFIRM_BUTTON_CLASSES as v } from "../../TimePicker.constants.js";
|
|
5
|
+
const B = ({
|
|
5
6
|
selectedHour: S,
|
|
6
7
|
setSelectedHour: _,
|
|
7
8
|
selectedMinute: N,
|
|
8
|
-
setSelectedMinute:
|
|
9
|
-
period:
|
|
10
|
-
setPeriod:
|
|
11
|
-
format:
|
|
9
|
+
setSelectedMinute: o,
|
|
10
|
+
period: t,
|
|
11
|
+
setPeriod: I,
|
|
12
|
+
format: T,
|
|
12
13
|
hours: C,
|
|
13
14
|
minutes: P,
|
|
14
15
|
timeValue: A,
|
|
@@ -29,7 +30,7 @@ const x = ({
|
|
|
29
30
|
onClick: () => _(e),
|
|
30
31
|
className: r(
|
|
31
32
|
n,
|
|
32
|
-
S === e ?
|
|
33
|
+
S === e ? m : E
|
|
33
34
|
),
|
|
34
35
|
children: e.toString().padStart(2, "0")
|
|
35
36
|
},
|
|
@@ -41,26 +42,26 @@ const x = ({
|
|
|
41
42
|
/* @__PURE__ */ c("div", { className: d, children: P.map((e) => /* @__PURE__ */ c(
|
|
42
43
|
"button",
|
|
43
44
|
{
|
|
44
|
-
onClick: () =>
|
|
45
|
+
onClick: () => o(e),
|
|
45
46
|
className: r(
|
|
46
47
|
n,
|
|
47
|
-
N === e ?
|
|
48
|
+
N === e ? m : E
|
|
48
49
|
),
|
|
49
50
|
children: e.toString().padStart(2, "0")
|
|
50
51
|
},
|
|
51
52
|
e
|
|
52
53
|
)) })
|
|
53
54
|
] }),
|
|
54
|
-
|
|
55
|
+
T === "12h" && /* @__PURE__ */ a("div", { className: "Bear-TimePicker__column bear-flex-1", children: [
|
|
55
56
|
/* @__PURE__ */ c("div", { className: s, children: i.period }),
|
|
56
57
|
/* @__PURE__ */ c("div", { className: "bear-space-y-1", children: ["AM", "PM"].map((e) => /* @__PURE__ */ c(
|
|
57
58
|
"button",
|
|
58
59
|
{
|
|
59
|
-
onClick: () =>
|
|
60
|
+
onClick: () => I(e),
|
|
60
61
|
className: r(
|
|
61
62
|
n,
|
|
62
63
|
"bear-py-2",
|
|
63
|
-
|
|
64
|
+
t === e ? m : E
|
|
64
65
|
),
|
|
65
66
|
children: e
|
|
66
67
|
},
|
|
@@ -71,11 +72,11 @@ const x = ({
|
|
|
71
72
|
/* @__PURE__ */ a("div", { className: h, children: [
|
|
72
73
|
O && A && /* @__PURE__ */ c("button", { onClick: () => {
|
|
73
74
|
l == null || l(null), M();
|
|
74
|
-
}, className:
|
|
75
|
-
/* @__PURE__ */ c("button", { onClick: R, className:
|
|
75
|
+
}, className: p, children: i.cancel }),
|
|
76
|
+
/* @__PURE__ */ c("button", { onClick: R, className: v, children: i.ok })
|
|
76
77
|
] })
|
|
77
78
|
] });
|
|
78
79
|
};
|
|
79
80
|
export {
|
|
80
|
-
|
|
81
|
+
B as TimePickerColumnsDropdown
|
|
81
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),E=({values:t,isHourMode:n,format:i,selectedHour:r,selectedMinute:l,onSelect:b,className:h})=>{const f=c=>n?(c*30-90)*(Math.PI/180):(c*(360/t.length)-90)*(Math.PI/180),s=(n?(i==="12h"?r===12?0:r%12:r)*30-90:l*6-90)*Math.PI/180;return a.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",h),children:[a.jsx("circle",{cx:e.CLOCK_CENTER,cy:e.CLOCK_CENTER,r:e.CLOCK_RADIUS,className:"Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"}),t.map((c,x)=>{const C=f(x),o=e.CLOCK_CENTER+e.CLOCK_RADIUS*.85*Math.cos(C),_=e.CLOCK_CENTER+e.CLOCK_RADIUS*.85*Math.sin(C),k=n?i==="12h"?c===12?r===12:r%12===c:r===c:l===c;return a.jsxs("g",{onClick:()=>b(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[k&&a.jsx("circle",{cx:o,cy:_,r:14,className:"Bear-TimePicker__clock-face-dot bear-fill-blue-500"}),a.jsx("text",{x:o,y:_,textAnchor:"middle",dominantBaseline:"middle",className:m.cn("Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",k?"bear-fill-white":"bear-fill-gray-700 dark:bear-fill-zinc-300"),children:typeof c=="number"?c.toString().padStart(2,"0"):c})]},c)}),a.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*.6*Math.cos(s),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*.6*Math.sin(s),className:"Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=E;
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { cn as _ } from "../../../utils/cn.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
import { CLOCK_RADIUS as c, CLOCK_CENTER as r } from "../TimePicker.constants.js";
|
|
5
|
+
const T = ({
|
|
5
6
|
values: i,
|
|
6
7
|
isHourMode: t,
|
|
7
8
|
format: l,
|
|
8
|
-
selectedHour:
|
|
9
|
+
selectedHour: a,
|
|
9
10
|
selectedMinute: o,
|
|
10
11
|
onSelect: g,
|
|
11
12
|
className: x
|
|
12
13
|
}) => {
|
|
13
|
-
const d = (e) => t ? (e * 30 - 90) * (Math.PI / 180) : (e * (360 / i.length) - 90) * (Math.PI / 180), s = (t ? (l === "12h" ?
|
|
14
|
+
const d = (e) => t ? (e * 30 - 90) * (Math.PI / 180) : (e * (360 / i.length) - 90) * (Math.PI / 180), s = (t ? (l === "12h" ? a === 12 ? 0 : a % 12 : a) * 30 - 90 : o * 6 - 90) * Math.PI / 180;
|
|
14
15
|
return /* @__PURE__ */ f("svg", { viewBox: "0 0 200 200", className: _("Bear-TimePicker__clock-face bear-w-full bear-h-full", x), children: [
|
|
15
16
|
/* @__PURE__ */ n(
|
|
16
17
|
"circle",
|
|
17
18
|
{
|
|
18
|
-
cx:
|
|
19
|
-
cy:
|
|
19
|
+
cx: r,
|
|
20
|
+
cy: r,
|
|
20
21
|
r: c,
|
|
21
22
|
className: "Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"
|
|
22
23
|
}
|
|
23
24
|
),
|
|
24
25
|
i.map((e, p) => {
|
|
25
|
-
const m = d(p), k =
|
|
26
|
+
const m = d(p), k = r + c * 0.85 * Math.cos(m), h = r + c * 0.85 * Math.sin(m), b = t ? l === "12h" ? e === 12 ? a === 12 : a % 12 === e : a === e : o === e;
|
|
26
27
|
return /* @__PURE__ */ f(
|
|
27
28
|
"g",
|
|
28
29
|
{
|
|
@@ -52,10 +53,10 @@ const N = ({
|
|
|
52
53
|
/* @__PURE__ */ n(
|
|
53
54
|
"line",
|
|
54
55
|
{
|
|
55
|
-
x1:
|
|
56
|
-
y1:
|
|
57
|
-
x2:
|
|
58
|
-
y2:
|
|
56
|
+
x1: r,
|
|
57
|
+
y1: r,
|
|
58
|
+
x2: r + c * 0.6 * Math.cos(s),
|
|
59
|
+
y2: r + c * 0.6 * Math.sin(s),
|
|
59
60
|
className: "Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",
|
|
60
61
|
strokeLinecap: "round"
|
|
61
62
|
}
|
|
@@ -63,5 +64,5 @@ const N = ({
|
|
|
63
64
|
] });
|
|
64
65
|
};
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
T as ClockFaceSvg
|
|
67
68
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),x=require("../../utils/cn.cjs"),M=require("./Transition.const.cjs"),P=({show:a,name:y="fade",duration:i=M.DEFAULT_DURATION,delay:n=0,easing:I=M.DEFAULT_EASING,enterFrom:l,enterTo:o,leaveFrom:f,leaveTo:N,unmountOnHide:T=!0,onEnter:m,onEntered:d,onLeave:c,onLeft:S,children:v,className:R,as:A="div"})=>{const[q,F]=s.useState(a),[b,u]=s.useState(a?"idle":"exit-active"),e=s.useRef(null);if(s.useEffect(()=>(e.current&&clearTimeout(e.current),a?(F(!0),u("enter"),m==null||m(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u("enter-active"),e.current=setTimeout(()=>{u("idle"),d==null||d()},i+n)})})):(u("exit"),c==null||c(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u("exit-active"),e.current=setTimeout(()=>{T&&F(!1),S==null||S()},i+n)})})),()=>{e.current&&clearTimeout(e.current)}),[a]),!q&&T)return null;const t=M.TRANSITION_PRESETS[y];let r={transition:`all ${i}ms ${I} ${n}ms`};switch(b){case"enter":r={...r,...l??(t==null?void 0:t.enter)};break;case"enter-active":case"idle":r={...r,...o??(t==null?void 0:t.enterActive)};break;case"exit":r={...r,...f??(t==null?void 0:t.exit)};break;case"exit-active":r={...r,...N??(t==null?void 0:t.exitActive)};break}return s.createElement(A,{className:x.cn(R),style:r},v)},$=({children:a,initial:y,animate:i,exit:n,transition:I={},whileHover:l,whileTap:o,inView:f=!0,as:N="div",className:T,testId:m})=>{const[d,c]=s.useState(y??{}),[S,v]=s.useState(!1),[R,A]=s.useState(!1),q=s.useRef(!1),{duration:F=300,delay:b=0,easing:u=M.DEFAULT_EASING}=I;s.useEffect(()=>{q.current?f&&i?c(i):!f&&n&&c(n):(q.current=!0,requestAnimationFrame(()=>{f&&i&&c(i)}))},[f]);let e={...d,transition:`all ${F}ms ${u} ${b}ms`};return R&&o?e={...e,...o}:S&&l&&(e={...e,...l}),s.createElement(N,{className:x.cn(T),style:e,"data-testid":m,onMouseEnter:l?()=>v(!0):void 0,onMouseLeave:l?()=>{v(!1),A(!1)}:void 0,onMouseDown:o?()=>A(!0):void 0,onMouseUp:o?()=>A(!1):void 0},a)};exports.Motion=$;exports.Transition=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=300,e="cubic-bezier(0.4, 0, 0.2, 1)",a={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.9)"},enterActive:{opacity:1,transform:"scale(1)"},exit:{opacity:1,transform:"scale(1)"},exitActive:{opacity:0,transform:"scale(0.9)"}},"scale-y":{enter:{opacity:0,transform:"scaleY(0)"},enterActive:{opacity:1,transform:"scaleY(1)"},exit:{opacity:1,transform:"scaleY(1)"},exitActive:{opacity:0,transform:"scaleY(0)"}},"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=a;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { TransitionName } from './Transition.types';
|
|
3
|
+
/** Default transition duration (ms) */
|
|
4
|
+
export declare const DEFAULT_DURATION = 300;
|
|
5
|
+
/** Default easing */
|
|
6
|
+
export declare const DEFAULT_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
7
|
+
interface TransitionStyles {
|
|
8
|
+
enter: CSSProperties;
|
|
9
|
+
enterActive: CSSProperties;
|
|
10
|
+
exit: CSSProperties;
|
|
11
|
+
exitActive: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
/** Built-in transition presets */
|
|
14
|
+
export declare const TRANSITION_PRESETS: Record<TransitionName, TransitionStyles>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const t = 300, e = "cubic-bezier(0.4, 0, 0.2, 1)", a = {
|
|
2
|
+
fade: {
|
|
3
|
+
enter: { opacity: 0 },
|
|
4
|
+
enterActive: { opacity: 1 },
|
|
5
|
+
exit: { opacity: 1 },
|
|
6
|
+
exitActive: { opacity: 0 }
|
|
7
|
+
},
|
|
8
|
+
"slide-up": {
|
|
9
|
+
enter: { opacity: 0, transform: "translateY(16px)" },
|
|
10
|
+
enterActive: { opacity: 1, transform: "translateY(0)" },
|
|
11
|
+
exit: { opacity: 1, transform: "translateY(0)" },
|
|
12
|
+
exitActive: { opacity: 0, transform: "translateY(16px)" }
|
|
13
|
+
},
|
|
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)" }
|
|
19
|
+
},
|
|
20
|
+
"slide-left": {
|
|
21
|
+
enter: { opacity: 0, transform: "translateX(-16px)" },
|
|
22
|
+
enterActive: { opacity: 1, transform: "translateX(0)" },
|
|
23
|
+
exit: { opacity: 1, transform: "translateX(0)" },
|
|
24
|
+
exitActive: { opacity: 0, transform: "translateX(-16px)" }
|
|
25
|
+
},
|
|
26
|
+
"slide-right": {
|
|
27
|
+
enter: { opacity: 0, transform: "translateX(16px)" },
|
|
28
|
+
enterActive: { opacity: 1, transform: "translateX(0)" },
|
|
29
|
+
exit: { opacity: 1, transform: "translateX(0)" },
|
|
30
|
+
exitActive: { opacity: 0, transform: "translateX(16px)" }
|
|
31
|
+
},
|
|
32
|
+
scale: {
|
|
33
|
+
enter: { opacity: 0, transform: "scale(0.9)" },
|
|
34
|
+
enterActive: { opacity: 1, transform: "scale(1)" },
|
|
35
|
+
exit: { opacity: 1, transform: "scale(1)" },
|
|
36
|
+
exitActive: { opacity: 0, transform: "scale(0.9)" }
|
|
37
|
+
},
|
|
38
|
+
"scale-y": {
|
|
39
|
+
enter: { opacity: 0, transform: "scaleY(0)" },
|
|
40
|
+
enterActive: { opacity: 1, transform: "scaleY(1)" },
|
|
41
|
+
exit: { opacity: 1, transform: "scaleY(1)" },
|
|
42
|
+
exitActive: { opacity: 0, transform: "scaleY(0)" }
|
|
43
|
+
},
|
|
44
|
+
"scale-x": {
|
|
45
|
+
enter: { opacity: 0, transform: "scaleX(0)" },
|
|
46
|
+
enterActive: { opacity: 1, transform: "scaleX(1)" },
|
|
47
|
+
exit: { opacity: 1, transform: "scaleX(1)" },
|
|
48
|
+
exitActive: { opacity: 0, transform: "scaleX(0)" }
|
|
49
|
+
},
|
|
50
|
+
rotate: {
|
|
51
|
+
enter: { opacity: 0, transform: "rotate(-90deg)" },
|
|
52
|
+
enterActive: { opacity: 1, transform: "rotate(0)" },
|
|
53
|
+
exit: { opacity: 1, transform: "rotate(0)" },
|
|
54
|
+
exitActive: { opacity: 0, transform: "rotate(90deg)" }
|
|
55
|
+
},
|
|
56
|
+
flip: {
|
|
57
|
+
enter: { opacity: 0, transform: "perspective(400px) rotateY(-90deg)" },
|
|
58
|
+
enterActive: { opacity: 1, transform: "perspective(400px) rotateY(0)" },
|
|
59
|
+
exit: { opacity: 1, transform: "perspective(400px) rotateY(0)" },
|
|
60
|
+
exitActive: { opacity: 0, transform: "perspective(400px) rotateY(90deg)" }
|
|
61
|
+
},
|
|
62
|
+
collapse: {
|
|
63
|
+
enter: { height: "0px", overflow: "hidden", opacity: 0 },
|
|
64
|
+
enterActive: { height: "auto", overflow: "hidden", opacity: 1 },
|
|
65
|
+
exit: { height: "auto", overflow: "hidden", opacity: 1 },
|
|
66
|
+
exitActive: { height: "0px", overflow: "hidden", opacity: 0 }
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
t as DEFAULT_DURATION,
|
|
71
|
+
e as DEFAULT_EASING,
|
|
72
|
+
a as TRANSITION_PRESETS
|
|
73
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TransitionProps, MotionProps } from './Transition.types';
|
|
3
|
+
/**
|
|
4
|
+
* Transition - Declarative enter/leave transitions
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Wraps children with CSS transitions for show/hide animations.
|
|
8
|
+
* Supports built-in presets and custom enter/leave styles.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Transition show={isOpen} name="slide-up" duration={300}>
|
|
13
|
+
* <div>Content</div>
|
|
14
|
+
* </Transition>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const Transition: FC<TransitionProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Motion - Framer Motion-inspired declarative animation component
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* Animates between initial, animate, and exit states with
|
|
23
|
+
* optional hover and tap interactions.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Motion
|
|
28
|
+
* initial={{ opacity: 0, y: 20 }}
|
|
29
|
+
* animate={{ opacity: 1, y: 0 }}
|
|
30
|
+
* whileHover={{ scale: 1.05 }}
|
|
31
|
+
* transition={{ duration: 500 }}
|
|
32
|
+
* >
|
|
33
|
+
* <Card>Content</Card>
|
|
34
|
+
* </Motion>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const Motion: FC<MotionProps>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useState as v, useRef as y, useEffect as P, createElement as R } from "react";
|
|
2
|
+
import { cn as b } from "../../utils/cn.js";
|
|
3
|
+
import { DEFAULT_EASING as k, DEFAULT_DURATION as D, TRANSITION_PRESETS as U } from "./Transition.const.js";
|
|
4
|
+
const G = ({
|
|
5
|
+
show: u,
|
|
6
|
+
name: I = "fade",
|
|
7
|
+
duration: r = D,
|
|
8
|
+
delay: a = 0,
|
|
9
|
+
easing: M = k,
|
|
10
|
+
enterFrom: n,
|
|
11
|
+
enterTo: l,
|
|
12
|
+
leaveFrom: m,
|
|
13
|
+
leaveTo: N,
|
|
14
|
+
unmountOnHide: S = !0,
|
|
15
|
+
onEnter: o,
|
|
16
|
+
onEntered: f,
|
|
17
|
+
onLeave: i,
|
|
18
|
+
onLeft: d,
|
|
19
|
+
children: T,
|
|
20
|
+
className: $,
|
|
21
|
+
as: A = "div"
|
|
22
|
+
}) => {
|
|
23
|
+
const [x, F] = v(u), [q, c] = v(
|
|
24
|
+
u ? "idle" : "exit-active"
|
|
25
|
+
), e = y(null);
|
|
26
|
+
if (P(() => (e.current && clearTimeout(e.current), u ? (F(!0), c("enter"), o == null || o(), requestAnimationFrame(() => {
|
|
27
|
+
requestAnimationFrame(() => {
|
|
28
|
+
c("enter-active"), e.current = setTimeout(() => {
|
|
29
|
+
c("idle"), f == null || f();
|
|
30
|
+
}, r + a);
|
|
31
|
+
});
|
|
32
|
+
})) : (c("exit"), i == null || i(), requestAnimationFrame(() => {
|
|
33
|
+
requestAnimationFrame(() => {
|
|
34
|
+
c("exit-active"), e.current = setTimeout(() => {
|
|
35
|
+
S && F(!1), d == null || d();
|
|
36
|
+
}, r + a);
|
|
37
|
+
});
|
|
38
|
+
})), () => {
|
|
39
|
+
e.current && clearTimeout(e.current);
|
|
40
|
+
}), [u]), !x && S) return null;
|
|
41
|
+
const t = U[I];
|
|
42
|
+
let s = {
|
|
43
|
+
transition: `all ${r}ms ${M} ${a}ms`
|
|
44
|
+
};
|
|
45
|
+
switch (q) {
|
|
46
|
+
case "enter":
|
|
47
|
+
s = { ...s, ...n ?? (t == null ? void 0 : t.enter) };
|
|
48
|
+
break;
|
|
49
|
+
case "enter-active":
|
|
50
|
+
case "idle":
|
|
51
|
+
s = { ...s, ...l ?? (t == null ? void 0 : t.enterActive) };
|
|
52
|
+
break;
|
|
53
|
+
case "exit":
|
|
54
|
+
s = { ...s, ...m ?? (t == null ? void 0 : t.exit) };
|
|
55
|
+
break;
|
|
56
|
+
case "exit-active":
|
|
57
|
+
s = { ...s, ...N ?? (t == null ? void 0 : t.exitActive) };
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return R(
|
|
61
|
+
A,
|
|
62
|
+
{ className: b($), style: s },
|
|
63
|
+
T
|
|
64
|
+
);
|
|
65
|
+
}, O = ({
|
|
66
|
+
children: u,
|
|
67
|
+
initial: I,
|
|
68
|
+
animate: r,
|
|
69
|
+
exit: a,
|
|
70
|
+
transition: M = {},
|
|
71
|
+
whileHover: n,
|
|
72
|
+
whileTap: l,
|
|
73
|
+
inView: m = !0,
|
|
74
|
+
as: N = "div",
|
|
75
|
+
className: S,
|
|
76
|
+
testId: o
|
|
77
|
+
}) => {
|
|
78
|
+
const [f, i] = v(I ?? {}), [d, T] = v(!1), [$, A] = v(!1), x = y(!1), { duration: F = 300, delay: q = 0, easing: c = k } = M;
|
|
79
|
+
P(() => {
|
|
80
|
+
x.current ? m && r ? i(r) : !m && a && i(a) : (x.current = !0, requestAnimationFrame(() => {
|
|
81
|
+
m && r && i(r);
|
|
82
|
+
}));
|
|
83
|
+
}, [m]);
|
|
84
|
+
let e = {
|
|
85
|
+
...f,
|
|
86
|
+
transition: `all ${F}ms ${c} ${q}ms`
|
|
87
|
+
};
|
|
88
|
+
return $ && l ? e = { ...e, ...l } : d && n && (e = { ...e, ...n }), R(
|
|
89
|
+
N,
|
|
90
|
+
{
|
|
91
|
+
className: b(S),
|
|
92
|
+
style: e,
|
|
93
|
+
"data-testid": o,
|
|
94
|
+
onMouseEnter: n ? () => T(!0) : void 0,
|
|
95
|
+
onMouseLeave: n ? () => {
|
|
96
|
+
T(!1), A(!1);
|
|
97
|
+
} : void 0,
|
|
98
|
+
onMouseDown: l ? () => A(!0) : void 0,
|
|
99
|
+
onMouseUp: l ? () => A(!1) : void 0
|
|
100
|
+
},
|
|
101
|
+
u
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
O as Motion,
|
|
106
|
+
G as Transition
|
|
107
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in transition names
|
|
4
|
+
*/
|
|
5
|
+
export type TransitionName = 'fade' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'scale' | 'scale-y' | 'scale-x' | 'rotate' | 'flip' | 'collapse';
|
|
6
|
+
export interface TransitionProps {
|
|
7
|
+
/** Whether the child is visible */
|
|
8
|
+
show: boolean;
|
|
9
|
+
/** Transition name or custom styles */
|
|
10
|
+
name?: TransitionName;
|
|
11
|
+
/** Duration in ms */
|
|
12
|
+
duration?: number;
|
|
13
|
+
/** Delay in ms */
|
|
14
|
+
delay?: number;
|
|
15
|
+
/** Easing function */
|
|
16
|
+
easing?: string;
|
|
17
|
+
/** Custom enter styles */
|
|
18
|
+
enterFrom?: CSSProperties;
|
|
19
|
+
/** Custom enter-to styles */
|
|
20
|
+
enterTo?: CSSProperties;
|
|
21
|
+
/** Custom leave styles */
|
|
22
|
+
leaveFrom?: CSSProperties;
|
|
23
|
+
/** Custom leave-to styles */
|
|
24
|
+
leaveTo?: CSSProperties;
|
|
25
|
+
/** Unmount when hidden */
|
|
26
|
+
unmountOnHide?: boolean;
|
|
27
|
+
/** Called when enter transition starts */
|
|
28
|
+
onEnter?: () => void;
|
|
29
|
+
/** Called when enter transition ends */
|
|
30
|
+
onEntered?: () => void;
|
|
31
|
+
/** Called when leave transition starts */
|
|
32
|
+
onLeave?: () => void;
|
|
33
|
+
/** Called when leave transition ends */
|
|
34
|
+
onLeft?: () => void;
|
|
35
|
+
/** Children to animate */
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
/** Custom class name */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** As which HTML element */
|
|
40
|
+
as?: keyof JSX.IntrinsicElements;
|
|
41
|
+
}
|
|
42
|
+
export interface MotionProps {
|
|
43
|
+
/** Children to render */
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
/** Initial styles (on mount) */
|
|
46
|
+
initial?: CSSProperties;
|
|
47
|
+
/** Target styles (after mount) */
|
|
48
|
+
animate?: CSSProperties;
|
|
49
|
+
/** Exit styles */
|
|
50
|
+
exit?: CSSProperties;
|
|
51
|
+
/** Transition configuration */
|
|
52
|
+
transition?: {
|
|
53
|
+
duration?: number;
|
|
54
|
+
delay?: number;
|
|
55
|
+
easing?: string;
|
|
56
|
+
};
|
|
57
|
+
/** Hover styles */
|
|
58
|
+
whileHover?: CSSProperties;
|
|
59
|
+
/** Press/active styles */
|
|
60
|
+
whileTap?: CSSProperties;
|
|
61
|
+
/** Whether in view (trigger animation) */
|
|
62
|
+
inView?: boolean;
|
|
63
|
+
/** As which HTML element */
|
|
64
|
+
as?: keyof JSX.IntrinsicElements;
|
|
65
|
+
/** Custom class name */
|
|
66
|
+
className?: string;
|
|
67
|
+
/** Test ID */
|
|
68
|
+
testId?: string;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),t=require("react"),R=require("../../utils/cn.cjs"),r=require("./Typewriter.const.cjs"),X=b=>{const{text:f,speed:i=r.DEFAULT_SPEED,startDelay:N=r.DEFAULT_START_DELAY,deleteDelay:x=r.DEFAULT_DELETE_DELAY,deleteSpeed:d=r.DEFAULT_DELETE_SPEED,loop:_=!1,cursor:I=!0,cursorChar:h=r.DEFAULT_CURSOR_CHAR,cursorBlinkSpeed:A=r.DEFAULT_CURSOR_BLINK_SPEED,onComplete:n,onWordComplete:o,as:g="span",className:U,style:j,testId:w}=b,u=Array.isArray(f)?f:[f],[F,m]=t.useState(""),[a,p]=t.useState(r.INITIAL_TEXT_INDEX),[l,S]=t.useState(r.INITIAL_CHAR_INDEX),[E,L]=t.useState(!1),[v,B]=t.useState(!0),e=t.useRef(),D=t.useRef(!1);t.useEffect(()=>{if(!I)return;const T=setInterval(()=>B(s=>!s),A);return()=>clearInterval(T)},[I,A]);const c=t.useCallback(()=>{const T=u[a];if(E)if(l>0)S(s=>s-1),m(T.slice(0,l-1)),e.current=setTimeout(c,d);else{L(!1);const s=a+1;s>=u.length?_?(p(r.INITIAL_TEXT_INDEX),e.current=setTimeout(c,i)):n==null||n():(p(s),e.current=setTimeout(c,i))}else if(l<T.length)m(T.slice(0,l+1)),S(s=>s+1),e.current=setTimeout(c,i);else{if(o==null||o(a),u.length===1&&!_){n==null||n();return}e.current=setTimeout(()=>{L(!0),c()},x)}},[u,a,l,E,i,d,x,_,n,o]);return t.useEffect(()=>{if(!D.current)return D.current=!0,e.current=setTimeout(c,N),()=>{e.current&&clearTimeout(e.current)}},[]),t.useEffect(()=>{if(D.current)return e.current&&clearTimeout(e.current),e.current=setTimeout(c,E?d:i),()=>{e.current&&clearTimeout(e.current)}},[E,a]),y.jsxs(g,{className:R.cn("Bear-Typewriter","bear-inline",U),style:j,"data-testid":w,"aria-label":u.join(", "),children:[y.jsx("span",{className:"Bear-Typewriter__text",children:F}),I&&y.jsx("span",{className:R.cn("Bear-Typewriter__cursor","bear-inline-block bear-ml-0.5","bear-text-[var(--bear-primary-500)]"),style:{opacity:v?1:0},"aria-hidden":"true",children:h})]})};exports.Typewriter=X;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=80,_=500,D=1500,T=40,A="|",L=530,I=0,U=0;exports.DEFAULT_CURSOR_BLINK_SPEED=L;exports.DEFAULT_CURSOR_CHAR=A;exports.DEFAULT_DELETE_DELAY=D;exports.DEFAULT_DELETE_SPEED=T;exports.DEFAULT_SPEED=E;exports.DEFAULT_START_DELAY=_;exports.INITIAL_CHAR_INDEX=U;exports.INITIAL_TEXT_INDEX=I;
|