@worknice/whiteboard 0.23.3 → 0.25.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.
Files changed (45) hide show
  1. package/dist/controls/Action.stories.d.ts +52 -0
  2. package/dist/controls/Action.stories.js +93 -0
  3. package/dist/controls/Button.stories.d.ts +2 -16
  4. package/dist/controls/Button.stories.js +5 -28
  5. package/dist/controls/ButtonCard.stories.d.ts +31 -0
  6. package/dist/controls/ButtonCard.stories.js +77 -0
  7. package/dist/controls/ButtonLink.d.ts +6 -1
  8. package/dist/controls/ButtonLink.js +1 -1
  9. package/dist/controls/ButtonLink.stories.d.ts +46 -0
  10. package/dist/controls/ButtonLink.stories.js +72 -0
  11. package/dist/controls/Disclosure.d.ts +4 -0
  12. package/dist/controls/Disclosure.stories.d.ts +53 -0
  13. package/dist/controls/Disclosure.stories.js +132 -0
  14. package/dist/controls/Link.d.ts +5 -0
  15. package/dist/controls/Link.stories.d.ts +38 -0
  16. package/dist/controls/Link.stories.js +34 -0
  17. package/dist/controls/LinkCard.stories.d.ts +23 -0
  18. package/dist/controls/LinkCard.stories.js +25 -0
  19. package/dist/controls/MenuButton.d.ts +2 -0
  20. package/dist/controls/MenuButton.js +2 -1
  21. package/dist/controls/MenuButton.stories.d.ts +71 -0
  22. package/dist/controls/MenuButton.stories.js +275 -0
  23. package/dist/controls/PageTabSet.d.ts +6 -2
  24. package/dist/controls/PageTabSet.js +2 -2
  25. package/dist/controls/PageTabSet.stories.d.ts +49 -0
  26. package/dist/controls/PageTabSet.stories.js +106 -0
  27. package/dist/controls/Sortable.d.ts +8 -4
  28. package/dist/controls/Sortable.stories.d.ts +32 -0
  29. package/dist/controls/Sortable.stories.js +106 -0
  30. package/dist/controls/SortableItem.d.ts +1 -0
  31. package/dist/controls/TabSet.stories.d.ts +43 -0
  32. package/dist/controls/TabSet.stories.js +109 -0
  33. package/dist/controls/TabSetLink.d.ts +3 -0
  34. package/dist/controls/TabSetLink.stories.d.ts +44 -0
  35. package/dist/controls/TabSetLink.stories.js +204 -0
  36. package/dist/fields/StringField.d.ts +1 -1
  37. package/dist/fields/StringField.js +3 -2
  38. package/dist/presentation/PersonAvatar.js +1 -0
  39. package/dist/utils/storybook.d.ts +2 -0
  40. package/dist/utils/storybook.js +26 -0
  41. package/dist/validators/isFutureDate.d.ts +8 -0
  42. package/dist/validators/isFutureDate.js +23 -0
  43. package/dist/validators/isFutureDate.test.d.ts +1 -0
  44. package/dist/validators/isFutureDate.test.js +119 -0
  45. package/package.json +12 -14
