@stoker-platform/web-app 0.5.26 → 0.5.28
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.
- package/CHANGELOG.md +16 -0
- package/package.json +4 -4
- package/src/Form.tsx +41 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add month picker
|
|
8
|
+
- @stoker-platform/node-client@0.5.19
|
|
9
|
+
- @stoker-platform/utils@0.5.13
|
|
10
|
+
- @stoker-platform/web-client@0.5.14
|
|
11
|
+
|
|
12
|
+
## 0.5.27
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @stoker-platform/web-client@0.5.13
|
|
18
|
+
|
|
3
19
|
## 0.5.26
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"scripts": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@react-google-maps/api": "^2.20.8",
|
|
53
53
|
"@sentry/react": "^10.38.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.19",
|
|
55
|
+
"@stoker-platform/utils": "0.5.13",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.14",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/Form.tsx
CHANGED
|
@@ -158,6 +158,7 @@ import Collection from "./Collection"
|
|
|
158
158
|
import { Separator } from "./components/ui/separator"
|
|
159
159
|
import { SearchResult } from "minisearch"
|
|
160
160
|
import { sortList } from "./utils/sortList"
|
|
161
|
+
import MonthPicker from "./components/ui/month-picker"
|
|
161
162
|
|
|
162
163
|
interface FormLabelWithIconProps {
|
|
163
164
|
collection: CollectionSchema
|
|
@@ -286,6 +287,7 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
286
287
|
const [isTextarea, setIsTextarea] = useState(false)
|
|
287
288
|
const [isSwitch, setIsSwitch] = useState(false)
|
|
288
289
|
const [isTime, setIsTime] = useState(false)
|
|
290
|
+
const [isMonth, setIsMonth] = useState(false)
|
|
289
291
|
const [isSlider, setIsSlider] = useState(false)
|
|
290
292
|
const [isRichText, setIsRichText] = useState(false)
|
|
291
293
|
const [isLocation, setIsLocation] = useState<LocationFieldAdmin | undefined>(undefined)
|
|
@@ -306,6 +308,7 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
306
308
|
textarea,
|
|
307
309
|
isSwitch,
|
|
308
310
|
isTime,
|
|
311
|
+
isMonth,
|
|
309
312
|
isSlider,
|
|
310
313
|
isRichText,
|
|
311
314
|
image,
|
|
@@ -320,6 +323,7 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
320
323
|
tryPromise(admin?.textarea),
|
|
321
324
|
tryPromise(admin?.switch),
|
|
322
325
|
tryPromise(admin?.time),
|
|
326
|
+
tryPromise(admin?.month),
|
|
323
327
|
tryPromise(admin?.slider),
|
|
324
328
|
tryPromise(admin?.richText),
|
|
325
329
|
tryPromise(admin?.image),
|
|
@@ -336,6 +340,7 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
336
340
|
setIsTextarea(!!textarea)
|
|
337
341
|
setIsSwitch(!!isSwitch)
|
|
338
342
|
setIsTime(!!isTime)
|
|
343
|
+
setIsMonth(!!isMonth)
|
|
339
344
|
setIsSlider(!!isSlider)
|
|
340
345
|
setIsRichText(!!isRichText)
|
|
341
346
|
setIsImage(!!image)
|
|
@@ -462,6 +467,7 @@ const RecordFormField = (props: FieldProps) => {
|
|
|
462
467
|
description={description}
|
|
463
468
|
isDisabled={isDisabled}
|
|
464
469
|
isTime={isTime}
|
|
470
|
+
isMonth={isMonth}
|
|
465
471
|
icon={icon}
|
|
466
472
|
/>
|
|
467
473
|
)
|
|
@@ -1139,8 +1145,9 @@ function TimestampField({
|
|
|
1139
1145
|
form,
|
|
1140
1146
|
isDisabled,
|
|
1141
1147
|
isTime,
|
|
1148
|
+
isMonth,
|
|
1142
1149
|
icon,
|
|
1143
|
-
}: FieldProps & { isTime?: boolean }) {
|
|
1150
|
+
}: FieldProps & { isTime?: boolean; isMonth?: boolean }) {
|
|
1144
1151
|
const [open, setOpen] = useState(false)
|
|
1145
1152
|
const globalConfig = getGlobalConfigModule()
|
|
1146
1153
|
const timezone = getTimezone()
|
|
@@ -1163,7 +1170,39 @@ function TimestampField({
|
|
|
1163
1170
|
const currentValue = formField.value
|
|
1164
1171
|
? DateTime.fromJSDate(formField.value.toDate()).setZone(timezone)
|
|
1165
1172
|
: undefined
|
|
1166
|
-
if (
|
|
1173
|
+
if (isMonth) {
|
|
1174
|
+
return (
|
|
1175
|
+
<FormItem>
|
|
1176
|
+
<FormLabelWithIcon
|
|
1177
|
+
collection={collection}
|
|
1178
|
+
label={label}
|
|
1179
|
+
field={field}
|
|
1180
|
+
operation={operation}
|
|
1181
|
+
icon={icon}
|
|
1182
|
+
form={form}
|
|
1183
|
+
/>
|
|
1184
|
+
<FormControl>
|
|
1185
|
+
<div className="flex w-fit flex-col gap-2 rounded-md border border-input">
|
|
1186
|
+
<MonthPicker
|
|
1187
|
+
currentMonth={
|
|
1188
|
+
currentValue
|
|
1189
|
+
? keepTimezone(currentValue.toJSDate(), timezone)
|
|
1190
|
+
: keepTimezone(new Date(), timezone)
|
|
1191
|
+
}
|
|
1192
|
+
onMonthChange={(date: Date | undefined) => {
|
|
1193
|
+
if (!date) return
|
|
1194
|
+
const newDate = DateTime.fromJSDate(date).setZone(timezone)
|
|
1195
|
+
formField.onChange(Timestamp.fromDate(newDate.toJSDate()))
|
|
1196
|
+
}}
|
|
1197
|
+
disabled={isDisabled}
|
|
1198
|
+
/>
|
|
1199
|
+
</div>
|
|
1200
|
+
</FormControl>
|
|
1201
|
+
{description && <FormDescription>{description}</FormDescription>}
|
|
1202
|
+
<FormMessage className="bg-destructive p-4 rounded-md text-background dark:text-primary" />
|
|
1203
|
+
</FormItem>
|
|
1204
|
+
)
|
|
1205
|
+
} else if (isTime) {
|
|
1167
1206
|
// Use HH:mm for broad browser compatibility (iOS Safari returns HH:mm)
|
|
1168
1207
|
const timeString = currentValue?.toFormat("HH:mm") || "00:00"
|
|
1169
1208
|
|