@worknice/whiteboard 0.13.0 → 0.14.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.
@@ -1,4 +1,4 @@
1
- import type { Dispatch, ReactNode } from "react";
1
+ import { type Dispatch, type ReactNode } from "react";
2
2
  import type { ValidationError } from "../forms/_types";
3
3
  type Props<Option> = {
4
4
  autoFocus?: boolean;
@@ -6,7 +6,6 @@ type Props<Option> = {
6
6
  id: string;
7
7
  includeValueInTracking?: boolean;
8
8
  onChange: Dispatch<Option>;
9
- options: Array<Option>;
10
9
  optionToId: (option: Option) => string;
11
10
  optionToLabel: (option: Option) => ReactNode;
12
11
  value: Option | null;
@@ -20,6 +19,15 @@ type Props<Option> = {
20
19
  label: ReactNode;
21
20
  labelFont?: "heading" | "subheading" | "label" | "regular-bold" | "regular";
22
21
  required?: boolean;
23
- };
24
- declare const SingleSelectComboBoxField: <Option>({ autoFocus, disabled, id, includeValueInTracking, onChange, options, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, description, errors, label, labelFont, required, }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
22
+ } & ({
23
+ options: Array<Option>;
24
+ optionGroups?: never;
25
+ } | {
26
+ options?: never;
27
+ optionGroups: Array<{
28
+ header: string;
29
+ options: Array<Option>;
30
+ }>;
31
+ });
32
+ declare const SingleSelectComboBoxField: <Option>({ autoFocus, disabled, id, includeValueInTracking, onChange, options, optionGroups, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, description, errors, label, labelFont, required, }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
25
33
  export default SingleSelectComboBoxField;
@@ -1,13 +1,10 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__ from "../forms/RegularField.js";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE__inputs_SingleSelectComboboxInput_js_15b92560__ from "../inputs/SingleSelectComboboxInput.js";
4
- const SingleSelectComboBoxField = ({ autoFocus = false, disabled = false, id, includeValueInTracking, onChange, options, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, description, errors, label, labelFont = "label", required = false })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
5
- description: description,
6
- errors: errors,
7
- label: label,
8
- labelFont: labelFont,
9
- required: required,
10
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_SingleSelectComboboxInput_js_15b92560__["default"], {
5
+ const SingleSelectComboBoxField = ({ autoFocus = false, disabled = false, id, includeValueInTracking, onChange, options, optionGroups, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, description, errors, label, labelFont = "label", required = false })=>{
6
+ const comboboxInput = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
7
+ if (options) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_SingleSelectComboboxInput_js_15b92560__["default"], {
11
8
  autoFocus: autoFocus,
12
9
  disabled: disabled,
13
10
  id: id,
@@ -22,7 +19,48 @@ const SingleSelectComboBoxField = ({ autoFocus = false, disabled = false, id, in
22
19
  searchFields: searchFields,
23
20
  onCreate: onCreate,
24
21
  onClear: onClear
25
- })
22
+ });
23
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_SingleSelectComboboxInput_js_15b92560__["default"], {
24
+ autoFocus: autoFocus,
25
+ disabled: disabled,
26
+ id: id,
27
+ includeValueInTracking: includeValueInTracking,
28
+ onChange: onChange,
29
+ optionGroups: optionGroups,
30
+ optionToId: optionToId,
31
+ optionToLabel: optionToLabel,
32
+ value: value,
33
+ placeholder: placeholder,
34
+ searchPlaceholder: searchPlaceholder,
35
+ searchFields: searchFields,
36
+ onCreate: onCreate,
37
+ onClear: onClear
38
+ });
39
+ }, [
40
+ autoFocus,
41
+ disabled,
42
+ id,
43
+ includeValueInTracking,
44
+ onChange,
45
+ optionGroups,
46
+ optionToId,
47
+ optionToLabel,
48
+ value,
49
+ placeholder,
50
+ searchPlaceholder,
51
+ searchFields,
52
+ onCreate,
53
+ onClear,
54
+ options
55
+ ]);
56
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
57
+ description: description,
58
+ errors: errors,
59
+ label: label,
60
+ labelFont: labelFont,
61
+ required: required,
62
+ children: comboboxInput
26
63
  });
64
+ };
27
65
  const SingleSelectComboboxField_rslib_entry_ = SingleSelectComboBoxField;
