@arkyn/components 1.4.6 → 1.4.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/HasFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,OAAO,cAAc,CAAC;AAEtB,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAuDjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/HasFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,OAAO,cAAc,CAAC;AAEtB,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA4DjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -5,8 +5,10 @@ import { IconButton } from "../../IconButton";
5
5
  import { Tooltip } from "../../Tooltip";
6
6
  import "./styles.css";
7
7
  function HasFileContent(props) {
8
- const { filePath, isLoading, acceptImage, changeImageButtonText, handleSelectFile, reSendImage, } = props;
8
+ const { disabled, filePath, isLoading, acceptImage, changeImageButtonText, handleSelectFile, reSendImage, } = props;
9
9
  function handleClick() {
10
+ if (disabled)
11
+ return;
10
12
  const input = document.createElement("input");
11
13
  input.type = "file";
12
14
  input.accept = acceptImage;
@@ -17,6 +19,6 @@ function HasFileContent(props) {
17
19
  };
18
20
  input.click();
19
21
  }
20
- return (_jsxs("div", { className: "arkynImageUploadHasFileContent", style: { backgroundImage: `url("${filePath}")` }, children: [reSendImage && (_jsx(Tooltip, { orientation: "bottom", text: "Reenviar imagem", children: _jsx(IconButton, { type: "button", "aria-label": "resend image", variant: "outline", scheme: "danger", size: "sm", isLoading: isLoading, onClick: reSendImage, icon: RefreshCw }) })), _jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "outline", size: "sm", type: "button", children: changeImageButtonText })] }));
22
+ return (_jsxs("div", { className: "arkynImageUploadHasFileContent", style: { backgroundImage: `url("${filePath}")` }, children: [reSendImage && (_jsx(Tooltip, { orientation: "bottom", text: "Reenviar imagem", children: _jsx(IconButton, { type: "button", "aria-label": "resend image", variant: "outline", scheme: "danger", size: "sm", isLoading: isLoading, onClick: reSendImage, icon: RefreshCw, disabled: disabled }) })), _jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "outline", size: "sm", type: "button", disabled: disabled, children: changeImageButtonText })] }));
21
23
  }
22
24
  export { HasFileContent };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/NoFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,cAAc,CAAC;AAEtB,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA4C/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/NoFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,cAAc,CAAC;AAEtB,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAkD/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -2,14 +2,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "../../Button";
3
3
  import "./styles.css";
4
4
  function NoFileContent(props) {
5
- const { dropImageText, isLoading, acceptImage, handleSelectFile, selectImageButtonText, } = props;
5
+ const { dropImageText, isLoading, acceptImage, handleSelectFile, selectImageButtonText, disabled, } = props;
6
6
  function handleDrop(event) {
7
+ if (disabled)
8
+ return;
7
9
  event.preventDefault();
8
10
  const file = event.dataTransfer.files[0];
9
11
  if (file)
10
12
  handleSelectFile(file);
11
13
  }
12
14
  function handleClick() {
15
+ if (disabled)
16
+ return;
13
17
  const input = document.createElement("input");
14
18
  input.type = "file";
15
19
  input.accept = acceptImage;
@@ -20,6 +24,6 @@ function NoFileContent(props) {
20
24
  };
21
25
  input.click();
22
26
  }
23
- return (_jsxs("div", { onDrop: handleDrop, className: "arkynImageUploadNoFileContent", children: [_jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "ghost", size: "sm", type: "button", children: selectImageButtonText }), _jsx("p", { children: dropImageText })] }));
27
+ return (_jsxs("div", { onDrop: handleDrop, className: "arkynImageUploadNoFileContent", children: [_jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "ghost", size: "sm", type: "button", disabled: disabled, children: selectImageButtonText }), _jsx("p", { children: dropImageText })] }));
24
28
  }
25
29
  export { NoFileContent };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ImageUpload/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUhD,OAAO,cAAc,CAAC;AAEtB,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA6F3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ImageUpload/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUhD,OAAO,cAAc,CAAC;AAEtB,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAoG3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -7,7 +7,7 @@ import { ImageUploadLabel } from "./ImageUploadLabel";
7
7
  import { NoFileContent } from "./NoFileContent";
8
8
  import "./styles.css";
