@worknice/whiteboard 0.23.2 → 0.24.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.
@@ -9,11 +9,11 @@ import * as __WEBPACK_EXTERNAL_MODULE__PageTabSet_module_js_7890aa24__ from "./P
9
9
  const PageTabSet = ({ id, pages, variant })=>{
10
10
  const { Link, pathname } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
11
11
  const trackingContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__utils_TrackingContext_js_139012da__["default"]);
12
- const activeIndex = pages.findIndex(({ path })=>pathname === path);
12
+ const activeIndex = pages.findIndex(({ path })=>pathname?.startsWith(path));
13
13
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("nav", {
14
14
  className: __WEBPACK_EXTERNAL_MODULE__PageTabSet_module_js_7890aa24__["default"].container,
15
15
  children: pages.map(({ path, label, key }, index)=>{
16
- const isActive = pathname === path;
16
+ const isActive = pathname?.startsWith(path);
17
17
  if ("steps" === variant && index > activeIndex) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
18
18
  className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__PageTabSet_module_js_7890aa24__["default"].button, __WEBPACK_EXTERNAL_MODULE__PageTabSet_module_js_7890aa24__["default"].disabled),
19
19
  children: label
@@ -9,5 +9,5 @@ type Props = ComponentProps<typeof StringInput> & {
9
9
  labelFont?: LabelFontOption;
10
10
  required?: boolean;
11
11
  };
12
- declare const StringField: ({ autoFocus, description, disabled, errors, id, label, labelFont, onChange, placeholder, required, value, type, inputMode, prefix, suffix, }: Props) => import("react/jsx-runtime").JSX.Element;
12
+ declare const StringField: ({ autoFocus, description, disabled, errors, id, label, labelFont, onChange, placeholder, required, value, type, inputMode, prefix, suffix, maxLength, }: Props) => import("react/jsx-runtime").JSX.Element;
13
13
  export default StringField;
@@ -1,7 +1,7 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__ from "../forms/RegularField.js";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__inputs_StringInput_js_091f1e06__ from "../inputs/StringInput.js";
4
- const StringField = ({ autoFocus = false, description, disabled = false, errors, id, label, labelFont = "label", onChange, placeholder, required = false, value, type, inputMode, prefix, suffix })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
4
+ const StringField = ({ autoFocus = false, description, disabled = false, errors, id, label, labelFont = "label", onChange, placeholder, required = false, value, type, inputMode, prefix, suffix, maxLength })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
5
5
  description: description,
6
6
  errors: errors,
7
7
  inputId: id,
@@ -18,7 +18,8 @@ const StringField = ({ autoFocus = false, description, disabled = false, errors,
18
18
  type: type,
19
19
  inputMode: inputMode,
20
20
  prefix: prefix,
21
- suffix: suffix
21
+ suffix: suffix,
22
+ maxLength: maxLength
22
23
  })
23
24
  });
24
25
  const StringField_rslib_entry_ = StringField;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
4
  const SIZES = {
@@ -0,0 +1,8 @@
1
+ declare const isFutureDate: <Model extends {
2
+ [Field: string]: any;
3
+ }>(field: keyof Model, timezone: string, message?: string) => (data: Model) => {
4
+ id: string;
5
+ field: keyof Model;
6
+ message: string;
7
+ } | null;
8
+ export default isFutureDate;
@@ -0,0 +1,23 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__ from "temporal-polyfill";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_uuid__ from "uuid";
3
+ const isFutureDate = (field, timezone, message = "Date must be in the future.")=>(data)=>{
4
+ const value = data[field];
5
+ if ("string" != typeof value || "" === value.trim()) return null;
6
+ try {
7
+ const today = __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__.Temporal.Now.plainDateISO(timezone);
8
+ const date = __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__.Temporal.PlainDate.from(value);
9
+ return __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__.Temporal.PlainDate.compare(date, today) <= 0 ? {
10
+ id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
11
+ field,
12
+ message
13
+ } : null;
14
+ } catch {
15
+ return {
16
+ id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
17
+ field,
18
+ message: "Invalid date."
19
+ };
20
+ }
21
+ };
22
+ const isFutureDate_rslib_entry_ = isFutureDate;
23
+ export { isFutureDate_rslib_entry_ as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,119 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__ from "./isFutureDate.js";
3
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("isFutureDate", ()=>{
4
+ const timezone = "Australia/Sydney";
5
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given a null value", ()=>{
6
+ const date = null;
7
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns null", ()=>{
8
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
9
+ const result = validator({
10
+ date
11
+ });
12
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toBeNull();
13
+ });
14
+ });
15
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given an undefined value", ()=>{
16
+ const date = void 0;
17
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns null", ()=>{
18
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
19
+ const result = validator({
20
+ date
21
+ });
22
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toBeNull();
23
+ });
24
+ });
25
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given an empty string", ()=>{
26
+ const date = "";
27
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns null", ()=>{
28
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
29
+ const result = validator({
30
+ date
31
+ });
32
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toBeNull();
33
+ });
34
+ });
35
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given a whitespace-only string", ()=>{
36
+ const date = " ";
37
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns null", ()=>{
38
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
39
+ const result = validator({
40
+ date
41
+ });
42
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toBeNull();
43
+ });
44
+ });
45
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given a date in the future", ()=>{
46
+ const date = "2099-12-31";
47
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns null", ()=>{
48
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
49
+ const result = validator({
50
+ date
51
+ });
52
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toBeNull();
53
+ });
54
+ });
55
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given a date in the past", ()=>{
56
+ const date = "2020-01-01";
57
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns an error with the default message", ()=>{
58
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
59
+ const result = validator({
60
+ date
61
+ });
62
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toEqual({
63
+ id: __WEBPACK_EXTERNAL_MODULE_vitest__.expect.any(String),
64
+ field: "date",
65
+ message: "Date must be in the future."
66
+ });
67
+ });
68
+ });
69
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given an invalid date format", ()=>{
70
+ const date = "invalid-date";
71
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns an invalid date error", ()=>{
72
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", timezone);
73
+ const result = validator({
74
+ date
75
+ });
76
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toEqual({
77
+ id: __WEBPACK_EXTERNAL_MODULE_vitest__.expect.any(String),
78
+ field: "date",
79
+ message: "Invalid date."
80
+ });
81
+ });
82
+ });
83
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given a custom error message", ()=>{
84
+ const customMessage = "Custom error message";
85
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("returns an error with the custom message", ()=>{
86
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("dueDate", timezone, customMessage);
87
+ const result = validator({
88
+ dueDate: "2020-01-01"
89
+ });
90
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(result).toEqual({
91
+ id: __WEBPACK_EXTERNAL_MODULE_vitest__.expect.any(String),
92
+ field: "dueDate",
93
+ message: customMessage
94
+ });
95
+ });
96
+ });
97
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.describe)("given different timezones", ()=>{
98
+ const utcTimezone = "UTC";
99
+ const sydneyTimezone = "Australia/Sydney";
100
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("validates the UTC date", ()=>{
101
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", utcTimezone);
102
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(validator({
103
+ date: "2020-01-01"
104
+ })).not.toBeNull();
105
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(validator({
106
+ date: "2099-01-01"
107
+ })).toBeNull();
108
+ });
109
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.it)("validates the Australia/Sydney date", ()=>{
110
+ const validator = (0, __WEBPACK_EXTERNAL_MODULE__isFutureDate_js_3937c5fe__["default"])("date", sydneyTimezone);
111
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(validator({
112
+ date: "2020-01-01"
113
+ })).not.toBeNull();
114
+ (0, __WEBPACK_EXTERNAL_MODULE_vitest__.expect)(validator({
115
+ date: "2099-01-01"
116
+ })).toBeNull();
117
+ });
118
+ });
119
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@worknice/whiteboard",
3
3
  "description": "",