28
66
  export { SingleSelectComboboxField_rslib_entry_ as default };
@@ -5,7 +5,6 @@ type Props<Option> = {
5
5
  id: string;
6
6
  includeValueInTracking?: boolean;
7
7
  onChange: Dispatch<Option>;
8
- options: Array<Option>;
9
8
  optionToId: (option: Option) => string;
10
9
  optionToLabel: (option: Option) => ReactNode;
11
10
  value: Option | null;
@@ -14,6 +13,15 @@ type Props<Option> = {
14
13
  searchFields: Array<keyof Option & string>;
15
14
  onCreate?: (onClose: () => void, searchTerm: string) => ReactNode;
16
15
  onClear?: () => void;
17
- };
18
- declare const SingleSelectComboBoxInput: <Option>({ autoFocus, disabled, id, onChange, options, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
16
+ } & ({
17
+ options: Array<Option>;
18
+ optionGroups?: never;
19
+ } | {
20
+ options?: never;
21
+ optionGroups: Array<{
22
+ header: string;
23
+ options: Array<Option>;
24
+ }>;
25
+ });
26
+ declare const SingleSelectComboBoxInput: <Option>({ autoFocus, disabled, id, onChange, options, optionGroups, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear, }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
19
27
  export default SingleSelectComboBoxInput;
@@ -5,7 +5,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__ from "../presentation/Icon.js";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__utils_search_js_89d5ae26__ from "../utils/search.js";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__ from "./SingleSelectComboboxInput.module.js";
8
- const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, onChange, options, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear })=>{
8
+ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, onChange, options, optionGroups, optionToId, optionToLabel, value, placeholder, searchPlaceholder, searchFields, onCreate, onClear })=>{
9
+ const listboxId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useId)();
10
+ const buttonId = id;
9
11
  const optionsRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)([]);
10
12
  const searchRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
11
13
  const listBoxRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
@@ -13,10 +15,16 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
13
15
  const [createNewOption, setCreateNewOption] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
14
16
  const [isOpen, setIsOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
15
17
  const [activeIndex, setActiveIndex] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
16
- const filteredOptions = "" !== searchTerm.trim() ? (0, __WEBPACK_EXTERNAL_MODULE__utils_search_js_89d5ae26__["default"])(options.map((option)=>({
17
- ...option,
18
- id: optionToId(option)
19
- })), searchFields, searchTerm) : options;
18
+ const filteredOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>"" !== searchTerm.trim() ? (0, __WEBPACK_EXTERNAL_MODULE__utils_search_js_89d5ae26__["default"])((options ?? optionGroups.flatMap((group)=>group.options) ?? []).map((option)=>({
19
+ ...option,
20
+ id: optionToId(option)
21
+ })), searchFields, searchTerm) : options ?? optionGroups.flatMap((group)=>group.options) ?? [], [
22
+ options,
23
+ optionGroups,
24
+ searchFields,
25
+ searchTerm,
26
+ optionToId
27
+ ]);
20
28
  const { refs: floatingUiRefs, floatingStyles, context } = (0, __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.useFloating)({
21
29
  open: isOpen,
22
30
  onOpenChange: (open)=>{
@@ -54,9 +62,79 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
54
62
  dismiss,
55
63
  listNav
56
64
  ]);
65
+ const renderOption = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((option, index)=>{
66
+ const optionId = optionToId(option);
67
+ const optionLabel = optionToLabel(option);
68
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("li", {
69
+ role: "option",
70
+ className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItem, {
71
+ [__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].activeListItem]: activeIndex === index
72
+ }),
73
+ ...getItemProps({
74
+ onClick: ()=>{
75
+ setIsOpen(false);
76
+ onChange(option);
77
+ },
78
+ ref: (node)=>{
79
+ optionsRef.current[index] = node;
80
+ }
81
+ }),
82
+ children: [
83
+ optionLabel,
84
+ value && optionToId(value) === optionToId(option) ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
85
+ symbol: "CheckMark"
86
+ }) : null
87
+ ]
88
+ }, optionId);
89
+ }, [
90
+ activeIndex,
91
+ onChange,
92
+ optionToId,
93
+ optionToLabel,
94
+ value,
95
+ getItemProps
96
+ ]);
97
+ const renderOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
98
+ if (options) return filteredOptions.map(renderOption);
99
+ return optionGroups.map((group)=>{
100
+ if (0 === group.options.length) return null;
101
+ const groupOptionIds = new Set(group.options.map((o)=>optionToId(o)));
102
+ const filteredGroupOptions = filteredOptions.filter((o)=>groupOptionIds.has(optionToId(o)));
103
+ if (0 === filteredGroupOptions.length) return null;
104
+ const headerId = `${listboxId}-group-${group.header}`;
105
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("li", {
106
+ role: "presentation",
107
+ children: [
108
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
109
+ id: headerId,
110
+ className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItemGroupHeader,
111
+ children: group.header
112
+ }),
113
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("ul", {
114
+ role: "group",
115
+ "aria-labelledby": headerId,
116
+ children: filteredGroupOptions.map((option)=>{
117
+ const optionIndex = optionGroups.flatMap((group)=>group.options).indexOf(option);
118
+ return renderOption(option, optionIndex);
119
+ })
120
+ })
121
+ ]
122
+ }, group.header);
123
+ });
124
+ }, [
125
+ filteredOptions,
126
+ listboxId,
127
+ optionGroups,
128
+ optionToId,
129
+ renderOption,
130
+ options
131
+ ]);
57
132
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
58
133
  children: [
59
134
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("button", {
135
+ "aria-controls": listboxId,
136
+ "aria-haspopup": "listbox",
137
+ "aria-expanded": isOpen,
60
138
  autoFocus: autoFocus,
61
139
  disabled: disabled,
62
140
  className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].toggleButton,
@@ -64,7 +142,7 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
64
142
  type: "button",
65
143
  ref: floatingUiRefs.setReference,
66
144
  ...getReferenceProps({
67
- id: id
145
+ id: buttonId
68
146
  }),
69
147
  children: [
70
148
  value ? optionToLabel(value) : placeholder ?? "Select an option",
@@ -90,82 +168,60 @@ const SingleSelectComboBoxInput = ({ autoFocus = false, disabled = false, id, on
90
168
  })
91
169
  ]
92
170
  }),