@@ -0,0 +1,204 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_storybook_preview_api_98c434a5__ from "storybook/preview-api";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__ from "../presentation/Badge.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__ from "../presentation/HStack.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__ from "../presentation/Icon.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__ from "../presentation/PlainText.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__TabSetLink_js_237d0287__ from "./TabSetLink.js";
8
+ const meta = {
9
+ component: __WEBPACK_EXTERNAL_MODULE__TabSetLink_js_237d0287__["default"],
10
+ argTypes: {
11
+ id: {
12
+ control: false
13
+ },
14
+ activeHref: {
15
+ control: "select",
16
+ options: [
17
+ "/page1",
18
+ "/page2",
19
+ "/page3"
20
+ ],
21
+ description: "The href of the currently active tab"
22
+ }
23
+ },
24
+ args: {
25
+ activeHref: "/page1",
26
+ items: [
27
+ {
28
+ label: "Page 1",
29
+ href: "/page1"
30
+ },
31
+ {
32
+ label: "Page 2",
33
+ href: "/page2"
34
+ },
35
+ {
36
+ label: "Page 3",
37
+ href: "/page3"
38
+ }
39
+ ]
40
+ },
41
+ render: (args)=>{
42
+ const [{ activeHref }] = (0, __WEBPACK_EXTERNAL_MODULE_storybook_preview_api_98c434a5__.useArgs)();
43
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
44
+ children: [
45
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__TabSetLink_js_237d0287__["default"], {
46
+ ...args,
47
+ activeHref: activeHref
48
+ }),
49
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
50
+ style: {
51
+ marginTop: "1rem",
52
+ padding: "1rem",
53
+ background: "#f5f5f5"
54
+ },
55
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
56
+ tone: "muted",
57
+ font: "small",
58
+ children: "Note: Clicking links in Storybook won't navigate, but you can change the active tab using the storybook controls."
59
+ })
60
+ })
61
+ ]
62
+ });
63
+ }
64
+ };
65
+ const TabSetLink_stories_rslib_entry_ = meta;
66
+ const Default = {};
67
+ const WithPrefix = {
68
+ args: {
69
+ activeHref: "/page2",
70
+ items: [
71
+ {
72
+ label: "Page 1",
73
+ href: "/page1",
74
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
75
+ symbol: "Edit"
76
+ })
77
+ },
78
+ {
79
+ label: "Page 2",
80
+ href: "/page2",
81
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
82
+ symbol: "Archive"
83
+ })
84
+ },
85
+ {
86
+ label: "Page 3",
87
+ href: "/page3",
88
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
89
+ symbol: "Copy"
90
+ })
91
+ }
92
+ ]
93
+ }
94
+ };
95
+ const WithRichContent = {
96
+ args: {
97
+ activeHref: "/page2",
98
+ items: [
99
+ {
100
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
101
+ spacing: "n2",
102
+ children: [
103
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
104
+ children: "Page 1"
105
+ }),
106
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
107
+ children: "3"
108
+ })
109
+ ]
110
+ }),
111
+ href: "/page1"
112
+ },
113
+ {
114
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
115
+ spacing: "n2",
116
+ children: [
117
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
118
+ children: "Page 2"
119
+ }),
120
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
121
+ color: "red",
122
+ children: "20"
123
+ })
124
+ ]
125
+ }),
126
+ href: "/page2"
127
+ },
128
+ {
129
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
130
+ spacing: "n2",
131
+ children: [
132
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
133
+ children: "Page 3"
134
+ }),
135
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
136
+ children: "0"
137
+ })
138
+ ]
139
+ }),
140
+ href: "/page3"
141
+ }
142
+ ]
143
+ }
144
+ };
145
+ const WithPrefixAndRichContent = {
146
+ args: {
147
+ activeHref: "/inbox",
148
+ items: [
149
+ {
150
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
151
+ spacing: "n2",
152
+ children: [
153
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
154
+ children: "Inbox"
155
+ }),
156
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
157
+ color: "red",
158
+ children: "5"
159
+ })
160
+ ]
161
+ }),
162
+ href: "/inbox",
163
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
164
+ symbol: "Inbox"
165
+ })
166
+ },
167
+ {
168
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
169
+ spacing: "n2",
170
+ children: [
171
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
172
+ children: "Sent"
173
+ }),
174
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
175
+ children: "12"
176
+ })
177
+ ]
178
+ }),
179
+ href: "/sent",
180
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
181
+ symbol: "Email"
182
+ })
183
+ },
184
+ {
185
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__presentation_HStack_js_10bfc552__["default"], {
186
+ spacing: "n2",
187
+ children: [
188
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
189
+ children: "Drafts"
190
+ }),
191
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Badge_js_d3f5e18a__["default"], {
192
+ children: "2"
193
+ })
194
+ ]
195
+ }),
196
+ href: "/drafts",
197
+ prefix: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
198
+ symbol: "Edit"
199
+ })
200
+ }
201
+ ]
202
+ }
203
+ };
204
+ export { Default, WithPrefix, WithPrefixAndRichContent, WithRichContent, TabSetLink_stories_rslib_entry_ as default };
@@ -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,2 @@
1
+ import type { ArgTypes } from "@storybook/nextjs-vite";
2
+ export declare const iconStoryControl: () => ArgTypes[string];
@@ -0,0 +1,26 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__icons_index_js_d6af4ddb__ from "../icons/index.js";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__ from "../presentation/Icon.js";
4
+ const iconStoryControl = ()=>{
5
+ const availableIcons = Object.keys(__WEBPACK_EXTERNAL_MODULE__icons_index_js_d6af4ddb__);
6
+ const options = [
7
+ "None",
8
+ ...Object.keys(__WEBPACK_EXTERNAL_MODULE__icons_index_js_d6af4ddb__)
9
+ ];
10
+ const mapping = {};
11
+ mapping.None = null;
12
+ for (const iconName of availableIcons)mapping[iconName] = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
13
+ symbol: iconName
14
+ });
15
+ return {
16
+ control: "select",
17
+ options,
18
+ mapping,
19
+ table: {
20
+ type: {
21
+ summary: "ReactNode"
22
+ }
23
+ }
24
+ };
25
+ };
26
+ export { iconStoryControl };
@@ -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.3",
4
+ "version": "0.25.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.95"
41
+ "zod": "^4.1.13",
42
+ "@worknice/utils": "^0.8.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
  },