@forgedevstack/bear 1.0.3 → 1.0.4-alpha
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/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.const.cjs +1 -0
- package/dist/components/Accordion/Accordion.const.d.ts +10 -0
- package/dist/components/Accordion/Accordion.const.js +8 -0
- package/dist/components/Accordion/Accordion.d.ts +1 -0
- package/dist/components/Accordion/Accordion.js +49 -44
- package/dist/components/Accordion/Accordion.types.d.ts +2 -0
- package/dist/components/Accordion/index.d.ts +3 -2
- package/dist/components/ActivityItem/ActivityItem.cjs +1 -0
- package/dist/components/ActivityItem/ActivityItem.d.ts +7 -0
- package/dist/components/ActivityItem/ActivityItem.js +44 -0
- package/dist/components/ActivityItem/ActivityItem.types.d.ts +17 -0
- package/dist/components/ActivityItem/index.d.ts +2 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -0
- package/dist/components/Alert/Alert.const.d.ts +14 -0
- package/dist/components/Alert/Alert.const.js +27 -0
- package/dist/components/Alert/Alert.js +54 -63
- package/dist/components/Alert/Alert.types.d.ts +3 -1
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.const.cjs +1 -0
- package/dist/components/Avatar/Avatar.const.d.ts +28 -0
- package/dist/components/Avatar/Avatar.const.js +28 -0
- package/dist/components/Avatar/Avatar.js +49 -60
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +24 -22
- package/dist/components/BearLogo/EmberLogo.cjs +17 -0
- package/dist/components/BearLogo/EmberLogo.js +91 -0
- package/dist/components/BearLogo/index.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.const.cjs +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.const.d.ts +16 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.const.js +19 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +49 -34
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +8 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +1 -1
- package/dist/components/Button/Button.constants.d.ts +2 -2
- package/dist/components/Button/Button.constants.js +2 -2
- package/dist/components/Button/Button.js +41 -46
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.helpers.cjs +1 -0
- package/dist/components/Calendar/Calendar.helpers.d.ts +10 -0
- package/dist/components/Calendar/Calendar.helpers.js +9 -0
- package/dist/components/Calendar/Calendar.js +112 -115
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.const.cjs +1 -0
- package/dist/components/Card/Card.const.d.ts +13 -0
- package/dist/components/Card/Card.const.js +32 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.js +101 -105
- package/dist/components/Card/index.d.ts +3 -2
- package/dist/components/Chart/Chart.cjs +1 -0
- package/dist/components/Chart/Chart.const.d.ts +15 -0
- package/dist/components/Chart/Chart.d.ts +18 -0
- package/dist/components/Chart/Chart.js +225 -0
- package/dist/components/Chart/Chart.types.d.ts +51 -0
- package/dist/components/Chart/Chart.utils.d.ts +31 -0
- package/dist/components/Chart/index.d.ts +2 -0
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
- package/dist/components/CodeBlock/CodeBlock.js +65 -52
- package/dist/components/CodeBlock/CodeBlock.types.d.ts +12 -1
- package/dist/components/Editable/Editable.cjs +1 -1
- package/dist/components/Editable/Editable.js +115 -115
- package/dist/components/Gauge/Gauge.cjs +1 -0
- package/dist/components/Gauge/Gauge.d.ts +3 -0
- package/dist/components/Gauge/Gauge.js +92 -0
- package/dist/components/Gauge/Gauge.types.d.ts +27 -0
- package/dist/components/Gauge/index.d.ts +2 -0
- package/dist/components/Icon/icons/editor.cjs +1 -1
- package/dist/components/Icon/icons/editor.d.ts +1 -0
- package/dist/components/Icon/icons/editor.js +66 -61
- package/dist/components/Icon/icons/misc.cjs +1 -1
- package/dist/components/Icon/icons/misc.d.ts +13 -0
- package/dist/components/Icon/icons/misc.js +157 -88
- package/dist/components/Icon/index.d.ts +22 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +36 -35
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -0
- package/dist/components/Modal/Modal.const.d.ts +10 -0
- package/dist/components/Modal/Modal.const.js +17 -0
- package/dist/components/Modal/Modal.d.ts +11 -0
- package/dist/components/Modal/Modal.js +80 -77
- package/dist/components/Modal/Modal.types.d.ts +6 -1
- package/dist/components/Modal/index.d.ts +3 -2
- package/dist/components/Rating/Rating.cjs +1 -1
- package/dist/components/Rating/Rating.const.cjs +1 -0
- package/dist/components/Rating/Rating.const.d.ts +14 -0
- package/dist/components/Rating/Rating.const.js +22 -0
- package/dist/components/Rating/Rating.d.ts +5 -10
- package/dist/components/Rating/Rating.js +135 -93
- package/dist/components/Rating/Rating.types.d.ts +27 -25
- package/dist/components/Rating/index.d.ts +2 -2
- package/dist/components/RichEditor/RichEditor.cjs +1 -10
- package/dist/components/RichEditor/RichEditor.const.cjs +141 -0
- package/dist/components/RichEditor/RichEditor.const.d.ts +137 -0
- package/dist/components/RichEditor/RichEditor.const.js +279 -0
- package/dist/components/RichEditor/RichEditor.d.ts +14 -0
- package/dist/components/RichEditor/RichEditor.js +341 -129
- package/dist/components/RichEditor/RichEditor.types.d.ts +38 -1
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +25 -0
- package/dist/components/RichEditor/components/ToolbarButton/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +126 -0
- package/dist/components/RichEditor/components/ToolbarColorPicker/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts +4 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +57 -0
- package/dist/components/RichEditor/components/ToolbarDropdown/index.d.ts +1 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.d.ts +7 -0
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +45 -0
- package/dist/components/RichEditor/components/ToolbarMore/index.d.ts +2 -0
- package/dist/components/RichEditor/components/index.d.ts +4 -0
- package/dist/components/RichEditor/helpers/formatHelpers.cjs +1 -0
- package/dist/components/RichEditor/helpers/formatHelpers.d.ts +57 -0
- package/dist/components/RichEditor/helpers/formatHelpers.js +26 -0
- package/dist/components/RichEditor/helpers/index.d.ts +1 -0
- package/dist/components/RichEditor/index.d.ts +4 -2
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.const.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.const.d.ts +16 -0
- package/dist/components/Sidebar/Sidebar.const.js +22 -0
- package/dist/components/Sidebar/Sidebar.d.ts +14 -2
- package/dist/components/Sidebar/Sidebar.js +50 -138
- package/dist/components/Sidebar/Sidebar.types.d.ts +7 -3
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.d.ts +4 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +45 -0
- package/dist/components/Sidebar/components/SidebarGroup/index.d.ts +2 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.d.ts +4 -0
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +66 -0
- package/dist/components/Sidebar/components/SidebarItem/index.d.ts +2 -0
- package/dist/components/Sidebar/components/index.d.ts +2 -0
- package/dist/components/Sidebar/index.d.ts +5 -2
- package/dist/components/SignPad/SignPad.cjs +1 -0
- package/dist/components/SignPad/SignPad.const.cjs +1 -0
- package/dist/components/SignPad/SignPad.const.d.ts +19 -0
- package/dist/components/SignPad/SignPad.const.js +20 -0
- package/dist/components/SignPad/SignPad.d.ts +17 -0
- package/dist/components/SignPad/SignPad.js +161 -0
- package/dist/components/SignPad/SignPad.types.d.ts +37 -0
- package/dist/components/SignPad/index.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.const.cjs +36 -0
- package/dist/components/Skeleton/Skeleton.const.d.ts +12 -0
- package/dist/components/Skeleton/Skeleton.const.js +58 -0
- package/dist/components/Skeleton/Skeleton.d.ts +15 -24
- package/dist/components/Skeleton/Skeleton.js +132 -103
- package/dist/components/Skeleton/Skeleton.types.d.ts +18 -8
- package/dist/components/Skeleton/index.d.ts +2 -2
- package/dist/components/Sparkline/Sparkline.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.const.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.const.d.ts +16 -0
- package/dist/components/Sparkline/Sparkline.const.js +16 -0
- package/dist/components/Sparkline/Sparkline.d.ts +3 -0
- package/dist/components/Sparkline/Sparkline.js +80 -0
- package/dist/components/Sparkline/Sparkline.types.d.ts +19 -0
- package/dist/components/Sparkline/Sparkline.utils.cjs +1 -0
- package/dist/components/Sparkline/Sparkline.utils.d.ts +27 -0
- package/dist/components/Sparkline/Sparkline.utils.js +30 -0
- package/dist/components/Sparkline/index.d.ts +5 -0
- package/dist/components/SpeedDial/SpeedDial.cjs +12 -1
- package/dist/components/SpeedDial/SpeedDial.const.cjs +1 -0
- package/dist/components/SpeedDial/SpeedDial.const.d.ts +22 -0
- package/dist/components/SpeedDial/SpeedDial.const.js +26 -0
- package/dist/components/SpeedDial/SpeedDial.d.ts +5 -7
- package/dist/components/SpeedDial/SpeedDial.js +154 -144
- package/dist/components/SpeedDial/SpeedDial.types.d.ts +26 -29
- package/dist/components/SpeedDial/index.d.ts +1 -1
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +17 -15
- package/dist/components/StatCard/StatCard.cjs +1 -0
- package/dist/components/StatCard/StatCard.d.ts +7 -0
- package/dist/components/StatCard/StatCard.js +36 -0
- package/dist/components/StatCard/StatCard.types.d.ts +13 -0
- package/dist/components/StatCard/index.d.ts +2 -0
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -0
- package/dist/components/Stepper/Stepper.const.d.ts +29 -0
- package/dist/components/Stepper/Stepper.const.js +46 -0
- package/dist/components/Stepper/Stepper.d.ts +10 -3
- package/dist/components/Stepper/Stepper.js +143 -92
- package/dist/components/Stepper/Stepper.types.d.ts +63 -13
- package/dist/components/Stepper/index.d.ts +2 -2
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.js +74 -47
- package/dist/components/Switch/Switch.types.d.ts +11 -1
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +33 -29
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.d.ts +14 -0
- package/dist/components/TimePicker/TimePicker.constants.js +18 -4
- package/dist/components/TimePicker/TimePicker.js +92 -91
- package/dist/components/Timeline/Timeline.cjs +1 -1
- package/dist/components/Timeline/Timeline.const.cjs +1 -0
- package/dist/components/Timeline/Timeline.const.d.ts +40 -0
- package/dist/components/Timeline/Timeline.const.js +58 -0
- package/dist/components/Timeline/Timeline.d.ts +16 -2
- package/dist/components/Timeline/Timeline.js +131 -63
- package/dist/components/Timeline/Timeline.types.d.ts +30 -11
- package/dist/components/Timeline/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +37 -35
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +38 -36
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +17 -5
- package/dist/components/index.js +216 -195
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.js +42 -14
- package/dist/hooks/useBounce/index.d.ts +2 -0
- package/dist/hooks/useBounce/useBounce.cjs +1 -0
- package/dist/hooks/useBounce/useBounce.d.ts +2 -0
- package/dist/hooks/useBounce/useBounce.js +36 -0
- package/dist/hooks/useBounce/useBounce.types.d.ts +27 -0
- package/dist/hooks/useClickOutside/index.d.ts +2 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +22 -0
- package/dist/hooks/useClickOutside/useClickOutside.types.d.ts +10 -0
- package/dist/hooks/useClipboard/index.d.ts +2 -0
- package/dist/hooks/useClipboard/useClipboard.cjs +1 -0
- package/dist/hooks/useClipboard/useClipboard.d.ts +15 -0
- package/dist/hooks/useClipboard/useClipboard.js +22 -0
- package/dist/hooks/useClipboard/useClipboard.types.d.ts +20 -0
- package/dist/hooks/useDebounce/index.d.ts +2 -0
- package/dist/hooks/useDebounce/useDebounce.cjs +1 -0
- package/dist/hooks/useDebounce/useDebounce.d.ts +32 -0
- package/dist/hooks/useDebounce/useDebounce.js +39 -0
- package/dist/hooks/useDebounce/useDebounce.types.d.ts +20 -0
- package/dist/hooks/useFloat/index.d.ts +2 -0
- package/dist/hooks/useFloat/useFloat.cjs +1 -0
- package/dist/hooks/useFloat/useFloat.d.ts +2 -0
- package/dist/hooks/useFloat/useFloat.js +37 -0
- package/dist/hooks/useFloat/useFloat.types.d.ts +25 -0
- package/dist/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.cjs +1 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +25 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.js +39 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.types.d.ts +22 -0
- package/dist/hooks/useKeyPress/index.d.ts +2 -0
- package/dist/hooks/useKeyPress/useKeyPress.cjs +1 -0
- package/dist/hooks/useKeyPress/useKeyPress.d.ts +22 -0
- package/dist/hooks/useKeyPress/useKeyPress.js +39 -0
- package/dist/hooks/useKeyPress/useKeyPress.types.d.ts +19 -0
- package/dist/hooks/useLocalStorage/index.d.ts +2 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.cjs +1 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +11 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.js +47 -0
- package/dist/hooks/useLocalStorage/useLocalStorage.types.d.ts +16 -0
- package/dist/hooks/useMediaQuery/index.d.ts +3 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +12 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.types.d.ts +21 -0
- package/dist/hooks/useParallax/index.d.ts +2 -0
- package/dist/hooks/useParallax/useParallax.cjs +1 -0
- package/dist/hooks/useParallax/useParallax.d.ts +2 -0
- package/dist/hooks/useParallax/useParallax.js +36 -0
- package/dist/hooks/useParallax/useParallax.types.d.ts +19 -0
- package/dist/hooks/usePulse/index.d.ts +2 -0
- package/dist/hooks/usePulse/usePulse.cjs +1 -0
- package/dist/hooks/usePulse/usePulse.d.ts +2 -0
- package/dist/hooks/usePulse/usePulse.js +38 -0
- package/dist/hooks/usePulse/usePulse.types.d.ts +29 -0
- package/dist/hooks/useShake/index.d.ts +2 -0
- package/dist/hooks/useShake/useShake.cjs +1 -0
- package/dist/hooks/useShake/useShake.d.ts +2 -0
- package/dist/hooks/useShake/useShake.js +14 -0
- package/dist/hooks/useShake/useShake.types.d.ts +19 -0
- package/dist/hooks/useSlide/index.d.ts +2 -0
- package/dist/hooks/useSlide/useSlide.cjs +1 -0
- package/dist/hooks/useSlide/useSlide.d.ts +2 -0
- package/dist/hooks/useSlide/useSlide.js +68 -0
- package/dist/hooks/useSlide/useSlide.types.d.ts +36 -0
- package/dist/hooks/useThrottle/index.d.ts +2 -0
- package/dist/hooks/useThrottle/useThrottle.cjs +1 -0
- package/dist/hooks/useThrottle/useThrottle.d.ts +26 -0
- package/dist/hooks/useThrottle/useThrottle.js +44 -0
- package/dist/hooks/useThrottle/useThrottle.types.d.ts +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +273 -224
- package/dist/styles.css +1 -1
- package/package.json +16 -23
- package/dist/components/RichEditor/RichEditor.icons.cjs +0 -1
- package/dist/components/RichEditor/RichEditor.icons.d.ts +0 -16
- package/dist/components/RichEditor/RichEditor.icons.js +0 -62
- package/dist/components/RichEditor/RichEditor.utils.cjs +0 -1
- package/dist/components/RichEditor/RichEditor.utils.d.ts +0 -3
- package/dist/components/RichEditor/RichEditor.utils.js +0 -22
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./Sparkline.const.cjs"),I=n=>{if(n.length===0)return[];const a=Math.max(...n),e=Math.min(...n),c=a-e||1;return n.map((t,l)=>({x:l/(n.length-1||1)*r.SPARKLINE.VIEWBOX_SIZE,y:r.SPARKLINE.VIEWBOX_SIZE-(t-e)/c*r.SPARKLINE.Y_RANGE-r.SPARKLINE.Y_PADDING,value:t}))},S=n=>n.length===0?"":n.reduce((a,e,c)=>{if(c===0)return`M ${e.x},${e.y}`;const t=n[c-1],l=t.x+(e.x-t.x)/r.SPARKLINE.CONTROL_POINT_FACTOR,P=e.x-(e.x-t.x)/r.SPARKLINE.CONTROL_POINT_FACTOR;return`${a} C ${l},${t.y} ${P},${e.y} ${e.x},${e.y}`},""),s=n=>n?`${n} L ${r.SPARKLINE.VIEWBOX_SIZE},${r.SPARKLINE.VIEWBOX_SIZE} L 0,${r.SPARKLINE.VIEWBOX_SIZE} Z`:"",x=n=>{if(n.length===0)return{path:"",areaPath:"",minPoint:null,maxPoint:null};const a=I(n),e=Math.max(...n),c=Math.min(...n),t=n.indexOf(c),l=n.indexOf(e),P=S(a),u=s(P);return{path:P,areaPath:u,minPoint:a[t]||null,maxPoint:a[l]||null}};exports.calculateSparklinePathData=x;exports.calculateSparklinePoints=I;exports.generateAreaPath=s;exports.generateSparklinePath=S;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface SparklinePoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SparklinePathData {
|
|
7
|
+
path: string;
|
|
8
|
+
areaPath: string;
|
|
9
|
+
minPoint: SparklinePoint | null;
|
|
10
|
+
maxPoint: SparklinePoint | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Calculate points for sparkline from data array
|
|
14
|
+
*/
|
|
15
|
+
export declare const calculateSparklinePoints: (data: number[]) => SparklinePoint[];
|
|
16
|
+
/**
|
|
17
|
+
* Generate smooth bezier curve path from points
|
|
18
|
+
*/
|
|
19
|
+
export declare const generateSparklinePath: (points: SparklinePoint[]) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate area path for filled sparkline
|
|
22
|
+
*/
|
|
23
|
+
export declare const generateAreaPath: (linePath: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Calculate all sparkline path data from raw data
|
|
26
|
+
*/
|
|
27
|
+
export declare const calculateSparklinePathData: (data: number[]) => SparklinePathData;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SPARKLINE as e } from "./Sparkline.const.js";
|
|
2
|
+
const s = (n) => {
|
|
3
|
+
if (n.length === 0) return [];
|
|
4
|
+
const c = Math.max(...n), t = Math.min(...n), x = c - t || 1;
|
|
5
|
+
return n.map((r, l) => ({
|
|
6
|
+
x: l / (n.length - 1 || 1) * e.VIEWBOX_SIZE,
|
|
7
|
+
y: e.VIEWBOX_SIZE - (r - t) / x * e.Y_RANGE - e.Y_PADDING,
|
|
8
|
+
value: r
|
|
9
|
+
}));
|
|
10
|
+
}, a = (n) => n.length === 0 ? "" : n.reduce((c, t, x) => {
|
|
11
|
+
if (x === 0) return `M ${t.x},${t.y}`;
|
|
12
|
+
const r = n[x - 1], l = r.x + (t.x - r.x) / e.CONTROL_POINT_FACTOR, m = t.x - (t.x - r.x) / e.CONTROL_POINT_FACTOR;
|
|
13
|
+
return `${c} C ${l},${r.y} ${m},${t.y} ${t.x},${t.y}`;
|
|
14
|
+
}, ""), u = (n) => n ? `${n} L ${e.VIEWBOX_SIZE},${e.VIEWBOX_SIZE} L 0,${e.VIEWBOX_SIZE} Z` : "", O = (n) => {
|
|
15
|
+
if (n.length === 0)
|
|
16
|
+
return { path: "", areaPath: "", minPoint: null, maxPoint: null };
|
|
17
|
+
const c = s(n), t = Math.max(...n), x = Math.min(...n), r = n.indexOf(x), l = n.indexOf(t), m = a(c), o = u(m);
|
|
18
|
+
return {
|
|
19
|
+
path: m,
|
|
20
|
+
areaPath: o,
|
|
21
|
+
minPoint: c[r] || null,
|
|
22
|
+
maxPoint: c[l] || null
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
O as calculateSparklinePathData,
|
|
27
|
+
s as calculateSparklinePoints,
|
|
28
|
+
u as generateAreaPath,
|
|
29
|
+
a as generateSparklinePath
|
|
30
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Sparkline } from './Sparkline';
|
|
2
|
+
export type { SparklineProps } from './Sparkline.types';
|
|
3
|
+
export { SPARKLINE } from './Sparkline.const';
|
|
4
|
+
export { calculateSparklinePoints, calculateSparklinePathData, generateSparklinePath, generateAreaPath, } from './Sparkline.utils';
|
|
5
|
+
export type { SparklinePoint, SparklinePathData } from './Sparkline.utils';
|
|
@@ -1 +1,12 @@
|
|
|
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"),o=require("react"),i=require("../../utils/cn.cjs"),r=require("./SpeedDial.const.cjs"),O=({className:a})=>t.jsxs("svg",{className:a,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),T=({className:a})=>t.jsxs("svg",{className:a,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),E=o.forwardRef(({actions:a,icon:S,openIcon:y,direction:u="up",size:f="md",position:m,fixed:I=!0,openOnHover:x=!1,open:p,onOpenChange:c,showLabels:_=!0,ariaLabel:D="Speed dial",testId:b,className:h,...A},v)=>{const[L,j]=o.useState(!1),d=o.useRef(null),s=p!==void 0?p:L,n=o.useCallback(e=>{j(e),c==null||c(e)},[c]),w=o.useCallback(()=>{n(!s)},[s,n]);o.useEffect(()=>{const e=l=>{d.current&&!d.current.contains(l.target)&&n(!1)};if(s)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s,n]),o.useEffect(()=>{const e=l=>{l.key==="Escape"&&n(!1)};if(s)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s,n]);const N=r.SPEED_DIAL_MAIN_SIZES[f],k=r.SPEED_DIAL_ACTION_SIZES[f],P=()=>{switch(u){case"up":return"bottom-full left-1/2 -translate-x-1/2 pb-3 flex-col-reverse";case"down":return"top-full left-1/2 -translate-x-1/2 pt-3 flex-col";case"left":return"right-full top-1/2 -translate-y-1/2 pr-3 flex-row-reverse";case"right":return"left-full top-1/2 -translate-y-1/2 pl-3 flex-row";default:return""}},C=e=>{switch(e.tooltipPosition||(u==="up"||u==="down"?"left":"top")){case"left":return"right-full mr-2";case"right":return"left-full ml-2";case"top":return"bottom-full mb-2";case"bottom":return"top-full mt-2";default:return"right-full mr-2"}},g=e=>{var l;e.disabled||((l=e.onClick)==null||l.call(e),n(!1))};return t.jsxs("div",{ref:d,className:i.cn(r.SPEED_DIAL_BASE,I&&m&&r.SPEED_DIAL_POSITIONS[m],h),"data-testid":b,onMouseEnter:x?()=>n(!0):void 0,onMouseLeave:x?()=>n(!1):void 0,...A,children:[s&&t.jsx("div",{className:i.cn(r.SPEED_DIAL_ACTIONS_CONTAINER,P()),children:a.map((e,l)=>t.jsxs("div",{className:"relative flex items-center",style:{animation:`fadeInUp 150ms ease-out ${l*50}ms forwards`,opacity:0},children:[_&&t.jsx("span",{className:i.cn(r.SPEED_DIAL_LABEL,C(e)),children:e.label}),t.jsx("button",{type:"button",className:i.cn(r.SPEED_DIAL_ACTION,k,e.disabled?"opacity-50 cursor-not-allowed":r.SPEED_DIAL_ACTION_COLORS,"flex items-center justify-center"),style:e.color?{backgroundColor:e.color,color:"white"}:void 0,onClick:()=>g(e),disabled:e.disabled,"aria-label":e.label,children:e.icon})]},l))}),t.jsx("button",{ref:v,type:"button",className:i.cn(r.SPEED_DIAL_MAIN_BUTTON,N,r.SPEED_DIAL_MAIN_COLORS,"flex items-center justify-center",s&&"rotate-45"),onClick:w,"aria-label":D,"aria-expanded":s,children:s?y||t.jsx(T,{}):S||t.jsx(O,{})}),t.jsx("style",{children:`
|
|
2
|
+
@keyframes fadeInUp {
|
|
3
|
+
from {
|
|
4
|
+
opacity: 0;
|
|
5
|
+
transform: translateY(8px);
|
|
6
|
+
}
|
|
7
|
+
to {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: translateY(0);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`})]})});E.displayName="SpeedDial";exports.SpeedDial=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t="Bear-SpeedDial relative inline-flex flex-col items-center",e={"bottom-right":"fixed bottom-6 right-6","bottom-left":"fixed bottom-6 left-6","top-right":"fixed top-6 right-6","top-left":"fixed top-6 left-6"},_="Bear-SpeedDial__trigger rounded-full shadow-lg transition-all duration-200",E={sm:"w-12 h-12",md:"w-14 h-14",lg:"w-16 h-16"},S="bg-pink-500 hover:bg-pink-600 text-white",o="Bear-SpeedDial__action rounded-full shadow-md transition-all duration-200",D={sm:"w-9 h-9",md:"w-10 h-10",lg:"w-12 h-12"},I="bg-white dark:bg-zinc-800 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-zinc-700",i="Bear-SpeedDial__actions absolute flex items-center gap-2",A="Bear-SpeedDial__label px-2 py-1 text-xs font-medium bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded shadow-md whitespace-nowrap";exports.SPEED_DIAL_ACTION=o;exports.SPEED_DIAL_ACTIONS_CONTAINER=i;exports.SPEED_DIAL_ACTION_COLORS=I;exports.SPEED_DIAL_ACTION_SIZES=D;exports.SPEED_DIAL_BASE=t;exports.SPEED_DIAL_LABEL=A;exports.SPEED_DIAL_MAIN_BUTTON=_;exports.SPEED_DIAL_MAIN_COLORS=S;exports.SPEED_DIAL_MAIN_SIZES=E;exports.SPEED_DIAL_POSITIONS=e;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SpeedDialDirection, SpeedDialSize } from './SpeedDial.types';
|
|
2
|
+
export declare const SPEED_DIAL_BASE = "Bear-SpeedDial relative inline-flex flex-col items-center";
|
|
3
|
+
export declare const SPEED_DIAL_POSITIONS: {
|
|
4
|
+
'bottom-right': string;
|
|
5
|
+
'bottom-left': string;
|
|
6
|
+
'top-right': string;
|
|
7
|
+
'top-left': string;
|
|
8
|
+
};
|
|
9
|
+
export declare const SPEED_DIAL_DIRECTIONS: Record<SpeedDialDirection, {
|
|
10
|
+
container: string;
|
|
11
|
+
item: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const SPEED_DIAL_MAIN_BUTTON = "Bear-SpeedDial__trigger rounded-full shadow-lg transition-all duration-200";
|
|
14
|
+
export declare const SPEED_DIAL_MAIN_SIZES: Record<SpeedDialSize, string>;
|
|
15
|
+
export declare const SPEED_DIAL_MAIN_COLORS = "bg-pink-500 hover:bg-pink-600 text-white";
|
|
16
|
+
export declare const SPEED_DIAL_ACTION = "Bear-SpeedDial__action rounded-full shadow-md transition-all duration-200";
|
|
17
|
+
export declare const SPEED_DIAL_ACTION_SIZES: Record<SpeedDialSize, string>;
|
|
18
|
+
export declare const SPEED_DIAL_ACTION_COLORS = "bg-white dark:bg-zinc-800 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-zinc-700";
|
|
19
|
+
export declare const SPEED_DIAL_ACTIONS_CONTAINER = "Bear-SpeedDial__actions absolute flex items-center gap-2";
|
|
20
|
+
export declare const SPEED_DIAL_LABEL = "Bear-SpeedDial__label px-2 py-1 text-xs font-medium bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded shadow-md whitespace-nowrap";
|
|
21
|
+
export declare const SPEED_DIAL_ENTER = "animate-in fade-in zoom-in-95";
|
|
22
|
+
export declare const SPEED_DIAL_EXIT = "animate-out fade-out zoom-out-95";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const t = "Bear-SpeedDial relative inline-flex flex-col items-center", e = {
|
|
2
|
+
"bottom-right": "fixed bottom-6 right-6",
|
|
3
|
+
"bottom-left": "fixed bottom-6 left-6",
|
|
4
|
+
"top-right": "fixed top-6 right-6",
|
|
5
|
+
"top-left": "fixed top-6 left-6"
|
|
6
|
+
}, o = "Bear-SpeedDial__trigger rounded-full shadow-lg transition-all duration-200", a = {
|
|
7
|
+
sm: "w-12 h-12",
|
|
8
|
+
md: "w-14 h-14",
|
|
9
|
+
lg: "w-16 h-16"
|
|
10
|
+
}, i = "bg-pink-500 hover:bg-pink-600 text-white", r = "Bear-SpeedDial__action rounded-full shadow-md transition-all duration-200", _ = {
|
|
11
|
+
sm: "w-9 h-9",
|
|
12
|
+
md: "w-10 h-10",
|
|
13
|
+
lg: "w-12 h-12"
|
|
14
|
+
}, n = "bg-white dark:bg-zinc-800 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-zinc-700", d = "Bear-SpeedDial__actions absolute flex items-center gap-2", l = "Bear-SpeedDial__label px-2 py-1 text-xs font-medium bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded shadow-md whitespace-nowrap";
|
|
15
|
+
export {
|
|
16
|
+
r as SPEED_DIAL_ACTION,
|
|
17
|
+
d as SPEED_DIAL_ACTIONS_CONTAINER,
|
|
18
|
+
n as SPEED_DIAL_ACTION_COLORS,
|
|
19
|
+
_ as SPEED_DIAL_ACTION_SIZES,
|
|
20
|
+
t as SPEED_DIAL_BASE,
|
|
21
|
+
l as SPEED_DIAL_LABEL,
|
|
22
|
+
o as SPEED_DIAL_MAIN_BUTTON,
|
|
23
|
+
i as SPEED_DIAL_MAIN_COLORS,
|
|
24
|
+
a as SPEED_DIAL_MAIN_SIZES,
|
|
25
|
+
e as SPEED_DIAL_POSITIONS
|
|
26
|
+
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
1
|
import { SpeedDialProps } from './SpeedDial.types';
|
|
3
2
|
/**
|
|
4
|
-
* SpeedDial - Floating action button
|
|
3
|
+
* SpeedDial - Floating action button with expandable actions
|
|
5
4
|
*
|
|
6
5
|
* @example
|
|
7
6
|
* ```tsx
|
|
8
7
|
* <SpeedDial
|
|
9
8
|
* actions={[
|
|
10
|
-
* {
|
|
11
|
-
* {
|
|
12
|
-
* {
|
|
9
|
+
* { label: 'Copy', icon: <CopyIcon />, onClick: handleCopy },
|
|
10
|
+
* { label: 'Print', icon: <PrintIcon />, onClick: handlePrint },
|
|
11
|
+
* { label: 'Share', icon: <ShareIcon />, onClick: handleShare },
|
|
13
12
|
* ]}
|
|
14
13
|
* position="bottom-right"
|
|
15
|
-
* direction="up"
|
|
16
14
|
* />
|
|
17
15
|
* ```
|
|
18
16
|
*/
|
|
19
|
-
export declare const SpeedDial:
|
|
17
|
+
export declare const SpeedDial: import('react').ForwardRefExoticComponent<SpeedDialProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
20
18
|
export default SpeedDial;
|
|
@@ -1,150 +1,160 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as T, useState as R, useRef as B, useCallback as E, useEffect as I } from "react";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
|
+
import { SPEED_DIAL_LABEL as M, SPEED_DIAL_ACTION_COLORS as j, SPEED_DIAL_ACTION_SIZES as U, SPEED_DIAL_ACTION as W, SPEED_DIAL_ACTIONS_CONTAINER as Y, SPEED_DIAL_MAIN_COLORS as Z, SPEED_DIAL_MAIN_SIZES as z, SPEED_DIAL_MAIN_BUTTON as $, SPEED_DIAL_POSITIONS as q, SPEED_DIAL_BASE as F } from "./SpeedDial.const.js";
|
|
5
|
+
const G = ({ className: o }) => /* @__PURE__ */ i("svg", { className: o, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
6
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
7
|
+
/* @__PURE__ */ t("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
8
|
+
] }), J = ({ className: o }) => /* @__PURE__ */ i("svg", { className: o, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
9
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
10
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
11
|
+
] }), K = T(
|
|
12
|
+
({
|
|
13
|
+
actions: o,
|
|
14
|
+
icon: y,
|
|
15
|
+
openIcon: S,
|
|
16
|
+
direction: c = "up",
|
|
17
|
+
size: f = "md",
|
|
18
|
+
position: u,
|
|
19
|
+
fixed: _ = !0,
|
|
20
|
+
openOnHover: m = !1,
|
|
21
|
+
open: p,
|
|
22
|
+
onOpenChange: a,
|
|
23
|
+
showLabels: h = !0,
|
|
24
|
+
ariaLabel: x = "Speed dial",
|
|
25
|
+
testId: A,
|
|
26
|
+
className: D,
|
|
27
|
+
...b
|
|
28
|
+
}, L) => {
|
|
29
|
+
const [v, w] = R(!1), d = B(null), l = p !== void 0 ? p : v, s = E((e) => {
|
|
30
|
+
w(e), a == null || a(e);
|
|
31
|
+
}, [a]), N = E(() => {
|
|
32
|
+
s(!l);
|
|
33
|
+
}, [l, s]);
|
|
34
|
+
I(() => {
|
|
35
|
+
const e = (r) => {
|
|
36
|
+
d.current && !d.current.contains(r.target) && s(!1);
|
|
37
|
+
};
|
|
38
|
+
if (l)
|
|
39
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
40
|
+
}, [l, s]), I(() => {
|
|
41
|
+
const e = (r) => {
|
|
42
|
+
r.key === "Escape" && s(!1);
|
|
43
|
+
};
|
|
44
|
+
if (l)
|
|
45
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
46
|
+
}, [l, s]);
|
|
47
|
+
const k = z[f], P = U[f], C = () => {
|
|
48
|
+
switch (c) {
|
|
49
|
+
case "up":
|
|
50
|
+
return "bottom-full left-1/2 -translate-x-1/2 pb-3 flex-col-reverse";
|
|
51
|
+
case "down":
|
|
52
|
+
return "top-full left-1/2 -translate-x-1/2 pt-3 flex-col";
|
|
53
|
+
case "left":
|
|
54
|
+
return "right-full top-1/2 -translate-y-1/2 pr-3 flex-row-reverse";
|
|
55
|
+
case "right":
|
|
56
|
+
return "left-full top-1/2 -translate-y-1/2 pl-3 flex-row";
|
|
57
|
+
default:
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
}, g = (e) => {
|
|
61
|
+
switch (e.tooltipPosition || (c === "up" || c === "down" ? "left" : "top")) {
|
|
62
|
+
case "left":
|
|
63
|
+
return "right-full mr-2";
|
|
64
|
+
case "right":
|
|
65
|
+
return "left-full ml-2";
|
|
66
|
+
case "top":
|
|
67
|
+
return "bottom-full mb-2";
|
|
68
|
+
case "bottom":
|
|
69
|
+
return "top-full mt-2";
|
|
70
|
+
default:
|
|
71
|
+
return "right-full mr-2";
|
|
72
|
+
}
|
|
73
|
+
}, O = (e) => {
|
|
74
|
+
var r;
|
|
75
|
+
e.disabled || ((r = e.onClick) == null || r.call(e), s(!1));
|
|
52
76
|
};
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
const e = (a) => {
|
|
56
|
-
a.key === "Escape" && t && (l || o(!1), r == null || r(!1));
|
|
57
|
-
};
|
|
58
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
59
|
-
}, [t, l, r]);
|
|
60
|
-
const W = () => {
|
|
61
|
-
if (u !== "auto") return u;
|
|
62
|
-
switch (i) {
|
|
63
|
-
case "up":
|
|
64
|
-
case "down":
|
|
65
|
-
return n.includes("right") ? "left" : "right";
|
|
66
|
-
case "left":
|
|
67
|
-
case "right":
|
|
68
|
-
return "top";
|
|
69
|
-
}
|
|
70
|
-
}, F = (e, a) => {
|
|
71
|
-
const y = /* @__PURE__ */ s(
|
|
72
|
-
p,
|
|
77
|
+
return /* @__PURE__ */ i(
|
|
78
|
+
"div",
|
|
73
79
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"bear-rounded-full bear-shadow-lg bear-transition-all bear-duration-200",
|
|
80
|
-
"bear-w-12 bear-h-12 bear-p-0 bear-flex bear-items-center bear-justify-center",
|
|
81
|
-
t ? "bear-opacity-100 bear-scale-100" : "bear-opacity-0 bear-scale-75 bear-pointer-events-none"
|
|
80
|
+
ref: d,
|
|
81
|
+
className: n(
|
|
82
|
+
F,
|
|
83
|
+
_ && u && q[u],
|
|
84
|
+
D
|
|
82
85
|
),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
children:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
86
|
+
"data-testid": A,
|
|
87
|
+
onMouseEnter: m ? () => s(!0) : void 0,
|
|
88
|
+
onMouseLeave: m ? () => s(!1) : void 0,
|
|
89
|
+
...b,
|
|
90
|
+
children: [
|
|
91
|
+
l && /* @__PURE__ */ t("div", { className: n(Y, C()), children: o.map((e, r) => /* @__PURE__ */ i(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: "relative flex items-center",
|
|
95
|
+
style: {
|
|
96
|
+
animation: `fadeInUp 150ms ease-out ${r * 50}ms forwards`,
|
|
97
|
+
opacity: 0
|
|
98
|
+
},
|
|
99
|
+
children: [
|
|
100
|
+
h && /* @__PURE__ */ t("span", { className: n(M, g(e)), children: e.label }),
|
|
101
|
+
/* @__PURE__ */ t(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
className: n(
|
|
106
|
+
W,
|
|
107
|
+
P,
|
|
108
|
+
e.disabled ? "opacity-50 cursor-not-allowed" : j,
|
|
109
|
+
"flex items-center justify-center"
|
|
110
|
+
),
|
|
111
|
+
style: e.color ? { backgroundColor: e.color, color: "white" } : void 0,
|
|
112
|
+
onClick: () => O(e),
|
|
113
|
+
disabled: e.disabled,
|
|
114
|
+
"aria-label": e.label,
|
|
115
|
+
children: e.icon
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
r
|
|
121
|
+
)) }),
|
|
122
|
+
/* @__PURE__ */ t(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
ref: L,
|
|
126
|
+
type: "button",
|
|
127
|
+
className: n(
|
|
128
|
+
$,
|
|
129
|
+
k,
|
|
130
|
+
Z,
|
|
131
|
+
"flex items-center justify-center",
|
|
132
|
+
l && "rotate-45"
|
|
133
|
+
),
|
|
134
|
+
onClick: N,
|
|
135
|
+
"aria-label": x,
|
|
136
|
+
"aria-expanded": l,
|
|
137
|
+
children: l ? S || /* @__PURE__ */ t(J, {}) : y || /* @__PURE__ */ t(G, {})
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ t("style", { children: `
|
|
141
|
+
@keyframes fadeInUp {
|
|
142
|
+
from {
|
|
143
|
+
opacity: 0;
|
|
144
|
+
transform: translateY(8px);
|
|
145
|
+
}
|
|
146
|
+
to {
|
|
147
|
+
opacity: 1;
|
|
148
|
+
transform: translateY(0);
|
|
149
|
+
}
|
|
125
150
|
}
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
className: b(
|
|
134
|
-
"bear-rounded-full bear-shadow-xl bear-transition-transform bear-duration-300",
|
|
135
|
-
"bear-w-14 bear-h-14 bear-p-0 bear-flex bear-items-center bear-justify-center",
|
|
136
|
-
t && "bear-rotate-45"
|
|
137
|
-
),
|
|
138
|
-
"aria-label": D,
|
|
139
|
-
"aria-expanded": t,
|
|
140
|
-
"aria-haspopup": "menu",
|
|
141
|
-
children: t ? S : E
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
};
|
|
151
|
+
` })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
K.displayName = "SpeedDial";
|
|
148
158
|
export {
|
|
149
|
-
|
|
159
|
+
K as SpeedDial
|
|
150
160
|
};
|
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
export type SpeedDialDirection = 'up' | 'down' | 'left' | 'right';
|
|
3
|
+
export type SpeedDialSize = 'sm' | 'md' | 'lg';
|
|
3
4
|
export interface SpeedDialAction {
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/** Action label (shown as tooltip) */
|
|
6
|
+
label: string;
|
|
6
7
|
/** Action icon */
|
|
7
8
|
icon: ReactNode;
|
|
8
|
-
/** Action tooltip/label */
|
|
9
|
-
label: string;
|
|
10
9
|
/** Click handler */
|
|
11
10
|
onClick?: () => void;
|
|
12
|
-
/**
|
|
11
|
+
/** Disabled state */
|
|
13
12
|
disabled?: boolean;
|
|
13
|
+
/** Custom color */
|
|
14
|
+
color?: string;
|
|
15
|
+
/** Tooltip position */
|
|
16
|
+
tooltipPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
14
17
|
}
|
|
15
18
|
export interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
16
|
-
/** Array of actions
|
|
19
|
+
/** Array of actions */
|
|
17
20
|
actions: SpeedDialAction[];
|
|
18
|
-
/** Main
|
|
21
|
+
/** Main button icon (when closed) */
|
|
19
22
|
icon?: ReactNode;
|
|
20
|
-
/** Main
|
|
23
|
+
/** Main button icon (when open) */
|
|
21
24
|
openIcon?: ReactNode;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/** Direction to expand actions */
|
|
27
|
-
direction?: 'up' | 'down' | 'left' | 'right';
|
|
28
|
-
/** FAB variant */
|
|
29
|
-
variant?: BearVariant;
|
|
30
|
-
/** FAB size */
|
|
31
|
-
size?: BearSize;
|
|
32
|
-
/** Whether to show tooltips */
|
|
33
|
-
showTooltips?: boolean;
|
|
34
|
-
/** Tooltip placement relative to direction */
|
|
35
|
-
tooltipPlacement?: 'left' | 'right' | 'top' | 'bottom' | 'auto';
|
|
36
|
-
/** Whether to hide on click action */
|
|
37
|
-
closeOnAction?: boolean;
|
|
25
|
+
/** Direction to expand */
|
|
26
|
+
direction?: SpeedDialDirection;
|
|
27
|
+
/** Size */
|
|
28
|
+
size?: SpeedDialSize;
|
|
38
29
|
/** Position on screen */
|
|
39
30
|
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
40
|
-
/**
|
|
31
|
+
/** Whether to use fixed positioning */
|
|
41
32
|
fixed?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
33
|
+
/** Open on hover */
|
|
34
|
+
openOnHover?: boolean;
|
|
35
|
+
/** Controlled open state */
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/** Called when open state changes */
|
|
45
38
|
onOpenChange?: (open: boolean) => void;
|
|
39
|
+
/** Show labels next to actions */
|
|
40
|
+
showLabels?: boolean;
|
|
41
|
+
/** Hide main button label */
|
|
42
|
+
ariaLabel?: string;
|
|
46
43
|
/** Test ID */
|
|
47
44
|
testId?: string;
|
|
48
45
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { SpeedDial } from './SpeedDial';
|
|
2
|
-
export type { SpeedDialProps, SpeedDialAction } from './SpeedDial.types';
|
|
2
|
+
export type { SpeedDialProps, SpeedDialAction, SpeedDialDirection, SpeedDialSize } from './SpeedDial.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs"),t={xs:"bear-w-3 bear-h-3",sm:"bear-w-4 bear-h-4",md:"bear-w-6 bear-h-6",lg:"bear-w-8 bear-h-8",xl:"bear-w-10 bear-h-10"},c=({size:r="md",className:n,color:a="currentColor",label:s="Loading"})=>e.jsxs("svg",{className:i.cn("Bear-Spinner",`Bear-Spinner--${r}`,"bear-animate-spin",t[r],n),viewBox:"0 0 24 24",fill:"none","aria-label":s,role:"status",children:[e.jsx("circle",{className:"Bear-Spinner__track bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:a,strokeWidth:"4"}),e.jsx("path",{className:"Bear-Spinner__arc bear-opacity-75",fill:a,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"})]});exports.Spinner=c;
|