93
- !disabled && isOpen ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
94
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.FloatingPortal, {
95
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.FloatingFocusManager, {
96
- context: context,
97
- initialFocus: searchRef,
98
- modal: false,
99
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
100
- ref: floatingUiRefs.setFloating,
101
- style: floatingStyles,
102
- className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].menu),
103
- ...getFloatingProps(),
104
- children: [
105
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("input", {
106
- type: "text",
107
- className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].searchInput,
108
- placeholder: searchPlaceholder ?? "Search for an option",
109
- "aria-autocomplete": "list",
110
- onChange: (e)=>{
111
- setSearchTerm(e.target.value);
112
- setActiveIndex(0);
113
- },
114
- value: searchTerm,
115
- ref: searchRef,
116
- onKeyDown: (e)=>{
117
- if ("Enter" === e.key && null != activeIndex) {
118
- setIsOpen(false);
119
- onChange(filteredOptions[activeIndex]);
120
- }
171
+ !disabled && isOpen ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.FloatingPortal, {
172
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__.FloatingFocusManager, {
173
+ context: context,
174
+ initialFocus: searchRef,
175
+ modal: false,
176
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
177
+ ref: floatingUiRefs.setFloating,
178
+ style: floatingStyles,
179
+ className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].menu),
180
+ ...getFloatingProps(),
181
+ children: [
182
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("input", {
183
+ type: "text",
184
+ className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].searchInput,
185
+ placeholder: searchPlaceholder ?? "Search for an option",
186
+ "aria-autocomplete": "list",
187
+ onChange: (e)=>{
188
+ setSearchTerm(e.target.value);
189
+ setActiveIndex(0);
190
+ },
191
+ value: searchTerm,
192
+ ref: searchRef,
193
+ onKeyDown: (e)=>{
194
+ if ("Enter" === e.key && null != activeIndex) {
195
+ setIsOpen(false);
196
+ onChange(filteredOptions[activeIndex]);
121
197
  }
122
- }),
123
- 0 !== filteredOptions.length || onCreate ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("ul", {
124
- className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listBox,
125
- ref: listBoxRef,
126
- children: [
127
- filteredOptions.map((option, index)=>{
128
- const optionId = optionToId(option);
129
- const optionLabel = optionToLabel(option);
130
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("li", {
131
- className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItem, {
132
- [__WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].activeListItem]: activeIndex === index
133
- }),
134
- ...getItemProps({
135
- onClick: ()=>{
136
- setIsOpen(false);
137
- onChange(option);
138
- },
139
- ref: (node)=>{
140
- optionsRef.current[index] = node;
141
- }
142
- }),
143
- children: [
144
- optionLabel,
145
- value && optionToId(value) === optionToId(option) ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_Icon_js_6961aa57__["default"], {
146
- symbol: "CheckMark"
147
- }) : null
148
- ]
149
- }, optionId);
150
- }),
151
- onCreate ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("li", {
152
- className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])([
153
- __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItem,
154
- __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItemCreate
155
- ]),
156
- onClick: ()=>{
157
- setIsOpen(false);
158
- setCreateNewOption(true);
159
- },
160
- children: [
161
- "+ Create new option ",
162
- searchTerm ? `"${searchTerm}"` : null
163
- ]
164
- }) : null
165
- ]
166
- }) : null
167
- ]
168
- })
198
+ }
199
+ }),
200
+ 0 !== filteredOptions.length || onCreate ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("ul", {
201
+ className: __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listBox,
202
+ ref: listBoxRef,
203
+ id: listboxId,
204
+ role: "listbox",
205
+ "aria-labelledby": buttonId,
206
+ children: [
207
+ renderOptions(),
208
+ onCreate ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("li", {
209
+ className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])([
210
+ __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItem,
211
+ __WEBPACK_EXTERNAL_MODULE__SingleSelectComboboxInput_module_js_54aa53da__["default"].listItemCreate
212
+ ]),
213
+ onClick: ()=>{
214
+ setIsOpen(false);
215
+ setCreateNewOption(true);
216
+ },
217
+ children: [
218
+ "+ Create new option ",
219
+ searchTerm ? `"${searchTerm}"` : null
220
+ ]
221
+ }) : null
222
+ ]
223
+ }) : null
224
+ ]
169
225
  })
