@forgedevstack/bear 1.0.3 → 1.0.4
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 +14 -21
- 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,37 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface SignPadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
|
+
/** Callback when signature changes - receives base64 image data */
|
|
4
|
+
onChange?: (signature: string | null) => void;
|
|
5
|
+
/** Width of the canvas */
|
|
6
|
+
width?: number;
|
|
7
|
+
/** Height of the canvas */
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Stroke color */
|
|
10
|
+
strokeColor?: string;
|
|
11
|
+
/** Stroke width */
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
/** Background color */
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
/** Placeholder text */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Disabled state */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Read-only state */
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
/** Show clear button */
|
|
22
|
+
showClear?: boolean;
|
|
23
|
+
/** Show save button */
|
|
24
|
+
showSave?: boolean;
|
|
25
|
+
/** Clear button text */
|
|
26
|
+
clearText?: string;
|
|
27
|
+
/** Save button text */
|
|
28
|
+
saveText?: string;
|
|
29
|
+
/** Output format */
|
|
30
|
+
outputFormat?: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
31
|
+
/** Output quality (0-1 for jpeg/webp) */
|
|
32
|
+
outputQuality?: number;
|
|
33
|
+
/** Test ID */
|
|
34
|
+
testId?: string;
|
|
35
|
+
/** Unique ID */
|
|
36
|
+
id?: string;
|
|
37
|
+
}
|
|
@@ -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"),c=require("react"),T=require("../../utils/cn.cjs"),d=require("./Skeleton.const.cjs"),_=()=>{const e="bear-skeleton-styles";if(typeof document<"u"&&!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=d.SKELETON_WAVE_STYLES,document.head.appendChild(t)}},a=c.forwardRef(({variant:e="text",animation:t="pulse",width:l,height:s,borderRadius:n,count:i=1,gap:E=8,className:o,style:f,testId:y,...h},p)=>{c.useEffect(()=>{t==="wave"&&_()},[t]);const x=S=>{if(S!==void 0)return typeof S=="number"?`${S}px`:S},N={width:x(l),height:x(s)||(e==="text"?d.SKELETON_TEXT_HEIGHT:void 0),borderRadius:n?x(n):void 0,...f},k=T.cn(d.SKELETON_BASE_CLASSES,d.SKELETON_VARIANT_CLASSES[e],d.SKELETON_ANIMATION_CLASSES[t],d.SKELETON_BG_CLASSES,o);return i>1?r.jsx("div",{className:"Bear-Skeleton__group flex flex-col",style:{gap:x(E)},"data-testid":y,children:Array.from({length:i}).map((S,g)=>r.jsx("div",{ref:g===0?p:void 0,className:k,style:N,...h},g))}):r.jsx("div",{ref:p,className:k,style:N,"data-testid":y,...h})});a.displayName="Skeleton";const u=c.forwardRef(({lines:e=3,lastLineWidth:t="80%",gap:l=8,animation:s="pulse",...n},i)=>{c.useEffect(()=>{s==="wave"&&_()},[s]);const E=o=>{if(o!==void 0)return typeof o=="number"?`${o}px`:o};return r.jsx("div",{ref:i,className:"Bear-SkeletonText flex flex-col",style:{gap:E(l)},children:Array.from({length:e}).map((o,f)=>r.jsx(a,{variant:"text",animation:s,width:f===e-1?t:"100%",...n},f))})});u.displayName="SkeletonText";const m=c.forwardRef(({size:e="md",animation:t="pulse",...l},s)=>{const n=typeof e=="number"?e:d.SKELETON_AVATAR_SIZES[e];return r.jsx(a,{ref:s,variant:"circular",animation:t,width:n,height:n,...l})});m.displayName="SkeletonAvatar";const A=c.forwardRef(({animation:e="pulse",className:t,...l},s)=>r.jsxs("div",{ref:s,className:T.cn("Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",t),...l,children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx(m,{animation:e}),r.jsxs("div",{className:"flex-1",children:[r.jsx(a,{animation:e,width:"60%",height:16,className:"mb-2"}),r.jsx(a,{animation:e,width:"40%",height:12})]})]}),r.jsx(u,{animation:e,lines:3})]}));A.displayName="SkeletonCard";exports.Skeleton=a;exports.SkeletonAvatar=m;exports.SkeletonCard=A;exports.SkeletonText=u;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-Skeleton relative overflow-hidden",n={text:"rounded",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-lg"},a={pulse:"animate-pulse",wave:"Bear-Skeleton--wave",none:""},r="bg-gray-200 dark:bg-zinc-700",S=`
|
|
2
|
+
@keyframes Bear-Skeleton-wave {
|
|
3
|
+
0% {
|
|
4
|
+
transform: translateX(-100%);
|
|
5
|
+
}
|
|
6
|
+
50% {
|
|
7
|
+
transform: translateX(100%);
|
|
8
|
+
}
|
|
9
|
+
100% {
|
|
10
|
+
transform: translateX(100%);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.Bear-Skeleton--wave::after {
|
|
15
|
+
content: '';
|
|
16
|
+
position: absolute;
|
|
17
|
+
inset: 0;
|
|
18
|
+
transform: translateX(-100%);
|
|
19
|
+
background: linear-gradient(
|
|
20
|
+
90deg,
|
|
21
|
+
transparent,
|
|
22
|
+
rgba(255, 255, 255, 0.3),
|
|
23
|
+
transparent
|
|
24
|
+
);
|
|
25
|
+
animation: Bear-Skeleton-wave 1.6s linear 0.5s infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dark .Bear-Skeleton--wave::after {
|
|
29
|
+
background: linear-gradient(
|
|
30
|
+
90deg,
|
|
31
|
+
transparent,
|
|
32
|
+
rgba(255, 255, 255, 0.1),
|
|
33
|
+
transparent
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
`,t="1em",E={sm:32,md:40,lg:56};exports.SKELETON_ANIMATION_CLASSES=a;exports.SKELETON_AVATAR_SIZES=E;exports.SKELETON_BASE_CLASSES=e;exports.SKELETON_BG_CLASSES=r;exports.SKELETON_TEXT_HEIGHT=t;exports.SKELETON_VARIANT_CLASSES=n;exports.SKELETON_WAVE_STYLES=S;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SkeletonVariant, SkeletonAnimation } from './Skeleton.types';
|
|
2
|
+
export declare const SKELETON_BASE_CLASSES = "Bear-Skeleton relative overflow-hidden";
|
|
3
|
+
export declare const SKELETON_VARIANT_CLASSES: Record<SkeletonVariant, string>;
|
|
4
|
+
export declare const SKELETON_ANIMATION_CLASSES: Record<SkeletonAnimation, string>;
|
|
5
|
+
export declare const SKELETON_BG_CLASSES = "bg-gray-200 dark:bg-zinc-700";
|
|
6
|
+
export declare const SKELETON_WAVE_STYLES = "\n @keyframes Bear-Skeleton-wave {\n 0% {\n transform: translateX(-100%);\n }\n 50% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n \n .Bear-Skeleton--wave::after {\n content: '';\n position: absolute;\n inset: 0;\n transform: translateX(-100%);\n background: linear-gradient(\n 90deg,\n transparent,\n rgba(255, 255, 255, 0.3),\n transparent\n );\n animation: Bear-Skeleton-wave 1.6s linear 0.5s infinite;\n }\n \n .dark .Bear-Skeleton--wave::after {\n background: linear-gradient(\n 90deg,\n transparent,\n rgba(255, 255, 255, 0.1),\n transparent\n );\n }\n";
|
|
7
|
+
export declare const SKELETON_TEXT_HEIGHT = "1em";
|
|
8
|
+
export declare const SKELETON_AVATAR_SIZES: {
|
|
9
|
+
sm: number;
|
|
10
|
+
md: number;
|
|
11
|
+
lg: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const e = "Bear-Skeleton relative overflow-hidden", n = {
|
|
2
|
+
text: "rounded",
|
|
3
|
+
circular: "rounded-full",
|
|
4
|
+
rectangular: "rounded-none",
|
|
5
|
+
rounded: "rounded-lg"
|
|
6
|
+
}, a = {
|
|
7
|
+
pulse: "animate-pulse",
|
|
8
|
+
wave: "Bear-Skeleton--wave",
|
|
9
|
+
none: ""
|
|
10
|
+
}, r = "bg-gray-200 dark:bg-zinc-700", t = `
|
|
11
|
+
@keyframes Bear-Skeleton-wave {
|
|
12
|
+
0% {
|
|
13
|
+
transform: translateX(-100%);
|
|
14
|
+
}
|
|
15
|
+
50% {
|
|
16
|
+
transform: translateX(100%);
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
transform: translateX(100%);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.Bear-Skeleton--wave::after {
|
|
24
|
+
content: '';
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset: 0;
|
|
27
|
+
transform: translateX(-100%);
|
|
28
|
+
background: linear-gradient(
|
|
29
|
+
90deg,
|
|
30
|
+
transparent,
|
|
31
|
+
rgba(255, 255, 255, 0.3),
|
|
32
|
+
transparent
|
|
33
|
+
);
|
|
34
|
+
animation: Bear-Skeleton-wave 1.6s linear 0.5s infinite;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dark .Bear-Skeleton--wave::after {
|
|
38
|
+
background: linear-gradient(
|
|
39
|
+
90deg,
|
|
40
|
+
transparent,
|
|
41
|
+
rgba(255, 255, 255, 0.1),
|
|
42
|
+
transparent
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
`, o = "1em", S = {
|
|
46
|
+
sm: 32,
|
|
47
|
+
md: 40,
|
|
48
|
+
lg: 56
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
a as SKELETON_ANIMATION_CLASSES,
|
|
52
|
+
S as SKELETON_AVATAR_SIZES,
|
|
53
|
+
e as SKELETON_BASE_CLASSES,
|
|
54
|
+
r as SKELETON_BG_CLASSES,
|
|
55
|
+
o as SKELETON_TEXT_HEIGHT,
|
|
56
|
+
n as SKELETON_VARIANT_CLASSES,
|
|
57
|
+
t as SKELETON_WAVE_STYLES
|
|
58
|
+
};
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SkeletonProps } from './Skeleton.types';
|
|
1
|
+
import { SkeletonProps, SkeletonTextProps, SkeletonAvatarProps } from './Skeleton.types';
|
|
3
2
|
/**
|
|
4
|
-
* Skeleton
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <Skeleton variant="text" width={200} />
|
|
9
|
-
* <Skeleton variant="circular" width={40} height={40} />
|
|
10
|
-
* <Skeleton variant="rectangular" width="100%" height={200} />
|
|
11
|
-
* <Skeleton variant="text" count={3} />
|
|
12
|
-
* ```
|
|
3
|
+
* Skeleton - Loading placeholder with animation
|
|
13
4
|
*/
|
|
14
|
-
export declare const Skeleton:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
export declare const Skeleton: import('react').ForwardRefExoticComponent<SkeletonProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
/**
|
|
7
|
+
* SkeletonText - Text placeholder with multiple lines
|
|
8
|
+
*/
|
|
9
|
+
export declare const SkeletonText: import('react').ForwardRefExoticComponent<SkeletonTextProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* SkeletonAvatar - Circular avatar placeholder
|
|
12
|
+
*/
|
|
13
|
+
export declare const SkeletonAvatar: import('react').ForwardRefExoticComponent<SkeletonAvatarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/**
|
|
15
|
+
* SkeletonCard - Card placeholder
|
|
16
|
+
*/
|
|
17
|
+
export declare const SkeletonCard: import('react').ForwardRefExoticComponent<SkeletonProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
27
18
|
export default Skeleton;
|
|
@@ -1,116 +1,145 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
1
|
+
import { jsx as r, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useEffect as _ } from "react";
|
|
3
|
+
import { cn as A } from "../../utils/cn.js";
|
|
4
|
+
import { SKELETON_BG_CLASSES as v, SKELETON_ANIMATION_CLASSES as L, SKELETON_VARIANT_CLASSES as b, SKELETON_BASE_CLASSES as C, SKELETON_TEXT_HEIGHT as w, SKELETON_AVATAR_SIZES as O, SKELETON_WAVE_STYLES as K } from "./Skeleton.const.js";
|
|
5
|
+
const T = () => {
|
|
6
|
+
const e = "bear-skeleton-styles";
|
|
7
|
+
if (typeof document < "u" && !document.getElementById(e)) {
|
|
8
|
+
const t = document.createElement("style");
|
|
9
|
+
t.id = e, t.textContent = K, document.head.appendChild(t);
|
|
10
|
+
}
|
|
11
|
+
}, i = m(
|
|
12
|
+
({
|
|
13
|
+
variant: e = "text",
|
|
14
|
+
animation: t = "pulse",
|
|
15
|
+
width: l,
|
|
16
|
+
height: s,
|
|
17
|
+
borderRadius: d,
|
|
18
|
+
count: S = 1,
|
|
19
|
+
gap: E = 8,
|
|
20
|
+
className: o,
|
|
21
|
+
style: a,
|
|
22
|
+
testId: p,
|
|
23
|
+
...h
|
|
24
|
+
}, y) => {
|
|
25
|
+
_(() => {
|
|
26
|
+
t === "wave" && T();
|
|
27
|
+
}, [t]);
|
|
28
|
+
const c = (n) => {
|
|
29
|
+
if (n !== void 0)
|
|
30
|
+
return typeof n == "number" ? `${n}px` : n;
|
|
31
|
+
}, N = {
|
|
32
|
+
width: c(l),
|
|
33
|
+
height: c(s) || (e === "text" ? w : void 0),
|
|
34
|
+
borderRadius: d ? c(d) : void 0,
|
|
35
|
+
...a
|
|
36
|
+
}, g = A(
|
|
37
|
+
C,
|
|
38
|
+
b[e],
|
|
39
|
+
L[t],
|
|
40
|
+
v,
|
|
41
|
+
o
|
|
42
|
+
);
|
|
43
|
+
return S > 1 ? /* @__PURE__ */ r(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: "Bear-Skeleton__group flex flex-col",
|
|
47
|
+
style: { gap: c(E) },
|
|
48
|
+
"data-testid": p,
|
|
49
|
+
children: Array.from({ length: S }).map((n, u) => /* @__PURE__ */ r(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
ref: u === 0 ? y : void 0,
|
|
53
|
+
className: g,
|
|
54
|
+
style: N,
|
|
55
|
+
...h
|
|
56
|
+
},
|
|
57
|
+
u
|
|
58
|
+
))
|
|
59
|
+
}
|
|
60
|
+
) : /* @__PURE__ */ r(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref: y,
|
|
64
|
+
className: g,
|
|
65
|
+
style: N,
|
|
66
|
+
"data-testid": p,
|
|
67
|
+
...h
|
|
35
68
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
i.displayName = "Skeleton";
|
|
73
|
+
const k = m(
|
|
74
|
+
({ lines: e = 3, lastLineWidth: t = "80%", gap: l = 8, animation: s = "pulse", ...d }, S) => (_(() => {
|
|
75
|
+
s === "wave" && T();
|
|
76
|
+
}, [s]), /* @__PURE__ */ r(
|
|
40
77
|
"div",
|
|
41
78
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
79
|
+
ref: S,
|
|
80
|
+
className: "Bear-SkeletonText flex flex-col",
|
|
81
|
+
style: { gap: ((o) => {
|
|
82
|
+
if (o !== void 0)
|
|
83
|
+
return typeof o == "number" ? `${o}px` : o;
|
|
84
|
+
})(l) },
|
|
85
|
+
children: Array.from({ length: e }).map((o, a) => /* @__PURE__ */ r(
|
|
86
|
+
i,
|
|
47
87
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
o
|
|
53
|
-
),
|
|
54
|
-
style: {
|
|
55
|
-
...s,
|
|
56
|
-
width: g === n - 1 ? "80%" : s.width
|
|
57
|
-
},
|
|
58
|
-
...b
|
|
88
|
+
variant: "text",
|
|
89
|
+
animation: s,
|
|
90
|
+
width: a === e - 1 ? t : "100%",
|
|
91
|
+
...d
|
|
59
92
|
},
|
|
60
|
-
|
|
93
|
+
a
|
|
61
94
|
))
|
|
62
95
|
}
|
|
63
|
-
)
|
|
96
|
+
))
|
|
97
|
+
);
|
|
98
|
+
k.displayName = "SkeletonText";
|
|
99
|
+
const x = m(
|
|
100
|
+
({ size: e = "md", animation: t = "pulse", ...l }, s) => {
|
|
101
|
+
const d = typeof e == "number" ? e : O[e];
|
|
102
|
+
return /* @__PURE__ */ r(
|
|
103
|
+
i,
|
|
104
|
+
{
|
|
105
|
+
ref: s,
|
|
106
|
+
variant: "circular",
|
|
107
|
+
animation: t,
|
|
108
|
+
width: d,
|
|
109
|
+
height: d,
|
|
110
|
+
...l
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
x.displayName = "SkeletonAvatar";
|
|
116
|
+
const B = m(
|
|
117
|
+
({ animation: e = "pulse", className: t, ...l }, s) => /* @__PURE__ */ f(
|
|
64
118
|
"div",
|
|
65
119
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
o
|
|
120
|
+
ref: s,
|
|
121
|
+
className: A(
|
|
122
|
+
"Bear-SkeletonCard p-4 rounded-lg border border-gray-200 dark:border-zinc-700 bg-white dark:bg-zinc-900",
|
|
123
|
+
t
|
|
71
124
|
),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
125
|
+
...l,
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ f("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
128
|
+
/* @__PURE__ */ r(x, { animation: e }),
|
|
129
|
+
/* @__PURE__ */ f("div", { className: "flex-1", children: [
|
|
130
|
+
/* @__PURE__ */ r(i, { animation: e, width: "60%", height: 16, className: "mb-2" }),
|
|
131
|
+
/* @__PURE__ */ r(i, { animation: e, width: "40%", height: 12 })
|
|
132
|
+
] })
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ r(k, { animation: e, lines: 3 })
|
|
135
|
+
]
|
|
75
136
|
}
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
className: t
|
|
80
|
-
}) => /* @__PURE__ */ r(
|
|
81
|
-
a,
|
|
82
|
-
{
|
|
83
|
-
variant: "circular",
|
|
84
|
-
width: e,
|
|
85
|
-
height: e,
|
|
86
|
-
className: t
|
|
87
|
-
}
|
|
88
|
-
), v = ({
|
|
89
|
-
lines: e = 3,
|
|
90
|
-
width: t = "100%",
|
|
91
|
-
className: l
|
|
92
|
-
}) => /* @__PURE__ */ r(
|
|
93
|
-
a,
|
|
94
|
-
{
|
|
95
|
-
variant: "text",
|
|
96
|
-
count: e,
|
|
97
|
-
width: t,
|
|
98
|
-
className: l
|
|
99
|
-
}
|
|
100
|
-
), w = ({ className: e }) => /* @__PURE__ */ c("div", { className: d("bear-p-4 bear-space-y-4", e), children: [
|
|
101
|
-
/* @__PURE__ */ r(a, { variant: "rectangular", height: 200 }),
|
|
102
|
-
/* @__PURE__ */ c("div", { className: "bear-flex bear-items-center bear-gap-3", children: [
|
|
103
|
-
/* @__PURE__ */ r(S, {}),
|
|
104
|
-
/* @__PURE__ */ c("div", { className: "bear-flex-1", children: [
|
|
105
|
-
/* @__PURE__ */ r(a, { variant: "text", width: "60%" }),
|
|
106
|
-
/* @__PURE__ */ r(a, { variant: "text", width: "40%", className: "bear-mt-2" })
|
|
107
|
-
] })
|
|
108
|
-
] }),
|
|
109
|
-
/* @__PURE__ */ r(v, { lines: 3 })
|
|
110
|
-
] });
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
B.displayName = "SkeletonCard";
|
|
111
140
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
141
|
+
i as Skeleton,
|
|
142
|
+
x as SkeletonAvatar,
|
|
143
|
+
B as SkeletonCard,
|
|
144
|
+
k as SkeletonText
|
|
116
145
|
};
|
|
@@ -2,20 +2,30 @@ import { HTMLAttributes } from 'react';
|
|
|
2
2
|
export type SkeletonVariant = 'text' | 'circular' | 'rectangular' | 'rounded';
|
|
3
3
|
export type SkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
4
4
|
export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
5
|
+
/** Variant type */
|
|
6
6
|
variant?: SkeletonVariant;
|
|
7
7
|
/** Animation type */
|
|
8
8
|
animation?: SkeletonAnimation;
|
|
9
|
-
/** Width
|
|
9
|
+
/** Width (number = px, string = any CSS unit) */
|
|
10
10
|
width?: number | string;
|
|
11
|
-
/** Height
|
|
11
|
+
/** Height (number = px, string = any CSS unit) */
|
|
12
12
|
height?: number | string;
|
|
13
|
-
/**
|
|
13
|
+
/** Border radius for rounded variant */
|
|
14
|
+
borderRadius?: number | string;
|
|
15
|
+
/** Number of skeleton lines to show */
|
|
14
16
|
count?: number;
|
|
15
|
-
/** Gap between
|
|
17
|
+
/** Gap between lines when count > 1 */
|
|
16
18
|
gap?: number | string;
|
|
17
|
-
/**
|
|
18
|
-
className?: string;
|
|
19
|
-
/** Test ID for testing */
|
|
19
|
+
/** Test ID */
|
|
20
20
|
testId?: string;
|
|
21
21
|
}
|
|
22
|
+
export interface SkeletonTextProps extends Omit<SkeletonProps, 'variant'> {
|
|
23
|
+
/** Number of lines */
|
|
24
|
+
lines?: number;
|
|
25
|
+
/** Make last line shorter */
|
|
26
|
+
lastLineWidth?: number | string;
|
|
27
|
+
}
|
|
28
|
+
export interface SkeletonAvatarProps extends Omit<SkeletonProps, 'variant' | 'width' | 'height'> {
|
|
29
|
+
/** Size of avatar */
|
|
30
|
+
size?: 'sm' | 'md' | 'lg' | number;
|
|
31
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Skeleton,
|
|
2
|
-
export type { SkeletonProps, SkeletonVariant, SkeletonAnimation } from './Skeleton.types';
|
|
1
|
+
export { Skeleton, SkeletonText, SkeletonAvatar, SkeletonCard } from './Skeleton';
|
|
2
|
+
export type { SkeletonProps, SkeletonTextProps, SkeletonAvatarProps, SkeletonVariant, SkeletonAnimation } from './Skeleton.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("react"),i=require("../../utils/cn.cjs"),t=require("./Sparkline.const.cjs"),S=require("./Sparkline.utils.cjs"),L=d=>{const{data:a,width:I=t.SPARKLINE.DEFAULT_WIDTH,height:f=t.SPARKLINE.DEFAULT_HEIGHT,color:s=t.SPARKLINE.DEFAULT_COLOR,fill:p=!1,strokeWidth:R=t.SPARKLINE.DEFAULT_STROKE_WIDTH,showExtremes:o=!1,animated:c=!0,className:x,...A}=d,{path:u,areaPath:E,minPoint:n,maxPoint:r}=N.useMemo(()=>S.calculateSparklinePathData(a),[a]),l=`sparkline-gradient-${s.replace("#","")}`;return e.jsx("div",{className:i.cn("inline-block",x),style:{width:I,height:f},...A,children:e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:s,stopOpacity:"0.4"}),e.jsx("stop",{offset:"100%",stopColor:s,stopOpacity:"0"})]})}),p&&e.jsx("path",{d:E,fill:`url(#${l})`,className:i.cn(c&&"animate-fade-in")}),e.jsx("path",{d:u,fill:"none",stroke:s,strokeWidth:R,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",className:i.cn(c&&"animate-draw-line")}),o&&n&&e.jsx("circle",{cx:n.x,cy:n.y,r:t.SPARKLINE.INDICATOR_RADIUS,fill:t.SPARKLINE.MIN_INDICATOR_COLOR,vectorEffect:"non-scaling-stroke"}),o&&r&&e.jsx("circle",{cx:r.x,cy:r.y,r:t.SPARKLINE.INDICATOR_RADIUS,fill:t.SPARKLINE.MAX_INDICATOR_COLOR,vectorEffect:"non-scaling-stroke"})]})})};exports.Sparkline=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I={DEFAULT_WIDTH:100,DEFAULT_HEIGHT:32,DEFAULT_COLOR:"#ec4899",DEFAULT_STROKE_WIDTH:2,VIEWBOX_SIZE:100,Y_PADDING:10,Y_RANGE:80,CONTROL_POINT_FACTOR:3,MIN_INDICATOR_COLOR:"#ef4444",MAX_INDICATOR_COLOR:"#10b981",INDICATOR_RADIUS:3};exports.SPARKLINE=I;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparkline constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const SPARKLINE: {
|
|
5
|
+
readonly DEFAULT_WIDTH: 100;
|
|
6
|
+
readonly DEFAULT_HEIGHT: 32;
|
|
7
|
+
readonly DEFAULT_COLOR: "#ec4899";
|
|
8
|
+
readonly DEFAULT_STROKE_WIDTH: 2;
|
|
9
|
+
readonly VIEWBOX_SIZE: 100;
|
|
10
|
+
readonly Y_PADDING: 10;
|
|
11
|
+
readonly Y_RANGE: 80;
|
|
12
|
+
readonly CONTROL_POINT_FACTOR: 3;
|
|
13
|
+
readonly MIN_INDICATOR_COLOR: "#ef4444";
|
|
14
|
+
readonly MAX_INDICATOR_COLOR: "#10b981";
|
|
15
|
+
readonly INDICATOR_RADIUS: 3;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const I = {
|
|
2
|
+
DEFAULT_WIDTH: 100,
|
|
3
|
+
DEFAULT_HEIGHT: 32,
|
|
4
|
+
DEFAULT_COLOR: "#ec4899",
|
|
5
|
+
DEFAULT_STROKE_WIDTH: 2,
|
|
6
|
+
VIEWBOX_SIZE: 100,
|
|
7
|
+
Y_PADDING: 10,
|
|
8
|
+
Y_RANGE: 80,
|
|
9
|
+
CONTROL_POINT_FACTOR: 3,
|
|
10
|
+
MIN_INDICATOR_COLOR: "#ef4444",
|
|
11
|
+
MAX_INDICATOR_COLOR: "#10b981",
|
|
12
|
+
INDICATOR_RADIUS: 3
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
I as SPARKLINE
|
|
16
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as R } from "react";
|
|
3
|
+
import { cn as i } from "../../utils/cn.js";
|
|
4
|
+
import { SPARKLINE as t } from "./Sparkline.const.js";
|
|
5
|
+
import { calculateSparklinePathData as T } from "./Sparkline.utils.js";
|
|
6
|
+
const u = (p) => {
|
|
7
|
+
const {
|
|
8
|
+
data: s,
|
|
9
|
+
width: m = t.DEFAULT_WIDTH,
|
|
10
|
+
height: d = t.DEFAULT_HEIGHT,
|
|
11
|
+
color: o = t.DEFAULT_COLOR,
|
|
12
|
+
fill: I = !1,
|
|
13
|
+
strokeWidth: h = t.DEFAULT_STROKE_WIDTH,
|
|
14
|
+
showExtremes: l = !1,
|
|
15
|
+
animated: n = !0,
|
|
16
|
+
className: A,
|
|
17
|
+
...D
|
|
18
|
+
} = p, { path: O, areaPath: x, minPoint: r, maxPoint: a } = R(
|
|
19
|
+
() => T(s),
|
|
20
|
+
[s]
|
|
21
|
+
), c = `sparkline-gradient-${o.replace("#", "")}`;
|
|
22
|
+
return /* @__PURE__ */ e(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: i("inline-block", A),
|
|
26
|
+
style: { width: m, height: d },
|
|
27
|
+
...D,
|
|
28
|
+
children: /* @__PURE__ */ f("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "w-full h-full", children: [
|
|
29
|
+
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ f("linearGradient", { id: c, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
30
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: o, stopOpacity: "0.4" }),
|
|
31
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: o, stopOpacity: "0" })
|
|
32
|
+
] }) }),
|
|
33
|
+
I && /* @__PURE__ */ e(
|
|
34
|
+
"path",
|
|
35
|
+
{
|
|
36
|
+
d: x,
|
|
37
|
+
fill: `url(#${c})`,
|
|
38
|
+
className: i(n && "animate-fade-in")
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ e(
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
d: O,
|
|
45
|
+
fill: "none",
|
|
46
|
+
stroke: o,
|
|
47
|
+
strokeWidth: h,
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeLinejoin: "round",
|
|
50
|
+
vectorEffect: "non-scaling-stroke",
|
|
51
|
+
className: i(n && "animate-draw-line")
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
l && r && /* @__PURE__ */ e(
|
|
55
|
+
"circle",
|
|
56
|
+
{
|
|
57
|
+
cx: r.x,
|
|
58
|
+
cy: r.y,
|
|
59
|
+
r: t.INDICATOR_RADIUS,
|
|
60
|
+
fill: t.MIN_INDICATOR_COLOR,
|
|
61
|
+
vectorEffect: "non-scaling-stroke"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
l && a && /* @__PURE__ */ e(
|
|
65
|
+
"circle",
|
|
66
|
+
{
|
|
67
|
+
cx: a.x,
|
|
68
|
+
cy: a.y,
|
|
69
|
+
r: t.INDICATOR_RADIUS,
|
|
70
|
+
fill: t.MAX_INDICATOR_COLOR,
|
|
71
|
+
vectorEffect: "non-scaling-stroke"
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
u as Sparkline
|
|
80
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface SparklineProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Data points (array of numbers) */
|
|
4
|
+
data: number[];
|
|
5
|
+
/** Width of the sparkline */
|
|
6
|
+
width?: number;
|
|
7
|
+
/** Height of the sparkline */
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Line color */
|
|
10
|
+
color?: string;
|
|
11
|
+
/** Fill area under the line */
|
|
12
|
+
fill?: boolean;
|
|
13
|
+
/** Line width */
|
|
14
|
+
strokeWidth?: number;
|
|
15
|
+
/** Show min/max indicators */
|
|
16
|
+
showExtremes?: boolean;
|
|
17
|
+
/** Animate on render */
|
|
18
|
+
animated?: boolean;
|
|
19
|
+
}
|