4
- "version": "0.23.2",
4
+ "version": "0.24.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "files": [
@@ -38,11 +38,11 @@
38
38
  "js-search": "^2.0.0",
39
39
  "react-markdown": "^10.1.0",
40
40
  "utf8": "^3.0.0",
41
- "zod": "^3.22.3",
42
- "@worknice/utils": "^0.6.94"
41
+ "zod": "^4.1.13",
42
+ "@worknice/utils": "^0.7.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@anolilab/semantic-release-pnpm": "^1.1.10",
45
+ "@anolilab/semantic-release-pnpm": "^3.2.2",
46
46
  "@react-email/components": "^0.0.36",
47
47
  "@rsbuild/plugin-react": "^1.1.0",
48
48
  "@rslib/core": "^0.4.1",
@@ -52,28 +52,26 @@
52
52
  "@total-typescript/tsconfig": "^1.0.4",
53
53
  "@types/css-modules": "^1.0.5",
54
54
  "@types/js-search": "^1.4.0",
55
- "@types/react": "^19.1.0",
56
- "@types/react-dom": "^19.1.1",
55
+ "@types/react": "~19.1.2",
56
+ "@types/react-dom": "~19.1.2",
57
57
  "@types/utf8": "^3.0.0",
58
58
  "@types/uuid": "^8.3.1",
59
59
  "@typescript-eslint/eslint-plugin": "^8.7.0",
60
60
  "@typescript-eslint/parser": "^8.7.0",
61
- "@worknice/commit-analyzer": "github:WorkniceHR/commit-analyzer#master",
62
61
  "clsx": "^2.0.0",
63
62
  "concurrently": "^9.2.0",
64
63
  "eslint": "^8.57.1",
65
64
  "eslint-plugin-react": "^7.34.2",
66
65
  "eslint-plugin-react-hooks": "^4.6.2",
67
66
  "eslint-plugin-storybook": "^10.1.2",
68
- "next": "~15.5.7",
67
+ "next": "~15.5.9",
69
68
  "nodemon": "^3.1.4",
70
69
  "prettier": "^3.5.3",
71
70
  "prettier-plugin-embed": "^0.5.0",
72
71
  "prettier-plugin-sql": "^0.19.0",
73
- "react": "^19.1.0",
74
- "react-dom": "^19.1.0",
72
+ "react": "~19.1.2",
73
+ "react-dom": "~19.1.2",
75
74
  "semantic-release": "^24.2.2",
76
- "semantic-release-scope-filter": "^1.0.0",
77
75
  "storybook": "^10.1.2",
78
76
  "temporal-polyfill": "^0.2.5",
79
77
  "typescript": "~5.5.0",
@@ -83,9 +81,9 @@
83
81
  "peerDependencies": {
84
82
  "@react-email/components": "^0.0.7",
85
83
  "clsx": "^2.0.0",
86
- "next": "~15.5.0",
87
- "react": "^18.2.0",
88
- "react-dom": "^18.2.0",
84
+ "next": "~15.5.9",
85
+ "react": "~19.1.2",
86
+ "react-dom": "~19.1.2",
89
87
  "temporal-polyfill": "^0.2.1",
90
88
  "uuid": "^8.3.2"
91
89
  },