@iit/precision-ui 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/textarea/TextareaWithLabel.d.ts.map +1 -1
- package/dist/index.d.ts +19 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +89 -82
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +1 -1
- package/dist/index.es11.js +1 -1
- package/dist/index.es12.js +1 -1
- package/dist/index.es13.js +79 -24
- package/dist/index.es13.js.map +1 -1
- package/dist/index.es14.js +83 -26
- package/dist/index.es14.js.map +1 -1
- package/dist/index.es15.js +19 -19
- package/dist/index.es15.js.map +1 -1
- package/dist/index.es16.js +28 -25
- package/dist/index.es16.js.map +1 -1
- package/dist/index.es17.js +24 -69
- package/dist/index.es17.js.map +1 -1
- package/dist/index.es18.js +22 -32
- package/dist/index.es18.js.map +1 -1
- package/dist/index.es19.js +72 -31
- package/dist/index.es19.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es20.js +24 -19
- package/dist/index.es20.js.map +1 -1
- package/dist/index.es21.js +31 -18
- package/dist/index.es21.js.map +1 -1
- package/dist/index.es22.js +28 -44
- package/dist/index.es22.js.map +1 -1
- package/dist/index.es23.js +18 -36
- package/dist/index.es23.js.map +1 -1
- package/dist/index.es24.js +40 -48
- package/dist/index.es24.js.map +1 -1
- package/dist/index.es25.js +37 -14
- package/dist/index.es25.js.map +1 -1
- package/dist/index.es26.js +53 -5
- package/dist/index.es26.js.map +1 -1
- package/dist/index.es27.js +13 -52
- package/dist/index.es27.js.map +1 -1
- package/dist/index.es28.js +5 -26
- package/dist/index.es28.js.map +1 -1
- package/dist/index.es29.js +50 -94
- package/dist/index.es29.js.map +1 -1
- package/dist/index.es3.js +2 -2
- package/dist/index.es30.js +24 -53
- package/dist/index.es30.js.map +1 -1
- package/dist/index.es31.js +77 -72
- package/dist/index.es31.js.map +1 -1
- package/dist/index.es32.js +38 -80
- package/dist/index.es32.js.map +1 -1
- package/dist/index.es33.js +90 -11
- package/dist/index.es33.js.map +1 -1
- package/dist/index.es34.js +87 -34
- package/dist/index.es34.js.map +1 -1
- package/dist/index.es35.js +13 -24
- package/dist/index.es35.js.map +1 -1
- package/dist/index.es36.js +42 -25
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +18 -204
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +37 -50
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +25 -55
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es40.js +205 -56
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +50 -18
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +57 -18
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +59 -89
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +18 -88
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +19 -33
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +88 -74
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +76 -29
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es48.js +31 -9
- package/dist/index.es48.js.map +1 -1
- package/dist/index.es49.js +77 -6
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.es50.js +42 -21
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +10 -19
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +6 -20
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +21 -84
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +20 -39
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +19 -26
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +44 -13
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +26 -46
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +16 -4
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es60.js +7 -0
- package/dist/index.es60.js.map +1 -0
- package/dist/index.es7.js +1 -1
- package/dist/index.es8.js +1 -1
- package/package.json +1 -1
package/dist/index.es14.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es14.js","sources":["../src/components/ui/
|
|
1
|
+
{"version":3,"file":"index.es14.js","sources":["../src/components/ui/input/SearchInputWithButton.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\r\n\r\nimport { Button } from \"../button\";\r\nimport { Close16X16 } from \"@iit/precision-ui-icons\";\r\nimport { Input } from \"@/components/ui/input\";\r\nimport { SearchIcon } from \"lucide-react\";\r\nimport { cn } from \"@/lib/utils/cn\";\r\n\r\ninterface SearchInputWithButtonProps {\r\n id?: string;\r\n placeholder?: string;\r\n className?: string;\r\n containerClassName?: string;\r\n value?: string;\r\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\r\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\r\n onClickSubmitButton?: () => void;\r\n onClickClearButton?: () => void;\r\n withoutBottomBorder?: boolean;\r\n}\r\n\r\nconst SearchInputWithButton: React.FC<SearchInputWithButtonProps> = ({\r\n id,\r\n placeholder,\r\n className,\r\n containerClassName,\r\n value = \"\",\r\n onChange,\r\n onKeyDown,\r\n onClickSubmitButton,\r\n onClickClearButton,\r\n withoutBottomBorder,\r\n ...props\r\n}) => {\r\n const [inputValue, setInputValue] = useState(value);\r\n const [isHovered, setIsHovered] = useState(false); // Track hover state\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n setInputValue(value);\r\n }, [value]);\r\n\r\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n setInputValue(event.target.value);\r\n if (onChange) {\r\n onChange(event);\r\n }\r\n };\r\n\r\n const handleClearClick = () => {\r\n setInputValue(\"\");\r\n if (inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n if (onChange) {\r\n onChange({\r\n target: { value: \"\" },\r\n } as React.ChangeEvent<HTMLInputElement>);\r\n }\r\n if (onClickClearButton) {\r\n onClickClearButton();\r\n }\r\n };\r\n\r\n return (\r\n <div\r\n className={cn(\"relative w-full max-w-2xl\", containerClassName)}\r\n onMouseEnter={() => setIsHovered(true)}\r\n onMouseLeave={() => setIsHovered(false)}\r\n >\r\n <Input\r\n ref={inputRef}\r\n id={id}\r\n placeholder={placeholder}\r\n className={cn(\r\n \"w-full pl-8 pr-20 hover:bg-navy-opacity-4-absolute rounded-full bg-whitish h-14\",\r\n className,\r\n withoutBottomBorder && \"border-b border-transparent\"\r\n )}\r\n value={inputValue}\r\n onChange={handleInputChange}\r\n onKeyDown={onKeyDown}\r\n {...props}\r\n />\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className={cn(\r\n \"absolute right-14 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground p-0 hover:bg-navy group\",\r\n isHovered ? \"bg-white\" : \"bg-navy-opacity-8\"\r\n )}\r\n onClick={handleClearClick}\r\n style={{ display: inputValue ? \"block\" : \"none\" }}\r\n >\r\n <Close16X16 className=\"h-[10px] w-[10px] left-[5px] top-0 relative text-navy group-hover:text-whitish\" />\r\n <span className=\"sr-only\">Очистить</span>\r\n </Button>\r\n\r\n <Button\r\n className={cn(\r\n \"absolute right-2 top-1/2 -translate-y-1/2 text-navy h-10 w-10 hover:bg-navy group/submit disabled:pointer-events-auto active:transform active:scale-90\",\r\n isHovered ? \"bg-white\" : \"bg-navy-opacity-8\"\r\n )}\r\n disabled={!inputValue}\r\n onClick={onClickSubmitButton || undefined}\r\n >\r\n <SearchIcon className=\"h-4 w-4 group-hover/submit:text-whitish\" />\r\n </Button>\r\n </div>\r\n );\r\n};\r\n\r\nexport default SearchInputWithButton;\r\n"],"names":["SearchInputWithButton","id","placeholder","className","containerClassName","value","onChange","onKeyDown","onClickSubmitButton","onClickClearButton","withoutBottomBorder","props","inputValue","setInputValue","useState","isHovered","setIsHovered","inputRef","useRef","useEffect","handleInputChange","event","handleClearClick","React","cn","Input","Button","Close16X16","SearchIcon","SearchInputWithButton$1"],"mappings":";;;;;;AAqBA,MAAMA,IAA8D,CAAC;AAAA,EACnE,IAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAST,CAAK,GAC5C,CAACU,GAAWC,CAAY,IAAIF,EAAS,EAAK,GAC1CG,IAAWC,EAAyB,IAAI;AAE9C,EAAAC,EAAU,MAAM;AACd,IAAAN,EAAcR,CAAK;AAAA,EAAA,GAClB,CAACA,CAAK,CAAC;AAEJ,QAAAe,IAAoB,CAACC,MAA+C;AAC1D,IAAAR,EAAAQ,EAAM,OAAO,KAAK,GAC5Bf,KACFA,EAASe,CAAK;AAAA,EAChB,GAGIC,IAAmB,MAAM;AAC7B,IAAAT,EAAc,EAAE,GACZI,EAAS,WACXA,EAAS,QAAQ,SAEfX,KACOA,EAAA;AAAA,MACP,QAAQ,EAAE,OAAO,GAAG;AAAA,IAAA,CACkB,GAEtCG,KACiBA;EACrB;AAIA,SAAAc,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAG,6BAA6BpB,CAAkB;AAAA,MAC7D,cAAc,MAAMY,EAAa,EAAI;AAAA,MACrC,cAAc,MAAMA,EAAa,EAAK;AAAA,IAAA;AAAA,IAEtCO,gBAAAA,EAAA;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,KAAKR;AAAA,QACL,IAAAhB;AAAA,QACA,aAAAC;AAAA,QACA,WAAWsB;AAAA,UACT;AAAA,UACArB;AAAA,UACAO,KAAuB;AAAA,QACzB;AAAA,QACA,OAAOE;AAAA,QACP,UAAUQ;AAAA,QACV,WAAAb;AAAA,QACC,GAAGI;AAAA,MAAA;AAAA,IACN;AAAA,IACAY,gBAAAA,EAAA;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,WAAWF;AAAA,UACT;AAAA,UACAT,IAAY,aAAa;AAAA,QAC3B;AAAA,QACA,SAASO;AAAA,QACT,OAAO,EAAE,SAASV,IAAa,UAAU,OAAO;AAAA,MAAA;AAAA,MAEhDW,gBAAAA,EAAA,cAACI,GAAW,EAAA,WAAU,iFAAiF,CAAA;AAAA,MACtGJ,gBAAAA,EAAA,cAAA,QAAA,EAAK,WAAU,UAAA,GAAU,UAAQ;AAAA,IACpC;AAAA,IAEAA,gBAAAA,EAAA;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,WAAWF;AAAA,UACT;AAAA,UACAT,IAAY,aAAa;AAAA,QAC3B;AAAA,QACA,UAAU,CAACH;AAAA,QACX,SAASJ,KAAuB;AAAA,MAAA;AAAA,MAEhCe,gBAAAA,EAAA,cAACK,GAAW,EAAA,WAAU,0CAA0C,CAAA;AAAA,IAClE;AAAA,EAAA;AAGN,GAEAC,IAAe7B;"}
|
package/dist/index.es15.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"typo_variant_h6 leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 duration-200",
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { cva as i } from "class-variance-authority";
|
|
3
|
+
import { cn as n } from "./index.es52.js";
|
|
4
|
+
const s = i(
|
|
5
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible0:ring-2 focus-visible0:ring-ring focus-visible0:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
7
6
|
{
|
|
8
7
|
variants: {
|
|
9
8
|
variant: {
|
|
10
|
-
default: "text-navy",
|
|
11
|
-
blue: "text-whitish"
|
|
9
|
+
default: "bg-navy-opacity-4 text-navy focus:border-navy hover:bg-navy-opacity-8 border-b-navy-opacity-32",
|
|
10
|
+
blue: "bg-whitish-opacity-8 text-white focus:border-white hover:bg-whitish-opacity-16 border-b-whitish-opacity-32"
|
|
12
11
|
}
|
|
13
12
|
},
|
|
14
13
|
defaultVariants: {
|
|
15
14
|
variant: "default"
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
),
|
|
19
|
-
t.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
), c = e.forwardRef(
|
|
18
|
+
({ className: t, variant: a, ...r }, o) => /* @__PURE__ */ e.createElement(
|
|
19
|
+
"textarea",
|
|
20
|
+
{
|
|
21
|
+
className: n(s({ variant: a, className: t })),
|
|
22
|
+
ref: o,
|
|
23
|
+
...r
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
c.displayName = "Textarea";
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
-
s as labelVariants
|
|
29
|
+
c as Textarea
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=index.es15.js.map
|
package/dist/index.es15.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es15.js","sources":["../src/components/ui/
|
|
1
|
+
{"version":3,"file":"index.es15.js","sources":["../src/components/ui/textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react'\r\n\r\nimport { VariantProps, cva } from 'class-variance-authority'\r\n\r\nimport { cn } from '@/lib/utils/cn'\r\n\r\nconst textareaVariants = cva(\r\n 'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible0:ring-2 focus-visible0:ring-ring focus-visible0:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',\r\n {\r\n variants: {\r\n variant: {\r\n default:\r\n 'bg-navy-opacity-4 text-navy focus:border-navy hover:bg-navy-opacity-8 border-b-navy-opacity-32',\r\n blue: 'bg-whitish-opacity-8 text-white focus:border-white hover:bg-whitish-opacity-16 border-b-whitish-opacity-32',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n }\r\n)\r\n\r\nexport interface TextareaProps\r\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement>,\r\n VariantProps<typeof textareaVariants> {\r\n // className?: string\r\n}\r\n\r\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\r\n ({ className, variant, ...props }, ref) => {\r\n return (\r\n <textarea\r\n className={cn(textareaVariants({ variant, className }))}\r\n ref={ref}\r\n {...props}\r\n />\r\n )\r\n }\r\n)\r\nTextarea.displayName = 'Textarea'\r\n\r\nexport { Textarea }\r\n"],"names":["textareaVariants","cva","Textarea","React","className","variant","props","ref","cn"],"mappings":";;;AAMA,MAAMA,IAAmBC;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF,GAQMC,IAAWC,EAAM;AAAA,EACrB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,GAAGC,EAAA,GAASC,MAE/B,gBAAAJ,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWK,EAAGR,EAAiB,EAAE,SAAAK,GAAS,WAAAD,EAAW,CAAA,CAAC;AAAA,MACtD,KAAAG;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAIZ;AACAJ,EAAS,cAAc;"}
|
package/dist/index.es16.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import t, { useId as n } from "react";
|
|
2
|
+
import { Label as l } from "./index.es17.js";
|
|
3
|
+
import { Textarea as m } from "./index.es15.js";
|
|
4
|
+
function p({
|
|
5
|
+
id: s,
|
|
6
|
+
variant: e = "default",
|
|
7
|
+
label: a,
|
|
8
|
+
className: c
|
|
9
|
+
}) {
|
|
10
|
+
const i = n(), o = s || i, r = e === "default" ? "group-focus-within:text-navy-opacity-40" : "group-focus-within:text-whitish-opacity-60";
|
|
11
|
+
return /* @__PURE__ */ t.createElement("div", { className: `grid w-full items-center gap-1 group ${c}` }, a && /* @__PURE__ */ t.createElement(
|
|
12
|
+
l,
|
|
13
|
+
{
|
|
14
|
+
variant: e,
|
|
15
|
+
htmlFor: o,
|
|
16
|
+
className: r
|
|
17
|
+
},
|
|
18
|
+
a
|
|
19
|
+
), /* @__PURE__ */ t.createElement(
|
|
20
|
+
m,
|
|
21
|
+
{
|
|
22
|
+
id: o,
|
|
23
|
+
variant: e,
|
|
24
|
+
className: `focus:outline-none '${r}'`
|
|
25
|
+
}
|
|
26
|
+
));
|
|
27
|
+
}
|
|
25
28
|
export {
|
|
26
|
-
|
|
29
|
+
p as TextareaWithLabel
|
|
27
30
|
};
|
|
28
31
|
//# sourceMappingURL=index.es16.js.map
|
package/dist/index.es16.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es16.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index.es16.js","sources":["../src/components/ui/textarea/TextareaWithLabel.tsx"],"sourcesContent":["import React, { useId } from 'react'\r\n\r\nimport { InputVariant } from '../input/types'\r\nimport { Label } from '../label'\r\nimport { Textarea } from './Textarea'\r\n\r\ninterface TextareaWithLabelProps {\r\n variant?: InputVariant\r\n label?: string\r\n id?: string\r\n className?: string\r\n}\r\n\r\nexport function TextareaWithLabel({\r\n id,\r\n variant = 'default',\r\n label,\r\n className,\r\n}: TextareaWithLabelProps) {\r\n const generatedId = useId()\r\n const textareaId = id || generatedId\r\n\r\n const textareaClasses =\r\n variant === 'default'\r\n ? 'group-focus-within:text-navy-opacity-40'\r\n : 'group-focus-within:text-whitish-opacity-60'\r\n\r\n return (\r\n <div className={`grid w-full items-center gap-1 group ${className}`}>\r\n {label && (\r\n <Label\r\n variant={variant}\r\n htmlFor={textareaId}\r\n className={textareaClasses}\r\n >\r\n {label}\r\n </Label>\r\n )}\r\n\r\n <Textarea\r\n id={textareaId}\r\n variant={variant}\r\n className={`focus:outline-none '${textareaClasses}'`}\r\n />\r\n\r\n {/* {desc && <p className=\"text-sm text-muted-foreground\">{desc}</p>} */}\r\n </div>\r\n )\r\n}\r\n"],"names":["TextareaWithLabel","id","variant","label","className","generatedId","useId","textareaId","textareaClasses","React","Label","Textarea"],"mappings":";;;AAaO,SAASA,EAAkB;AAAA,EAChC,IAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,WAAAC;AACF,GAA2B;AACzB,QAAMC,IAAcC,KACdC,IAAaN,KAAMI,GAEnBG,IACJN,MAAY,YACR,4CACA;AAEN,yCACG,OAAI,EAAA,WAAW,wCAAwCE,CAAS,MAC9DD,KACCM,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAR;AAAA,MACA,SAASK;AAAA,MACT,WAAWC;AAAA,IAAA;AAAA,IAEVL;AAAA,EAIL,GAAAM,gBAAAA,EAAA;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,IAAIJ;AAAA,MACJ,SAAAL;AAAA,MACA,WAAW,uBAAuBM,CAAe;AAAA,IAAA;AAAA,EAAA,CAIrD;AAEJ;"}
|
package/dist/index.es17.js
CHANGED
|
@@ -1,76 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} else
|
|
13
|
-
!a.has(e) && !s.endsWith("/>") && r.push(e);
|
|
14
|
-
}
|
|
15
|
-
return r.length === 0;
|
|
16
|
-
}, m = (t) => {
|
|
17
|
-
const a = /<[a-z]+\s+([^>]+)>/gi, i = t.matchAll(a);
|
|
18
|
-
for (const [s, e] of i) {
|
|
19
|
-
const o = e.match(/\w+\s*=\s*(['"])(.*?)\1|\w+(?!=)/g) || [];
|
|
20
|
-
for (const n of o)
|
|
21
|
-
if (n.includes("=")) {
|
|
22
|
-
const [g, ...f] = n.split("="), c = f.join("=");
|
|
23
|
-
if (!(c.startsWith('"') && c.endsWith('"') || c.startsWith("'") && c.endsWith("'")))
|
|
24
|
-
return !1;
|
|
25
|
-
const d = c[0];
|
|
26
|
-
if (c.slice(1, -1).includes(d))
|
|
27
|
-
return !1;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const r = /<[^>]*?['"][^'"]*>/g, l = t.match(r) || [];
|
|
31
|
-
for (const s of l) {
|
|
32
|
-
let e = !1, o = "";
|
|
33
|
-
for (let n = 0; n < s.length; n++)
|
|
34
|
-
(s[n] === "'" || s[n] === '"') && (e ? s[n] === o && (e = !1) : (e = !0, o = s[n]));
|
|
35
|
-
if (e)
|
|
36
|
-
return !1;
|
|
37
|
-
}
|
|
38
|
-
return !0;
|
|
39
|
-
}, v = (t) => {
|
|
40
|
-
const a = [...t.matchAll(/<([a-z]+)(\s[^>]*)\/>/gi)];
|
|
41
|
-
for (const [i, r, l] of a) {
|
|
42
|
-
const s = /(\w+)=["']([^"']*)["']/g, e = [...l.matchAll(s)];
|
|
43
|
-
for (const [g, f, c] of e)
|
|
44
|
-
if (!f || !c)
|
|
45
|
-
return !1;
|
|
46
|
-
const o = /(\w+)=["'][^"']*$/g;
|
|
47
|
-
if ([...l.matchAll(o)].length > 0)
|
|
48
|
-
return !1;
|
|
49
|
-
}
|
|
50
|
-
return !0;
|
|
51
|
-
}, p = (t) => {
|
|
52
|
-
const a = /style=["']([^"']*)["']/gi, i = [...t.matchAll(a)];
|
|
53
|
-
for (const [r, l] of i) {
|
|
54
|
-
const s = l.split(";");
|
|
55
|
-
for (const e of s)
|
|
56
|
-
if (e.trim()) {
|
|
57
|
-
const [o, n] = e.split(":");
|
|
58
|
-
if (!o || !n)
|
|
59
|
-
return !1;
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import * as t from "@radix-ui/react-label";
|
|
3
|
+
import { cva as l } from "class-variance-authority";
|
|
4
|
+
import { cn as n } from "./index.es52.js";
|
|
5
|
+
const s = l(
|
|
6
|
+
"typo_variant_h6 leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 duration-200",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "text-navy",
|
|
11
|
+
blue: "text-whitish"
|
|
60
12
|
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: "default"
|
|
16
|
+
}
|
|
61
17
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
html: t,
|
|
65
|
-
className: a
|
|
66
|
-
}) => T(t) ? /* @__PURE__ */ u.createElement(
|
|
67
|
-
"div",
|
|
18
|
+
), d = a.forwardRef(({ className: e, variant: r, ...o }, i) => /* @__PURE__ */ a.createElement(
|
|
19
|
+
t.Root,
|
|
68
20
|
{
|
|
69
|
-
|
|
70
|
-
|
|
21
|
+
ref: i,
|
|
22
|
+
className: n(s({ variant: r }), e),
|
|
23
|
+
...o
|
|
71
24
|
}
|
|
72
|
-
)
|
|
25
|
+
));
|
|
26
|
+
d.displayName = t.Root.displayName;
|
|
73
27
|
export {
|
|
74
|
-
|
|
28
|
+
d as Label,
|
|
29
|
+
s as labelVariants
|
|
75
30
|
};
|
|
76
31
|
//# sourceMappingURL=index.es17.js.map
|
package/dist/index.es17.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es17.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index.es17.js","sources":["../src/components/ui/label.tsx"],"sourcesContent":["import * as React from 'react'\r\nimport * as LabelPrimitive from '@radix-ui/react-label'\r\nimport { cva, type VariantProps } from 'class-variance-authority'\r\n\r\nimport { cn } from '@/lib/utils/cn'\r\n\r\nexport const labelVariants = cva(\r\n 'typo_variant_h6 leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 duration-200',\r\n {\r\n variants: {\r\n variant: {\r\n default: 'text-navy',\r\n blue: 'text-whitish',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n }\r\n)\r\n\r\nconst Label = React.forwardRef<\r\n React.ElementRef<typeof LabelPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\r\n VariantProps<typeof labelVariants>\r\n>(({ className, variant, ...props }, ref) => (\r\n <LabelPrimitive.Root\r\n ref={ref}\r\n className={cn(labelVariants({ variant }), className)}\r\n {...props}\r\n />\r\n))\r\nLabel.displayName = LabelPrimitive.Root.displayName\r\n\r\nexport { Label }\r\n"],"names":["labelVariants","cva","Label","React","className","variant","props","ref","LabelPrimitive","cn"],"mappings":";;;;AAMO,MAAMA,IAAgBC;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF,GAEMC,IAAQC,EAAM,WAIlB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,GAAGC,EAAM,GAAGC,MACnC,gBAAAJ,EAAA;AAAA,EAACK,EAAe;AAAA,EAAf;AAAA,IACC,KAAAD;AAAA,IACA,WAAWE,EAAGT,EAAc,EAAE,SAAAK,EAAS,CAAA,GAAGD,CAAS;AAAA,IAClD,GAAGE;AAAA,EAAA;AACN,CACD;AACDJ,EAAM,cAAcM,EAAe,KAAK;"}
|
package/dist/index.es18.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
1
|
+
import { Popover as n, PopoverTrigger as a, PopoverContent as l } from "./index.es54.js";
|
|
2
|
+
import { TooltipProvider as m, Tooltip as i, TooltipTrigger as c, TooltipContent as s } from "./index.es55.js";
|
|
3
|
+
import { Button as r } from "./index.es2.js";
|
|
4
|
+
import { Info as o } from "lucide-react";
|
|
5
|
+
import e from "react";
|
|
6
|
+
const p = ({ content: t }) => /* @__PURE__ */ e.createElement(m, { delayDuration: 0 }, /* @__PURE__ */ e.createElement("div", { className: "hidden xl:block" }, /* @__PURE__ */ e.createElement(i, null, /* @__PURE__ */ e.createElement(c, { asChild: !0 }, /* @__PURE__ */ e.createElement(
|
|
7
|
+
r,
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
), h = e.forwardRef(({ className: i, variant: r, ...o }, s) => /* @__PURE__ */ e.createElement(
|
|
20
|
-
t.Root,
|
|
9
|
+
variant: "ghost",
|
|
10
|
+
size: "icon",
|
|
11
|
+
className: "rounded-full group/informer h-8 w-8"
|
|
12
|
+
},
|
|
13
|
+
/* @__PURE__ */ e.createElement(o, { className: "w-5 h-5 text-navy-opacity-40 group-hover/informer:text-navy transition-colors" }),
|
|
14
|
+
/* @__PURE__ */ e.createElement("span", { className: "sr-only" }, "Warning")
|
|
15
|
+
)), /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("div", null, t)))), /* @__PURE__ */ e.createElement("div", { className: "block xl:hidden" }, /* @__PURE__ */ e.createElement(n, null, /* @__PURE__ */ e.createElement(a, { asChild: !0 }, /* @__PURE__ */ e.createElement(
|
|
16
|
+
r,
|
|
21
17
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
variant: "ghost",
|
|
19
|
+
size: "icon",
|
|
20
|
+
className: "rounded-full group/informer h-8 w-8"
|
|
25
21
|
},
|
|
26
|
-
/* @__PURE__ */ e.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: a("flex items-center justify-center text-current")
|
|
30
|
-
},
|
|
31
|
-
/* @__PURE__ */ e.createElement(c, { className: "h-[18px] w-[18px] relative bottom-[1px]" })
|
|
32
|
-
)
|
|
33
|
-
));
|
|
34
|
-
h.displayName = t.Root.displayName;
|
|
22
|
+
/* @__PURE__ */ e.createElement(o, { className: "w-5 h-5 text-navy-opacity-40 group-hover/informer:text-navy transition-colors" }),
|
|
23
|
+
/* @__PURE__ */ e.createElement("span", { className: "sr-only" }, "Warning")
|
|
24
|
+
)), /* @__PURE__ */ e.createElement(l, { className: "px-3 py-1.5" }, /* @__PURE__ */ e.createElement("div", null, t))))), g = p;
|
|
35
25
|
export {
|
|
36
|
-
|
|
26
|
+
g as default
|
|
37
27
|
};
|
|
38
28
|
//# sourceMappingURL=index.es18.js.map
|
package/dist/index.es18.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es18.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index.es18.js","sources":["../src/components/Informer.tsx"],"sourcesContent":["import {\r\n Popover,\r\n PopoverContent,\r\n PopoverTrigger,\r\n} from '@/components/ui/popover'\r\nimport {\r\n Tooltip,\r\n TooltipContent,\r\n TooltipProvider,\r\n TooltipTrigger,\r\n} from '@/components/ui/tooltip'\r\n\r\nimport { Button } from '@/components/ui/button'\r\nimport { Info } from 'lucide-react'\r\nimport React from 'react'\r\n\r\ninterface InformerProps {\r\n content: string\r\n}\r\n\r\nconst Informer = ({ content }: InformerProps) => {\r\n return (\r\n <TooltipProvider delayDuration={0}>\r\n <div className=\"hidden xl:block\">\r\n <Tooltip>\r\n <TooltipTrigger asChild>\r\n <Button\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className=\"rounded-full group/informer h-8 w-8\"\r\n >\r\n <Info className=\"w-5 h-5 text-navy-opacity-40 group-hover/informer:text-navy transition-colors\" />\r\n <span className=\"sr-only\">Warning</span>\r\n </Button>\r\n </TooltipTrigger>\r\n <TooltipContent>\r\n <div>{content}</div>\r\n </TooltipContent>\r\n </Tooltip>\r\n </div>\r\n <div className=\"block xl:hidden\">\r\n <Popover>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"ghost\"\r\n size=\"icon\"\r\n className=\"rounded-full group/informer h-8 w-8\"\r\n >\r\n <Info className=\"w-5 h-5 text-navy-opacity-40 group-hover/informer:text-navy transition-colors\" />\r\n <span className=\"sr-only\">Warning</span>\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent className=\"px-3 py-1.5\">\r\n <div>{content}</div>\r\n </PopoverContent>\r\n </Popover>\r\n </div>\r\n </TooltipProvider>\r\n )\r\n}\r\n\r\nexport default Informer\r\n"],"names":["Informer","content","React","TooltipProvider","Tooltip","TooltipTrigger","Button","Info","TooltipContent","Popover","PopoverTrigger","PopoverContent","Informer$1"],"mappings":";;;;;AAoBA,MAAMA,IAAW,CAAC,EAAE,SAAAC,QAEfC,gBAAAA,EAAA,cAAAC,GAAA,EAAgB,eAAe,EAAA,GAC7BD,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAU,qBACZA,gBA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", "input", "hr", "meta", "link"]), i = /<\/?([a-z]+)(\s[^>]*)?>/gi, r = [];
|
|
4
|
+
let l;
|
|
5
|
+
for (; (l = i.exec(t)) !== null; ) {
|
|
6
|
+
const s = l[0], e = l[1].toLowerCase();
|
|
7
|
+
if (s === "</br>")
|
|
8
|
+
return !1;
|
|
9
|
+
if (s.startsWith("</")) {
|
|
10
|
+
if (a.has(e) || r.length === 0 || r.pop() !== e)
|
|
11
|
+
return !1;
|
|
12
|
+
} else
|
|
13
|
+
!a.has(e) && !s.endsWith("/>") && r.push(e);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
return r.length === 0;
|
|
16
|
+
}, m = (t) => {
|
|
17
|
+
const a = /<[a-z]+\s+([^>]+)>/gi, i = t.matchAll(a);
|
|
18
|
+
for (const [s, e] of i) {
|
|
19
|
+
const o = e.match(/\w+\s*=\s*(['"])(.*?)\1|\w+(?!=)/g) || [];
|
|
20
|
+
for (const n of o)
|
|
21
|
+
if (n.includes("=")) {
|
|
22
|
+
const [g, ...f] = n.split("="), c = f.join("=");
|
|
23
|
+
if (!(c.startsWith('"') && c.endsWith('"') || c.startsWith("'") && c.endsWith("'")))
|
|
24
|
+
return !1;
|
|
25
|
+
const d = c[0];
|
|
26
|
+
if (c.slice(1, -1).includes(d))
|
|
27
|
+
return !1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const r = /<[^>]*?['"][^'"]*>/g, l = t.match(r) || [];
|
|
31
|
+
for (const s of l) {
|
|
32
|
+
let e = !1, o = "";
|
|
33
|
+
for (let n = 0; n < s.length; n++)
|
|
34
|
+
(s[n] === "'" || s[n] === '"') && (e ? s[n] === o && (e = !1) : (e = !0, o = s[n]));
|
|
35
|
+
if (e)
|
|
36
|
+
return !1;
|
|
37
|
+
}
|
|
38
|
+
return !0;
|
|
39
|
+
}, v = (t) => {
|
|
40
|
+
const a = [...t.matchAll(/<([a-z]+)(\s[^>]*)\/>/gi)];
|
|
41
|
+
for (const [i, r, l] of a) {
|
|
42
|
+
const s = /(\w+)=["']([^"']*)["']/g, e = [...l.matchAll(s)];
|
|
43
|
+
for (const [g, f, c] of e)
|
|
44
|
+
if (!f || !c)
|
|
45
|
+
return !1;
|
|
46
|
+
const o = /(\w+)=["'][^"']*$/g;
|
|
47
|
+
if ([...l.matchAll(o)].length > 0)
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
50
|
+
return !0;
|
|
51
|
+
}, p = (t) => {
|
|
52
|
+
const a = /style=["']([^"']*)["']/gi, i = [...t.matchAll(a)];
|
|
53
|
+
for (const [r, l] of i) {
|
|
54
|
+
const s = l.split(";");
|
|
55
|
+
for (const e of s)
|
|
56
|
+
if (e.trim()) {
|
|
57
|
+
const [o, n] = e.split(":");
|
|
58
|
+
if (!o || !n)
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return !0;
|
|
63
|
+
}, T = (t) => h(t) && m(t) && v(t) && p(t), y = ({
|
|
64
|
+
html: t,
|
|
65
|
+
className: a
|
|
66
|
+
}) => T(t) ? /* @__PURE__ */ u.createElement(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: ["content", a].filter(Boolean).join(" "),
|
|
70
|
+
dangerouslySetInnerHTML: { __html: t }
|
|
71
|
+
}
|
|
72
|
+
) : (console.error("Invalid HTML content:", t), /* @__PURE__ */ u.createElement("div", { style: { color: "red" } }, "Invalid HTML content")), R = y;
|
|
32
73
|
export {
|
|
33
|
-
|
|
74
|
+
R as default
|
|
34
75
|
};
|
|
35
76
|
//# sourceMappingURL=index.es19.js.map
|
package/dist/index.es19.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es19.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index.es19.js","sources":["../src/components/SafeHtml.tsx"],"sourcesContent":["import React from 'react'\r\n\r\n// Check if tags are correctly opened and closed\r\nconst validateTags = (htmlString: string) => {\r\n // List of known self-closing tags\r\n const selfClosingTags = new Set(['br', 'img', 'input', 'hr', 'meta', 'link'])\r\n\r\n const tagPattern = /<\\/?([a-z]+)(\\s[^>]*)?>/gi\r\n const tagStack: string[] = []\r\n let match\r\n\r\n while ((match = tagPattern.exec(htmlString)) !== null) {\r\n const fullTag = match[0]\r\n const tagName = match[1].toLowerCase()\r\n\r\n // Check for incorrect </br> usage\r\n if (fullTag === '</br>') {\r\n return false // </br> is invalid HTML\r\n }\r\n\r\n if (fullTag.startsWith('</')) {\r\n // Closing tag\r\n if (selfClosingTags.has(tagName)) {\r\n return false // Self-closing tags shouldn't have closing tags\r\n }\r\n if (tagStack.length === 0) return false\r\n const lastTag = tagStack.pop()\r\n if (lastTag !== tagName) return false\r\n } else {\r\n // Opening tag\r\n if (!selfClosingTags.has(tagName) && !fullTag.endsWith('/>')) {\r\n tagStack.push(tagName)\r\n }\r\n }\r\n }\r\n\r\n return tagStack.length === 0\r\n}\r\n\r\nconst validateAttributes = (htmlString: string) => {\r\n const attributeRegex = /<[a-z]+\\s+([^>]+)>/gi\r\n const matches = htmlString.matchAll(attributeRegex)\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n for (const [fullMatch, attributes] of matches) {\r\n // Split attributes by space, but keep quoted values together\r\n const attrs = attributes.match(/\\w+\\s*=\\s*(['\"])(.*?)\\1|\\w+(?!=)/g) || []\r\n\r\n for (const attr of attrs) {\r\n // Check if attribute has quotes\r\n if (attr.includes('=')) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [name, ...rest] = attr.split('=')\r\n const value = rest.join('=') // Rejoin in case value contains =\r\n\r\n // Check for proper quote matching\r\n if (\r\n !(\r\n (value.startsWith('\"') && value.endsWith('\"')) ||\r\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\r\n )\r\n ) {\r\n return false\r\n }\r\n\r\n // Extract the quote character used\r\n const quoteChar = value[0]\r\n // Check if there are any unescaped quotes of the same type inside the value\r\n const valueContent = value.slice(1, -1)\r\n if (valueContent.includes(quoteChar)) {\r\n return false\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Additional check for unclosed quotes before >\r\n const unclosedQuoteCheck = /<[^>]*?['\"][^'\"]*>/g\r\n const potentiallyUnclosedTags = htmlString.match(unclosedQuoteCheck) || []\r\n for (const tag of potentiallyUnclosedTags) {\r\n let inQuote = false\r\n let quoteChar = ''\r\n for (let i = 0; i < tag.length; i++) {\r\n if (tag[i] === \"'\" || tag[i] === '\"') {\r\n if (!inQuote) {\r\n inQuote = true\r\n quoteChar = tag[i]\r\n } else if (tag[i] === quoteChar) {\r\n inQuote = false\r\n }\r\n }\r\n }\r\n if (inQuote) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n}\r\n\r\n// Check if self-closing tags are valid\r\nconst validateSelfClosingTags = (htmlString: string) => {\r\n const selfClosingTags = [...htmlString.matchAll(/<([a-z]+)(\\s[^>]*)\\/>/gi)]\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n for (const [_, tag, attributes] of selfClosingTags) {\r\n const attrRegex = /(\\w+)=[\"']([^\"']*)[\"']/g\r\n const attrs = [...attributes.matchAll(attrRegex)]\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n for (const [_, attrName, attrValue] of attrs) {\r\n if (!attrName || !attrValue) {\r\n return false // Invalid attribute format\r\n }\r\n }\r\n\r\n // Check for unclosed attributes\r\n const unclosedAttrRegex = /(\\w+)=[\"'][^\"']*$/g\r\n const unclosedAttrs = [...attributes.matchAll(unclosedAttrRegex)]\r\n\r\n if (unclosedAttrs.length > 0) {\r\n return false // Unclosed attribute in self-closing tag\r\n }\r\n }\r\n\r\n return true // Self-closing tags are valid\r\n}\r\n\r\n// Check for inline styles and ensure they follow a valid format\r\nconst validateInlineStyles = (htmlString: string) => {\r\n const styleRegex = /style=[\"']([^\"']*)[\"']/gi\r\n const styles = [...htmlString.matchAll(styleRegex)]\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n for (const [_, styleContent] of styles) {\r\n // A basic check for properly formatted style declarations (e.g., \"property: value;\")\r\n const styleRules = styleContent.split(';')\r\n for (const rule of styleRules) {\r\n if (rule.trim()) {\r\n const [property, value] = rule.split(':')\r\n if (!property || !value) {\r\n return false // Invalid style declaration\r\n }\r\n }\r\n }\r\n }\r\n\r\n return true // Inline styles are valid\r\n}\r\n\r\n// Main function that calls the smaller subfunctions\r\nconst validateHtmlBasic = (htmlString: string) => {\r\n return (\r\n validateTags(htmlString) &&\r\n validateAttributes(htmlString) &&\r\n validateSelfClosingTags(htmlString) &&\r\n validateInlineStyles(htmlString)\r\n )\r\n}\r\n\r\n////\r\n\r\nconst SafeHtmlRenderer = ({\r\n html,\r\n className,\r\n}: {\r\n html: string\r\n className?: string\r\n}) => {\r\n const isValid = validateHtmlBasic(html)\r\n // console.log(\"isValidHTML\", isValid);\r\n // TODO: add send error to TG\r\n\r\n if (!isValid) {\r\n console.error('Invalid HTML content:', html)\r\n return <div style={{ color: 'red' }}>Invalid HTML content</div>\r\n }\r\n\r\n return (\r\n <div\r\n className={['content', className].filter(Boolean).join(' ')}\r\n dangerouslySetInnerHTML={{ __html: html }}\r\n />\r\n )\r\n}\r\n\r\nexport default SafeHtmlRenderer\r\n"],"names":["validateTags","htmlString","selfClosingTags","tagPattern","tagStack","match","fullTag","tagName","validateAttributes","attributeRegex","matches","fullMatch","attributes","attrs","attr","name","rest","value","quoteChar","unclosedQuoteCheck","potentiallyUnclosedTags","tag","inQuote","i","validateSelfClosingTags","_","attrRegex","attrName","attrValue","unclosedAttrRegex","validateInlineStyles","styleRegex","styles","styleContent","styleRules","rule","property","validateHtmlBasic","SafeHtmlRenderer","html","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mBP,CAAU,KAC7BuB,EAAwBvB,CAAU,KAClC6B,EAAqB7B,CAAU,GAM7BqC,IAAmB,CAAC;AAAA,EACxB,MAAAC;AAAA,EACA,WAAAC;AACF,MAIkBH,EAAkBE,CAAI,IAUpCE,gBAAAA,EAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,CAAC,WAAWD,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IAC1D,yBAAyB,EAAE,QAAQD,EAAK;AAAA,EAAA;AAAA,KAPlC,QAAA,MAAM,yBAAyBA,CAAI,mCACnC,OAAI,EAAA,OAAO,EAAE,OAAO,MAAA,KAAS,sBAAoB,IAW7DG,IAAeJ;"}
|
package/dist/index.es2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import { Slot as d } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva as c } from "class-variance-authority";
|
|
4
|
-
import { cn as u } from "./index.
|
|
4
|
+
import { cn as u } from "./index.es52.js";
|
|
5
5
|
const l = c(
|
|
6
6
|
"inline-flex items-center justify-center whitespace-nowrap rounded-full typo_variant_button ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed border-none",
|
|
7
7
|
{
|