@forgedevstack/bear 1.0.1 → 1.0.3
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/ActiveBar/ActiveBar.cjs +8 -0
- package/dist/components/ActiveBar/ActiveBar.d.ts +2 -0
- package/dist/components/ActiveBar/ActiveBar.js +90 -0
- package/dist/components/ActiveBar/ActiveBar.types.d.ts +16 -0
- package/dist/components/ActiveBar/index.d.ts +2 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +38 -38
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +15 -15
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.constants.cjs +1 -0
- package/dist/components/Badge/Badge.constants.d.ts +6 -0
- package/dist/components/Badge/Badge.constants.js +34 -0
- package/dist/components/Badge/Badge.js +27 -52
- package/dist/components/Box/Box.cjs +1 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.js +64 -0
- package/dist/components/Box/Box.types.d.ts +24 -0
- package/dist/components/Box/Box.utils.cjs +1 -0
- package/dist/components/Box/Box.utils.d.ts +3 -0
- package/dist/components/Box/Box.utils.js +21 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -57
- package/dist/components/Button/Button.constants.cjs +57 -0
- package/dist/components/Button/Button.constants.d.ts +3 -0
- package/dist/components/Button/Button.constants.js +77 -0
- package/dist/components/Button/Button.js +55 -119
- package/dist/components/Button/Button.types.d.ts +6 -1
- package/dist/components/ButtonGroup/ButtonGroup.cjs +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +17 -17
- package/dist/components/Calendar/Calendar.cjs +1 -0
- package/dist/components/Calendar/Calendar.const.cjs +1 -0
- package/dist/components/Calendar/Calendar.const.d.ts +18 -0
- package/dist/components/Calendar/Calendar.const.js +27 -0
- package/dist/components/Calendar/Calendar.d.ts +3 -0
- package/dist/components/Calendar/Calendar.js +189 -0
- package/dist/components/Calendar/Calendar.types.d.ts +128 -0
- package/dist/components/Calendar/Calendar.utils.cjs +1 -0
- package/dist/components/Calendar/Calendar.utils.d.ts +41 -0
- package/dist/components/Calendar/Calendar.utils.js +33 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.js +65 -65
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.js +48 -48
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +2 -0
- package/dist/components/CodeBlock/CodeBlock.js +55 -0
- package/dist/components/CodeBlock/CodeBlock.types.d.ts +10 -0
- package/dist/components/CodeBlock/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -0
- package/dist/components/Columns/Columns.d.ts +5 -0
- package/dist/components/Columns/Columns.js +54 -0
- package/dist/components/Columns/Columns.types.d.ts +17 -0
- package/dist/components/Columns/index.d.ts +2 -0
- package/dist/components/Container/Container.cjs +1 -1
- package/dist/components/Container/Container.js +15 -15
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +77 -85
- package/dist/components/DatePicker/DatePicker.types.d.ts +9 -0
- package/dist/components/DatePicker/DatePicker.utils.cjs +1 -0
- package/dist/components/DatePicker/DatePicker.utils.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.utils.js +9 -0
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +178 -0
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +26 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.cjs +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.d.ts +2 -0
- package/dist/components/DateTimePicker/DateTimePicker.utils.js +16 -0
- package/dist/components/DateTimePicker/index.d.ts +2 -0
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +29 -29
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +70 -70
- package/dist/components/Editable/Editable.cjs +1 -0
- package/dist/components/Editable/Editable.d.ts +10 -0
- package/dist/components/Editable/Editable.js +194 -0
- package/dist/components/Editable/Editable.types.d.ts +39 -0
- package/dist/components/Editable/index.d.ts +2 -0
- package/dist/components/Em/Em.cjs +1 -0
- package/dist/components/Em/Em.d.ts +2 -0
- package/dist/components/Em/Em.js +24 -0
- package/dist/components/Em/Em.types.d.ts +5 -0
- package/dist/components/Em/index.d.ts +2 -0
- package/dist/components/Fab/Fab.cjs +1 -1
- package/dist/components/Fab/Fab.js +43 -43
- package/dist/components/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/FileUpload/FileUpload.js +46 -49
- package/dist/components/FileUpload/FileUpload.utils.cjs +1 -0
- package/dist/components/FileUpload/FileUpload.utils.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.utils.js +9 -0
- package/dist/components/Flex/Flex.cjs +1 -1
- package/dist/components/Flex/Flex.js +58 -58
- package/dist/components/Grid/Grid.cjs +1 -1
- package/dist/components/Grid/Grid.js +60 -60
- package/dist/components/Highlight/Highlight.cjs +1 -0
- package/dist/components/Highlight/Highlight.d.ts +2 -0
- package/dist/components/Highlight/Highlight.js +28 -0
- package/dist/components/Highlight/Highlight.types.d.ts +6 -0
- package/dist/components/Highlight/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -0
- package/dist/components/HoverCard/HoverCard.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.js +68 -0
- package/dist/components/HoverCard/HoverCard.types.d.ts +13 -0
- package/dist/components/HoverCard/HoverCard.utils.cjs +1 -0
- package/dist/components/HoverCard/HoverCard.utils.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.utils.js +23 -0
- package/dist/components/HoverCard/index.d.ts +2 -0
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +5 -0
- package/dist/components/Icon/index.js +28 -21
- package/dist/components/Link/Link.cjs +1 -1
- package/dist/components/Link/Link.js +47 -47
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +117 -117
- package/dist/components/Mark/Mark.cjs +1 -0
- package/dist/components/Mark/Mark.d.ts +2 -0
- package/dist/components/Mark/Mark.js +26 -0
- package/dist/components/Mark/Mark.types.d.ts +5 -0
- package/dist/components/Mark/index.d.ts +2 -0
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +58 -58
- package/dist/components/Paper/Paper.cjs +1 -1
- package/dist/components/Paper/Paper.js +36 -36
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.js +79 -79
- package/dist/components/Rating/Rating.cjs +1 -1
- package/dist/components/Rating/Rating.js +37 -37
- package/dist/components/RichEditor/RichEditor.cjs +10 -0
- package/dist/components/RichEditor/RichEditor.d.ts +4 -0
- package/dist/components/RichEditor/RichEditor.icons.cjs +1 -0
- package/dist/components/RichEditor/RichEditor.icons.d.ts +16 -0
- package/dist/components/RichEditor/RichEditor.icons.js +62 -0
- package/dist/components/RichEditor/RichEditor.js +151 -0
- package/dist/components/RichEditor/RichEditor.types.d.ts +20 -0
- package/dist/components/RichEditor/RichEditor.utils.cjs +1 -0
- package/dist/components/RichEditor/RichEditor.utils.d.ts +3 -0
- package/dist/components/RichEditor/RichEditor.utils.js +22 -0
- package/dist/components/RichEditor/index.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/Sidebar.js +158 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +40 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.js +8 -8
- package/dist/components/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/SpeedDial/SpeedDial.js +40 -40
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +24 -24
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.constants.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.constants.d.ts +5 -0
- package/dist/components/TimePicker/TimePicker.constants.js +16 -0
- package/dist/components/TimePicker/TimePicker.js +91 -70
- package/dist/components/TimePicker/TimePicker.types.d.ts +5 -2
- package/dist/components/TimePicker/TimePicker.utils.cjs +1 -0
- package/dist/components/TimePicker/TimePicker.utils.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.utils.js +7 -0
- package/dist/components/TransferList/TransferList.cjs +1 -1
- package/dist/components/TransferList/TransferList.js +74 -74
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +52 -52
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +119 -91
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +6 -1
- package/dist/context/BearProvider.js +42 -38
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +6 -5
- package/dist/hooks/bearStyled.cjs +1 -0
- package/dist/hooks/bearStyled.d.ts +17 -0
- package/dist/hooks/bearStyled.js +17 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +14 -10
- package/dist/hooks/useBearStyles.cjs +1 -0
- package/dist/hooks/useBearStyles.d.ts +11 -0
- package/dist/hooks/useBearStyles.js +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +146 -113
- package/dist/styles.css +1 -1
- package/dist/types/bis.types.d.ts +9 -0
- package/dist/types/component.types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -3,61 +3,61 @@ import { forwardRef as f } from "react";
|
|
|
3
3
|
import { cn as i } from "../../utils/cn.js";
|
|
4
4
|
const w = {
|
|
5
5
|
0: "",
|
|
6
|
-
1: "
|
|
7
|
-
2: "
|
|
8
|
-
3: "
|
|
9
|
-
4: "
|
|
10
|
-
5: "
|
|
6
|
+
1: "bear-shadow-sm",
|
|
7
|
+
2: "bear-shadow",
|
|
8
|
+
3: "bear-shadow-md",
|
|
9
|
+
4: "bear-shadow-lg",
|
|
10
|
+
5: "bear-shadow-xl"
|
|
11
11
|
}, c = {
|
|
12
|
-
none: "
|
|
13
|
-
sm: "
|
|
14
|
-
md: "
|
|
15
|
-
lg: "
|
|
16
|
-
xl: "
|
|
17
|
-
full: "
|
|
12
|
+
none: "bear-rounded-none",
|
|
13
|
+
sm: "bear-rounded-sm",
|
|
14
|
+
md: "bear-rounded-md",
|
|
15
|
+
lg: "bear-rounded-lg",
|
|
16
|
+
xl: "bear-rounded-xl",
|
|
17
|
+
full: "bear-rounded-full"
|
|
18
18
|
}, y = {
|
|
19
19
|
none: "",
|
|
20
|
-
sm: "
|
|
21
|
-
md: "
|
|
22
|
-
lg: "
|
|
20
|
+
sm: "bear-p-2",
|
|
21
|
+
md: "bear-p-4",
|
|
22
|
+
lg: "bear-p-6"
|
|
23
23
|
}, o = {
|
|
24
|
-
default: "
|
|
25
|
-
paper: "
|
|
26
|
-
transparent: "
|
|
24
|
+
default: "bear-bg-white dark:bear-bg-gray-900",
|
|
25
|
+
paper: "bear-bg-gray-50 dark:bear-bg-gray-800",
|
|
26
|
+
transparent: "bear-bg-transparent"
|
|
27
27
|
}, A = f(({
|
|
28
28
|
elevation: d = 1,
|
|
29
|
-
rounded:
|
|
30
|
-
variant:
|
|
31
|
-
fullWidth:
|
|
32
|
-
padding:
|
|
33
|
-
background:
|
|
34
|
-
children:
|
|
35
|
-
className:
|
|
36
|
-
style:
|
|
29
|
+
rounded: b = "md",
|
|
30
|
+
variant: e = "elevation",
|
|
31
|
+
fullWidth: n = !1,
|
|
32
|
+
padding: s = "none",
|
|
33
|
+
background: r = "default",
|
|
34
|
+
children: t,
|
|
35
|
+
className: l,
|
|
36
|
+
style: m,
|
|
37
37
|
testId: p,
|
|
38
38
|
...g
|
|
39
39
|
}, u) => {
|
|
40
|
-
const
|
|
40
|
+
const a = r && !o[r];
|
|
41
41
|
return /* @__PURE__ */ S(
|
|
42
42
|
"div",
|
|
43
43
|
{
|
|
44
44
|
ref: u,
|
|
45
45
|
className: i(
|
|
46
|
-
c[
|
|
47
|
-
y[
|
|
48
|
-
!
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
c[b],
|
|
47
|
+
y[s],
|
|
48
|
+
!a && o[r],
|
|
49
|
+
e === "elevation" && w[d],
|
|
50
|
+
e === "outlined" && "bear-border bear-border-gray-200 dark:bear-border-gray-700",
|
|
51
|
+
n && "bear-w-full",
|
|
52
|
+
l
|
|
53
53
|
),
|
|
54
54
|
style: {
|
|
55
|
-
...
|
|
56
|
-
...
|
|
55
|
+
...m,
|
|
56
|
+
...a && { backgroundColor: r }
|
|
57
57
|
},
|
|
58
58
|
"data-testid": p,
|
|
59
59
|
...g,
|
|
60
|
-
children:
|
|
60
|
+
children: t
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),r=require("../../utils/cn.cjs"),L={xs:"bear-w-3 bear-h-3",sm:"bear-w-4 bear-h-4",md:"bear-w-5 bear-h-5",lg:"bear-w-6 bear-h-6",xl:"bear-w-7 bear-h-7"},V={xs:"bear-text-xs",sm:"bear-text-sm",md:"bear-text-base",lg:"bear-text-lg",xl:"bear-text-xl"},_={primary:"#ec4899",secondary:"#6b7280",success:"#22c55e",danger:"#ef4444",warning:"#f59e0b",info:"#3b82f6",ghost:"#9ca3af",outline:"#374151",error:"#ef4444"},A=l.createContext(null),E=l.forwardRef(({label:o,size:f="md",variant:v="primary",color:i,disabled:h=!1,error:s=!1,helperText:x,className:j,testId:g,value:t,name:n,checked:m,onChange:c,...N},S)=>{const e=l.useContext(A),p=l.useId(),d=(e==null?void 0:e.size)??f,R=(e==null?void 0:e.variant)??v,b=(e==null?void 0:e.disabled)??h,u=(e==null?void 0:e.name)??n,y=e?e.value===t:m,k=i??_[R],I=l.useCallback(()=>{if(b)return;const w=typeof t=="string"?t:String(t);e&&w&&e.onChange(w),c==null||c({target:{value:w}})},[e,t,c,b]);return a.jsxs("div",{className:r.cn("bear-flex bear-flex-col",j),children:[a.jsxs("label",{className:r.cn("bear-inline-flex bear-items-center bear-gap-2 bear-cursor-pointer",b&&"bear-opacity-50 bear-cursor-not-allowed"),children:[a.jsxs("div",{className:"bear-relative bear-flex bear-items-center bear-justify-center",children:[a.jsx("input",{ref:S,type:"radio",name:u,value:t,checked:y,disabled:b,onChange:I,className:"bear-sr-only",id:p,"data-testid":g,...N}),a.jsx("div",{className:r.cn(L[d],"bear-rounded-full bear-border-2 bear-transition-all bear-flex bear-items-center bear-justify-center",s?"bear-border-red-500":"bear-border-gray-300 dark:bear-border-gray-600",y&&!s&&"bear-border-current",!b&&"hover:bear-border-gray-400"),style:{borderColor:y&&!s?k:void 0},children:a.jsx("div",{className:r.cn("bear-rounded-full bear-transition-all bear-scale-0",y&&"bear-scale-100"),style:{width:"50%",height:"50%",backgroundColor:s?"#ef4444":k}})})]}),o&&a.jsx("span",{className:r.cn(V[d],"bear-text-gray-700 dark:bear-text-gray-300",s&&"bear-text-red-500"),children:o})]}),x&&a.jsx("span",{className:r.cn("bear-text-xs bear-mt-1 bear-ml-7",s?"bear-text-red-500":"bear-text-gray-500"),children:x})]})});E.displayName="Radio";const q=({name:o,value:f,defaultValue:v="",onChange:i,children:h,direction:s="column",size:x,variant:j,disabled:g=!1,gap:t=2,label:n,error:m=!1,helperText:c,className:N,testId:S})=>{const[e,p]=l.useState(v),d=f!==void 0,R=d?f:e,b=l.useCallback(u=>{d||p(u),i==null||i(u)},[d,i]);return a.jsxs("div",{className:r.cn("bear-flex bear-flex-col",N),role:"radiogroup","aria-label":typeof n=="string"?n:void 0,"data-testid":S,children:[n&&a.jsx("span",{className:r.cn("bear-text-sm bear-font-medium bear-mb-2 bear-text-gray-700 dark:bear-text-gray-300",m&&"bear-text-red-500"),children:n}),a.jsx(A.Provider,{value:{name:o,value:R,onChange:b,size:x,variant:j,disabled:g},children:a.jsx("div",{className:r.cn("bear-flex",s==="column"?"bear-flex-col":"bear-flex-row bear-flex-wrap"),style:{gap:`${t*.25}rem`},children:h})}),c&&a.jsx("span",{className:r.cn("bear-text-xs bear-mt-2",m?"bear-text-red-500":"bear-text-gray-500"),children:c})]})};exports.Radio=E;exports.RadioGroup=q;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as y, jsx as
|
|
1
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as j, forwardRef as V, useContext as _, useId as z, useCallback as E, useState as G } from "react";
|
|
3
|
-
import { cn as
|
|
3
|
+
import { cn as a } from "../../utils/cn.js";
|
|
4
4
|
const O = {
|
|
5
|
-
xs: "
|
|
6
|
-
sm: "
|
|
7
|
-
md: "
|
|
8
|
-
lg: "
|
|
9
|
-
xl: "
|
|
5
|
+
xs: "bear-w-3 bear-h-3",
|
|
6
|
+
sm: "bear-w-4 bear-h-4",
|
|
7
|
+
md: "bear-w-5 bear-h-5",
|
|
8
|
+
lg: "bear-w-6 bear-h-6",
|
|
9
|
+
xl: "bear-w-7 bear-h-7"
|
|
10
10
|
}, Z = {
|
|
11
|
-
xs: "
|
|
12
|
-
sm: "
|
|
13
|
-
md: "
|
|
14
|
-
lg: "
|
|
15
|
-
xl: "
|
|
11
|
+
xs: "bear-text-xs",
|
|
12
|
+
sm: "bear-text-sm",
|
|
13
|
+
md: "bear-text-base",
|
|
14
|
+
lg: "bear-text-lg",
|
|
15
|
+
xl: "bear-text-xl"
|
|
16
16
|
}, B = {
|
|
17
17
|
primary: "#ec4899",
|
|
18
18
|
secondary: "#6b7280",
|
|
@@ -24,37 +24,37 @@ const O = {
|
|
|
24
24
|
outline: "#374151",
|
|
25
25
|
error: "#ef4444"
|
|
26
26
|
}, I = j(null), D = V(({
|
|
27
|
-
label:
|
|
28
|
-
size:
|
|
27
|
+
label: n,
|
|
28
|
+
size: o = "md",
|
|
29
29
|
variant: v = "primary",
|
|
30
|
-
color:
|
|
30
|
+
color: c,
|
|
31
31
|
disabled: h = !1,
|
|
32
|
-
error:
|
|
33
|
-
helperText:
|
|
32
|
+
error: t = !1,
|
|
33
|
+
helperText: f,
|
|
34
34
|
className: N,
|
|
35
35
|
testId: p,
|
|
36
36
|
value: s,
|
|
37
|
-
name:
|
|
38
|
-
checked:
|
|
39
|
-
onChange:
|
|
37
|
+
name: i,
|
|
38
|
+
checked: m,
|
|
39
|
+
onChange: b,
|
|
40
40
|
...g
|
|
41
41
|
}, S) => {
|
|
42
|
-
const e = _(I), w = z(),
|
|
43
|
-
if (
|
|
42
|
+
const e = _(I), w = z(), d = (e == null ? void 0 : e.size) ?? o, k = (e == null ? void 0 : e.variant) ?? v, l = (e == null ? void 0 : e.disabled) ?? h, x = (e == null ? void 0 : e.name) ?? i, u = e ? e.value === s : m, A = c ?? B[k], L = E(() => {
|
|
43
|
+
if (l) return;
|
|
44
44
|
const R = typeof s == "string" ? s : String(s);
|
|
45
|
-
e && R && e.onChange(R),
|
|
46
|
-
}, [e, s,
|
|
47
|
-
return /* @__PURE__ */ y("div", { className:
|
|
45
|
+
e && R && e.onChange(R), b == null || b({ target: { value: R } });
|
|
46
|
+
}, [e, s, b, l]);
|
|
47
|
+
return /* @__PURE__ */ y("div", { className: a("bear-flex bear-flex-col", N), children: [
|
|
48
48
|
/* @__PURE__ */ y(
|
|
49
49
|
"label",
|
|
50
50
|
{
|
|
51
|
-
className:
|
|
52
|
-
"
|
|
53
|
-
|
|
51
|
+
className: a(
|
|
52
|
+
"bear-inline-flex bear-items-center bear-gap-2 bear-cursor-pointer",
|
|
53
|
+
l && "bear-opacity-50 bear-cursor-not-allowed"
|
|
54
54
|
),
|
|
55
55
|
children: [
|
|
56
|
-
/* @__PURE__ */ y("div", { className: "
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ y("div", { className: "bear-relative bear-flex bear-items-center bear-justify-center", children: [
|
|
57
|
+
/* @__PURE__ */ r(
|
|
58
58
|
"input",
|
|
59
59
|
{
|
|
60
60
|
ref: S,
|
|
@@ -62,106 +62,106 @@ const O = {
|
|
|
62
62
|
name: x,
|
|
63
63
|
value: s,
|
|
64
64
|
checked: u,
|
|
65
|
-
disabled:
|
|
65
|
+
disabled: l,
|
|
66
66
|
onChange: L,
|
|
67
|
-
className: "
|
|
67
|
+
className: "bear-sr-only",
|
|
68
68
|
id: w,
|
|
69
69
|
"data-testid": p,
|
|
70
70
|
...g
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ r(
|
|
74
74
|
"div",
|
|
75
75
|
{
|
|
76
|
-
className:
|
|
77
|
-
O[
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
u && !
|
|
81
|
-
!
|
|
76
|
+
className: a(
|
|
77
|
+
O[d],
|
|
78
|
+
"bear-rounded-full bear-border-2 bear-transition-all bear-flex bear-items-center bear-justify-center",
|
|
79
|
+
t ? "bear-border-red-500" : "bear-border-gray-300 dark:bear-border-gray-600",
|
|
80
|
+
u && !t && "bear-border-current",
|
|
81
|
+
!l && "hover:bear-border-gray-400"
|
|
82
82
|
),
|
|
83
83
|
style: {
|
|
84
|
-
borderColor: u && !
|
|
84
|
+
borderColor: u && !t ? A : void 0
|
|
85
85
|
},
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ r(
|
|
87
87
|
"div",
|
|
88
88
|
{
|
|
89
|
-
className:
|
|
90
|
-
"
|
|
91
|
-
u && "
|
|
89
|
+
className: a(
|
|
90
|
+
"bear-rounded-full bear-transition-all bear-scale-0",
|
|
91
|
+
u && "bear-scale-100"
|
|
92
92
|
),
|
|
93
93
|
style: {
|
|
94
94
|
width: "50%",
|
|
95
95
|
height: "50%",
|
|
96
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: t ? "#ef4444" : A
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
}
|
|
101
101
|
)
|
|
102
102
|
] }),
|
|
103
|
-
|
|
104
|
-
Z[
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
), children:
|
|
103
|
+
n && /* @__PURE__ */ r("span", { className: a(
|
|
104
|
+
Z[d],
|
|
105
|
+
"bear-text-gray-700 dark:bear-text-gray-300",
|
|
106
|
+
t && "bear-text-red-500"
|
|
107
|
+
), children: n })
|
|
108
108
|
]
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
|
|
114
|
-
), children:
|
|
111
|
+
f && /* @__PURE__ */ r("span", { className: a(
|
|
112
|
+
"bear-text-xs bear-mt-1 bear-ml-7",
|
|
113
|
+
t ? "bear-text-red-500" : "bear-text-gray-500"
|
|
114
|
+
), children: f })
|
|
115
115
|
] });
|
|
116
116
|
});
|
|
117
117
|
D.displayName = "Radio";
|
|
118
118
|
const C = ({
|
|
119
|
-
name:
|
|
120
|
-
value:
|
|
119
|
+
name: n,
|
|
120
|
+
value: o,
|
|
121
121
|
defaultValue: v = "",
|
|
122
|
-
onChange:
|
|
122
|
+
onChange: c,
|
|
123
123
|
children: h,
|
|
124
|
-
direction:
|
|
125
|
-
size:
|
|
124
|
+
direction: t = "column",
|
|
125
|
+
size: f,
|
|
126
126
|
variant: N,
|
|
127
127
|
disabled: p = !1,
|
|
128
128
|
gap: s = 2,
|
|
129
|
-
label:
|
|
130
|
-
error:
|
|
131
|
-
helperText:
|
|
129
|
+
label: i,
|
|
130
|
+
error: m = !1,
|
|
131
|
+
helperText: b,
|
|
132
132
|
className: g,
|
|
133
133
|
testId: S
|
|
134
134
|
}) => {
|
|
135
|
-
const [e, w] = G(v),
|
|
136
|
-
|
|
137
|
-
}, [
|
|
135
|
+
const [e, w] = G(v), d = o !== void 0, k = d ? o : e, l = E((x) => {
|
|
136
|
+
d || w(x), c == null || c(x);
|
|
137
|
+
}, [d, c]);
|
|
138
138
|
return /* @__PURE__ */ y(
|
|
139
139
|
"div",
|
|
140
140
|
{
|
|
141
|
-
className:
|
|
141
|
+
className: a("bear-flex bear-flex-col", g),
|
|
142
142
|
role: "radiogroup",
|
|
143
|
-
"aria-label": typeof
|
|
143
|
+
"aria-label": typeof i == "string" ? i : void 0,
|
|
144
144
|
"data-testid": S,
|
|
145
145
|
children: [
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
|
|
149
|
-
), children:
|
|
150
|
-
/* @__PURE__ */
|
|
146
|
+
i && /* @__PURE__ */ r("span", { className: a(
|
|
147
|
+
"bear-text-sm bear-font-medium bear-mb-2 bear-text-gray-700 dark:bear-text-gray-300",
|
|
148
|
+
m && "bear-text-red-500"
|
|
149
|
+
), children: i }),
|
|
150
|
+
/* @__PURE__ */ r(I.Provider, { value: { name: n, value: k, onChange: l, size: f, variant: N, disabled: p }, children: /* @__PURE__ */ r(
|
|
151
151
|
"div",
|
|
152
152
|
{
|
|
153
|
-
className:
|
|
154
|
-
"
|
|
155
|
-
|
|
153
|
+
className: a(
|
|
154
|
+
"bear-flex",
|
|
155
|
+
t === "column" ? "bear-flex-col" : "bear-flex-row bear-flex-wrap"
|
|
156
156
|
),
|
|
157
157
|
style: { gap: `${s * 0.25}rem` },
|
|
158
158
|
children: h
|
|
159
159
|
}
|
|
160
160
|
) }),
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
), children:
|
|
161
|
+
b && /* @__PURE__ */ r("span", { className: a(
|
|
162
|
+
"bear-text-xs bear-mt-2",
|
|
163
|
+
m ? "bear-text-red-500" : "bear-text-gray-500"
|
|
164
|
+
), children: b })
|
|
165
165
|
]
|
|
166
166
|
}
|
|
167
167
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),y=require("../../utils/cn.cjs"),U={xs:14,sm:18,md:24,lg:30,xl:36},W="#fbbf24",Y="#d1d5db",Z=({value:j,defaultValue:F=0,max:u=5,size:L="md",readOnly:o=!1,disabled:r=!1,precision:S=1,color:m=W,emptyColor:h=Y,filledIcon:v,emptyIcon:k,halfIcon:g,highlightOnHover:l=!0,showLabel:C=!1,formatLabel:E,onChange:c,className:_,testId:A,...T})=>{const[$,q]=i.useState(F),[M,w]=i.useState(null),f=j!==void 0,z=f?j:$,p=M!==null&&!o&&!r?M:z,x=U[L],B=i.useCallback(t=>{o||r||(f||q(t),c==null||c(t))},[f,c,o,r]),G=i.useCallback(t=>{o||r||!l||w(t)},[o,r,l]),N=i.useCallback(()=>{o||r||!l||w(null)},[o,r,l]),b=i.useMemo(()=>({FilledStar:({size:s,color:a})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:a,stroke:"none",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),EmptyStar:({size:s,color:a})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",children:e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),HalfStar:({size:s,color:a,emptyColor:R})=>e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"halfGrad",children:[e.jsx("stop",{offset:"50%",stopColor:a}),e.jsx("stop",{offset:"50%",stopColor:R,stopOpacity:"0"})]})}),e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:"url(#halfGrad)",stroke:R,strokeWidth:"2"})]})}),[]),P=t=>{const n=p-t,d=n>=1,s=S===.5&&n>=.5&&n<1,a=n<(S===.5?.5:1);return v&&d?v:g&&s?g:k&&a?k:d?e.jsx(b.FilledStar,{size:x,color:m}):s?e.jsx(b.HalfStar,{size:x,color:m,emptyColor:h}):e.jsx(b.EmptyStar,{size:x,color:h})},D=i.useMemo(()=>Array.from({length:u},(t,n)=>n+1),[u]),H=E?E(p):`${p} out of ${u}`;return e.jsxs("div",{className:y.cn("bear-inline-flex bear-items-center bear-gap-1",r&&"bear-opacity-50 bear-cursor-not-allowed",_),role:"radiogroup","aria-label":"Rating","data-testid":A,onMouseLeave:N,...T,children:[D.map(t=>e.jsx("button",{type:"button",role:"radio","aria-checked":z>=t,"aria-label":`${t} star${t>1?"s":""}`,className:y.cn("bear-p-0.5 bear-rounded bear-transition-transform bear-bg-transparent bear-border-none",!o&&!r&&"hover:bear-scale-110 bear-cursor-pointer",o&&"bear-cursor-default",r&&"bear-cursor-not-allowed"),onClick:()=>B(t),onMouseEnter:()=>G(t),disabled:r||o,children:P(t-1)},t)),C&&e.jsx("span",{className:"bear-ml-2 bear-text-sm bear-text-gray-600 dark:bear-text-gray-400",children:H})]})};exports.Rating=Z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as y, useCallback as S, useMemo as A } from "react";
|
|
3
3
|
import { cn as R } from "../../utils/cn.js";
|
|
4
4
|
const q = {
|
|
@@ -10,36 +10,36 @@ const q = {
|
|
|
10
10
|
}, I = "#fbbf24", J = "#d1d5db", V = ({
|
|
11
11
|
value: h,
|
|
12
12
|
defaultValue: $ = 0,
|
|
13
|
-
max:
|
|
13
|
+
max: c = 5,
|
|
14
14
|
size: B = "md",
|
|
15
15
|
readOnly: s = !1,
|
|
16
|
-
disabled:
|
|
16
|
+
disabled: e = !1,
|
|
17
17
|
precision: v = 1,
|
|
18
18
|
color: k = I,
|
|
19
19
|
emptyColor: x = J,
|
|
20
20
|
filledIcon: E,
|
|
21
21
|
emptyIcon: g,
|
|
22
22
|
halfIcon: w,
|
|
23
|
-
highlightOnHover:
|
|
23
|
+
highlightOnHover: a = !0,
|
|
24
24
|
showLabel: C = !1,
|
|
25
25
|
formatLabel: z,
|
|
26
|
-
onChange:
|
|
26
|
+
onChange: l,
|
|
27
27
|
className: G,
|
|
28
28
|
testId: N,
|
|
29
29
|
...T
|
|
30
30
|
}) => {
|
|
31
|
-
const [j, D] = y($), [M, F] = y(null),
|
|
32
|
-
s ||
|
|
33
|
-
}, [
|
|
34
|
-
s ||
|
|
35
|
-
}, [s,
|
|
36
|
-
s ||
|
|
37
|
-
}, [s,
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
31
|
+
const [j, D] = y($), [M, F] = y(null), f = h !== void 0, L = f ? h : j, u = M !== null && !s && !e ? M : L, p = q[B], H = S((t) => {
|
|
32
|
+
s || e || (f || D(t), l == null || l(t));
|
|
33
|
+
}, [f, l, s, e]), P = S((t) => {
|
|
34
|
+
s || e || !a || F(t);
|
|
35
|
+
}, [s, e, a]), U = S(() => {
|
|
36
|
+
s || e || !a || F(null);
|
|
37
|
+
}, [s, e, a]), b = A(() => ({ FilledStar: ({ size: o, color: i }) => /* @__PURE__ */ r("svg", { width: o, height: o, viewBox: "0 0 24 24", fill: i, stroke: "none", children: /* @__PURE__ */ r("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) }), EmptyStar: ({ size: o, color: i }) => /* @__PURE__ */ r("svg", { width: o, height: o, viewBox: "0 0 24 24", fill: "none", stroke: i, strokeWidth: "2", children: /* @__PURE__ */ r("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) }), HalfStar: ({ size: o, color: i, emptyColor: _ }) => /* @__PURE__ */ d("svg", { width: o, height: o, viewBox: "0 0 24 24", children: [
|
|
38
|
+
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ d("linearGradient", { id: "halfGrad", children: [
|
|
39
|
+
/* @__PURE__ */ r("stop", { offset: "50%", stopColor: i }),
|
|
40
|
+
/* @__PURE__ */ r("stop", { offset: "50%", stopColor: _, stopOpacity: "0" })
|
|
41
41
|
] }) }),
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ r(
|
|
43
43
|
"polygon",
|
|
44
44
|
{
|
|
45
45
|
points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",
|
|
@@ -48,19 +48,19 @@ const q = {
|
|
|
48
48
|
strokeWidth: "2"
|
|
49
49
|
}
|
|
50
50
|
)
|
|
51
|
-
] }) }), []), W = (
|
|
52
|
-
const n =
|
|
53
|
-
return E &&
|
|
51
|
+
] }) }), []), W = (t) => {
|
|
52
|
+
const n = u - t, m = n >= 1, o = v === 0.5 && n >= 0.5 && n < 1, i = n < (v === 0.5 ? 0.5 : 1);
|
|
53
|
+
return E && m ? E : w && o ? w : g && i ? g : m ? /* @__PURE__ */ r(b.FilledStar, { size: p, color: k }) : o ? /* @__PURE__ */ r(b.HalfStar, { size: p, color: k, emptyColor: x }) : /* @__PURE__ */ r(b.EmptyStar, { size: p, color: x });
|
|
54
54
|
}, Y = A(
|
|
55
|
-
() => Array.from({ length:
|
|
56
|
-
[
|
|
57
|
-
), Z = z ? z(
|
|
55
|
+
() => Array.from({ length: c }, (t, n) => n + 1),
|
|
56
|
+
[c]
|
|
57
|
+
), Z = z ? z(u) : `${u} out of ${c}`;
|
|
58
58
|
return /* @__PURE__ */ d(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
className: R(
|
|
62
|
-
"
|
|
63
|
-
|
|
62
|
+
"bear-inline-flex bear-items-center bear-gap-1",
|
|
63
|
+
e && "bear-opacity-50 bear-cursor-not-allowed",
|
|
64
64
|
G
|
|
65
65
|
),
|
|
66
66
|
role: "radiogroup",
|
|
@@ -69,27 +69,27 @@ const q = {
|
|
|
69
69
|
onMouseLeave: U,
|
|
70
70
|
...T,
|
|
71
71
|
children: [
|
|
72
|
-
Y.map((
|
|
72
|
+
Y.map((t) => /* @__PURE__ */ r(
|
|
73
73
|
"button",
|
|
74
74
|
{
|
|
75
75
|
type: "button",
|
|
76
76
|
role: "radio",
|
|
77
|
-
"aria-checked": L >=
|
|
78
|
-
"aria-label": `${
|
|
77
|
+
"aria-checked": L >= t,
|
|
78
|
+
"aria-label": `${t} star${t > 1 ? "s" : ""}`,
|
|
79
79
|
className: R(
|
|
80
|
-
"
|
|
81
|
-
!s && !
|
|
82
|
-
s && "
|
|
83
|
-
|
|
80
|
+
"bear-p-0.5 bear-rounded bear-transition-transform bear-bg-transparent bear-border-none",
|
|
81
|
+
!s && !e && "hover:bear-scale-110 bear-cursor-pointer",
|
|
82
|
+
s && "bear-cursor-default",
|
|
83
|
+
e && "bear-cursor-not-allowed"
|
|
84
84
|
),
|
|
85
|
-
onClick: () => H(
|
|
86
|
-
onMouseEnter: () => P(
|
|
87
|
-
disabled:
|
|
88
|
-
children: W(
|
|
85
|
+
onClick: () => H(t),
|
|
86
|
+
onMouseEnter: () => P(t),
|
|
87
|
+
disabled: e || s,
|
|
88
|
+
children: W(t - 1)
|
|
89
89
|
},
|
|
90
|
-
|
|
90
|
+
t
|
|
91
91
|
)),
|
|
92
|
-
C && /* @__PURE__ */
|
|
92
|
+
C && /* @__PURE__ */ r("span", { className: "bear-ml-2 bear-text-sm bear-text-gray-600 dark:bear-text-gray-400", children: Z })
|
|
93
93
|
]
|
|
94
94
|
}
|
|
95
95
|
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("react"),e=require("./RichEditor.utils.cjs"),o=require("./RichEditor.icons.cjs"),S=({icon:a,title:m,active:l,onClick:k,disabled:i})=>r.jsx("button",{type:"button",title:m,onClick:k,disabled:i,className:`
|
|
2
|
+
p-1.5 rounded transition-colors
|
|
3
|
+
${l?"bg-pink-500 text-white":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}
|
|
4
|
+
${i?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
|
5
|
+
`,children:a}),q=({value:a,defaultValue:m="",onChange:l,placeholder:k="Start typing...",disabled:i=!1,readOnly:b=!1,minHeight:g=150,maxHeight:u,toolbar:p=e.DEFAULT_TOOLBAR,className:y="",...L})=>{const n=d.useRef(null),[C,j]=d.useState(new Set);d.useEffect(()=>{n.current&&a!==void 0&&n.current.innerHTML!==a&&(n.current.innerHTML=a)},[a]),d.useEffect(()=>{n.current&&m&&!a&&(n.current.innerHTML=m)},[]);const c=d.useCallback(()=>{const t=new Set;e.queryCommandState("bold")&&t.add("bold"),e.queryCommandState("italic")&&t.add("italic"),e.queryCommandState("underline")&&t.add("underline"),e.queryCommandState("strikeThrough")&&t.add("strikethrough"),e.queryCommandState("insertUnorderedList")&&t.add("bulletList"),e.queryCommandState("insertOrderedList")&&t.add("orderedList"),j(t)},[]),f=d.useCallback(()=>{n.current&&l&&l(n.current.innerHTML),c()},[l,c]),I=d.useCallback(t=>{var s;if(!(i||b)){switch((s=n.current)==null||s.focus(),t){case"bold":e.execCommand("bold");break;case"italic":e.execCommand("italic");break;case"underline":e.execCommand("underline");break;case"strikethrough":e.execCommand("strikeThrough");break;case"heading1":e.execCommand("formatBlock","<h1>");break;case"heading2":e.execCommand("formatBlock","<h2>");break;case"heading3":e.execCommand("formatBlock","<h3>");break;case"bulletList":e.execCommand("insertUnorderedList");break;case"orderedList":e.execCommand("insertOrderedList");break;case"blockquote":e.execCommand("formatBlock","<blockquote>");break;case"code":e.execCommand("formatBlock","<pre>");break;case"link":const h=prompt("Enter URL:");h&&e.execCommand("createLink",h);break}c(),f()}},[i,b,c,f]),v=(t,s)=>{if(t==="divider")return r.jsx("div",{className:"w-px h-5 bg-gray-300 dark:bg-gray-600 mx-1"},`divider-${s}`);const x={bold:{icon:r.jsx(o.BoldIcon,{}),title:"Bold"},italic:{icon:r.jsx(o.ItalicIcon,{}),title:"Italic"},underline:{icon:r.jsx(o.UnderlineIcon,{}),title:"Underline"},strikethrough:{icon:r.jsx(o.StrikethroughIcon,{}),title:"Strikethrough"},heading1:{icon:r.jsx(o.Heading1Icon,{}),title:"Heading 1"},heading2:{icon:r.jsx(o.Heading2Icon,{}),title:"Heading 2"},bulletList:{icon:r.jsx(o.BulletListIcon,{}),title:"Bullet List"},orderedList:{icon:r.jsx(o.OrderedListIcon,{}),title:"Numbered List"},blockquote:{icon:r.jsx(o.BlockquoteIcon,{}),title:"Quote"},code:{icon:r.jsx(o.CodeIcon,{}),title:"Code Block"},link:{icon:r.jsx(o.LinkIcon,{}),title:"Insert Link"}}[t];return x?r.jsx(S,{icon:x.icon,title:x.title,active:C.has(t),onClick:()=>I(t),disabled:i||b},t):null};return r.jsxs("div",{className:`bear-rich-editor rounded-lg border border-gray-300 dark:border-gray-600 overflow-hidden bg-white dark:bg-gray-900 ${y}`,...L,children:[p.length>0&&r.jsx("div",{className:"bear-rich-editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:p.map((t,s)=>v(t,s))}),r.jsx("div",{ref:n,contentEditable:!i&&!b,onInput:f,onSelect:c,onKeyUp:c,onMouseUp:c,"data-placeholder":k,className:`
|
|
6
|
+
bear-rich-editor-content p-3 outline-none prose prose-sm dark:prose-invert max-w-none
|
|
7
|
+
text-gray-900 dark:text-white
|
|
8
|
+
[&:empty]:before:content-[attr(data-placeholder)] [&:empty]:before:text-gray-400 [&:empty]:before:pointer-events-none
|
|
9
|
+
${i?"opacity-50 cursor-not-allowed":""}
|
|
10
|
+
`,style:{minHeight:typeof g=="number"?`${g}px`:g,maxHeight:u?typeof u=="number"?`${u}px`:u:void 0,overflowY:u?"auto":void 0}})]})};exports.RichEditor=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),e=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),o.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),t=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),o.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),o.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),r=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"}),o.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]}),i=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M17.3 4.9c-2.3-.6-4.4-1-6.2-.9-2.7 0-5.3.7-5.3 3.6 0 1.5 1.8 3.3 3.6 3.9h.2"}),o.jsx("path",{d:"M8.7 19.1c2.3.6 4.4 1 6.2.9 2.7 0 5.3-.7 5.3-3.6 0-1.5-1.8-3.3-3.6-3.9h-.2"}),o.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]}),s=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M4 12h8"}),o.jsx("path",{d:"M4 18V6"}),o.jsx("path",{d:"M12 18V6"}),o.jsx("path",{d:"M17 12l3-2v8"})]}),c=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M4 12h8"}),o.jsx("path",{d:"M4 18V6"}),o.jsx("path",{d:"M12 18V6"}),o.jsx("path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"})]}),d=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),o.jsx("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),o.jsx("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),o.jsx("circle",{cx:"4",cy:"6",r:"1",fill:"currentColor"}),o.jsx("circle",{cx:"4",cy:"12",r:"1",fill:"currentColor"}),o.jsx("circle",{cx:"4",cy:"18",r:"1",fill:"currentColor"})]}),l=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),o.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),o.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),o.jsx("path",{d:"M4 6h1v4"}),o.jsx("path",{d:"M4 10h2"}),o.jsx("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]}),h=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21z"}),o.jsx("path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3z"})]}),x=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}),j=({size:n=16})=>o.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});exports.BlockquoteIcon=h;exports.BoldIcon=e;exports.BulletListIcon=d;exports.CodeIcon=x;exports.Heading1Icon=s;exports.Heading2Icon=c;exports.ItalicIcon=t;exports.LinkIcon=j;exports.OrderedListIcon=l;exports.StrikethroughIcon=i;exports.UnderlineIcon=r;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface IconProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const BoldIcon: FC<IconProps>;
|
|
6
|
+
export declare const ItalicIcon: FC<IconProps>;
|
|
7
|
+
export declare const UnderlineIcon: FC<IconProps>;
|
|
8
|
+
export declare const StrikethroughIcon: FC<IconProps>;
|
|
9
|
+
export declare const Heading1Icon: FC<IconProps>;
|
|
10
|
+
export declare const Heading2Icon: FC<IconProps>;
|
|
11
|
+
export declare const BulletListIcon: FC<IconProps>;
|
|
12
|
+
export declare const OrderedListIcon: FC<IconProps>;
|
|
13
|
+
export declare const BlockquoteIcon: FC<IconProps>;
|
|
14
|
+
export declare const CodeIcon: FC<IconProps>;
|
|
15
|
+
export declare const LinkIcon: FC<IconProps>;
|
|
16
|
+
export {};
|