@forgedevstack/bear 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
3
|
+
export { type MaxVisibleByBreakpoint, type MaxVisibleInput } from '../../utils/maxVisible.utils';
|
|
2
4
|
export interface TabsContextValue {
|
|
3
5
|
activeTab: string;
|
|
4
6
|
setActiveTab: (id: string) => void;
|
|
@@ -23,8 +25,8 @@ export interface TabsProps {
|
|
|
23
25
|
export interface TabListProps {
|
|
24
26
|
/** Tab buttons */
|
|
25
27
|
children: ReactNode;
|
|
26
|
-
/** Max
|
|
27
|
-
maxVisibleTabs?:
|
|
28
|
+
/** Max visible tabs before "…" dropdown. Number, or breakpoint map using theme.breakpoints (mobile < md, tablet md–lg, desktop ≥ lg). `custom` overrides all widths. */
|
|
29
|
+
maxVisibleTabs?: MaxVisibleInput;
|
|
28
30
|
/** Allow tabs to wrap to next line (flex-wrap), no breakpoints */
|
|
29
31
|
wrap?: boolean;
|
|
30
32
|
/** Custom class name */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Tabs, Tab, TabsContext } from './Tabs';
|
|
1
|
+
export { Tabs, Tab, Tab as ActiveTab, TabsContext } from './Tabs';
|
|
2
2
|
export { TabList } from './TabList';
|
|
3
3
|
export { TabPanel } from './TabPanel';
|
|
4
|
-
export type { TabsProps, TabListProps, TabProps, TabPanelProps, TabsContextValue } from './Tabs.types';
|
|
4
|
+
export type { TabsProps, TabListProps, TabProps, TabPanelProps, TabsContextValue, MaxVisibleInput, MaxVisibleByBreakpoint, } from './Tabs.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),M=require("react"),x=require("../../utils/cn.cjs"),o=require("./TagCloud.const.cjs"),O=({tags:n,minFontSize:u=o.DEFAULT_MIN_FONT,maxFontSize:p=o.DEFAULT_MAX_FONT,colors:h=o.DEFAULT_COLORS,layout:j="flow",mobileCompact:C=!1,onTagClick:s,testId:v,className:y,..._})=>{const{minVal:a,maxVal:f}=M.useMemo(()=>{let e=1/0,t=-1/0;for(const r of n)r.value<e&&(e=r.value),r.value>t&&(t=r.value);return{minVal:e,maxVal:t}},[n]),L=e=>f===a?(u+p)/2:u+(e-a)/(f-a)*(p-u),b=e=>.5+(e-a)/(f-a||1)*.5,I=j==="circle",T=(e,t,r)=>{const l=L(e.value),c=e.color??h[t%h.length],d=b(e.value),m=e.href?"a":"span";return i.jsx(m,{className:x.cn("Bear-TagCloud__tag inline-block transition-all duration-200 hover:scale-110 hover:opacity-100",(s||e.href)&&"cursor-pointer"),style:{fontSize:l,color:c,opacity:d,lineHeight:1.2,...r},onClick:()=>s==null?void 0:s(e),...e.href?{href:e.href,target:"_blank",rel:"noopener noreferrer"}:{},children:e.text},`${e.text}-${t}`)};if(I){const e=o.FULL_CIRCLE_DEG/n.length;return i.jsx("div",{className:x.cn("Bear-TagCloud Bear-TagCloud--circle relative",y),style:{width:"100%",paddingBottom:"100%"},"data-testid":v,..._,children:i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.map((t,r)=>{const l=(e*r-90)*(Math.PI/180),c=o.CIRCLE_RADIUS_RATIO,d=50+c*Math.cos(l),m=50+c*Math.sin(l);return T(t,r,{position:"absolute",left:`${d}%`,top:`${m}%`,transform:"translate(-50%, -50%)"})})})})}return i.jsx("div",{className:x.cn("Bear-TagCloud flex flex-wrap items-center justify-center gap-2 p-4",C&&"max-sm:flex-nowrap max-sm:overflow-x-auto max-sm:justify-start max-sm:gap-3 max-sm:pb-2",y),"data-testid":v,..._,children:n.map((e,t)=>T(e,t))})};exports.TagCloud=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=12,L=40,T=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444"],A=38,E=360;exports.CIRCLE_RADIUS_RATIO=A;exports.DEFAULT_COLORS=T;exports.DEFAULT_MAX_FONT=L;exports.DEFAULT_MIN_FONT=_;exports.FULL_CIRCLE_DEG=E;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as E } from "react";
|
|
3
|
+
import { cn as p } from "../../utils/cn.js";
|
|
4
|
+
import { FULL_CIRCLE_DEG as M, DEFAULT_MIN_FONT as N, DEFAULT_MAX_FONT as O, DEFAULT_COLORS as b, CIRCLE_RADIUS_RATIO as w } from "./TagCloud.const.js";
|
|
5
|
+
const j = ({
|
|
6
|
+
tags: n,
|
|
7
|
+
minFontSize: c = N,
|
|
8
|
+
maxFontSize: d = O,
|
|
9
|
+
colors: h = b,
|
|
10
|
+
layout: L = "flow",
|
|
11
|
+
mobileCompact: T = !1,
|
|
12
|
+
onTagClick: a,
|
|
13
|
+
testId: x,
|
|
14
|
+
className: v,
|
|
15
|
+
..._
|
|
16
|
+
}) => {
|
|
17
|
+
const { minVal: o, maxVal: f } = E(() => {
|
|
18
|
+
let e = 1 / 0, t = -1 / 0;
|
|
19
|
+
for (const r of n)
|
|
20
|
+
r.value < e && (e = r.value), r.value > t && (t = r.value);
|
|
21
|
+
return { minVal: e, maxVal: t };
|
|
22
|
+
}, [n]), C = (e) => f === o ? (c + d) / 2 : c + (e - o) / (f - o) * (d - c), I = (e) => 0.5 + (e - o) / (f - o || 1) * 0.5, A = L === "circle", y = (e, t, r) => {
|
|
23
|
+
const l = C(e.value), s = e.color ?? h[t % h.length], m = I(e.value), u = e.href ? "a" : "span";
|
|
24
|
+
return /* @__PURE__ */ i(
|
|
25
|
+
u,
|
|
26
|
+
{
|
|
27
|
+
className: p(
|
|
28
|
+
"Bear-TagCloud__tag inline-block transition-all duration-200 hover:scale-110 hover:opacity-100",
|
|
29
|
+
(a || e.href) && "cursor-pointer"
|
|
30
|
+
),
|
|
31
|
+
style: { fontSize: l, color: s, opacity: m, lineHeight: 1.2, ...r },
|
|
32
|
+
onClick: () => a == null ? void 0 : a(e),
|
|
33
|
+
...e.href ? { href: e.href, target: "_blank", rel: "noopener noreferrer" } : {},
|
|
34
|
+
children: e.text
|
|
35
|
+
},
|
|
36
|
+
`${e.text}-${t}`
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
if (A) {
|
|
40
|
+
const e = M / n.length;
|
|
41
|
+
return /* @__PURE__ */ i(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: p("Bear-TagCloud Bear-TagCloud--circle relative", v),
|
|
45
|
+
style: { width: "100%", paddingBottom: "100%" },
|
|
46
|
+
"data-testid": x,
|
|
47
|
+
..._,
|
|
48
|
+
children: /* @__PURE__ */ i("div", { className: "absolute inset-0 flex items-center justify-center", children: n.map((t, r) => {
|
|
49
|
+
const l = (e * r - 90) * (Math.PI / 180), s = w, m = 50 + s * Math.cos(l), u = 50 + s * Math.sin(l);
|
|
50
|
+
return y(t, r, {
|
|
51
|
+
position: "absolute",
|
|
52
|
+
left: `${m}%`,
|
|
53
|
+
top: `${u}%`,
|
|
54
|
+
transform: "translate(-50%, -50%)"
|
|
55
|
+
});
|
|
56
|
+
}) })
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ i(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: p(
|
|
64
|
+
"Bear-TagCloud flex flex-wrap items-center justify-center gap-2 p-4",
|
|
65
|
+
T && "max-sm:flex-nowrap max-sm:overflow-x-auto max-sm:justify-start max-sm:gap-3 max-sm:pb-2",
|
|
66
|
+
v
|
|
67
|
+
),
|
|
68
|
+
"data-testid": x,
|
|
69
|
+
..._,
|
|
70
|
+
children: n.map((e, t) => y(e, t))
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
j as TagCloud
|
|
76
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export type TagCloudLayout = 'flow' | 'circle';
|
|
3
|
+
export interface TagCloudItem {
|
|
4
|
+
text: string;
|
|
5
|
+
value: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TagCloudProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
10
|
+
/** Tags with text and weight value */
|
|
11
|
+
tags: TagCloudItem[];
|
|
12
|
+
/** Minimum font size in px */
|
|
13
|
+
minFontSize?: number;
|
|
14
|
+
/** Maximum font size in px */
|
|
15
|
+
maxFontSize?: number;
|
|
16
|
+
/** Color palette (cycled through) */
|
|
17
|
+
colors?: string[];
|
|
18
|
+
/** Layout mode */
|
|
19
|
+
layout?: TagCloudLayout;
|
|
20
|
+
/** Responsive: collapse to scrollable list on mobile */
|
|
21
|
+
mobileCompact?: boolean;
|
|
22
|
+
/** Callback when a tag is clicked */
|
|
23
|
+
onTagClick?: (tag: TagCloudItem) => void;
|
|
24
|
+
/** Test ID */
|
|
25
|
+
testId?: string;
|
|
26
|
+
}
|
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),b=require("../../../../utils/cn.cjs"),i=require("../../TimePicker.constants.cjs"),v=require("../../helpers/ClockFaceSvg.cjs"),m="bear-text-pink-600 dark:bear-text-pink-400 bear-font-bold bear-bg-pink-50 dark:bear-bg-pink-900/30 bear-rounded bear-px-1",u="bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1",D=({selectedHour:c,setSelectedHour:l,selectedMinute:d,setSelectedMinute:x,period:_,setPeriod:p,format:a,hours:T,minutes:S,timeValue:h,clearable:E,onChange:s,onConfirm:C,onClose:N,translations:P})=>{const[I,o]=k.useState("hour"),n={...i.TIMEPICKER_DEFAULT_TRANSLATIONS,...P},j=a==="12h"?c===12?12:c%12:c,y=d,g=j.toString().padStart(2,"0"),A=y.toString().padStart(2,"0"),M=a==="12h"?[...i.CLOCK_HOURS_12]:T,t=I==="hour",O=t?M:S,R=k.useCallback(r=>{t?(l(a==="12h"&&r===0?12:r),o("minute")):x(r)},[t,a,l,x]);return e.jsxs("div",{className:b.cn(i.TIMEPICKER_DROPDOWN_CLASSES,"Bear-TimePicker__dial bear-w-72"),children:[e.jsx("div",{className:"Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2",children:n.selectTime}),e.jsxs("div",{className:"Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4",children:[e.jsx("button",{type:"button",onClick:()=>o("hour"),className:b.cn("Bear-TimePicker__dial-hour-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",t?m:u),"aria-label":n.hour,children:g}),e.jsx("span",{className:"bear-text-2xl bear-font-bold bear-text-gray-900 dark:bear-text-white",children:":"}),e.jsx("button",{type:"button",onClick:()=>o("minute"),className:b.cn("Bear-TimePicker__dial-minute-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",t?u:m),"aria-label":n.minute,children:A}),a==="12h"&&e.jsx("div",{className:"Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5 bear-ml-2",children:["AM","PM"].map(r=>e.jsx("button",{onClick:()=>p(r),className:b.cn("Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",_===r?"bear-text-pink-600 dark:bear-text-pink-400 bear-font-medium":"bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"),children:r},r))})]}),e.jsx("div",{className:"Bear-TimePicker__dial-face bear-relative bear-w-48 bear-h-48 bear-mx-auto bear-mb-4",children:e.jsx(v.ClockFaceSvg,{values:O,isHourMode:t,format:a,selectedHour:c,selectedMinute:d,onSelect:R})}),e.jsxs("div",{className:i.TIMEPICKER_FOOTER_CLASSES,children:[E&&h&&e.jsx("button",{onClick:()=>{s==null||s(null),N()},className:i.TIMEPICKER_CLEAR_BUTTON_CLASSES,children:n.cancel}),e.jsx("button",{onClick:C,className:i.TIMEPICKER_CONFIRM_BUTTON_CLASSES,children:n.ok})]})]})};exports.TimePickerDialDropdown=D;
|
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as R, useCallback as v } from "react";
|
|
3
|
-
import { cn as
|
|
3
|
+
import { cn as n } from "../../../../utils/cn.js";
|
|
4
4
|
import { TIMEPICKER_DEFAULT_TRANSLATIONS as B, CLOCK_HOURS_12 as L, TIMEPICKER_FOOTER_CLASSES as D, TIMEPICKER_CLEAR_BUTTON_CLASSES as K, TIMEPICKER_CONFIRM_BUTTON_CLASSES as z, TIMEPICKER_DROPDOWN_CLASSES as w } from "../../TimePicker.constants.js";
|
|
5
5
|
import { ClockFaceSvg as F } from "../../helpers/ClockFaceSvg.js";
|
|
6
|
-
const
|
|
7
|
-
selectedHour:
|
|
6
|
+
const k = "bear-text-pink-600 dark:bear-text-pink-400 bear-font-bold bear-bg-pink-50 dark:bear-bg-pink-900/30 bear-rounded bear-px-1", x = "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1", G = ({
|
|
7
|
+
selectedHour: b,
|
|
8
8
|
setSelectedHour: s,
|
|
9
9
|
selectedMinute: d,
|
|
10
10
|
setSelectedMinute: m,
|
|
11
|
-
period:
|
|
12
|
-
setPeriod:
|
|
11
|
+
period: _,
|
|
12
|
+
setPeriod: p,
|
|
13
13
|
format: a,
|
|
14
|
-
hours:
|
|
14
|
+
hours: u,
|
|
15
15
|
minutes: h,
|
|
16
16
|
timeValue: T,
|
|
17
17
|
clearable: S,
|
|
18
|
-
onChange:
|
|
18
|
+
onChange: o,
|
|
19
19
|
onConfirm: E,
|
|
20
20
|
onClose: C,
|
|
21
21
|
translations: N
|
|
22
22
|
}) => {
|
|
23
|
-
const [I, c] = R("hour"),
|
|
23
|
+
const [I, c] = R("hour"), i = { ...B, ...N }, P = a === "12h" ? b === 12 ? 12 : b % 12 : b, y = d, A = P.toString().padStart(2, "0"), M = y.toString().padStart(2, "0"), O = a === "12h" ? [...L] : u, t = I === "hour", f = t ? O : h, g = v((r) => {
|
|
24
24
|
t ? (s(a === "12h" && r === 0 ? 12 : r), c("minute")) : m(r);
|
|
25
25
|
}, [t, a, s, m]);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children:
|
|
28
|
-
/* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ l("div", { className: n(w, "Bear-TimePicker__dial bear-w-72"), children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children: i.selectTime }),
|
|
28
|
+
/* @__PURE__ */ l("div", { className: "Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4", children: [
|
|
29
29
|
/* @__PURE__ */ e(
|
|
30
30
|
"button",
|
|
31
31
|
{
|
|
32
32
|
type: "button",
|
|
33
33
|
onClick: () => c("hour"),
|
|
34
|
-
className:
|
|
34
|
+
className: n(
|
|
35
35
|
"Bear-TimePicker__dial-hour-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
|
|
36
|
-
t ?
|
|
36
|
+
t ? k : x
|
|
37
37
|
),
|
|
38
|
-
"aria-label":
|
|
38
|
+
"aria-label": i.hour,
|
|
39
39
|
children: A
|
|
40
40
|
}
|
|
41
41
|
),
|
|
@@ -45,21 +45,21 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
|
|
|
45
45
|
{
|
|
46
46
|
type: "button",
|
|
47
47
|
onClick: () => c("minute"),
|
|
48
|
-
className:
|
|
48
|
+
className: n(
|
|
49
49
|
"Bear-TimePicker__dial-minute-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
|
|
50
|
-
t ?
|
|
50
|
+
t ? x : k
|
|
51
51
|
),
|
|
52
|
-
"aria-label":
|
|
52
|
+
"aria-label": i.minute,
|
|
53
53
|
children: M
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
56
|
a === "12h" && /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5 bear-ml-2", children: ["AM", "PM"].map((r) => /* @__PURE__ */ e(
|
|
57
57
|
"button",
|
|
58
58
|
{
|
|
59
|
-
onClick: () =>
|
|
60
|
-
className:
|
|
59
|
+
onClick: () => p(r),
|
|
60
|
+
className: n(
|
|
61
61
|
"Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",
|
|
62
|
-
|
|
62
|
+
_ === r ? "bear-text-pink-600 dark:bear-text-pink-400 bear-font-medium" : "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"
|
|
63
63
|
),
|
|
64
64
|
children: r
|
|
65
65
|
},
|
|
@@ -72,16 +72,16 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
|
|
|
72
72
|
values: f,
|
|
73
73
|
isHourMode: t,
|
|
74
74
|
format: a,
|
|
75
|
-
selectedHour:
|
|
75
|
+
selectedHour: b,
|
|
76
76
|
selectedMinute: d,
|
|
77
77
|
onSelect: g
|
|
78
78
|
}
|
|
79
79
|
) }),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ l("div", { className: D, children: [
|
|
81
81
|
S && T && /* @__PURE__ */ e("button", { onClick: () => {
|
|
82
|
-
|
|
83
|
-
}, className: K, children:
|
|
84
|
-
/* @__PURE__ */ e("button", { onClick: E, className: z, children:
|
|
82
|
+
o == null || o(null), C();
|
|
83
|
+
}, className: K, children: i.cancel }),
|
|
84
|
+
/* @__PURE__ */ e("button", { onClick: E, className: z, children: i.ok })
|
|
85
85
|
] })
|
|
86
86
|
] });
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,A=30,a=90,l=Math.PI/180,f=({values:o,isHourMode:t,format:_,selectedHour:n,selectedMinute:C,onSelect:L,className:N})=>{const b=c=>t?(c*A-a)*l:(c*(360/o.length)-a)*l,E=(t?(_==="12h"?n===12?0:n%12:n)*A-a:C*6-a)*l;return r.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",N),children:[r.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"}),o.map((c,h)=>{const T=b(h),i=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.cos(T),s=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.sin(T),k=t?_==="12h"?c===12?n===12:n%12===c:n===c:C===c;return r.jsxs("g",{onClick:()=>L(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[r.jsx("circle",{cx:i,cy:s,r:x,fill:"transparent"}),k&&r.jsx("circle",{cx:i,cy:s,r:S,className:"Bear-TimePicker__clock-face-dot bear-fill-pink-500"}),r.jsx("text",{x:i,y:s,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)}),r.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.cos(E),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.sin(E),className:"Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=f;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as b, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cn as A } from "../../../utils/cn.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { CLOCK_RADIUS as n, CLOCK_CENTER as c } from "../TimePicker.constants.js";
|
|
5
|
-
const I = 16, O = 14,
|
|
5
|
+
const I = 16, O = 14, p = 0.85, E = 0.6, x = 30, t = 90, s = Math.PI / 180, C = ({
|
|
6
6
|
values: _,
|
|
7
7
|
isHourMode: i,
|
|
8
8
|
format: m,
|
|
9
9
|
selectedHour: r,
|
|
10
10
|
selectedMinute: k,
|
|
11
|
-
onSelect:
|
|
12
|
-
className:
|
|
11
|
+
onSelect: N,
|
|
12
|
+
className: g
|
|
13
13
|
}) => {
|
|
14
|
-
const d = (e) => i ? (e *
|
|
15
|
-
return /* @__PURE__ */
|
|
14
|
+
const d = (e) => i ? (e * x - t) * s : (e * (360 / _.length) - t) * s, f = (i ? (m === "12h" ? r === 12 ? 0 : r % 12 : r) * x - t : k * 6 - t) * s;
|
|
15
|
+
return /* @__PURE__ */ b("svg", { viewBox: "0 0 200 200", className: A("Bear-TimePicker__clock-face bear-w-full bear-h-full", g), children: [
|
|
16
16
|
/* @__PURE__ */ a(
|
|
17
17
|
"circle",
|
|
18
18
|
{
|
|
@@ -23,25 +23,25 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
|
|
|
23
23
|
}
|
|
24
24
|
),
|
|
25
25
|
_.map((e, S) => {
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
26
|
+
const h = d(S), o = c + n * p * Math.cos(h), l = c + n * p * Math.sin(h), T = i ? m === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : k === e;
|
|
27
|
+
return /* @__PURE__ */ b(
|
|
28
28
|
"g",
|
|
29
29
|
{
|
|
30
|
-
onClick: () =>
|
|
30
|
+
onClick: () => N(e),
|
|
31
31
|
className: "Bear-TimePicker__clock-face-item bear-cursor-pointer",
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */ a("circle", { cx:
|
|
34
|
-
|
|
33
|
+
/* @__PURE__ */ a("circle", { cx: o, cy: l, r: I, fill: "transparent" }),
|
|
34
|
+
T && /* @__PURE__ */ a("circle", { cx: o, cy: l, r: O, className: "Bear-TimePicker__clock-face-dot bear-fill-pink-500" }),
|
|
35
35
|
/* @__PURE__ */ a(
|
|
36
36
|
"text",
|
|
37
37
|
{
|
|
38
|
-
x:
|
|
39
|
-
y:
|
|
38
|
+
x: o,
|
|
39
|
+
y: l,
|
|
40
40
|
textAnchor: "middle",
|
|
41
41
|
dominantBaseline: "middle",
|
|
42
42
|
className: A(
|
|
43
43
|
"Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",
|
|
44
|
-
|
|
44
|
+
T ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
|
|
45
45
|
),
|
|
46
46
|
children: typeof e == "number" ? e.toString().padStart(2, "0") : e
|
|
47
47
|
}
|
|
@@ -56,9 +56,9 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
|
|
|
56
56
|
{
|
|
57
57
|
x1: c,
|
|
58
58
|
y1: c,
|
|
59
|
-
x2: c + n *
|
|
60
|
-
y2: c + n *
|
|
61
|
-
className: "Bear-TimePicker__clock-face-hand bear-stroke-
|
|
59
|
+
x2: c + n * E * Math.cos(f),
|
|
60
|
+
y2: c + n * E * Math.sin(f),
|
|
61
|
+
className: "Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",
|
|
62
62
|
strokeLinecap: "round"
|
|
63
63
|
}
|
|
64
64
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),C=require("../../utils/cn.cjs"),f=require("../Typography/Typography.cjs"),a=require("./TimelineChart.const.cjs"),L=({items:n,min:d,max:h,barHeight:m=a.DEFAULT_BAR_HEIGHT,barGap:y=a.DEFAULT_BAR_GAP,showAxis:T=!0,axisTicks:s=a.DEFAULT_AXIS_TICKS,formatTick:_,onItemClick:l,testId:g,className:p,...v})=>{const{min:u,max:B,ticks:j}=b.useMemo(()=>{let e=d??1/0,t=h??-1/0;for(const i of n)i.start<e&&(e=i.start),i.end>t&&(t=i.end);isFinite(e)||(e=0),isFinite(t)||(t=100);const c=(t-e)/(s-1),o=Array.from({length:s},(i,A)=>e+c*A);return{min:e,max:t,ticks:o}},[n,d,h,s]),x=B-u||1;return r.jsxs("div",{className:C.cn("Bear-TimelineChart w-full",p),"data-testid":g,...v,children:[r.jsxs("div",{className:"Bear-TimelineChart__header flex",children:[r.jsx("div",{style:{width:a.LABEL_WIDTH},className:"flex-shrink-0"}),T&&r.jsx("div",{className:"Bear-TimelineChart__axis flex-1 flex justify-between mb-2",children:j.map((e,t)=>r.jsx(f.Typography,{variant:"caption",className:"Bear-TimelineChart__tick text-gray-400 dark:text-gray-500 text-[10px]",children:_?_(e):Math.round(e)},t))})]}),n.map((e,t)=>{const c=(e.start-u)/x*100,o=(e.end-e.start)/x*100,i=e.color??a.DEFAULT_COLORS[t%a.DEFAULT_COLORS.length];return r.jsxs("div",{className:"Bear-TimelineChart__row flex items-center",style:{height:m,marginBottom:y},children:[r.jsx("div",{style:{width:a.LABEL_WIDTH},className:"Bear-TimelineChart__label flex-shrink-0 pr-3 overflow-hidden",children:r.jsx(f.Typography,{variant:"caption",className:"truncate text-gray-700 dark:text-gray-300",children:e.label})}),r.jsx("div",{className:"Bear-TimelineChart__track flex-1 relative h-full bg-gray-100 dark:bg-zinc-800 rounded",children:r.jsx("div",{className:"Bear-TimelineChart__bar absolute top-0 h-full rounded cursor-pointer transition-opacity hover:opacity-80",style:{left:`${c}%`,width:`${o}%`,backgroundColor:i,minWidth:a.MIN_BAR_WIDTH},title:e.tooltip??`${e.label}: ${e.start} - ${e.end}`,onClick:()=>l==null?void 0:l(e,t)})})]},t)})]})};exports.TimelineChart=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=28,_=6,T=6,L=120,t=4,D=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4"];exports.DEFAULT_AXIS_TICKS=T;exports.DEFAULT_BAR_GAP=_;exports.DEFAULT_BAR_HEIGHT=A;exports.DEFAULT_COLORS=D;exports.LABEL_WIDTH=L;exports.MIN_BAR_WIDTH=t;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const A = 28, _ = 6, c = 6, T = 120, o = 4, t = ["#ec4899", "#8b5cf6", "#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#06b6d4"];
|
|
2
|
+
export {
|
|
3
|
+
c as DEFAULT_AXIS_TICKS,
|
|
4
|
+
_ as DEFAULT_BAR_GAP,
|
|
5
|
+
A as DEFAULT_BAR_HEIGHT,
|
|
6
|
+
t as DEFAULT_COLORS,
|
|
7
|
+
T as LABEL_WIDTH,
|
|
8
|
+
o as MIN_BAR_WIDTH
|
|
9
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as w } from "react";
|
|
3
|
+
import { cn as L } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as x } from "../Typography/Typography.js";
|
|
5
|
+
import { DEFAULT_AXIS_TICKS as D, LABEL_WIDTH as y, DEFAULT_COLORS as p, DEFAULT_BAR_GAP as E, DEFAULT_BAR_HEIGHT as F, MIN_BAR_WIDTH as $ } from "./TimelineChart.const.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
items: i,
|
|
8
|
+
min: d,
|
|
9
|
+
max: h,
|
|
10
|
+
barHeight: u = F,
|
|
11
|
+
barGap: T = E,
|
|
12
|
+
showAxis: g = !0,
|
|
13
|
+
axisTicks: l = D,
|
|
14
|
+
formatTick: m,
|
|
15
|
+
onItemClick: n,
|
|
16
|
+
testId: v,
|
|
17
|
+
className: B,
|
|
18
|
+
...A
|
|
19
|
+
}) => {
|
|
20
|
+
const { min: f, max: N, ticks: b } = w(() => {
|
|
21
|
+
let e = d ?? 1 / 0, t = h ?? -1 / 0;
|
|
22
|
+
for (const r of i)
|
|
23
|
+
r.start < e && (e = r.start), r.end > t && (t = r.end);
|
|
24
|
+
isFinite(e) || (e = 0), isFinite(t) || (t = 100);
|
|
25
|
+
const s = (t - e) / (l - 1), o = Array.from({ length: l }, (r, C) => e + s * C);
|
|
26
|
+
return { min: e, max: t, ticks: o };
|
|
27
|
+
}, [i, d, h, l]), _ = N - f || 1;
|
|
28
|
+
return /* @__PURE__ */ c("div", { className: L("Bear-TimelineChart w-full", B), "data-testid": v, ...A, children: [
|
|
29
|
+
/* @__PURE__ */ c("div", { className: "Bear-TimelineChart__header flex", children: [
|
|
30
|
+
/* @__PURE__ */ a("div", { style: { width: y }, className: "flex-shrink-0" }),
|
|
31
|
+
g && /* @__PURE__ */ a("div", { className: "Bear-TimelineChart__axis flex-1 flex justify-between mb-2", children: b.map((e, t) => /* @__PURE__ */ a(x, { variant: "caption", className: "Bear-TimelineChart__tick text-gray-400 dark:text-gray-500 text-[10px]", children: m ? m(e) : Math.round(e) }, t)) })
|
|
32
|
+
] }),
|
|
33
|
+
i.map((e, t) => {
|
|
34
|
+
const s = (e.start - f) / _ * 100, o = (e.end - e.start) / _ * 100, r = e.color ?? p[t % p.length];
|
|
35
|
+
return /* @__PURE__ */ c(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: "Bear-TimelineChart__row flex items-center",
|
|
39
|
+
style: { height: u, marginBottom: T },
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ a("div", { style: { width: y }, className: "Bear-TimelineChart__label flex-shrink-0 pr-3 overflow-hidden", children: /* @__PURE__ */ a(x, { variant: "caption", className: "truncate text-gray-700 dark:text-gray-300", children: e.label }) }),
|
|
42
|
+
/* @__PURE__ */ a("div", { className: "Bear-TimelineChart__track flex-1 relative h-full bg-gray-100 dark:bg-zinc-800 rounded", children: /* @__PURE__ */ a(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: "Bear-TimelineChart__bar absolute top-0 h-full rounded cursor-pointer transition-opacity hover:opacity-80",
|
|
46
|
+
style: {
|
|
47
|
+
left: `${s}%`,
|
|
48
|
+
width: `${o}%`,
|
|
49
|
+
backgroundColor: r,
|
|
50
|
+
minWidth: $
|
|
51
|
+
},
|
|
52
|
+
title: e.tooltip ?? `${e.label}: ${e.start} - ${e.end}`,
|
|
53
|
+
onClick: () => n == null ? void 0 : n(e, t)
|
|
54
|
+
}
|
|
55
|
+
) })
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
t
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
] });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
j as TimelineChart
|
|
65
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface TimelineChartItem {
|
|
3
|
+
label: string;
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
tooltip?: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface TimelineChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
11
|
+
/** Items to display on the timeline */
|
|
12
|
+
items: TimelineChartItem[];
|
|
13
|
+
/** Minimum value of the axis */
|
|
14
|
+
min?: number;
|
|
15
|
+
/** Maximum value of the axis */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** Height of each bar in px */
|
|
18
|
+
barHeight?: number;
|
|
19
|
+
/** Gap between bars in px */
|
|
20
|
+
barGap?: number;
|
|
21
|
+
/** Show axis labels */
|
|
22
|
+
showAxis?: boolean;
|
|
23
|
+
/** Number of axis ticks */
|
|
24
|
+
axisTicks?: number;
|
|
25
|
+
/** Format axis tick value */
|
|
26
|
+
formatTick?: (value: number) => string;
|
|
27
|
+
/** Callback when an item bar is clicked */
|
|
28
|
+
onItemClick?: (item: TimelineChartItem, index: number) => void;
|
|
29
|
+
/** Test ID */
|
|
30
|
+
testId?: string;
|
|
31
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),y=require("../../utils/cn.cjs"),T=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},I={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=r.createContext(null),E=()=>{const i=r.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:s,action:x,onClose:o,onRemove:u,className:g,autoScroll:f=!1})=>{const[j,m]=r.useState(!1),d=r.useRef(null);r.useEffect(()=>{f&&d.current&&d.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[f]),r.useEffect(()=>{if(n>0){const h=setTimeout(()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},n);return()=>clearTimeout(h)}},[n,u,o]);const t=()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},a=()=>s===!1?null:s||p[b];return e.jsxs("div",{ref:d,role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",j?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],g),children:[a()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:a()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:t,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},w=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=r.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:s}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",I[i],b),children:x.map(o=>e.jsx(N,{...o,onRemove:()=>s(o.id)},o.id))})},S=({children:i,position:c="top-right"})=>{const[b,n]=r.useState([]),l=r.useCallback(t=>{n(a=>a.filter(h=>h.id!==t))},[]),s=r.useCallback(t=>{const a=t.id||T.generateId();return n(h=>[...h,{...t,id:a}]),a},[]),x=r.useCallback(t=>s(t),[s]),o=r.useCallback((t,a)=>s({message:t,severity:"success",...a}),[s]),u=r.useCallback((t,a)=>s({message:t,severity:"info",...a}),[s]),g=r.useCallback((t,a)=>s({message:t,severity:"warning",...a}),[s]),f=r.useCallback((t,a)=>s({message:t,severity:"error",...a}),[s]),j=r.useCallback(t=>l(t),[l]),m=r.useCallback(()=>n([]),[]),d={toast:x,success:o,info:u,warning:g,error:f,dismiss:j,dismissAll:m,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:d,children:[i,e.jsx(w,{position:c})]})};exports.ToastContainer=w;exports.ToastProvider=S;exports.useToast=E;
|