9
9
  function ImageUpload(props) {
10
- const { name, defaultValue = "", label, showAsterisk = false, action, fileName = "file", method = "POST", acceptImage = "image/*", fileResponseName = "url", changeImageButtonText = "Alterar imagem", selectImageButtonText = "Selecionar imagem", dropImageText = "Ou arraste e solte a imagem aqui", onUpload, } = props;
10
+ const { name, defaultValue = "", label, showAsterisk = false, action, fileName = "file", method = "POST", acceptImage = "image/*", fileResponseName = "url", changeImageButtonText = "Alterar imagem", selectImageButtonText = "Selecionar imagem", dropImageText = "Ou arraste e solte a imagem aqui", onUpload, disabled = false, } = props;
11
11
  const fieldErrors = useFieldErrors();
12
12
  const fieldError = fieldErrors[name];
13
13
  const [value, setValue] = useState(defaultValue);
@@ -16,6 +16,8 @@ function ImageUpload(props) {
16
16
  const [filePath, setFilePath] = useState(defaultValue);
17
17
  const [isLoading, setIsLoading] = useState(false);
18
18
  async function handleUploadImage(file) {
19
+ if (disabled)
20
+ return;
19
21
  setIsLoading(true);
20
22
  setFile(file);
21
23
  setError("");
@@ -37,6 +39,8 @@ function ImageUpload(props) {
37
39
  .finally(() => setIsLoading(false));
38
40
  }
39
41
  function handleSelectFile(file) {
42
+ if (disabled)
43
+ return;
40
44
  setFilePath(URL.createObjectURL(file));
41
45
  handleUploadImage(file);
42
46
  }
@@ -44,6 +48,6 @@ function ImageUpload(props) {
44
48
  const hasErrorClassName = errorMessage ? "hasError" : "noHasError";
45
49
  const hasImageClassName = filePath ? "hasImage" : "noHasImage";
46
50
  const className = `arkynImageUpload ${hasErrorClassName} ${hasImageClassName}`;
47
- return (_jsxs("div", { className: "arkynImageUploadContainer", children: [label && _jsx(ImageUploadLabel, { label: label, showAsterisk: showAsterisk }), _jsxs("div", { className: className, children: [_jsx("input", { type: "hidden", name: name, value: value || "" }), !filePath && (_jsx(NoFileContent, { isLoading: isLoading, acceptImage: acceptImage, dropImageText: dropImageText, handleSelectFile: handleSelectFile, selectImageButtonText: selectImageButtonText })), filePath && (_jsx(HasFileContent, { isLoading: isLoading, acceptImage: acceptImage, filePath: filePath, handleSelectFile: handleSelectFile, changeImageButtonText: changeImageButtonText, reSendImage: !!errorMessage && file ? () => handleUploadImage(file) : undefined }))] }), errorMessage && _jsx(ImageUploadError, { error: errorMessage })] }));
51
+ return (_jsxs("div", { className: "arkynImageUploadContainer", children: [label && _jsx(ImageUploadLabel, { label: label, showAsterisk: showAsterisk }), _jsxs("div", { className: className, children: [_jsx("input", { type: "hidden", name: name, value: value || "" }), !filePath && (_jsx(NoFileContent, { disabled: disabled, isLoading: isLoading, acceptImage: acceptImage, dropImageText: dropImageText, handleSelectFile: handleSelectFile, selectImageButtonText: selectImageButtonText })), filePath && (_jsx(HasFileContent, { disabled: disabled, isLoading: isLoading, acceptImage: acceptImage, filePath: filePath, handleSelectFile: handleSelectFile, changeImageButtonText: changeImageButtonText, reSendImage: !!errorMessage && file ? () => handleUploadImage(file) : undefined }))] }), errorMessage && _jsx(ImageUploadError, { error: errorMessage })] }));
48
52
  }
49
53
  export { ImageUpload };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,aAAa,EAAE,MAAM,cAAc,CAAC;AAmCtE,OAAO,cAAc,CAAC;AAEtB,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAyKrC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,aAAa,EAAE,MAAM,cAAc,CAAC;AAmCtE,OAAO,cAAc,CAAC;AAEtB,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA2KrC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -72,7 +72,7 @@ function RichText(props) {
72
72
  function buttonIsNotHidden(format) {
73
73
  return !hiddenButtons?.includes(format);
74
74
  }
75
- return (_jsxs(Slate, { editor: editor, initialValue: getDefaultNodes(), onChange: handleChange, onValueChange: handleChange, children: [_jsxs("div", { className: className, children: [_jsxs(Toolbar, { children: [buttonIsNotHidden("headingOne") && (_jsx(BlockButton, { format: "headingOne", icon: Heading1 })), buttonIsNotHidden("headingTwo") && (_jsx(BlockButton, { format: "headingTwo", icon: Heading2 })), buttonIsNotHidden("blockQuote") && (_jsx(BlockButton, { format: "blockQuote", icon: Quote })), buttonIsNotHidden("bold") && (_jsx(MarkButton, { format: "bold", icon: Bold })), buttonIsNotHidden("italic") && (_jsx(MarkButton, { format: "italic", icon: Italic })), buttonIsNotHidden("underline") && (_jsx(MarkButton, { format: "underline", icon: Underline })), buttonIsNotHidden("code") && (_jsx(MarkButton, { format: "code", icon: Code })), buttonIsNotHidden("left") && (_jsx(BlockButton, { format: "left", icon: AlignLeft })), buttonIsNotHidden("right") && (_jsx(BlockButton, { format: "right", icon: AlignRight })), buttonIsNotHidden("center") && (_jsx(BlockButton, { format: "center", icon: AlignCenter })), buttonIsNotHidden("justify") && (_jsx(BlockButton, { format: "justify", icon: AlignJustify })), imageConfig && _jsx(InsertImage, { ...imageConfig })] }), _jsx(Editable, { className: "editorContainer", renderElement: renderElement, renderLeaf: renderLeaf, spellCheck: true, id: id, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onKeyDown: (event) => {
75
+ return (_jsxs(Slate, { editor: editor, initialValue: getDefaultNodes(), onChange: handleChange, onValueChange: handleChange, children: [_jsxs("div", { className: className, children: [_jsxs(Toolbar, { children: [buttonIsNotHidden("headingOne") && (_jsx(BlockButton, { format: "headingOne", icon: Heading1 })), buttonIsNotHidden("headingTwo") && (_jsx(BlockButton, { format: "headingTwo", icon: Heading2 })), buttonIsNotHidden("blockQuote") && (_jsx(BlockButton, { format: "blockQuote", icon: Quote })), buttonIsNotHidden("bold") && (_jsx(MarkButton, { format: "bold", icon: Bold })), buttonIsNotHidden("italic") && (_jsx(MarkButton, { format: "italic", icon: Italic })), buttonIsNotHidden("underline") && (_jsx(MarkButton, { format: "underline", icon: Underline })), buttonIsNotHidden("code") && (_jsx(MarkButton, { format: "code", icon: Code })), buttonIsNotHidden("left") && (_jsx(BlockButton, { format: "left", icon: AlignLeft })), buttonIsNotHidden("right") && (_jsx(BlockButton, { format: "right", icon: AlignRight })), buttonIsNotHidden("center") && (_jsx(BlockButton, { format: "center", icon: AlignCenter })), buttonIsNotHidden("justify") && (_jsx(BlockButton, { format: "justify", icon: AlignJustify })), imageConfig && buttonIsNotHidden("image") && (_jsx(InsertImage, { ...imageConfig }))] }), _jsx(Editable, { className: "editorContainer", renderElement: renderElement, renderLeaf: renderLeaf, spellCheck: true, id: id, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onKeyDown: (event) => {
76
76
  for (const hotkey in HOTKEYS) {
77
77
  if (isHotkey(hotkey, event)) {
78
78
  event.preventDefault();
package/dist/index.d.ts CHANGED
@@ -40,7 +40,8 @@ export { ClientOnly } from "./components/ClientOnly";
40
40
  export { GoogleMap } from "./components/GoogleMap";
41
41
  export { GoogleSearchPlaces } from "./components/GoogleSearchPlaces";
42
42
  export { GoogleTagManager } from "./components/GoogleTagManager";
43
- export { morpheme } from "./services/morpheme";
44
43
  export { getHtmlFromRichTextValue } from "./services/getHtmlFromRichTextValue";
45
44
  export { getRichTextValueFromHtml } from "./services/getRichTextValueFromHtml";
45
+ export { isHtml } from "./services/isHtml";
46
+ export { morpheme } from "./services/morpheme";
46
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAA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oogleSearchPlaces } from "./components/GoogleSearchPlaces";
49
49
  export { GoogleTagManager } from "./components/GoogleTagManager";
50
50
  // Services
51
- export { morpheme } from "./services/morpheme";
52
51
  export { getHtmlFromRichTextValue } from "./services/getHtmlFromRichTextValue";
53
52
  export { getRichTextValueFromHtml } from "./services/getRichTextValueFromHtml";
53
+ export { isHtml } from "./services/isHtml";
54
+ export { morpheme } from "./services/morpheme";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "main": "./dist/bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Lucas Gonçalves",
@@ -9,6 +9,7 @@ import "./styles.css";
9
9
 
10
10
  function HasFileContent(props: HasFileContentProps) {
11
11
  const {
12
+ disabled,
12
13
  filePath,
13
14
  isLoading,
14
15
  acceptImage,
@@ -18,6 +19,8 @@ function HasFileContent(props: HasFileContentProps) {
18
19
  } = props;
19
20
 
20
21
  function handleClick() {
22
+ if (disabled) return;
23
+
21
24
  const input = document.createElement("input");
22
25
 
23
26
  input.type = "file";
@@ -47,6 +50,7 @@ function HasFileContent(props: HasFileContentProps) {
47
50
  isLoading={isLoading}
48
51
  onClick={reSendImage}
49
52
  icon={RefreshCw}
53
+ disabled={disabled}
50
54
  />
51
55
  </Tooltip>
52
56
  )}
@@ -57,6 +61,7 @@ function HasFileContent(props: HasFileContentProps) {
57
61
  variant="outline"
58
62
  size="sm"
59
63
  type="button"
64
+ disabled={disabled}
60
65
  >
61
66
  {changeImageButtonText}
62
67
  </Button>
@@ -12,15 +12,20 @@ function NoFileContent(props: NoFileContentProps) {
12
12
  acceptImage,
13
13
  handleSelectFile,
14
14
  selectImageButtonText,
15
+ disabled,
15
16
  } = props;
16
17
 
17
18
  function handleDrop(event: DragEvent<HTMLDivElement>) {
19
+ if (disabled) return;
20
+
18
21
  event.preventDefault();
19
22
  const file = event.dataTransfer.files[0];
20
23
  if (file) handleSelectFile(file);
21
24
  }
22
25
 
23
26
  function handleClick() {
27
+ if (disabled) return;
28
+
24
29
  const input = document.createElement("input");
25
30
 
26
31
  input.type = "file";
@@ -42,6 +47,7 @@ function NoFileContent(props: NoFileContentProps) {
42
47
  variant="ghost"
43
48
  size="sm"
44
49
  type="button"
50
+ disabled={disabled}
45
51
  >
46
52
  {selectImageButtonText}
47
53
  </Button>
@@ -25,6 +25,7 @@ function ImageUpload(props: ImageUploadProps) {
25
25
  selectImageButtonText = "Selecionar imagem",
26
26
  dropImageText = "Ou arraste e solte a imagem aqui",
27
27
  onUpload,
28
+ disabled = false,
28
29
  } = props;
29
30
 
30
31
  const fieldErrors = useFieldErrors();
@@ -37,6 +38,8 @@ function ImageUpload(props: ImageUploadProps) {
37
38
  const [isLoading, setIsLoading] = useState(false);
38
39
 
39
40
  async function handleUploadImage(file: File) {
41
+ if (disabled) return;
42
+
40
43
  setIsLoading(true);
41
44
  setFile(file);
42
45
  setError("");
@@ -59,6 +62,8 @@ function ImageUpload(props: ImageUploadProps) {
59
62
  }
60
63
 
61
64
  function handleSelectFile(file: File) {
65
+ if (disabled) return;
66
+
62
67
  setFilePath(URL.createObjectURL(file));
63
68
  handleUploadImage(file);
64
69
  }
@@ -78,6 +83,7 @@ function ImageUpload(props: ImageUploadProps) {
78
83
 
79
84
  {!filePath && (
80
85
  <NoFileContent
86
+ disabled={disabled}
81
87
  isLoading={isLoading}
82
88
  acceptImage={acceptImage}
83
89
  dropImageText={dropImageText}
@@ -88,6 +94,7 @@ function ImageUpload(props: ImageUploadProps) {
88
94
 
89
95
  {filePath && (
90
96
  <HasFileContent
97
+ disabled={disabled}
91
98
  isLoading={isLoading}
92
99
  acceptImage={acceptImage}
93
100
  filePath={filePath}
@@ -173,7 +173,9 @@ function RichText(props: RichTextProps) {
173
173
  <BlockButton format="justify" icon={AlignJustify} />
174
174
  )}
175
175
 
176
- {imageConfig && <InsertImage {...imageConfig} />}
176
+ {imageConfig && buttonIsNotHidden("image") && (
177
+ <InsertImage {...imageConfig} />
178
+ )}
177
179
  </Toolbar>
178
180
 
179
181
  <Editable
package/src/index.ts CHANGED
@@ -67,6 +67,7 @@ export { GoogleSearchPlaces } from "./components/GoogleSearchPlaces";
67
67
  export { GoogleTagManager } from "./components/GoogleTagManager";
68
68
 
69
69
  // Services
70
- export { morpheme } from "./services/morpheme";
71
70
  export { getHtmlFromRichTextValue } from "./services/getHtmlFromRichTextValue";
72
71
  export { getRichTextValueFromHtml } from "./services/getRichTextValueFromHtml";
72
+ export { isHtml } from "./services/isHtml";
73
+ export { morpheme } from "./services/morpheme";