@worknice/whiteboard 0.17.0 → 0.18.0

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.
@@ -0,0 +1,14 @@
1
+ import { type Dispatch, type ReactNode } from "react";
2
+ import type { ValidationError } from "../forms/_types";
3
+ type Props = {
4
+ id?: string;
5
+ label?: ReactNode;
6
+ description?: ReactNode;
7
+ value: File | null | undefined;
8
+ onChange: Dispatch<File | null | undefined>;
9
+ errors?: Array<ValidationError>;
10
+ logoUrl?: string | null;
11
+ required?: boolean;
12
+ };
13
+ declare const OrgLogoField: ({ id, label, description, value, onChange, errors, logoUrl, required, }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ export default OrgLogoField;
@@ -0,0 +1,80 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__ from "../controls/Button.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__ from "../forms/RegularField.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__inputs_FileInput_js_305b2c00__ from "../inputs/FileInput.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__ from "../presentation/HStack.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__ from "../utils/useNextContext.js";
8
+ const OrgLogoField = ({ id = "org-logo", label = "Logo", description = "Must be a JPEG or PNG image with a white background. Recommended size is 192×192 pixels.", value, onChange, errors, logoUrl, required = false })=>{
9
+ const [removedImage, setRemovedImage] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(void 0);
10
+ const { Image } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
11
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
12
+ inputId: id,
13
+ label: label,
14
+ description: description,
15
+ errors: errors,
16
+ required: required,
17
+ labelFont: "label",
18
+ children: logoUrl && logoUrl !== removedImage ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
19
+ align: "center",
20
+ spacing: "p2",
21
+ children: [
22
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Image, {
23
+ src: logoUrl,
24
+ alt: "Logo",
25
+ width: 360,
26
+ height: 180
27
+ }),
28
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__["default"], {
29
+ size: "small",
30
+ type: "secondary",
31
+ onClick: ()=>{
32
+ setRemovedImage(logoUrl);
33
+ onChange(null);
34
+ },
35
+ children: "Remove"
36
+ })
37
+ ]
38
+ }) : null === value ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
39
+ align: "center",
40
+ spacing: "p2",
41
+ children: [
42
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_FileInput_js_305b2c00__["default"], {
43
+ id: id,
44
+ onChange: onChange
45
+ }),
46
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__["default"], {
47
+ size: "small",
48
+ type: "secondary",
49
+ onClick: ()=>{
50
+ setRemovedImage(void 0);
51
+ onChange(void 0);
52
+ },
53
+ children: "Cancel"
54
+ })
55
+ ]
56
+ }) : value ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
57
+ align: "center",
58
+ spacing: "p2",
59
+ children: [
60
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
61
+ children: value.name
62
+ }),
63
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__["default"], {
64
+ size: "small",
65
+ type: "secondary",
66
+ onClick: ()=>{
67
+ setRemovedImage(void 0);
68
+ onChange(void 0);
69
+ },
70
+ children: "Clear"
71
+ })
72
+ ]
73
+ }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_FileInput_js_305b2c00__["default"], {
74
+ id: id,
75
+ onChange: onChange
76
+ })
77
+ });
78
+ };
79
+ const OrgLogoField_rslib_entry_ = OrgLogoField;
80
+ export { OrgLogoField_rslib_entry_ as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@worknice/whiteboard",
3
3
  "description": "",
4
- "version": "0.17.0",
4
+ "version": "0.18.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "files": [
@@ -38,7 +38,7 @@
38
38
  "react-markdown": "^10.1.0",
39
39
  "utf8": "^3.0.0",
40
40
  "zod": "^3.22.3",
41
- "@worknice/utils": "^0.6.65"
41
+ "@worknice/utils": "^0.6.66"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@anolilab/semantic-release-pnpm": "^1.1.10",