@worknice/whiteboard 0.30.0 → 0.32.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.
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
2
2
  type Props = {
3
3
  children: ReactNode;
4
4
  href: string;
5
+ selected?: boolean;
5
6
  };
6
- declare const LinkCard: ({ children, href }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const LinkCard: ({ children, href, selected }: Props) => import("react/jsx-runtime").JSX.Element;
7
8
  export default LinkCard;
@@ -1,12 +1,13 @@
1
1
  "use client";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__ from "../presentation/Icon.js";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__ from "../utils/useNextContext.js";
5
6
  import * as __WEBPACK_EXTERNAL_MODULE__LinkCard_module_js_5998e563__ from "./LinkCard.module.js";
6
- const LinkCard = ({ children, href })=>{
7
+ const LinkCard = ({ children, href, selected })=>{
7
8
  const { Link } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
8
9
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Link, {
9
- className: __WEBPACK_EXTERNAL_MODULE__LinkCard_module_js_5998e563__["default"].container,
10
+ className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__LinkCard_module_js_5998e563__["default"].container, selected && __WEBPACK_EXTERNAL_MODULE__LinkCard_module_js_5998e563__["default"].selected),
10
11
  href: href,
11
12
  children: [
12
13
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -1,6 +1,7 @@
1
1
  import "./LinkCard_module.css";
2
2
  const LinkCard_module_rslib_entry_ = {
3
3
  container: "container-aEJeqL",
4
+ selected: "selected-xwPBRV",
4
5
  content: "content-Ge4Pjk"
5
6
  };
6
7
  export { LinkCard_module_rslib_entry_ as default };
@@ -1,8 +1,9 @@
1
1
  import type { StoryObj } from "@storybook/nextjs-vite";
2
2
  declare const meta: {
3
- component: ({ children, href }: {
3
+ component: ({ children, href, selected }: {
4
4
  children: import("react").ReactNode;
5
5
  href: string;
6
+ selected?: boolean;
6
7
  }) => import("react/jsx-runtime").JSX.Element;
7
8
  argTypes: {
8
9
  children: {
@@ -16,6 +16,11 @@
16
16
  }
17
17
  }
18
18
 
19
+ .selected-xwPBRV {
20
+ background-color: var(--color-purple-t10);
21
+ border-color: var(--color-purple-s01);
22
+ }
23
+
19
24
  .content-Ge4Pjk {
20
25
  place-items: center start;
21
26
  display: grid;
@@ -8,6 +8,18 @@ export type FormState<Model extends FormModel = Record<string, never>> = {
8
8
  setData: React.Dispatch<React.SetStateAction<Model>>;
9
9
  status: FormStatus;
10
10
  submit: (event?: React.UIEvent) => Promise<void>;
11
+ /**
12
+ * Resets the form state and errors.
13
+ * @param opts - Optional options to reset specific parts of the form state.
14
+ * @param opts.status - Reset the form status.
15
+ * @param opts.errors - Reset the form errors.
16
+ * @param opts.data - Reset the form data to initial values.
17
+ */
18
+ reset: (opts?: {
19
+ status?: boolean;
20
+ errors?: boolean;
21
+ data?: boolean;
22
+ }) => void;
11
23
  };
12
24
  export type FormStatus = "disabled" | "fresh" | "modified" | "loading" | "errored" | "success";
13
25
  export type ValidationError<Model extends FormModel = Record<string, never>> = {
@@ -62,13 +62,25 @@ const useForm = ({ initialValues, onSubmit, onSuccess, validators })=>{
62
62
  setData,
63
63
  setStatus
64
64
  ]);
65
+ const reset = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((opts = {
66
+ status: true,
67
+ errors: true,
68
+ data: true
69
+ })=>{
70
+ if (opts?.status) setStatus("fresh");
71
+ if (opts?.errors) setErrors([]);
72
+ if (opts?.data) setData(initialValues);
73
+ }, [
74
+ initialValues
75
+ ]);
65
76
  return {
66
77
  data,
67
78
  fieldErrors,
68
79
  formErrors,
69
80
  setData: setDataAndMarkAsModified,
70
81
  status,
71
- submit
82
+ submit,
83
+ reset
72
84
  };
73
85
  };
74
86
  const useSleep = ()=>{
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the possessive form of a name.
3
+ * Handles the grammar rule where names ending in 's' get an apostrophe only.
4
+ *
5
+ * @example
6
+ * getPossessiveForm("James") // "James'"
7
+ * getPossessiveForm("John") // "John's"
8
+ */
9
+ export declare const getPossessiveForm: (name: string) => string;
@@ -0,0 +1,2 @@
1
+ const getPossessiveForm = (name)=>name.endsWith("s") ? `${name}'` : `${name}'s`;
2
+ export { getPossessiveForm };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@worknice/whiteboard",
3
3
  "description": "",
4
- "version": "0.30.0",
4
+ "version": "0.32.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "files": [
@@ -39,7 +39,7 @@
39
39
  "react-markdown": "^10.1.0",
40
40
  "utf8": "^3.0.0",
41
41
  "zod": "^4.1.13",
42
- "@worknice/utils": "^0.13.0"
42
+ "@worknice/utils": "^0.15.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@anolilab/semantic-release-pnpm": "^3.2.2",