170
226
  })
171
227
  }) : null,
@@ -5,6 +5,7 @@ const SingleSelectComboboxInput_module_rslib_entry_ = {
5
5
  searchInput: "searchInput-s9NjcM",
6
6
  menu: "menu-f81oko",
7
7
  listBox: "listBox-biTMkv",
8
+ listItemGroupHeader: "listItemGroupHeader-SdoaP2",
8
9
  listItem: "listItem-ASZkke",
9
10
  listItemCreate: "listItemCreate-_tGId1",
10
11
  activeListItem: "activeListItem-_B_E3X"
@@ -54,6 +54,11 @@
54
54
  overflow-y: auto;
55
55
  }
56
56
 
57
+ .listItemGroupHeader-SdoaP2 {
58
+ padding: var(--size-n2) var(--size-n2) var(--size-n2) 0;
59
+ font: var(--font-regular-bold);
60
+ }
61
+
57
62
  .listItem-ASZkke {
58
63
  padding: var(--size-n2);
59
64
  border-radius: var(--size-n3);
@@ -0,0 +1,8 @@
1
+ declare const isValidDate: <Model extends {
2
+ [Field: string]: any;
3
+ }>(field: keyof Model, message?: string) => (data: Model) => {
4
+ id: string;
5
+ field: keyof Model;
6
+ message: string;
7
+ } | null;
8
+ export default isValidDate;
@@ -0,0 +1,18 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__ from "temporal-polyfill";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_uuid__ from "uuid";
3
+ const isValidDate = (field, message = "Invalid date.")=>(data)=>{
4
+ const value = data[field];
5
+ if (null == value) return null;
6
+ if ("string" == typeof value && "" !== value.trim()) try {
7
+ __WEBPACK_EXTERNAL_MODULE_temporal_polyfill_11c1db1c__.Temporal.PlainDate.from(value);
8
+ } catch {
9
+ return {
10
+ id: (0, __WEBPACK_EXTERNAL_MODULE_uuid__.v4)(),
11
+ field,
12
+ message
13
+ };
14
+ }
15
+ return null;
16
+ };
17
+ const isValidDate_rslib_entry_ = isValidDate;
18
+ export { isValidDate_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.13.0",
4
+ "version": "0.14.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.35"
41
+ "@worknice/utils": "^0.6.36"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@anolilab/semantic-release-pnpm": "^1.1.10",