@forgedevstack/bear 1.3.1 → 1.3.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/README.md +26 -0
- package/dist/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
- package/dist/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +1 -1
- package/dist/components/Banner/Banner.const.cjs +1 -1
- package/dist/components/Banner/Banner.const.js +1 -1
- package/dist/components/Blockquote/Blockquote.cjs +1 -1
- package/dist/components/Blockquote/Blockquote.js +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.d.ts +1 -2
- package/dist/components/Chart/BarChart.js +81 -61
- 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 +24 -3
- package/dist/components/Chart/Chart.const.js +39 -16
- package/dist/components/Chart/Chart.d.ts +1 -5
- package/dist/components/Chart/Chart.js +19 -23
- package/dist/components/Chart/Chart.types.d.ts +11 -19
- package/dist/components/Chart/Chart.utils.cjs +1 -1
- package/dist/components/Chart/Chart.utils.d.ts +8 -18
- package/dist/components/Chart/Chart.utils.js +39 -3
- package/dist/components/Chart/FunnelChart.cjs +1 -0
- package/dist/components/Chart/FunnelChart.d.ts +2 -0
- package/dist/components/Chart/FunnelChart.js +59 -0
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.d.ts +1 -2
- package/dist/components/Chart/LineChart.js +51 -55
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.d.ts +1 -2
- package/dist/components/Chart/PieChart.js +121 -106
- package/dist/components/Chart/PieChart.types.d.ts +8 -0
- package/dist/components/Chart/RadarChart.cjs +1 -0
- package/dist/components/Chart/RadarChart.d.ts +2 -0
- package/dist/components/Chart/RadarChart.js +100 -0
- package/dist/components/Chart/index.d.ts +3 -1
- package/dist/components/Chat/Chat.cjs +1 -1
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.js +1 -1
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.d.ts +2 -11
- package/dist/components/Drawer/Drawer.const.js +6 -55
- package/dist/components/Drawer/Drawer.d.ts +1 -2
- package/dist/components/Drawer/Drawer.js +87 -131
- package/dist/components/Drawer/Drawer.types.d.ts +16 -3
- package/dist/components/Drawer/Drawer.utils.d.ts +0 -4
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.js +26 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.types.d.ts +20 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.js +17 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.js +9 -0
- package/dist/components/Drawer/components/DrawerHeader/index.d.ts +2 -0
- package/dist/components/Drawer/components/index.d.ts +1 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.cjs +1 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.d.ts +2 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.js +9 -0
- package/dist/components/Drawer/helpers/index.d.ts +1 -0
- package/dist/components/Drawer/hooks/index.d.ts +1 -0
- package/dist/components/Drawer/hooks/useDrawer.cjs +1 -0
- package/dist/components/Drawer/hooks/useDrawer.d.ts +2 -0
- package/dist/components/Drawer/hooks/useDrawer.js +51 -0
- package/dist/components/Editable/Editable.cjs +1 -1
- package/dist/components/Editable/Editable.js +1 -1
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +1 -1
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.js +1 -1
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.const.cjs +1 -1
- package/dist/components/Gauge/Gauge.const.d.ts +5 -0
- package/dist/components/Gauge/Gauge.const.js +11 -6
- package/dist/components/Gauge/Gauge.d.ts +1 -2
- package/dist/components/Gauge/Gauge.js +69 -45
- package/dist/components/Gauge/Gauge.types.d.ts +11 -2
- package/dist/components/Gauge/helpers/GaugeLinearBar.cjs +1 -0
- package/dist/components/Gauge/helpers/GaugeLinearBar.d.ts +2 -0
- package/dist/components/Gauge/helpers/GaugeLinearBar.js +40 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -1
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -1
- package/dist/components/Heatmap/Heatmap.const.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.const.js +8 -6
- package/dist/components/Heatmap/Heatmap.js +51 -47
- package/dist/components/Heatmap/Heatmap.types.d.ts +1 -1
- package/dist/components/Icon/Icon.d.ts +2 -39
- package/dist/components/Icon/Icon.types.d.ts +1 -17
- package/dist/components/Icon/icons/action.d.ts +1 -85
- package/dist/components/Icon/icons/bear.d.ts +1 -12
- package/dist/components/Icon/icons/charts.d.ts +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +1 -25
- package/dist/components/Icon/icons/communication.d.ts +1 -48
- package/dist/components/Icon/icons/content.d.ts +1 -53
- package/dist/components/Icon/icons/device.d.ts +1 -27
- package/dist/components/Icon/icons/editor.d.ts +1 -54
- package/dist/components/Icon/icons/file.d.ts +1 -25
- package/dist/components/Icon/icons/index.d.ts +1 -9
- package/dist/components/Icon/icons/media.d.ts +1 -64
- package/dist/components/Icon/icons/misc.d.ts +1 -96
- package/dist/components/Icon/icons/navigation.d.ts +1 -56
- package/dist/components/Icon/icons/social.d.ts +1 -24
- package/dist/components/Icon/icons/status.d.ts +1 -61
- package/dist/components/Icon/index.d.ts +2 -605
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.js +1 -1
- package/dist/components/JsonViewer/JsonViewer.cjs +1 -1
- package/dist/components/JsonViewer/JsonViewer.js +1 -1
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -1
- package/dist/components/MediaPlayer/MediaPlayer.js +1 -1
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/PageNav/PageNav.cjs +1 -1
- package/dist/components/PageNav/PageNav.js +1 -1
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -1
- package/dist/components/PropsPlayground/PropsPlayground.js +1 -1
- package/dist/components/Rating/components/StarIcon/StarIcon.cjs +1 -1
- package/dist/components/Rating/components/StarIcon/StarIcon.js +1 -1
- package/dist/components/Result/Result.utils.cjs +1 -1
- package/dist/components/Result/Result.utils.js +1 -1
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +1 -1
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +1 -1
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +1 -1
- package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.js +1 -1
- package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/IconRender.js +16 -16
- package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
- package/dist/components/RingProgress/RingProgress.cjs +1 -1
- package/dist/components/RingProgress/RingProgress.const.cjs +1 -1
- package/dist/components/RingProgress/RingProgress.const.d.ts +3 -0
- package/dist/components/RingProgress/RingProgress.const.js +7 -4
- package/dist/components/RingProgress/RingProgress.js +38 -37
- package/dist/components/RingProgress/RingProgress.types.d.ts +1 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +16 -15
- package/dist/components/Sidebar/Sidebar.types.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.utils.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.utils.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.utils.js +11 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -1
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +1 -1
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -1
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +55 -51
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +19 -19
- package/dist/components/Sparkline/Sparkline.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.const.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.const.d.ts +5 -0
- package/dist/components/Sparkline/Sparkline.const.js +9 -4
- package/dist/components/Sparkline/Sparkline.d.ts +1 -2
- package/dist/components/Sparkline/Sparkline.js +75 -53
- package/dist/components/Sparkline/Sparkline.types.d.ts +2 -0
- package/dist/components/Sparkline/Sparkline.utils.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.utils.d.ts +7 -12
- package/dist/components/Sparkline/Sparkline.utils.js +33 -20
- package/dist/components/Sparkline/index.d.ts +2 -2
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +1 -1
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.js +1 -1
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -1
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -1
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +7 -4
- package/dist/components/TimelineChart/TimelineChart.js +56 -42
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.js +1 -1
- package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.cjs +1 -1
- package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.js +1 -1
- package/dist/components/TreeView/TreeView.cjs +1 -1
- package/dist/components/TreeView/TreeView.js +3 -2
- package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.cjs +1 -1
- package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.js +1 -1
- package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.cjs +1 -1
- package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +409 -406
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +4 -0
- package/dist/constants/generals.const.js +50 -47
- package/dist/icons.cjs +1 -1
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +551 -548
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +14 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +35 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +26 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +4 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +130 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +12 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +18 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +6 -0
- package/dist/styles/_drawer.css +213 -0
- package/dist/styles/_overlays.css +0 -1
- package/dist/styles/main.css +1 -0
- package/dist/styles.css +226 -25
- package/package.json +5 -1
- package/dist/components/Icon/Icon.cjs +0 -1
- package/dist/components/Icon/Icon.const.d.ts +0 -1
- package/dist/components/Icon/Icon.js +0 -45
- package/dist/components/Icon/icons/action.cjs +0 -1
- package/dist/components/Icon/icons/action.js +0 -351
- package/dist/components/Icon/icons/bear.cjs +0 -1
- package/dist/components/Icon/icons/bear.js +0 -47
- package/dist/components/Icon/icons/commerce.cjs +0 -1
- package/dist/components/Icon/icons/commerce.js +0 -124
- package/dist/components/Icon/icons/communication.cjs +0 -1
- package/dist/components/Icon/icons/communication.js +0 -184
- package/dist/components/Icon/icons/content.cjs +0 -1
- package/dist/components/Icon/icons/content.js +0 -231
- package/dist/components/Icon/icons/device.cjs +0 -1
- package/dist/components/Icon/icons/device.js +0 -122
- package/dist/components/Icon/icons/editor.cjs +0 -1
- package/dist/components/Icon/icons/editor.js +0 -285
- package/dist/components/Icon/icons/file.cjs +0 -1
- package/dist/components/Icon/icons/file.js +0 -120
- package/dist/components/Icon/icons/media.cjs +0 -1
- package/dist/components/Icon/icons/media.js +0 -306
- package/dist/components/Icon/icons/misc.cjs +0 -1
- package/dist/components/Icon/icons/misc.js +0 -450
- package/dist/components/Icon/icons/navigation.cjs +0 -1
- package/dist/components/Icon/icons/navigation.js +0 -215
- package/dist/components/Icon/icons/social.cjs +0 -1
- package/dist/components/Icon/icons/social.js +0 -89
- package/dist/components/Icon/icons/status.cjs +0 -1
- package/dist/components/Icon/icons/status.js +0 -271
- package/dist/components/Icon/index.cjs +0 -1
- package/dist/components/Icon/index.js +0 -79
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),i=require("react"),q=require("../../utils/cn.cjs"),k=require("@forgedevstack/bear-icons"),P=require("../Popover/Popover.cjs"),R=require("../Input/Input.cjs"),_=require("./ImageAnnotation.const.cjs");let T=1;function L(o,a,r,t){return c.jsx("div",{className:"Bear-ImageAnnotation__edit min-w-[160px]",children:c.jsx(R.Input,{autoFocus:!0,size:"sm",value:o,onChange:s=>a(s.target.value),onKeyDown:s=>{s.key==="Enter"&&r(),s.key==="Escape"&&t()},placeholder:"Add note..."})})}function O(o,a,r,t){return c.jsxs("div",{className:"Bear-ImageAnnotation__label text-xs text-gray-700 dark:text-gray-200 whitespace-nowrap flex items-center gap-1",children:[t??o.text,a&&c.jsx("button",{type:"button",className:"text-red-400 hover:text-red-600 ml-1",onClick:s=>{s.stopPropagation(),r(o.id)},children:c.jsx(k.BearIcons.XIcon,{size:12})})]})}const D=({src:o,alt:a="",annotations:r,onChange:t,editable:s=!0,pinColor:A=_.DEFAULT_PIN_COLOR,pinSize:x=_.DEFAULT_PIN_SIZE,renderPopover:f,testId:b,className:j,...y})=>{const p=i.useRef(null),[n,u]=i.useState(null),[d,v]=i.useState(""),h=i.useCallback(e=>{if(!s||!t||!p.current||e.target.closest(".Bear-ImageAnnotation__pin"))return;const l=p.current.getBoundingClientRect(),I=(e.clientX-l.left)/l.width*100,g=(e.clientY-l.top)/l.height*100,m=`ann-${T++}`,B={id:m,x:I,y:g,text:""};t([...r,B]),u(m),v("")},[s,t,r]),N=i.useCallback(()=>{!n||!t||(d.trim()?t(r.map(e=>e.id===n?{...e,text:d}:e)):t(r.filter(e=>e.id!==n)),u(null))},[n,d,t,r]),w=i.useCallback(()=>u(null),[]),E=i.useCallback(e=>{t==null||t(r.filter(l=>l.id!==e)),n===e&&u(null)},[t,r,n]);return c.jsxs("div",{ref:p,className:q.cn("Bear-ImageAnnotation relative inline-block select-none",s&&"cursor-crosshair",j),onClick:h,"data-testid":b,...y,children:[c.jsx("img",{src:o,alt:a,className:"w-full h-auto block rounded-lg",draggable:!1}),r.map(e=>{const l=n===e.id,I=!!e.text,g=f==null?void 0:f(e),m=l?L(d,v,N,w):I?O(e,s,E,g):null;return c.jsx("div",{className:"Bear-ImageAnnotation__pin absolute transform -translate-x-1/2 -translate-y-full z-10",style:{left:`${e.x}%`,top:`${e.y}%`},children:c.jsx(P.Popover,{content:m,trigger:l?"click":"hover",placement:"top",open:l||void 0,arrow:!1,children:c.jsx("div",{className:"Bear-ImageAnnotation__marker flex items-center justify-center rounded-full shadow-lg cursor-pointer transition-transform hover:scale-110",style:{width:x,height:x,backgroundColor:e.color??A},children:c.jsx(k.BearIcons.MapPinIcon,{size:x*_.PIN_ICON_RATIO,className:"text-white"})})})},e.id)})]})};exports.ImageAnnotation=D;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as h, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as R, useState as v, useCallback as u } from "react";
|
|
3
3
|
import { cn as T } from "../../utils/cn.js";
|
|
4
|
-
import { BearIcons as A } from "
|
|
4
|
+
import { BearIcons as A } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { Popover as O } from "../Popover/Popover.js";
|
|
6
6
|
import { Input as j } from "../Input/Input.js";
|
|
7
7
|
import { DEFAULT_PIN_COLOR as D, DEFAULT_PIN_SIZE as F, PIN_ICON_RATIO as $ } from "./ImageAnnotation.const.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../utils/cn.cjs"),v=require("../../context/BearProvider.cjs"),S=require("../Typography/Typography.cjs"),A=require("../Button/Button.cjs"),g=require("@forgedevstack/bear-icons"),u=require("./JsonViewer.const.cjs"),T=({name:r,value:s,path:d,depth:h,defaultExpandDepth:y,showDataTypes:j,showArrayIndices:x,onValueClick:c})=>{const[o,b]=i.useState(h<y),{mode:N}=v.useBear(),n=N==="dark"?u.DARK_THEME:u.DEFAULT_THEME,t=i.useMemo(()=>s===null?"null":Array.isArray(s)?"array":typeof s,[s]),p=t==="object"||t==="array",a=p&&Object.keys(s).length===0,f=i.useCallback(()=>{b(l=>!l)},[]),m=i.useCallback(()=>{c==null||c(d,s)},[d,s,c]),w=()=>{switch(t){case"string":return e.jsxs("span",{style:{color:n.string},className:"cursor-pointer hover:underline",onClick:m,children:['"',s,'"']});case"number":return e.jsx("span",{style:{color:n.number},className:"cursor-pointer hover:underline",onClick:m,children:String(s)});case"boolean":return e.jsx("span",{style:{color:n.boolean},className:"cursor-pointer hover:underline",onClick:m,children:String(s)});case"null":return e.jsx("span",{style:{color:n.null},className:"cursor-pointer hover:underline",onClick:m,children:"null"});default:return null}},k=()=>{if(!j)return null;const l=t==="array"?`Array(${s.length})`:t==="object"?"Object":t;return e.jsx("span",{className:"text-[10px] opacity-50 ml-1",children:l})};if(!p)return e.jsxs("div",{className:"flex items-center gap-1 py-0.5",children:[e.jsx("span",{className:"w-4"})," ",(x||typeof r=="string")&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:n.key},children:typeof r=="string"?`"${r}"`:r}),e.jsx("span",{style:{color:n.punctuation},children:":"})]}),w(),k()]});const B=Object.entries(s),q=t==="array"?"[":"{",E=t==="array"?"]":"}";return e.jsxs("div",{className:"py-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1 cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 rounded px-1 -mx-1",onClick:f,children:[e.jsx("span",{className:"w-4 flex items-center justify-center text-gray-400",children:a?null:o?e.jsx(g.BearIcons.ChevronDownIcon,{size:12}):e.jsx(g.BearIcons.ChevronRightIcon,{size:12})}),(x||typeof r=="string")&&r!==""&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:n.key},children:typeof r=="string"?`"${r}"`:r}),e.jsx("span",{style:{color:n.punctuation},children:":"})]}),e.jsx("span",{style:{color:n.bracket},children:q}),!o&&!a&&e.jsx("span",{className:"text-gray-400 text-xs",children:"..."}),(!o||a)&&e.jsx("span",{style:{color:n.bracket},children:E}),k()]}),o&&!a&&e.jsx("div",{className:"ml-4 border-l border-gray-200 dark:border-gray-700 pl-2",children:B.map(([l,C],F)=>e.jsx(T,{name:t==="array"?F:l,value:C,path:[...d,l],depth:h+1,defaultExpandDepth:y,showDataTypes:j,showArrayIndices:x,onValueClick:c},l))}),o&&!a&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{style:{color:n.bracket},children:E})]})]})},J=({data:r,defaultExpandDepth:s=u.DEFAULT_EXPAND_DEPTH,showDataTypes:d=!1,showArrayIndices:h=!0,showCopyButton:y=!0,rootName:j="root",onValueClick:x,onCopy:c,className:o,testId:b})=>{const{mode:N}=v.useBear(),n=N==="dark"?u.DARK_THEME:u.DEFAULT_THEME,[t,p]=i.useState(!1),a=i.useCallback(async()=>{try{await navigator.clipboard.writeText(JSON.stringify(r,null,2)),p(!0),c==null||c(r),setTimeout(()=>p(!1),2e3)}catch(f){console.error("Failed to copy:",f)}},[r,c]);return e.jsxs("div",{className:I.cn("Bear-JsonViewer","rounded-lg overflow-hidden font-mono text-sm",o),style:{backgroundColor:n.background},"data-testid":b,children:[y&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsx(S.Typography,{variant:"caption",className:"opacity-60",children:"JSON"}),e.jsx(A.Button,{variant:"ghost",size:"sm",onClick:a,className:"!py-1 !px-2 !text-xs",children:t?e.jsxs(e.Fragment,{children:[e.jsx(g.BearIcons.CheckIcon,{size:12,className:"mr-1"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(g.BearIcons.CopyIcon,{size:12,className:"mr-1"}),"Copy"]})})]}),e.jsx("div",{className:"p-3 overflow-x-auto",children:e.jsx(T,{name:j||"",value:r,path:[],depth:0,defaultExpandDepth:s,showDataTypes:d,showArrayIndices:h,onValueClick:x})})]})};exports.JsonViewer=J;
|
|
@@ -4,7 +4,7 @@ import { cn as I } from "../../utils/cn.js";
|
|
|
4
4
|
import { useBear as T } from "../../context/BearProvider.js";
|
|
5
5
|
import { Typography as _ } from "../Typography/Typography.js";
|
|
6
6
|
import { Button as H } from "../Button/Button.js";
|
|
7
|
-
import { BearIcons as b } from "
|
|
7
|
+
import { BearIcons as b } from "@forgedevstack/bear-icons";
|
|
8
8
|
import { DARK_THEME as B, DEFAULT_THEME as C, DEFAULT_EXPAND_DEPTH as L } from "./JsonViewer.const.js";
|
|
9
9
|
const z = ({
|
|
10
10
|
name: r,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),m=require("../../utils/cn.cjs"),n=require("../Icon/index.cjs"),j=require("./MediaPlayer.const.cjs"),C=require("./MediaPlayer.utils.cjs"),Te=require("../../hooks/useBearStyles.cjs"),Re=320,le=16,ze=({src:D,type:T="video",poster:R,autoPlay:z=!1,loop:L=!1,muted:G=!1,nativeControls:k=!1,width:A,height:H,size:ce="md",accentColor:u=j.DEFAULT_ACCENT,playIcon:Y,pauseIcon:Z,muteIcon:de,unmuteIcon:ue,fullscreenIcon:xe,centerOverlay:me=!1,sticky:q=!1,stickyPosition:$="right",stickySize:U=Re,airPlay:he=!1,playlist:w,onTrackChange:I,bis:fe,testId:ye,className:ge,style:ve,...pe})=>{const h=s.useRef(null),W=s.useRef(null),K=s.useRef(null),[b,F]=s.useState(z),[N,V]=s.useState(0),[g,X]=s.useState(0),[S,be]=s.useState(G),[f,J]=s.useState(L),[M,je]=s.useState(!1),[Q,ke]=s.useState(0),[Ne,_]=s.useState(!z),[l,we]=s.useState(0),O=Te.useBearStyles(fe,ve),x=s.useMemo(()=>w&&w.length>0?w:[{src:D,poster:R,type:T,title:void 0,artist:void 0}],[w,D,R,T]),o=x[l],Ie=o.src,B=o.poster??R,c=o.type??T,d=x.length>1,i=j.SIZE_MAP[ce];s.useEffect(()=>{J(L)},[L]),s.useEffect(()=>{const t=h.current;if(!t)return;const r=()=>V(t.currentTime),a=()=>X(t.duration),p=()=>{d&&l<x.length-1?v(l+1):f?d&&v(0):(F(!1),_(!0))};return t.addEventListener("timeupdate",r),t.addEventListener("loadedmetadata",a),t.addEventListener("ended",p),()=>{t.removeEventListener("timeupdate",r),t.removeEventListener("loadedmetadata",a),t.removeEventListener("ended",p)}},[f,d,l,x.length]),s.useEffect(()=>{if(!q||c!=="video")return;const t=K.current;if(!t)return;const r=()=>{const p=t.getBoundingClientRect().bottom<0;je(p),p&&ke(le)};return window.addEventListener("scroll",r,{passive:!0}),r(),()=>window.removeEventListener("scroll",r)},[q,c]);const v=s.useCallback(t=>{const r=Math.max(0,Math.min(x.length-1,t));we(r),V(0),X(0),_(!1),I==null||I(r,x[r]),setTimeout(()=>{const a=h.current;a&&(a.load(),a.play().catch(()=>{}),F(!0))},50)},[x,I]),E=s.useCallback(()=>{const t=h.current;t&&(b?(t.pause(),_(!0)):(t.play().catch(()=>{}),_(!1)),F(!b))},[b]),ee=s.useCallback(t=>{const r=h.current;if(!r||!g)return;const a=t.currentTarget.getBoundingClientRect(),p=Math.max(0,Math.min(1,(t.clientX-a.left)/a.width));r.currentTime=p*g},[g]),te=s.useCallback(()=>{const t=h.current;t&&(t.muted=!S,be(!S))},[S]),se=s.useCallback(()=>{const t=!f;J(t);const r=h.current;r&&(r.loop=t)},[f]),Se=s.useCallback(()=>{var r;const t=W.current;t&&(document.fullscreenElement?document.exitFullscreen():(r=t.requestFullscreen)==null||r.call(t))},[]),Me=s.useCallback(()=>{const t=h.current;t!=null&&t.webkitShowPlaybackTargetPicker&&t.webkitShowPlaybackTargetPicker()},[]),re=s.useCallback(()=>{if(N>3){const t=h.current;t&&(t.currentTime=0)}else l>0&&v(l-1)},[N,l,v]),ae=s.useCallback(()=>{l<x.length-1&&v(l+1)},[l,x.length,v]),ne=g?N/g*100:0,y=i.iconSm,P=i.iconMd,ie=b?Z??e.jsx(n.BearIcons.PauseIcon,{size:P}):Y??e.jsx(n.BearIcons.PlayIcon,{size:P}),oe=S?de??e.jsx(n.BearIcons.VolumeOffIcon,{size:y}):ue??e.jsx(n.BearIcons.VolumeUpIcon,{size:y}),_e=xe??e.jsx(n.BearIcons.MaximizeIcon,{size:y}),Be=c==="video"?"video":"audio",Ee=s.useMemo(()=>M&&c==="video"?{...O,position:"fixed",top:Q,[$==="left"?"left":"right"]:le,width:U,zIndex:50,boxShadow:"0 8px 32px rgba(0,0,0,0.45)",borderRadius:12,transition:"top 0.15s ease-out"}:{...O,width:A??"100%",height:H,maxWidth:A?void 0:i.maxWidth},[M,c,O,A,H,i.maxWidth,Q,$,U]),Pe=s.useMemo(()=>{if(!M)return{aspectRatio:i.aspectRatio}},[M,i.aspectRatio]),Ce=`${u}20`;return e.jsxs(e.Fragment,{children:[q&&e.jsx("div",{ref:K,style:{height:1}}),e.jsxs("div",{ref:W,className:m.cn("Bear-MediaPlayer relative rounded-xl overflow-hidden bg-black",ge),style:Ee,"data-testid":ye,...pe,children:[e.jsx(Be,{ref:h,src:Ie,poster:B,autoPlay:z,loop:f&&!d,muted:G,controls:k,playsInline:!0,className:m.cn(c==="video"?"Bear-MediaPlayer__video w-full object-cover":"hidden"),style:c==="video"?Pe:void 0,onClick:c==="video"?E:void 0}),me&&c==="video"&&Ne&&!k&&e.jsx("button",{type:"button",onClick:E,className:"Bear-MediaPlayer__overlay absolute inset-0 flex items-center justify-center bg-black/30 transition-opacity",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-white/90 flex items-center justify-center shadow-lg",children:b?Z??e.jsx(n.BearIcons.PauseIcon,{size:j.CENTER_ICON_SIZE,className:"text-gray-900"}):Y??e.jsx(n.BearIcons.PlayIcon,{size:j.CENTER_ICON_SIZE,className:"text-gray-900"})})}),!k&&c==="video"&&e.jsxs("div",{className:m.cn("Bear-MediaPlayer__controls absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pt-8",i.padding),children:[e.jsx("div",{className:"Bear-MediaPlayer__progress w-full cursor-pointer mb-2 group",style:{height:j.PROGRESS_HEIGHT},onClick:ee,children:e.jsx("div",{className:"w-full h-full bg-white/30 rounded-full relative overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ne}%`,backgroundColor:u}})})}),e.jsxs("div",{className:m.cn("Bear-MediaPlayer__bar flex items-center",i.gap),children:[d&&e.jsx("button",{type:"button",onClick:re,className:"text-white hover:text-primary-400 transition-colors",children:e.jsx(n.BearIcons.SkipBackIcon,{size:y})}),e.jsx("button",{type:"button",onClick:E,className:"text-white hover:text-primary-400 transition-colors",children:ie}),d&&e.jsx("button",{type:"button",onClick:ae,className:"text-white hover:text-primary-400 transition-colors",children:e.jsx(n.BearIcons.SkipForwardIcon,{size:y})}),e.jsx("button",{type:"button",onClick:te,className:"text-white hover:text-primary-400 transition-colors",children:oe}),e.jsxs("span",{className:m.cn("Bear-MediaPlayer__time text-white font-mono",i.text),children:[C.formatTime(N)," / ",C.formatTime(g)]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{type:"button",onClick:se,className:"transition-colors",style:{color:f?u:void 0},title:"Loop",children:e.jsx(n.BearIcons.RepeatIcon,{size:y,className:f?void 0:"text-white/60 hover:text-white"})}),he&&e.jsx("button",{type:"button",onClick:Me,className:"text-white hover:text-primary-400 transition-colors",title:"AirPlay",children:e.jsx(n.BearIcons.CastIcon,{size:y})}),e.jsx("button",{type:"button",onClick:Se,className:"text-white hover:text-primary-400 transition-colors",children:_e})]}),d&&o.title&&e.jsxs("div",{className:"mt-1 flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-white text-xs font-medium truncate",children:o.title}),o.artist&&e.jsxs("span",{className:"text-white/50 text-xs truncate",children:["— ",o.artist]})]})]}),c==="audio"&&!k&&e.jsxs("div",{className:m.cn("Bear-MediaPlayer__audio bg-gray-100 dark:bg-zinc-800 rounded-xl",i.padding),children:[d&&(B||o.title)&&e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[B&&e.jsx("img",{src:B,alt:"",className:"w-12 h-12 rounded-lg object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[o.title&&e.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",children:o.title}),o.artist&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.artist})]})]}),e.jsx("div",{className:"Bear-MediaPlayer__progress w-full cursor-pointer mb-1",style:{height:j.PROGRESS_HEIGHT},onClick:ee,children:e.jsx("div",{className:"w-full h-full bg-gray-300 dark:bg-zinc-600 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${ne}%`,backgroundColor:u}})})}),e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("span",{className:m.cn("text-gray-500 font-mono",i.text),children:C.formatTime(N)}),e.jsx("span",{className:m.cn("text-gray-500 font-mono",i.text),children:C.formatTime(g)})]}),e.jsxs("div",{className:m.cn("flex items-center justify-center",i.gap),children:[e.jsx("button",{type:"button",onClick:se,className:"transition-colors",style:{color:f?u:void 0},title:"Loop",children:e.jsx(n.BearIcons.RepeatIcon,{size:y,className:f?void 0:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"})}),d&&e.jsx("button",{type:"button",onClick:re,className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:e.jsx(n.BearIcons.SkipBackIcon,{size:P})}),e.jsx("button",{type:"button",onClick:E,className:"Bear-MediaPlayer__play w-10 h-10 rounded-full flex items-center justify-center text-white transition-colors",style:{backgroundColor:u},children:ie}),d&&e.jsx("button",{type:"button",onClick:ae,className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:e.jsx(n.BearIcons.SkipForwardIcon,{size:P})}),e.jsx("button",{type:"button",onClick:te,className:"text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:oe})]})]}),d&&!k&&e.jsx("div",{className:"Bear-MediaPlayer__playlist bg-gray-50 dark:bg-zinc-900 border-t border-gray-200 dark:border-zinc-700 max-h-48 overflow-y-auto",children:x.map((t,r)=>{const a=r===l;return e.jsxs("button",{type:"button",onClick:()=>v(r),className:m.cn("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",!a&&"hover:bg-gray-100 dark:hover:bg-zinc-800"),style:a?{backgroundColor:Ce}:void 0,children:[t.poster&&e.jsx("img",{src:t.poster,alt:"",className:"w-8 h-8 rounded object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-medium truncate",style:a?{color:u}:void 0,children:t.title??`Track ${r+1}`}),t.artist&&e.jsx("p",{className:"text-[10px] text-gray-400 truncate",children:t.artist})]}),a&&b&&e.jsxs("div",{className:"flex items-end gap-0.5 h-3",children:[e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"60%",backgroundColor:u}}),e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"100%",backgroundColor:u,animationDelay:"0.2s"}}),e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"40%",backgroundColor:u,animationDelay:"0.4s"}})]}),e.jsx("span",{className:"text-[10px] text-gray-400 tabular-nums shrink-0",children:r+1})]},r)})})]})]})};exports.MediaPlayer=ze;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),m=require("../../utils/cn.cjs"),n=require("@forgedevstack/bear-icons"),j=require("./MediaPlayer.const.cjs"),C=require("./MediaPlayer.utils.cjs"),Te=require("../../hooks/useBearStyles.cjs"),Re=320,le=16,ze=({src:D,type:T="video",poster:R,autoPlay:z=!1,loop:L=!1,muted:G=!1,nativeControls:k=!1,width:A,height:H,size:ce="md",accentColor:u=j.DEFAULT_ACCENT,playIcon:Y,pauseIcon:Z,muteIcon:de,unmuteIcon:ue,fullscreenIcon:xe,centerOverlay:me=!1,sticky:q=!1,stickyPosition:$="right",stickySize:U=Re,airPlay:he=!1,playlist:w,onTrackChange:I,bis:fe,testId:ye,className:ge,style:ve,...be})=>{const h=s.useRef(null),W=s.useRef(null),K=s.useRef(null),[p,F]=s.useState(z),[N,V]=s.useState(0),[g,X]=s.useState(0),[S,pe]=s.useState(G),[f,J]=s.useState(L),[M,je]=s.useState(!1),[Q,ke]=s.useState(0),[Ne,_]=s.useState(!z),[l,we]=s.useState(0),O=Te.useBearStyles(fe,ve),x=s.useMemo(()=>w&&w.length>0?w:[{src:D,poster:R,type:T,title:void 0,artist:void 0}],[w,D,R,T]),o=x[l],Ie=o.src,B=o.poster??R,c=o.type??T,d=x.length>1,i=j.SIZE_MAP[ce];s.useEffect(()=>{J(L)},[L]),s.useEffect(()=>{const t=h.current;if(!t)return;const r=()=>V(t.currentTime),a=()=>X(t.duration),b=()=>{d&&l<x.length-1?v(l+1):f?d&&v(0):(F(!1),_(!0))};return t.addEventListener("timeupdate",r),t.addEventListener("loadedmetadata",a),t.addEventListener("ended",b),()=>{t.removeEventListener("timeupdate",r),t.removeEventListener("loadedmetadata",a),t.removeEventListener("ended",b)}},[f,d,l,x.length]),s.useEffect(()=>{if(!q||c!=="video")return;const t=K.current;if(!t)return;const r=()=>{const b=t.getBoundingClientRect().bottom<0;je(b),b&&ke(le)};return window.addEventListener("scroll",r,{passive:!0}),r(),()=>window.removeEventListener("scroll",r)},[q,c]);const v=s.useCallback(t=>{const r=Math.max(0,Math.min(x.length-1,t));we(r),V(0),X(0),_(!1),I==null||I(r,x[r]),setTimeout(()=>{const a=h.current;a&&(a.load(),a.play().catch(()=>{}),F(!0))},50)},[x,I]),E=s.useCallback(()=>{const t=h.current;t&&(p?(t.pause(),_(!0)):(t.play().catch(()=>{}),_(!1)),F(!p))},[p]),ee=s.useCallback(t=>{const r=h.current;if(!r||!g)return;const a=t.currentTarget.getBoundingClientRect(),b=Math.max(0,Math.min(1,(t.clientX-a.left)/a.width));r.currentTime=b*g},[g]),te=s.useCallback(()=>{const t=h.current;t&&(t.muted=!S,pe(!S))},[S]),se=s.useCallback(()=>{const t=!f;J(t);const r=h.current;r&&(r.loop=t)},[f]),Se=s.useCallback(()=>{var r;const t=W.current;t&&(document.fullscreenElement?document.exitFullscreen():(r=t.requestFullscreen)==null||r.call(t))},[]),Me=s.useCallback(()=>{const t=h.current;t!=null&&t.webkitShowPlaybackTargetPicker&&t.webkitShowPlaybackTargetPicker()},[]),re=s.useCallback(()=>{if(N>3){const t=h.current;t&&(t.currentTime=0)}else l>0&&v(l-1)},[N,l,v]),ae=s.useCallback(()=>{l<x.length-1&&v(l+1)},[l,x.length,v]),ne=g?N/g*100:0,y=i.iconSm,P=i.iconMd,ie=p?Z??e.jsx(n.BearIcons.PauseIcon,{size:P}):Y??e.jsx(n.BearIcons.PlayIcon,{size:P}),oe=S?de??e.jsx(n.BearIcons.VolumeOffIcon,{size:y}):ue??e.jsx(n.BearIcons.VolumeUpIcon,{size:y}),_e=xe??e.jsx(n.BearIcons.MaximizeIcon,{size:y}),Be=c==="video"?"video":"audio",Ee=s.useMemo(()=>M&&c==="video"?{...O,position:"fixed",top:Q,[$==="left"?"left":"right"]:le,width:U,zIndex:50,boxShadow:"0 8px 32px rgba(0,0,0,0.45)",borderRadius:12,transition:"top 0.15s ease-out"}:{...O,width:A??"100%",height:H,maxWidth:A?void 0:i.maxWidth},[M,c,O,A,H,i.maxWidth,Q,$,U]),Pe=s.useMemo(()=>{if(!M)return{aspectRatio:i.aspectRatio}},[M,i.aspectRatio]),Ce=`${u}20`;return e.jsxs(e.Fragment,{children:[q&&e.jsx("div",{ref:K,style:{height:1}}),e.jsxs("div",{ref:W,className:m.cn("Bear-MediaPlayer relative rounded-xl overflow-hidden bg-black",ge),style:Ee,"data-testid":ye,...be,children:[e.jsx(Be,{ref:h,src:Ie,poster:B,autoPlay:z,loop:f&&!d,muted:G,controls:k,playsInline:!0,className:m.cn(c==="video"?"Bear-MediaPlayer__video w-full object-cover":"hidden"),style:c==="video"?Pe:void 0,onClick:c==="video"?E:void 0}),me&&c==="video"&&Ne&&!k&&e.jsx("button",{type:"button",onClick:E,className:"Bear-MediaPlayer__overlay absolute inset-0 flex items-center justify-center bg-black/30 transition-opacity",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-white/90 flex items-center justify-center shadow-lg",children:p?Z??e.jsx(n.BearIcons.PauseIcon,{size:j.CENTER_ICON_SIZE,className:"text-gray-900"}):Y??e.jsx(n.BearIcons.PlayIcon,{size:j.CENTER_ICON_SIZE,className:"text-gray-900"})})}),!k&&c==="video"&&e.jsxs("div",{className:m.cn("Bear-MediaPlayer__controls absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pt-8",i.padding),children:[e.jsx("div",{className:"Bear-MediaPlayer__progress w-full cursor-pointer mb-2 group",style:{height:j.PROGRESS_HEIGHT},onClick:ee,children:e.jsx("div",{className:"w-full h-full bg-white/30 rounded-full relative overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ne}%`,backgroundColor:u}})})}),e.jsxs("div",{className:m.cn("Bear-MediaPlayer__bar flex items-center",i.gap),children:[d&&e.jsx("button",{type:"button",onClick:re,className:"text-white hover:text-primary-400 transition-colors",children:e.jsx(n.BearIcons.SkipBackIcon,{size:y})}),e.jsx("button",{type:"button",onClick:E,className:"text-white hover:text-primary-400 transition-colors",children:ie}),d&&e.jsx("button",{type:"button",onClick:ae,className:"text-white hover:text-primary-400 transition-colors",children:e.jsx(n.BearIcons.SkipForwardIcon,{size:y})}),e.jsx("button",{type:"button",onClick:te,className:"text-white hover:text-primary-400 transition-colors",children:oe}),e.jsxs("span",{className:m.cn("Bear-MediaPlayer__time text-white font-mono",i.text),children:[C.formatTime(N)," / ",C.formatTime(g)]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{type:"button",onClick:se,className:"transition-colors",style:{color:f?u:void 0},title:"Loop",children:e.jsx(n.BearIcons.RepeatIcon,{size:y,className:f?void 0:"text-white/60 hover:text-white"})}),he&&e.jsx("button",{type:"button",onClick:Me,className:"text-white hover:text-primary-400 transition-colors",title:"AirPlay",children:e.jsx(n.BearIcons.CastIcon,{size:y})}),e.jsx("button",{type:"button",onClick:Se,className:"text-white hover:text-primary-400 transition-colors",children:_e})]}),d&&o.title&&e.jsxs("div",{className:"mt-1 flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-white text-xs font-medium truncate",children:o.title}),o.artist&&e.jsxs("span",{className:"text-white/50 text-xs truncate",children:["— ",o.artist]})]})]}),c==="audio"&&!k&&e.jsxs("div",{className:m.cn("Bear-MediaPlayer__audio bg-gray-100 dark:bg-zinc-800 rounded-xl",i.padding),children:[d&&(B||o.title)&&e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[B&&e.jsx("img",{src:B,alt:"",className:"w-12 h-12 rounded-lg object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[o.title&&e.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",children:o.title}),o.artist&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:o.artist})]})]}),e.jsx("div",{className:"Bear-MediaPlayer__progress w-full cursor-pointer mb-1",style:{height:j.PROGRESS_HEIGHT},onClick:ee,children:e.jsx("div",{className:"w-full h-full bg-gray-300 dark:bg-zinc-600 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${ne}%`,backgroundColor:u}})})}),e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("span",{className:m.cn("text-gray-500 font-mono",i.text),children:C.formatTime(N)}),e.jsx("span",{className:m.cn("text-gray-500 font-mono",i.text),children:C.formatTime(g)})]}),e.jsxs("div",{className:m.cn("flex items-center justify-center",i.gap),children:[e.jsx("button",{type:"button",onClick:se,className:"transition-colors",style:{color:f?u:void 0},title:"Loop",children:e.jsx(n.BearIcons.RepeatIcon,{size:y,className:f?void 0:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"})}),d&&e.jsx("button",{type:"button",onClick:re,className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:e.jsx(n.BearIcons.SkipBackIcon,{size:P})}),e.jsx("button",{type:"button",onClick:E,className:"Bear-MediaPlayer__play w-10 h-10 rounded-full flex items-center justify-center text-white transition-colors",style:{backgroundColor:u},children:ie}),d&&e.jsx("button",{type:"button",onClick:ae,className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors",children:e.jsx(n.BearIcons.SkipForwardIcon,{size:P})}),e.jsx("button",{type:"button",onClick:te,className:"text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:oe})]})]}),d&&!k&&e.jsx("div",{className:"Bear-MediaPlayer__playlist bg-gray-50 dark:bg-zinc-900 border-t border-gray-200 dark:border-zinc-700 max-h-48 overflow-y-auto",children:x.map((t,r)=>{const a=r===l;return e.jsxs("button",{type:"button",onClick:()=>v(r),className:m.cn("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",!a&&"hover:bg-gray-100 dark:hover:bg-zinc-800"),style:a?{backgroundColor:Ce}:void 0,children:[t.poster&&e.jsx("img",{src:t.poster,alt:"",className:"w-8 h-8 rounded object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-medium truncate",style:a?{color:u}:void 0,children:t.title??`Track ${r+1}`}),t.artist&&e.jsx("p",{className:"text-[10px] text-gray-400 truncate",children:t.artist})]}),a&&p&&e.jsxs("div",{className:"flex items-end gap-0.5 h-3",children:[e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"60%",backgroundColor:u}}),e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"100%",backgroundColor:u,animationDelay:"0.2s"}}),e.jsx("span",{className:"w-0.5 rounded-full animate-pulse",style:{height:"40%",backgroundColor:u,animationDelay:"0.4s"}})]}),e.jsx("span",{className:"text-[10px] text-gray-400 tabular-nums shrink-0",children:r+1})]},r)})})]})]})};exports.MediaPlayer=ze;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as De } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as $, useState as g, useMemo as G, useEffect as U, useCallback as p } from "react";
|
|
3
3
|
import { cn as h } from "../../utils/cn.js";
|
|
4
|
-
import { BearIcons as i } from "
|
|
4
|
+
import { BearIcons as i } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { SIZE_MAP as Oe, CENTER_ICON_SIZE as me, PROGRESS_HEIGHT as he, DEFAULT_ACCENT as Ye } from "./MediaPlayer.const.js";
|
|
6
6
|
import { formatTime as C } from "./MediaPlayer.utils.js";
|
|
7
7
|
import { useBearStyles as $e } from "../../hooks/useBearStyles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),E=require("react"),x=require("react-dom"),a=require("../../utils/cn.cjs"),j=require("../../utils/generateBearId.utils.cjs"),q=require("../../utils/useBearId.cjs"),g=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),E=require("react"),x=require("react-dom"),a=require("../../utils/cn.cjs"),j=require("../../utils/generateBearId.utils.cjs"),q=require("../../utils/useBearId.cjs"),g=require("../../node_modules/@forgedevstack/bear-icons/dist/navigation.cjs"),w=require("../Backdrop/Backdrop.cjs"),e=require("./Modal.const.cjs"),R=m=>{const{isOpen:s,onClose:l,title:r,children:L,size:M="md",showCloseButton:d=!0,closeOnEscape:A=!0,disableEscapeKeyDown:B=!1,lockBodyScroll:C=!0,cancelPreventScroll:O=!1,closeOnBackdrop:k=!0,hideBackdrop:b=!1,keepMounted:n=!1,isCancelBackgroundClick:i,zIndex:v=e.MODAL_Z_INDEX,className:y,footer:u,testId:D,id:f}=m,h=q.useBearId("Modal"),c=j.resolveBearId(f,h),_=C&&!O,p=i!==void 0?i:k,S=A&&!B,t=E.useCallback(N=>{S&&N.key==="Escape"&&l()},[S,l]);if(E.useEffect(()=>{if(s)return document.addEventListener("keydown",t),_&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow=""}},[s,t,_]),!s&&!n)return null;const I=o.jsxs("div",{className:e.MODAL_ROOT_CLASSES,"data-testid":D,id:c,style:{zIndex:v},children:[!b&&o.jsx(w.Backdrop,{open:s,keepMounted:n,blur:!0,nested:!0,className:"Bear-Modal__backdrop",onClick:p?()=>l():void 0}),o.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":r?`${c}-title`:void 0,className:a.cn("Bear-Modal__container",e.MODAL_CONTAINER_CLASSES,e.MODAL_SIZE_CLASSES[M],y),style:{zIndex:e.MODAL_PANEL_Z_INDEX},children:[(r||d)&&o.jsxs("div",{className:a.cn("Bear-Modal__header",e.MODAL_HEADER_CLASSES),children:[r&&o.jsx("h2",{id:`${c}-title`,className:a.cn("Bear-Modal__title",e.MODAL_TITLE_CLASSES),children:r}),d&&o.jsx("button",{onClick:l,className:a.cn("Bear-Modal__close",e.MODAL_CLOSE_CLASSES),"aria-label":"Close modal",children:o.jsx(g.CloseIcon,{className:"bear-w-5 bear-h-5"})})]}),o.jsx("div",{className:a.cn("Bear-Modal__body",e.MODAL_BODY_CLASSES),children:L}),u&&o.jsx("div",{className:a.cn("Bear-Modal__footer",e.MODAL_FOOTER_CLASSES),children:u})]})]});return x.createPortal(I,document.body)};exports.Modal=R;
|
|
@@ -4,7 +4,7 @@ import { createPortal as x } from "react-dom";
|
|
|
4
4
|
import { cn as o } from "../../utils/cn.js";
|
|
5
5
|
import { resolveBearId as T } from "../../utils/generateBearId.utils.js";
|
|
6
6
|
import { useBearId as R } from "../../utils/useBearId.js";
|
|
7
|
-
import { CloseIcon as g } from "
|
|
7
|
+
import { CloseIcon as g } from "../../node_modules/@forgedevstack/bear-icons/dist/navigation.js";
|
|
8
8
|
import { Backdrop as z } from "../Backdrop/Backdrop.js";
|
|
9
9
|
import { MODAL_Z_INDEX as P, MODAL_ROOT_CLASSES as Z, MODAL_PANEL_Z_INDEX as j, MODAL_TITLE_CLASSES as X, MODAL_CLOSE_CLASSES as $, MODAL_HEADER_CLASSES as F, MODAL_BODY_CLASSES as H, MODAL_FOOTER_CLASSES as K, MODAL_SIZE_CLASSES as Y, MODAL_CONTAINER_CLASSES as q } from "./Modal.const.js";
|
|
10
10
|
const le = (u) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs");require("react");const u=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs");require("react");const u=require("@forgedevstack/bear-icons"),r=require("./PageNav.const.cjs"),p=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),h=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),d=({item:a,direction:l,linkClass:n,labelClass:b,iconClass:t,sizeClass:x,iconSize:c})=>{const s=l==="prev",o=a.href?"a":"button",j=a.href?{href:a.href}:{type:"button",onClick:a.onClick};return e.jsxs(o,{...j,className:i.cn("bear-flex bear-flex-col bear-gap-1 bear-no-underline bear-min-w-0",s?"bear-items-start":"bear-items-end bear-ml-auto",n,x),children:[e.jsx("span",{className:i.cn("bear-text-[10px] bear-font-semibold bear-uppercase bear-tracking-wider",b),children:s?"Previous":"Next"}),e.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1.5 bear-font-medium",children:[s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(p,{size:c})}),e.jsx("span",{className:"bear-truncate",children:a.label}),!s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(h,{size:c})})]})]})},f=({prev:a,next:l,size:n="md",variant:b="default",className:t,testId:x,"aria-label":c="Page navigation"})=>{if(!a&&!l)return null;const s=r.VARIANT_CLASSES[b],o=r.ICON_SIZE[n];return e.jsxs("nav",{"data-testid":x,className:i.cn(r.ROOT_CLASS,"bear-flex bear-items-start bear-justify-between bear-gap-4 bear-border-t bear-border-zinc-700/50",r.SIZE_CLASSES[n],t),"aria-label":c,children:[a?e.jsx(d,{item:a,direction:"prev",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{}),l?e.jsx(d,{item:l,direction:"next",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{})]})};exports.PageNav=f;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cn as l } from "../../utils/cn.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Icon as f } from "
|
|
4
|
+
import { Icon as f } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { ICON_SIZE as C, LINK_SIZE as d, VARIANT_CLASSES as u, SIZE_CLASSES as N, ROOT_CLASS as x } from "./PageNav.const.js";
|
|
6
6
|
const S = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "15 18 9 12 15 6" }) }), g = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "9 6 15 12 9 18" }) }), m = ({ item: e, direction: s, linkClass: n, labelClass: c, iconClass: i, sizeClass: b, iconSize: t }) => {
|
|
7
7
|
const r = s === "prev", o = e.href ? "a" : "button", h = e.href ? { href: e.href } : { type: "button", onClick: e.onClick };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),b=require("../../utils/cn.cjs"),L=require("../Input/Input.cjs"),i=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),b=require("../../utils/cn.cjs"),L=require("../Input/Input.cjs"),i=require("../../node_modules/@forgedevstack/bear-icons/dist/action.cjs"),_=b.cn("Bear-PasswordInput__shift bear-text-xs bear-font-medium bear-px-1.5 bear-py-0.5","bear-rounded bear-bg-amber-100 bear-text-amber-700","dark:bear-bg-amber-900/40 dark:bear-text-amber-400","bear-select-none bear-whitespace-nowrap"),S=({visible:t,onVisibilityChange:a,hideToggle:d=!1,toggleAriaLabel:u="Toggle password visibility",showShiftIndicator:n=!1,visibleIcon:l,hiddenIcon:p,...w})=>{const[x,m]=s.useState(!1),[f,I]=s.useState(!1),o=t!==void 0,c=o?t:x,g=s.useCallback(()=>{o?a==null||a(!t):m(e=>!e)},[o,t,a]);s.useEffect(()=>{if(!n)return;const e=j=>I(j.getModifierState("CapsLock"));return window.addEventListener("keydown",e),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",e)}},[n]);const v=r.jsx(i.VisibilityOffIcon,{className:"bear-w-4 bear-h-4"}),k=r.jsx(i.VisibilityIcon,{className:"bear-w-4 bear-h-4"}),y=d?void 0:r.jsxs("span",{className:"Bear-PasswordInput__actions bear-inline-flex bear-items-center bear-gap-1.5",children:[n&&f&&r.jsx("span",{className:_,children:"Caps"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:g,className:b.cn("Bear-PasswordInput__toggle bear-inline-flex bear-items-center bear-justify-center","bear-text-gray-400 hover:bear-text-gray-600 dark:hover:bear-text-gray-300","bear-transition-colors bear-cursor-pointer"),"aria-label":u,children:c?l??v:p??k})]});return r.jsx(L.Input,{type:c?"text":"password",rightAddon:y,autoComplete:"current-password",...w})};exports.PasswordInput=S;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as L, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as b, useCallback as _, useEffect as
|
|
2
|
+
import { useState as b, useCallback as _, useEffect as N } from "react";
|
|
3
3
|
import { cn as c } from "../../utils/cn.js";
|
|
4
|
-
import { Input as
|
|
5
|
-
import { VisibilityOffIcon as B, VisibilityIcon as C } from "
|
|
4
|
+
import { Input as E } from "../Input/Input.js";
|
|
5
|
+
import { VisibilityOffIcon as B, VisibilityIcon as C } from "../../node_modules/@forgedevstack/bear-icons/dist/action.js";
|
|
6
6
|
const O = c(
|
|
7
7
|
"Bear-PasswordInput__shift bear-text-xs bear-font-medium bear-px-1.5 bear-py-0.5",
|
|
8
8
|
"bear-rounded bear-bg-amber-100 bear-text-amber-700",
|
|
@@ -21,7 +21,7 @@ const O = c(
|
|
|
21
21
|
const [u, f] = b(!1), [w, x] = b(!1), n = a !== void 0, o = n ? a : u, k = _(() => {
|
|
22
22
|
n ? t == null || t(!a) : f((e) => !e);
|
|
23
23
|
}, [n, a, t]);
|
|
24
|
-
|
|
24
|
+
N(() => {
|
|
25
25
|
if (!s) return;
|
|
26
26
|
const e = (y) => x(y.getModifierState("CapsLock"));
|
|
27
27
|
return window.addEventListener("keydown", e), window.addEventListener("keyup", e), () => {
|
|
@@ -47,7 +47,7 @@ const O = c(
|
|
|
47
47
|
)
|
|
48
48
|
] });
|
|
49
49
|
return /* @__PURE__ */ r(
|
|
50
|
-
|
|
50
|
+
E,
|
|
51
51
|
{
|
|
52
52
|
type: o ? "text" : "password",
|
|
53
53
|
rightAddon: g,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("../../utils/cn.cjs"),j=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("../../utils/cn.cjs"),j=require("@forgedevstack/bear-icons"),l=require("./PropsPlayground.const.cjs"),$=require("./PropsPlayground.utils.cjs"),q=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),I=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),O=({size:b})=>e.jsxs(j.Icon,{size:b,children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),R=({config:b,render:v,title:z="Props",size:S="md",defaultCollapsed:C=!1,showReset:w=!0,columns:P=3,className:L,testId:E})=>{const u=c.useMemo(()=>$.getDefaults(b),[b]),[g,f]=c.useState(u),[m,A]=c.useState(C),o=c.useCallback((r,s)=>{f(i=>({...i,[r]:s}))},[]),_=c.useCallback(()=>{f(u)},[u]),t=l.SIZE_CLASSES[S],N=Object.keys(b).length,p=n.cn("bear-w-full bear-rounded-md bear-border bear-border-zinc-700","bear-bg-zinc-800 bear-text-zinc-100","placeholder:bear-text-zinc-500","focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-primary-500/30 focus:bear-border-primary-500","bear-transition-colors",t.input);return e.jsxs("div",{"data-testid":E,className:n.cn(l.ROOT_CLASS,"bear-rounded-lg bear-border bear-border-zinc-700 bear-overflow-hidden",L),children:[e.jsxs("button",{type:"button",onClick:()=>A(r=>!r),className:n.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-font-medium bear-transition-colors","bear-bg-zinc-800/60 hover:bear-bg-zinc-800","bear-text-zinc-200 bear-border-b bear-border-zinc-700","bear-px-4 bear-py-3",t.text),children:[e.jsx("span",{className:"bear-text-primary-500",children:m?e.jsx(I,{size:12}):e.jsx(q,{size:12})}),e.jsx("span",{className:"bear-text-primary-500",children:e.jsx(O,{size:14})}),e.jsx("span",{className:"bear-font-semibold",children:z}),e.jsxs("span",{className:"bear-ml-auto bear-flex bear-items-center bear-gap-2",children:[e.jsxs("span",{className:"bear-text-[10px] bear-font-medium bear-text-zinc-500",children:[N," ",N===1?"control":"controls"]}),w&&!m&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),_()},className:"bear-text-[10px] bear-font-semibold bear-text-primary-500 hover:bear-text-primary-400 hover:bear-underline",children:"Reset"})]})]}),!m&&e.jsx("div",{className:n.cn("bear-bg-gray-50 dark:bear-bg-zinc-900/50",t.padding),children:e.jsx("div",{className:n.cn("bear-grid",t.gap,l.COLUMN_CLASSES[P]),children:Object.entries(b).map(([r,s])=>{const i=g[r],d=r.replace(/([A-Z])/g," $1").replace(/^./,a=>a.toUpperCase()).trim();if(s.type==="boolean"){const a=i===!0;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsx("span",{className:n.cn("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500 bear-mb-2",t.label),children:l.TYPE_LABELS.boolean}),e.jsxs("label",{className:"bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":a,onClick:()=>o(r,!a),className:n.cn("bear-relative bear-inline-flex bear-h-5 bear-w-9 bear-flex-shrink-0 bear-rounded-full bear-border-2 bear-border-transparent bear-transition-colors",a?"bear-bg-primary-500":"bear-bg-zinc-600"),children:e.jsx("span",{className:n.cn("bear-pointer-events-none bear-inline-block bear-h-4 bear-w-4 bear-transform bear-rounded-full bear-bg-white bear-shadow bear-transition",a?"bear-translate-x-4":"bear-translate-x-0")})}),e.jsx("span",{className:n.cn("bear-font-medium bear-text-zinc-200 bear-truncate",t.text),children:d})]})]},r)}if(s.type==="select"&&s.options)return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.select})]}),e.jsx("select",{id:`pp-${r}`,value:String(i),onChange:a=>{const x=s.options.find(h=>String(h.value)===a.target.value);o(r,x?x.value:a.target.value)},className:n.cn(p,"bear-cursor-pointer bear-appearance-none"),children:s.options.map(a=>e.jsx("option",{value:String(a.value),children:a.label},String(a.value)))})]},r);if(s.type==="number"){const a=Number(i),x=Number.isNaN(a)?s.default:a;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.number})]}),e.jsx("input",{id:`pp-${r}`,type:"number",value:x,min:s.min,max:s.max,step:s.step,onChange:h=>{const y=h.target.valueAsNumber;o(r,Number.isNaN(y)?s.default:y)},className:p})]},r)}return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-primary-500",t.label),children:l.TYPE_LABELS.string})]}),e.jsx("input",{id:`pp-${r}`,type:"text",value:String(i??""),onChange:a=>o(r,a.target.value),placeholder:s.placeholder,className:p})]},r)})})}),e.jsx("div",{className:"bear-border-t bear-border-gray-200 dark:bear-border-zinc-700 bear-p-6 bear-bg-white dark:bear-bg-zinc-900 bear-flex bear-items-center bear-justify-center bear-min-h-[180px]",children:e.jsx("div",{className:"bear-w-full",children:v(g)})})]})};exports.PropsPlayground=R;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as _, useState as z, useCallback as w } from "react";
|
|
3
3
|
import { cn as n } from "../../utils/cn.js";
|
|
4
|
-
import { Icon as g } from "
|
|
4
|
+
import { Icon as g } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { SIZE_CLASSES as F, TYPE_LABELS as m, COLUMN_CLASSES as I, ROOT_CLASS as V } from "./PropsPlayground.const.js";
|
|
6
6
|
import { getDefaults as k } from "./PropsPlayground.utils.js";
|
|
7
7
|
const D = ({ size: i }) => /* @__PURE__ */ e(g, { size: i, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) }), M = ({ size: i }) => /* @__PURE__ */ e(g, { size: i, children: /* @__PURE__ */ e("polyline", { points: "9 18 15 12 9 6" }) }), T = ({ size: i }) => /* @__PURE__ */ t(g, { size: i, children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../../constants/generals.const.cjs"),o=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../../constants/generals.const.cjs"),o=require("@forgedevstack/bear-icons"),S={filled:o.StarIcon,half:o.StarHalfIcon,empty:o.StarBorderIcon},I=r=>{const{size:n,state:t,color:c,emptyColor:s}=r,a=S[t],i=t===l.RATING_STAR_STATE_EMPTY?s:c;return e.jsx("div",{className:"Bear-Rating__star-icon",children:e.jsx(a,{size:n,color:i})})};exports.StarIcon=I;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { RATING_STAR_STATE_EMPTY as s } from "../../../../constants/generals.const.js";
|
|
3
|
-
import { StarBorderIcon as i, StarHalfIcon as l, StarIcon as m } from "
|
|
3
|
+
import { StarBorderIcon as i, StarHalfIcon as l, StarIcon as m } from "@forgedevstack/bear-icons";
|
|
4
4
|
const S = {
|
|
5
5
|
filled: m,
|
|
6
6
|
half: l,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("../../constants/numbers.const.cjs"),r=require("../../constants/generals.const.cjs"),e=require("@forgedevstack/bear-icons"),c=require("../Typography/Typography.cjs"),i={success:e.CheckCircleIcon,error:e.ErrorIcon,info:e.InfoIcon,warning:e.WarningIcon},S=[r.STATUS_NOT_FOUND,r.STATUS_FORBIDDEN,r.STATUS_SERVER_ERROR],T=n=>S.includes(n),a=n=>{const o=i[n];return o?t.jsx(o,{size:s.SIXTY_FOUR}):t.jsx(c.Typography,{variant:"h2",className:"bear-font-bold bear-leading-none",children:n})};exports.getStatusIcon=a;exports.isTextStatus=T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { SIXTY_FOUR as t } from "../../constants/numbers.const.js";
|
|
3
3
|
import { STATUS_NOT_FOUND as e, STATUS_FORBIDDEN as c, STATUS_SERVER_ERROR as T } from "../../constants/generals.const.js";
|
|
4
|
-
import { WarningIcon as i, InfoIcon as S, ErrorIcon as s, CheckCircleIcon as m } from "
|
|
4
|
+
import { WarningIcon as i, InfoIcon as S, ErrorIcon as s, CheckCircleIcon as m } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { Typography as a } from "../Typography/Typography.js";
|
|
6
6
|
const I = {
|
|
7
7
|
success: m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),c=require("../../../../utils/cn.cjs"),N=require("../../../../hooks/useClickOutside.cjs");require("../../../../context/BearProvider.cjs");require("../../../../hooks/useBearComponent/useBearComponent.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),c=require("../../../../utils/cn.cjs"),N=require("../../../../hooks/useClickOutside.cjs");require("../../../../context/BearProvider.cjs");require("../../../../hooks/useBearComponent/useBearComponent.cjs");const o=require("../../../../constants/numbers.const.cjs"),t=require("../../../../constants/generals.const.cjs"),j=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),q=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs");require("../../../FormControl/FormControl.context.cjs");const p=require("@forgedevstack/bear-icons"),L=require("../../../OverlayPortal/OverlayPortal.cjs"),R=require("../../../Tooltip/Tooltip.cjs"),P=require("../../RichEditor.const.cjs"),w=require("./ToolbarColorPicker.const.cjs"),I=O=>{const{value:n,onChange:E,title:b,disabled:i,type:s=t.COLOR_TYPE_TEXT,recentColors:l=[],onApplyLast:x}=O,[a,d]=h.useState(!1),u=h.useRef(null),y=h.useRef(null),{style:T,ready:C}=j.useFixedAnchorPosition({anchorRef:u,open:a,minWidthPx:o.TWO_HUNDRED_FORTY});N.useClickOutsideMultiple([u,y],()=>d(!1),{enabled:a});const g=r=>{E(r),d(!1)},f=s===t.COLOR_TYPE_TEXT?p.FormatColorTextIcon:p.HighlightIcon,_=l[o.ZERO]||n,k=s===t.COLOR_TYPE_TEXT?t.COLOR_BLACK:t.COLOR_HIGHLIGHT_YELLOW,m=s===t.COLOR_TYPE_TEXT?"Apply last text color":"Apply last highlight color";return e.jsxs("div",{className:"Bear-RichEditor__color-picker relative flex items-center",children:[e.jsx(R.Tooltip,{content:b,delay:o.FOUR_HUNDRED,position:"top",children:e.jsxs("button",{ref:u,type:"button","aria-label":b,disabled:i,onClick:()=>d(!a),className:c.cn("Bear-RichEditor__color-trigger p-1.5 rounded transition-colors","text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-zinc-700","flex items-center gap-0.5",i&&"Bear-RichEditor__color-trigger--disabled opacity-50 cursor-not-allowed"),children:[e.jsx(f,{size:o.SIXTEEN}),e.jsx("span",{className:"w-3 h-1 rounded-sm mt-0.5",style:{backgroundColor:n||k}})]})}),_&&x&&e.jsx(R.Tooltip,{content:m,delay:o.FOUR_HUNDRED,position:"top",children:e.jsx("button",{type:"button","aria-label":m,disabled:i,onClick:()=>x(_),className:c.cn("Bear-RichEditor__color-apply p-0.5 rounded transition-colors","text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700",i&&"opacity-50 cursor-not-allowed"),children:e.jsx(p.CheckIcon,{size:o.TWELVE})})}),e.jsxs(L.OverlayPortal,{open:a,ready:C,style:T,zIndex:q.ANCHOR_DEFAULT_Z_INDEX,panelRef:y,className:"Bear-RichEditor__color-menu p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px] max-w-[min(90vw,240px)]",children:[l.length>o.ZERO&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:"Recent"}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:l.slice(o.ZERO,w.COLOR_RECENT_MAX).map((r,v)=>e.jsx("button",{type:"button",onClick:()=>g(r),className:c.cn("w-6 h-6 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",n===r&&"ring-2 ring-primary-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:r},title:r},`recent-${v}`))})]}),e.jsx("div",{className:"grid grid-cols-8 gap-1",children:P.RICH_EDITOR_COLORS.map(r=>e.jsx("button",{type:"button",onClick:()=>g(r),className:c.cn("Bear-RichEditor__color-swatch w-5 h-5 rounded-full border border-gray-300 dark:border-zinc-600 transition-transform hover:scale-110 touch-manipulation",n===r&&"ring-2 ring-primary-500 ring-offset-1 dark:ring-offset-zinc-800"),style:{backgroundColor:r},title:r},r))}),e.jsxs("button",{type:"button",onClick:()=>g(""),className:"w-full mt-2 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded transition-colors touch-manipulation",children:["Remove ",s===t.COLOR_TYPE_TEXT?"color":"highlight"]})]})]})};exports.ToolbarColorPicker=I;
|
|
@@ -9,7 +9,7 @@ import { COLOR_TYPE_TEXT as e, COLOR_BLACK as H, COLOR_HIGHLIGHT_YELLOW as B } f
|
|
|
9
9
|
import { useFixedAnchorPosition as D } from "../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.js";
|
|
10
10
|
import { ANCHOR_DEFAULT_Z_INDEX as F } from "../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js";
|
|
11
11
|
import "../../../FormControl/FormControl.context.js";
|
|
12
|
-
import { FormatColorTextIcon as P, HighlightIcon as S, CheckIcon as U } from "
|
|
12
|
+
import { FormatColorTextIcon as P, HighlightIcon as S, CheckIcon as U } from "@forgedevstack/bear-icons";
|
|
13
13
|
import { OverlayPortal as W } from "../../../OverlayPortal/OverlayPortal.js";
|
|
14
14
|
import { Tooltip as _ } from "../../../Tooltip/Tooltip.js";
|
|
15
15
|
import { RICH_EDITOR_COLORS as X } from "../../RichEditor.const.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),h=require("../../../../utils/cn.cjs"),R=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),h=require("../../../../utils/cn.cjs"),R=require("@forgedevstack/bear-icons"),w=require("../../../OverlayPortal/OverlayPortal.cjs"),v=require("../../../Tooltip/Tooltip.cjs"),f=require("../../../../hooks/useClickOutside.cjs");require("../../../../context/BearProvider.cjs");require("../../../../hooks/useBearComponent/useBearComponent.cjs");const s=require("../../../../constants/numbers.const.cjs"),E=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),q=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs");require("../../../FormControl/FormControl.context.cjs");const k=x=>{const{options:l,value:c,onChange:g,title:d,disabled:u,icon:p}=x,[o,t]=a.useState(!1),n=a.useRef(null),b=a.useRef(null),{style:y,ready:m}=E.useFixedAnchorPosition({anchorRef:n,open:o,minWidthPx:s.ONE_HUNDRED_FIFTY});f.useClickOutsideMultiple([n,b],()=>t(!1),{enabled:o});const i=l.find(e=>e.value===c),_=e=>{g(e.value),t(!1)};return r.jsxs("div",{className:"Bear-RichEditor__dropdown relative",children:[r.jsx(v.Tooltip,{content:d,delay:s.FOUR_HUNDRED,position:"top",children:r.jsxs("button",{ref:n,type:"button","aria-label":d,disabled:u,onClick:()=>t(!o),className:h.cn("Bear-RichEditor__dropdown-trigger p-1.5 rounded transition-colors","text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-zinc-700","flex items-center gap-1 min-w-[80px]",u&&"Bear-RichEditor__dropdown-trigger--disabled opacity-50 cursor-not-allowed"),children:[p&&r.jsx("span",{className:"Bear-RichEditor__dropdown-icon",children:p}),r.jsx("span",{className:"Bear-RichEditor__dropdown-label text-xs truncate",children:(i==null?void 0:i.label)||"Normal"}),r.jsx(R.ChevronDownIcon,{size:s.TWELVE})]})}),r.jsx(w.OverlayPortal,{open:o,ready:m,style:y,zIndex:q.ANCHOR_DEFAULT_Z_INDEX,panelRef:b,className:"Bear-RichEditor__dropdown-menu min-w-[140px] bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-lg py-1",children:l.map(e=>r.jsx("button",{type:"button",onClick:()=>_(e),className:h.cn("Bear-RichEditor__dropdown-option","w-full px-3 py-2 text-left text-sm transition-colors","hover:bg-gray-100 dark:hover:bg-zinc-700",e.value===c?"bg-primary-50 dark:bg-primary-900/20 text-primary-600 dark:text-primary-400":"text-gray-700 dark:text-gray-300"),children:e.preview||e.label},e.value))})]})};exports.ToolbarDropdown=k;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as _, useRef as h } from "react";
|
|
3
3
|
import { cn as g } from "../../../../utils/cn.js";
|
|
4
|
-
import { ChevronDownIcon as w } from "
|
|
4
|
+
import { ChevronDownIcon as w } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { OverlayPortal as R } from "../../../OverlayPortal/OverlayPortal.js";
|
|
6
6
|
import { Tooltip as v } from "../../../Tooltip/Tooltip.js";
|
|
7
7
|
import { useClickOutsideMultiple as E } from "../../../../hooks/useClickOutside.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),x=require("../../../../utils/cn.cjs"),h=require("../../../OverlayPortal/OverlayPortal.cjs"),b=require("../../../Tooltip/Tooltip.cjs"),p=require("../../../../hooks/useClickOutside.cjs");require("../../../../context/BearProvider.cjs");require("../../../../hooks/useBearComponent/useBearComponent.cjs");const i=require("../../../../constants/numbers.const.cjs"),_=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),g=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs");require("../../../FormControl/FormControl.context.cjs");const a=require("../../RichEditor.const.cjs"),R=require("@forgedevstack/bear-icons"),y=l=>{const{children:d,disabled:n}=l,[r,s]=t.useState(!1),o=t.useRef(null),c=t.useRef(null),{style:u,ready:m}=_.useFixedAnchorPosition({anchorRef:o,open:r,minWidthPx:i.TWO_HUNDRED_TWENTY,placement:"bottom-end"});return p.useClickOutsideMultiple([o,c],()=>s(!1),{enabled:r}),e.jsxs("div",{className:"Bear-RichEditor__more relative",children:[e.jsx(b.Tooltip,{content:a.TITLE_MORE_OPTIONS,delay:i.FOUR_HUNDRED,position:"top",children:e.jsx("button",{ref:o,type:"button","aria-label":a.TITLE_MORE_OPTIONS,disabled:n,onClick:()=>s(!r),className:x.cn("Bear-RichEditor__more-trigger p-1.5 rounded transition-colors","text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-zinc-700","flex items-center justify-center",r&&"bg-primary-500 text-white",n&&"Bear-RichEditor__more-trigger--disabled opacity-50 cursor-not-allowed"),children:e.jsx(R.MoreHorizIcon,{size:i.SIXTEEN})})}),e.jsx(h.OverlayPortal,{open:r,ready:m,style:u,zIndex:g.ANCHOR_DEFAULT_Z_INDEX,panelRef:c,className:"Bear-RichEditor__more-menu p-2 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl min-w-[200px] max-w-[min(90vw,280px)] max-h-[70vh] overflow-y-auto",children:e.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:d})})]})};exports.ToolbarMore=y;
|
|
@@ -11,7 +11,7 @@ import { useFixedAnchorPosition as y } from "../../../../hooks/useFixedAnchorPos
|
|
|
11
11
|
import { ANCHOR_DEFAULT_Z_INDEX as E } from "../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js";
|
|
12
12
|
import "../../../FormControl/FormControl.context.js";
|
|
13
13
|
import { TITLE_MORE_OPTIONS as m } from "../../RichEditor.const.js";
|
|
14
|
-
import { MoreHorizIcon as N } from "
|
|
14
|
+
import { MoreHorizIcon as N } from "@forgedevstack/bear-icons";
|
|
15
15
|
const A = (l) => {
|
|
16
16
|
const { children: s, disabled: t } = l, [r, i] = f(!1), o = a(null), n = a(null), { style: c, ready: d } = y({
|
|
17
17
|
anchorRef: o,
|
|
@@ -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"),n=require("react"),p=require("../../../../utils/cn.cjs"),E=require("../../../../hooks/useClickOutside.cjs");require("../../../../context/BearProvider.cjs");require("../../../../hooks/useBearComponent/useBearComponent.cjs");const i=require("../../../../constants/numbers.const.cjs"),q=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),y=require("../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs");require("../../../FormControl/FormControl.context.cjs");const f=require("@forgedevstack/bear-icons"),m=require("../../../OverlayPortal/OverlayPortal.cjs"),T=require("../../../SignPad/SignPad.cjs"),j=require("../../../Tooltip/Tooltip.cjs"),d=require("../../../Button/Button.cjs"),h=require("../../RichEditor.const.cjs"),N=g=>{const{title:a,disabled:c,onInsert:b}=g,[r,t]=n.useState(!1),[o,l]=n.useState(null),s=n.useRef(null),u=n.useRef(null),{style:R,ready:_}=q.useFixedAnchorPosition({anchorRef:s,open:r,minWidthPx:i.FOUR_HUNDRED});E.useClickOutsideMultiple([s,u],()=>t(!1),{enabled:r});const x=()=>{o&&(b(o),l(null),t(!1))};return e.jsxs("div",{className:"Bear-RichEditor__signature relative",children:[e.jsx(j.Tooltip,{content:a,delay:i.FOUR_HUNDRED,position:"top",children:e.jsx("button",{ref:s,type:"button","aria-label":a,disabled:c,onClick:()=>t(!r),className:p.cn("Bear-RichEditor__button p-1.5 rounded transition-colors","text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-zinc-700",r&&"Bear-RichEditor__button--active bg-primary-500 text-white",c&&"Bear-RichEditor__button--disabled opacity-50 cursor-not-allowed"),children:e.jsx(f.EditIcon,{size:i.SIXTEEN})})}),e.jsxs(m.OverlayPortal,{open:r,ready:_,style:R,zIndex:y.ANCHOR_DEFAULT_Z_INDEX,panelRef:u,className:"Bear-RichEditor__signature-menu p-3 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-lg shadow-xl",children:[e.jsx(T.SignPad,{height:i.TWO_HUNDRED,onChange:l,placeholder:"Sign here"}),e.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[e.jsx(d.Button,{size:"sm",variant:"ghost",onClick:()=>t(!1),children:h.TITLE_CANCEL}),e.jsx(d.Button,{size:"sm",variant:"primary",onClick:x,disabled:!o,children:h.TITLE_INSERT})]})]})]})};exports.ToolbarSignature=N;
|
|
@@ -8,7 +8,7 @@ import { FOUR_HUNDRED as p, SIXTEEN as y, TWO_HUNDRED as x } from "../../../../c
|
|
|
8
8
|
import { useFixedAnchorPosition as N } from "../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.js";
|
|
9
9
|
import { ANCHOR_DEFAULT_Z_INDEX as I } from "../../../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js";
|
|
10
10
|
import "../../../FormControl/FormControl.context.js";
|
|
11
|
-
import { EditIcon as T } from "
|
|
11
|
+
import { EditIcon as T } from "@forgedevstack/bear-icons";
|
|
12
12
|
import { OverlayPortal as v } from "../../../OverlayPortal/OverlayPortal.js";
|
|
13
13
|
import { SignPad as k } from "../../../SignPad/SignPad.js";
|
|
14
14
|
import { Tooltip as C } from "../../../Tooltip/Tooltip.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../constants/numbers.const.cjs"),n=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../constants/numbers.const.cjs"),n=require("../../../node_modules/@forgedevstack/bear-icons/dist/editor.cjs"),s={bold:e.jsx(n.BoldIcon,{size:i.SIXTEEN}),italic:e.jsx(n.ItalicIcon,{size:i.SIXTEEN}),underline:e.jsx(n.UnderlineIcon,{size:i.SIXTEEN}),strikethrough:e.jsx(n.StrikethroughIcon,{size:i.SIXTEEN}),heading1:e.jsx(n.Heading1Icon,{size:i.SIXTEEN}),heading2:e.jsx(n.Heading2Icon,{size:i.SIXTEEN}),heading3:e.jsx(n.Heading3Icon,{size:i.SIXTEEN}),bulletList:e.jsx(n.ListBulletIcon,{size:i.SIXTEEN}),orderedList:e.jsx(n.ListNumberedIcon,{size:i.SIXTEEN}),blockquote:e.jsx(n.QuoteIcon,{size:i.SIXTEEN}),code:e.jsx(n.CodeIcon,{size:i.SIXTEEN}),link:e.jsx(n.InsertLinkIcon,{size:i.SIXTEEN}),alignLeft:e.jsx(n.AlignLeftIcon,{size:i.SIXTEEN}),alignCenter:e.jsx(n.AlignCenterIcon,{size:i.SIXTEEN}),alignRight:e.jsx(n.AlignRightIcon,{size:i.SIXTEEN}),alignJustify:e.jsx(n.AlignJustifyIcon,{size:i.SIXTEEN}),image:e.jsx(n.InsertPhotoIcon,{size:i.SIXTEEN}),indent:e.jsx(n.IndentIncreaseIcon,{size:i.SIXTEEN}),outdent:e.jsx(n.IndentDecreaseIcon,{size:i.SIXTEEN}),clearFormat:e.jsx(n.FormatClearIcon,{size:i.SIXTEEN}),table:e.jsx(n.TableIcon,{size:i.SIXTEEN})};exports.RICH_EDITOR_ICONS=s;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { SIXTEEN as i } from "../../../constants/numbers.const.js";
|
|
3
|
-
import { TableIcon as
|
|
4
|
-
const
|
|
3
|
+
import { TableIcon as s, FormatClearIcon as n, IndentDecreaseIcon as o, IndentIncreaseIcon as a, InsertPhotoIcon as t, AlignJustifyIcon as I, AlignRightIcon as c, AlignCenterIcon as r, AlignLeftIcon as l, InsertLinkIcon as z, CodeIcon as d, QuoteIcon as g, ListNumberedIcon as u, ListBulletIcon as m, Heading3Icon as h, Heading2Icon as f, Heading1Icon as L, StrikethroughIcon as C, UnderlineIcon as b, ItalicIcon as k, BoldIcon as p } from "../../../node_modules/@forgedevstack/bear-icons/dist/editor.js";
|
|
4
|
+
const x = {
|
|
5
5
|
bold: /* @__PURE__ */ e(p, { size: i }),
|
|
6
6
|
italic: /* @__PURE__ */ e(k, { size: i }),
|
|
7
|
-
underline: /* @__PURE__ */ e(
|
|
8
|
-
strikethrough: /* @__PURE__ */ e(
|
|
7
|
+
underline: /* @__PURE__ */ e(b, { size: i }),
|
|
8
|
+
strikethrough: /* @__PURE__ */ e(C, { size: i }),
|
|
9
9
|
heading1: /* @__PURE__ */ e(L, { size: i }),
|
|
10
10
|
heading2: /* @__PURE__ */ e(f, { size: i }),
|
|
11
|
-
heading3: /* @__PURE__ */ e(
|
|
12
|
-
bulletList: /* @__PURE__ */ e(
|
|
11
|
+
heading3: /* @__PURE__ */ e(h, { size: i }),
|
|
12
|
+
bulletList: /* @__PURE__ */ e(m, { size: i }),
|
|
13
13
|
orderedList: /* @__PURE__ */ e(u, { size: i }),
|
|
14
14
|
blockquote: /* @__PURE__ */ e(g, { size: i }),
|
|
15
15
|
code: /* @__PURE__ */ e(d, { size: i }),
|
|
16
16
|
link: /* @__PURE__ */ e(z, { size: i }),
|
|
17
|
-
alignLeft: /* @__PURE__ */ e(
|
|
18
|
-
alignCenter: /* @__PURE__ */ e(
|
|
19
|
-
alignRight: /* @__PURE__ */ e(
|
|
20
|
-
alignJustify: /* @__PURE__ */ e(
|
|
21
|
-
image: /* @__PURE__ */ e(
|
|
22
|
-
indent: /* @__PURE__ */ e(
|
|
23
|
-
outdent: /* @__PURE__ */ e(
|
|
24
|
-
clearFormat: /* @__PURE__ */ e(
|
|
25
|
-
table: /* @__PURE__ */ e(
|
|
17
|
+
alignLeft: /* @__PURE__ */ e(l, { size: i }),
|
|
18
|
+
alignCenter: /* @__PURE__ */ e(r, { size: i }),
|
|
19
|
+
alignRight: /* @__PURE__ */ e(c, { size: i }),
|
|
20
|
+
alignJustify: /* @__PURE__ */ e(I, { size: i }),
|
|
21
|
+
image: /* @__PURE__ */ e(t, { size: i }),
|
|
22
|
+
indent: /* @__PURE__ */ e(a, { size: i }),
|
|
23
|
+
outdent: /* @__PURE__ */ e(o, { size: i }),
|
|
24
|
+
clearFormat: /* @__PURE__ */ e(n, { size: i }),
|
|
25
|
+
table: /* @__PURE__ */ e(s, { size: i })
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
x as RICH_EDITOR_ICONS
|
|
29
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("../../../constants/numbers.const.cjs"),T=require("../../../constants/generals.const.cjs"),l=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("../../../constants/numbers.const.cjs"),T=require("../../../constants/generals.const.cjs"),l=require("../../../node_modules/@forgedevstack/bear-icons/dist/editor.cjs"),E=require("../components/ToolbarButton/ToolbarButton.cjs"),A=require("../components/ToolbarDropdown/ToolbarDropdown.cjs"),L=require("../components/ToolbarColorPicker/ToolbarColorPicker.cjs"),N=require("../components/ToolbarMore/ToolbarMore.cjs"),M=require("../components/ToolbarSignature/ToolbarSignature.cjs"),I=require("../RichEditor.const.cjs"),d=require("./IconRender.cjs"),c=e=>{const n=e.disabled||e.readOnly,R={[T.TOOLBAR_ITEM_DIVIDER]:_=>o.jsx("div",{className:"Bear-RichEditor__divider w-px h-5 bg-gray-300 dark:bg-zinc-600 mx-1"},`${T.TOOLBAR_ITEM_DIVIDER}-${_}`),[T.TOOLBAR_ITEM_HEADING_DROPDOWN]:()=>o.jsx(A.ToolbarDropdown,{options:I.RICH_EDITOR_HEADING_OPTIONS,value:e.currentBlock,onChange:e.handleHeadingChange,title:I.TITLE_TEXT_STYLE,disabled:n,icon:o.jsx(l.TextIcon,{size:i.SIXTEEN})},T.TOOLBAR_ITEM_HEADING_DROPDOWN),[T.TOOLBAR_ITEM_TEXT_COLOR]:()=>o.jsx(L.ToolbarColorPicker,{value:e.textColorValue,onChange:e.handleTextColor,title:I.TITLE_TEXT_COLOR,disabled:n,type:"text",recentColors:e.recentTextColors,onApplyLast:e.handleApplyLastTextColor},T.TOOLBAR_ITEM_TEXT_COLOR),[T.TOOLBAR_ITEM_HIGHLIGHT_COLOR]:()=>o.jsx(L.ToolbarColorPicker,{value:e.highlightColorValue,onChange:e.handleHighlightColor,title:I.TITLE_HIGHLIGHT_COLOR,disabled:n,type:"highlight",recentColors:e.recentHighlightColors,onApplyLast:e.handleApplyLastHighlightColor},T.TOOLBAR_ITEM_HIGHLIGHT_COLOR),[T.TOOLBAR_ITEM_LINK]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.InsertLinkIcon,{size:i.SIXTEEN}),title:I.TITLE_INSERT_LINK,onClick:e.handleLink,disabled:n},T.TOOLBAR_ITEM_LINK),[T.TOOLBAR_ITEM_IMAGE]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.InsertPhotoIcon,{size:i.SIXTEEN}),title:I.TITLE_INSERT_IMAGE,onClick:e.handleImageUpload,disabled:n},T.TOOLBAR_ITEM_IMAGE),[T.TOOLBAR_ITEM_SIGNATURE]:()=>o.jsx(M.ToolbarSignature,{title:I.TITLE_INSERT_SIGNATURE,disabled:n,onInsert:e.handleInsertSignature},T.TOOLBAR_ITEM_SIGNATURE),[T.TOOLBAR_ITEM_ALIGN_LEFT]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.AlignLeftIcon,{size:i.SIXTEEN}),title:I.TITLE_ALIGN_LEFT,onClick:()=>e.execAlign(T.COMMAND_JUSTIFY_LEFT),disabled:n},T.TOOLBAR_ITEM_ALIGN_LEFT),[T.TOOLBAR_ITEM_ALIGN_CENTER]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.AlignCenterIcon,{size:i.SIXTEEN}),title:I.TITLE_ALIGN_CENTER,onClick:()=>e.execAlign(T.COMMAND_JUSTIFY_CENTER),disabled:n},T.TOOLBAR_ITEM_ALIGN_CENTER),[T.TOOLBAR_ITEM_ALIGN_RIGHT]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.AlignRightIcon,{size:i.SIXTEEN}),title:I.TITLE_ALIGN_RIGHT,onClick:()=>e.execAlign(T.COMMAND_JUSTIFY_RIGHT),disabled:n},T.TOOLBAR_ITEM_ALIGN_RIGHT),[T.TOOLBAR_ITEM_ALIGN_JUSTIFY]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.AlignJustifyIcon,{size:i.SIXTEEN}),title:I.TITLE_JUSTIFY,onClick:()=>e.execAlign(T.COMMAND_JUSTIFY_FULL),disabled:n},T.TOOLBAR_ITEM_ALIGN_JUSTIFY),[T.TOOLBAR_ITEM_INDENT]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.IndentIncreaseIcon,{size:i.SIXTEEN}),title:I.TITLE_INCREASE_INDENT,onClick:()=>e.execAlign(T.COMMAND_INDENT),disabled:n},T.TOOLBAR_ITEM_INDENT),[T.TOOLBAR_ITEM_OUTDENT]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.IndentDecreaseIcon,{size:i.SIXTEEN}),title:I.TITLE_DECREASE_INDENT,onClick:()=>e.execAlign(T.COMMAND_OUTDENT),disabled:n},T.TOOLBAR_ITEM_OUTDENT),[T.TOOLBAR_ITEM_CLEAR_FORMAT]:()=>o.jsx(E.ToolbarButton,{icon:o.jsx(l.FormatClearIcon,{size:i.SIXTEEN}),title:I.TITLE_CLEAR_FORMATTING,onClick:()=>e.execAlign(T.COMMAND_REMOVE_FORMAT),disabled:n},T.TOOLBAR_ITEM_CLEAR_FORMAT),[T.TOOLBAR_ITEM_MORE]:()=>{const _=e.isMobile?I.RICH_EDITOR_MOBILE_MORE_ITEMS:I.RICH_EDITOR_DESKTOP_MORE_ITEMS;return o.jsx(N.ToolbarMore,{disabled:n,isMobile:e.isMobile,children:_.map((t,r)=>O(t,r))},T.TOOLBAR_ITEM_MORE)}},O=(_,t)=>{const r=R[_];if(r)return r(t);const s=I.RICH_EDITOR_BUTTON_CONFIG[_],a=d.RICH_EDITOR_ICONS[_];return!s||!a?null:o.jsx(E.ToolbarButton,{icon:a,title:s.title,active:e.activeFormats.has(_),onClick:()=>e.handleFormat(_),disabled:n},_)};return O};exports.createToolbarItemRenderer=c;
|