@tulip-systems/core 0.6.0 → 0.6.1
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/dist/commands/client.d.mts +2 -1
- package/dist/commands/client.mjs +2 -1
- package/dist/components/editor/components/menu-nodes.client.mjs +2 -2
- package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -1
- package/dist/components/ui/input-date-time.d.mts +4 -4
- package/dist/components/ui/input-date-time.d.mts.map +1 -1
- package/dist/components/ui/input-date-time.mjs +4 -6
- package/dist/components/ui/input-date-time.mjs.map +1 -1
- package/dist/inline-edit/client.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
- package/dist/lib/hooks/use-indicator.mjs +11 -8
- package/dist/lib/hooks/use-indicator.mjs.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.mjs +1 -1
- package/dist/modules/auth/components/auth-layout.server.mjs.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.d.mts +8 -1
- package/dist/modules/commands/hooks/use-command-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
- package/dist/modules/commands/menus/floating-menu.client.d.mts +19 -0
- package/dist/modules/commands/menus/floating-menu.client.d.mts.map +1 -0
- package/dist/modules/commands/menus/{data-table-menu.client.mjs → floating-menu.client.mjs} +10 -10
- package/dist/modules/commands/menus/floating-menu.client.mjs.map +1 -0
- package/dist/modules/data-tables/tables/data-table/components/table.mjs +8 -2
- package/dist/modules/data-tables/tables/data-table/components/table.mjs.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs +8 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.mjs.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +5 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.mjs +5 -1
- package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.mjs +5 -1
- package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.mjs +5 -1
- package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/date-time.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-time.client.mjs +6 -1
- package/dist/modules/inline-edit/components/date-time.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.mjs +5 -1
- package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs +5 -1
- package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.mjs +5 -1
- package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.mjs +15 -3
- package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.mjs +5 -1
- package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.mjs +5 -1
- package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.mjs +5 -1
- package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +20 -5
- package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs +11 -8
- package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
- package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.d.mts +1 -0
- package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +2 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +5 -3
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +11 -11
- package/dist/modules/storage/lib/service.server.d.mts +9 -9
- package/dist/modules/storage/lib/validators.d.mts +7 -7
- package/package.json +1 -1
- package/src/components/editor/components/menu-nodes.client.tsx +2 -2
- package/src/components/navigation/admin-sidebar.client.tsx +1 -0
- package/src/components/ui/input-date-time.tsx +12 -10
- package/src/lib/hooks/use-indicator.tsx +17 -8
- package/src/modules/auth/components/auth-layout.server.tsx +1 -1
- package/src/modules/commands/entry.client.ts +16 -0
- package/src/modules/commands/hooks/use-command-menu.client.tsx +2 -0
- package/src/modules/commands/menus/floating-menu.client.tsx +54 -0
- package/src/modules/data-tables/tables/data-table/components/table.tsx +11 -2
- package/src/modules/data-tables/tables/inline-table/components/table.tsx +11 -2
- package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +4 -0
- package/src/modules/inline-edit/components/combobox.client.tsx +4 -0
- package/src/modules/inline-edit/components/date-input.client.tsx +4 -0
- package/src/modules/inline-edit/components/date-picker.client.tsx +4 -0
- package/src/modules/inline-edit/components/date-time.client.tsx +15 -1
- package/src/modules/inline-edit/components/editor.client.tsx +4 -0
- package/src/modules/inline-edit/components/input-recipient.client.tsx +4 -0
- package/src/modules/inline-edit/components/input-toggle.client.tsx +4 -0
- package/src/modules/inline-edit/components/input.client.tsx +12 -0
- package/src/modules/inline-edit/components/select.client.tsx +4 -0
- package/src/modules/inline-edit/components/switch.client.tsx +4 -0
- package/src/modules/inline-edit/components/toggle.client.tsx +4 -0
- package/src/modules/inline-edit/hooks/use-inline.client.tsx +37 -13
- package/src/modules/inline-edit/lib/parsers.ts +9 -0
- package/src/modules/storage/components/upload-zone-context.client.tsx +1 -0
- package/src/modules/storage/components/upload-zone.client.tsx +8 -2
- package/dist/modules/commands/menus/data-table-menu.client.mjs.map +0 -1
- package/src/modules/commands/menus/data-table-menu.client.tsx +0 -46
|
@@ -19,7 +19,11 @@ function InlineDatePicker({ initialValue, action, permission, variant, className
|
|
|
19
19
|
action,
|
|
20
20
|
permission,
|
|
21
21
|
updateStrategy,
|
|
22
|
-
isRequired
|
|
22
|
+
isRequired,
|
|
23
|
+
parser: {
|
|
24
|
+
decode: (value) => value,
|
|
25
|
+
encode: (value) => value
|
|
26
|
+
}
|
|
23
27
|
});
|
|
24
28
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
25
29
|
open,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.client.mjs","names":["Calendar"],"sources":["../../../../src/modules/inline-edit/components/date-picker.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { CalendarIcon } from \"lucide-react\";\nimport React, { type ComponentProps } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Calendar } from \"@/components/ui/calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { formatDate } from \"@/lib/utils/format\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineEditDatePickerProps<Required extends boolean> = ComponentProps<typeof Button> &\n useInlineEditOptions<Date, Required> &\n InlineEditVariantsProps;\n\nexport function InlineDatePicker<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n variant,\n className,\n disabled,\n updateStrategy,\n isRequired,\n ...props\n}: InlineEditDatePickerProps<Required>) {\n const [open, setOpen] = React.useState(false);\n\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Popover\n open={open}\n onOpenChange={(open) => {\n setOpen(open);\n if (!open && value) handleBlur(value);\n }}\n >\n <PopoverTrigger asChild>\n <Button\n {...props}\n type=\"button\"\n variant=\"outline\"\n className={cn(\"w-full\", inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4\" />\n {value ? formatDate(value) : <span>Kies een datum</span>}\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-auto p-0\">\n <Calendar\n mode=\"single\"\n autoFocus\n selected={value ? new Date(value) : undefined}\n onSelect={(date) => handleChange(date ?? null)}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAgB,iBAAmD,EACjE,cACA,QACA,YACA,SACA,WACA,UACA,gBACA,YACA,GAAG,SACmC;CACtC,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;CAE7C,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"date-picker.client.mjs","names":["Calendar"],"sources":["../../../../src/modules/inline-edit/components/date-picker.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { CalendarIcon } from \"lucide-react\";\nimport React, { type ComponentProps } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Calendar } from \"@/components/ui/calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { formatDate } from \"@/lib/utils/format\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineEditDatePickerProps<Required extends boolean> = ComponentProps<typeof Button> &\n useInlineEditOptions<Date, Required> &\n InlineEditVariantsProps;\n\nexport function InlineDatePicker<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n variant,\n className,\n disabled,\n updateStrategy,\n isRequired,\n ...props\n}: InlineEditDatePickerProps<Required>) {\n const [open, setOpen] = React.useState(false);\n\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Popover\n open={open}\n onOpenChange={(open) => {\n setOpen(open);\n if (!open && value) handleBlur(value);\n }}\n >\n <PopoverTrigger asChild>\n <Button\n {...props}\n type=\"button\"\n variant=\"outline\"\n className={cn(\"w-full\", inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4\" />\n {value ? formatDate(value) : <span>Kies een datum</span>}\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-auto p-0\">\n <Calendar\n mode=\"single\"\n autoFocus\n selected={value ? new Date(value) : undefined}\n onSelect={(date) => handleChange(date ?? null)}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAgB,iBAAmD,EACjE,cACA,QACA,YACA,SACA,WACA,UACA,gBACA,YACA,GAAG,SACmC;CACtC,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,MAAM;CAE7C,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,qBAAC;EACO;EACN,eAAe,SAAS;AACtB,WAAQ,KAAK;AACb,OAAI,CAAC,QAAQ,MAAO,YAAW,MAAM;;aAGvC,oBAAC;GAAe;aACd,qBAAC;IACC,GAAI;IACJ,MAAK;IACL,SAAQ;IACR,WAAW,GAAG,UAAU,mBAAmB;KAAE;KAAS;KAAQ,CAAC,EAAE,UAAU;IAC3E,UAAU,YAAY,CAAC;eAEvB,oBAAC,gBAAa,WAAU,iBAAiB,EACxC,QAAQ,WAAW,MAAM,GAAG,oBAAC,oBAAK,mBAAqB;KACjD;IACM,EAEjB,oBAAC;GAAe,WAAU;aACxB,oBAACA;IACC,MAAK;IACL;IACA,UAAU,QAAQ,IAAI,KAAK,MAAM,GAAG;IACpC,WAAW,SAAS,aAAa,QAAQ,KAAK;KAC9C;IACa;GACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-time.client.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"date-time.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/date-time.client.tsx"],"mappings":";;;;;;;iBASgB,mBAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,UAAA;EACA,OAAA;EACA,SAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,aAAA,IACvB,oBAAA,CAAqB,IAAA,EAAM,QAAA,IAC3B,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -5,6 +5,7 @@ import { DateTimeInput } from "../../../components/ui/input-date-time.mjs";
|
|
|
5
5
|
import { useInlineEdit } from "../hooks/use-inline.client.mjs";
|
|
6
6
|
import { inlineEditVariants } from "../lib/variants.mjs";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { format } from "date-fns";
|
|
8
9
|
|
|
9
10
|
//#region src/modules/inline-edit/components/date-time.client.tsx
|
|
10
11
|
function InlineDateTimeInput({ initialValue, action, permission, variant, className, updateStrategy, isRequired, disabled, ...props }) {
|
|
@@ -13,7 +14,11 @@ function InlineDateTimeInput({ initialValue, action, permission, variant, classN
|
|
|
13
14
|
action,
|
|
14
15
|
permission,
|
|
15
16
|
updateStrategy,
|
|
16
|
-
isRequired
|
|
17
|
+
isRequired,
|
|
18
|
+
parser: {
|
|
19
|
+
decode: (value) => value instanceof Date ? format(value, "yyyy-MM-dd'T'HH:mm") : typeof value === "string" ? value : void 0,
|
|
20
|
+
encode: (value) => value ? new Date(value) : null
|
|
21
|
+
}
|
|
17
22
|
});
|
|
18
23
|
return /* @__PURE__ */ jsx(DateTimeInput, {
|
|
19
24
|
value: value ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/date-time.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { DateTimeInput } from \"@/components/ui/input-date-time\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport function InlineDateTimeInput<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n variant,\n className,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: ComponentProps<typeof DateTimeInput> &\n useInlineEditOptions<Date, Required> &\n InlineEditVariantsProps) {\n const { value, handleChange, handleBlur, status, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <DateTimeInput\n value={value ?? undefined}\n className={cn(inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n onValueChange={(date) => handleChange(date ?? null)}\n onValueBlur={(date) => handleBlur(date ?? null)}\n {...props}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-time.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/date-time.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { format } from \"date-fns\";\nimport type { ComponentProps } from \"react\";\nimport { DateTimeInput } from \"@/components/ui/input-date-time\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport function InlineDateTimeInput<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n variant,\n className,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: ComponentProps<typeof DateTimeInput> &\n useInlineEditOptions<Date, Required> &\n InlineEditVariantsProps) {\n const { value, handleChange, handleBlur, status, isAllowed } = useInlineEdit<\n string,\n Date,\n Required\n >({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) =>\n (value instanceof Date\n ? format(value, \"yyyy-MM-dd'T'HH:mm\")\n : typeof value === \"string\"\n ? value\n : undefined) as string,\n encode: (value) => (value ? new Date(value) : null) as Date,\n },\n });\n\n return (\n <DateTimeInput\n value={value ?? undefined}\n className={cn(inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n onValueChange={(date) => handleChange(date ?? null)}\n onValueBlur={(date) => handleBlur(date ?? null)}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,oBAAsD,EACpE,cACA,QACA,YACA,SACA,WACA,gBACA,YACA,UACA,GAAG,SAGsB;CACzB,MAAM,EAAE,OAAO,cAAc,YAAY,QAAQ,cAAc,cAI7D;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UACN,iBAAiB,OACd,OAAO,OAAO,qBAAqB,GACnC,OAAO,UAAU,WACf,QACA;GACR,SAAS,UAAW,QAAQ,IAAI,KAAK,MAAM,GAAG;GAC/C;EACF,CAAC;AAEF,QACE,oBAAC;EACC,OAAO,SAAS;EAChB,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;EACjE,UAAU,YAAY,CAAC;EACvB,gBAAgB,SAAS,aAAa,QAAQ,KAAK;EACnD,cAAc,SAAS,WAAW,QAAQ,KAAK;EAC/C,GAAI;GACJ"}
|
|
@@ -13,7 +13,11 @@ function InlineEditor({ initialValue, action, extensions, variant, disabled, per
|
|
|
13
13
|
action,
|
|
14
14
|
permission,
|
|
15
15
|
updateStrategy,
|
|
16
|
-
isRequired
|
|
16
|
+
isRequired,
|
|
17
|
+
parser: {
|
|
18
|
+
decode: (value) => value,
|
|
19
|
+
encode: (value) => value
|
|
20
|
+
}
|
|
17
21
|
});
|
|
18
22
|
return /* @__PURE__ */ jsx(Editor, {
|
|
19
23
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Editor, type EditorProps } from \"@/components/editor/components/editor.client\";\nimport type { EditorJSONContent } from \"@/components/editor/lib/types\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport type InlineEditorProps<Required extends boolean = false> = useInlineEditOptions<\n EditorJSONContent,\n Required\n> &\n InlineEditVariantsProps &\n Omit<EditorProps, \"value\" | \"onUpdate\" | \"onBlur\" | \"variant\">;\n\nexport function InlineEditor<Required extends boolean = false>({\n initialValue,\n action,\n extensions,\n variant,\n disabled,\n permission,\n updateStrategy,\n isRequired,\n className,\n children,\n}: InlineEditorProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Editor\n value={value}\n extensions={extensions}\n onUpdate={(value) => handleChange(value)}\n onBlur={(value) => handleBlur(value)}\n className={cn(inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n variant={variant}\n >\n {children}\n </Editor>\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,SACA,UACA,YACA,gBACA,YACA,WACA,YAC8B;CAC9B,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"editor.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Editor, type EditorProps } from \"@/components/editor/components/editor.client\";\nimport type { EditorJSONContent } from \"@/components/editor/lib/types\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport type InlineEditorProps<Required extends boolean = false> = useInlineEditOptions<\n EditorJSONContent,\n Required\n> &\n InlineEditVariantsProps &\n Omit<EditorProps, \"value\" | \"onUpdate\" | \"onBlur\" | \"variant\">;\n\nexport function InlineEditor<Required extends boolean = false>({\n initialValue,\n action,\n extensions,\n variant,\n disabled,\n permission,\n updateStrategy,\n isRequired,\n className,\n children,\n}: InlineEditorProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Editor\n value={value}\n extensions={extensions}\n onUpdate={(value) => handleChange(value)}\n onBlur={(value) => handleBlur(value)}\n className={cn(inlineEditVariants({ variant, status }), className)}\n disabled={disabled || !isAllowed}\n variant={variant}\n >\n {children}\n </Editor>\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,SACA,UACA,YACA,gBACA,YACA,WACA,YAC8B;CAC9B,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACQ;EACK;EACZ,WAAW,UAAU,aAAa,MAAM;EACxC,SAAS,UAAU,WAAW,MAAM;EACpC,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;EACjE,UAAU,YAAY,CAAC;EACd;EAER;GACM"}
|
|
@@ -16,7 +16,11 @@ function InlineRecipientInput({ initialValue, action, variant, disabled, contact
|
|
|
16
16
|
action,
|
|
17
17
|
permission,
|
|
18
18
|
updateStrategy,
|
|
19
|
-
isRequired
|
|
19
|
+
isRequired,
|
|
20
|
+
parser: {
|
|
21
|
+
decode: (value) => value,
|
|
22
|
+
encode: (value) => value
|
|
23
|
+
}
|
|
20
24
|
});
|
|
21
25
|
return /* @__PURE__ */ jsx(RecipientInput, {
|
|
22
26
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-recipient.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-recipient.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { type Contact, RecipientInput } from \"@/components/ui/input-recipient\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineRecipientInputProps<Required extends boolean = false> = Omit<\n ComponentProps<typeof RecipientInput>,\n \"value\" | \"onChange\"\n> &\n useInlineEditOptions<string[], Required> &\n InlineEditVariantsProps & {\n contacts: Contact[];\n };\n\n/**\n * The inline edit recipient input component.\n */\nexport function InlineRecipientInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n disabled,\n contacts,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineRecipientInputProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <RecipientInput\n {...props}\n contacts={contacts}\n value={value ?? []}\n onChange={(newValue) => {\n handleChange(newValue);\n handleBlur(newValue);\n }}\n disabled={disabled || !isAllowed}\n className={cn(inlineEditVariants({ variant, status }), className)}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,qBAAuD,EACrE,cACA,QACA,SACA,UACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SACmC;CACtC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"input-recipient.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-recipient.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { type Contact, RecipientInput } from \"@/components/ui/input-recipient\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineRecipientInputProps<Required extends boolean = false> = Omit<\n ComponentProps<typeof RecipientInput>,\n \"value\" | \"onChange\"\n> &\n useInlineEditOptions<string[], Required> &\n InlineEditVariantsProps & {\n contacts: Contact[];\n };\n\n/**\n * The inline edit recipient input component.\n */\nexport function InlineRecipientInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n disabled,\n contacts,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineRecipientInputProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <RecipientInput\n {...props}\n contacts={contacts}\n value={value ?? []}\n onChange={(newValue) => {\n handleChange(newValue);\n handleBlur(newValue);\n }}\n disabled={disabled || !isAllowed}\n className={cn(inlineEditVariants({ variant, status }), className)}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,qBAAuD,EACrE,cACA,QACA,SACA,UACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SACmC;CACtC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACM;EACV,OAAO,SAAS,EAAE;EAClB,WAAW,aAAa;AACtB,gBAAa,SAAS;AACtB,cAAW,SAAS;;EAEtB,UAAU,YAAY,CAAC;EACvB,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;GACjE"}
|
|
@@ -16,7 +16,11 @@ function InlineStringInputToggle({ initialValue, action, disabled, permission, u
|
|
|
16
16
|
action,
|
|
17
17
|
permission,
|
|
18
18
|
updateStrategy,
|
|
19
|
-
isRequired
|
|
19
|
+
isRequired,
|
|
20
|
+
parser: {
|
|
21
|
+
decode: (value) => value,
|
|
22
|
+
encode: (value) => value
|
|
23
|
+
}
|
|
20
24
|
});
|
|
21
25
|
function handleToggle() {
|
|
22
26
|
setEnabled(!enabled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { type ComponentProps, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/entry\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\ntype InlineStringInputToggleProps<Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<string, Required>;\n\nexport function InlineStringInputToggle<Required extends boolean>({\n initialValue,\n action,\n disabled,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineStringInputToggleProps<Required>) {\n const [enabled, setEnabled] = useState(!!initialValue);\n\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n function handleToggle() {\n setEnabled(!enabled);\n if (!enabled) return;\n\n handleBlur(null);\n }\n\n const isDisabled = !enabled || disabled || !isAllowed;\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={isDisabled}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\"border-border/70 hover:border-border w-full\", className)}\n />\n\n <Button\n variant=\"ghost\"\n onClick={handleToggle}\n tabIndex={-1}\n className={cn(\n \"absolute bottom-0 right-0 top-0 opacity-50\",\n !value && \"text-muted-foreground\",\n )}\n >\n {enabled ? <CheckIcon /> : <XIcon />}\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,wBAAkD,EAChE,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SACsC;CACzC,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC,CAAC,aAAa;CAEtD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"input-toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input-toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { CheckIcon, XIcon } from \"lucide-react\";\nimport { type ComponentProps, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/entry\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\ntype InlineStringInputToggleProps<Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<string, Required>;\n\nexport function InlineStringInputToggle<Required extends boolean>({\n initialValue,\n action,\n disabled,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineStringInputToggleProps<Required>) {\n const [enabled, setEnabled] = useState(!!initialValue);\n\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n function handleToggle() {\n setEnabled(!enabled);\n if (!enabled) return;\n\n handleBlur(null);\n }\n\n const isDisabled = !enabled || disabled || !isAllowed;\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={isDisabled}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\"border-border/70 hover:border-border w-full\", className)}\n />\n\n <Button\n variant=\"ghost\"\n onClick={handleToggle}\n tabIndex={-1}\n className={cn(\n \"absolute bottom-0 right-0 top-0 opacity-50\",\n !value && \"text-muted-foreground\",\n )}\n >\n {enabled ? <CheckIcon /> : <XIcon />}\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,wBAAkD,EAChE,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SACsC;CACzC,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC,CAAC,aAAa;CAEtD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;CAEF,SAAS,eAAe;AACtB,aAAW,CAAC,QAAQ;AACpB,MAAI,CAAC,QAAS;AAEd,aAAW,KAAK;;CAGlB,MAAM,aAAa,CAAC,WAAW,YAAY,CAAC;AAE5C,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC;GACC,GAAI;GACJ,MAAK;GACL,OAAO,SAAS;GAChB,UAAU;GACV,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;GACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;GACjE,WAAW,GAAG,+CAA+C,UAAU;IACvE,EAEF,oBAAC;GACC,SAAQ;GACR,SAAS;GACT,UAAU;GACV,WAAW,GACT,8CACA,CAAC,SAAS,wBACX;aAEA,UAAU,oBAAC,cAAY,GAAG,oBAAC,UAAQ;IAC7B;GACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"mappings":";;;;;;;KAQK,oBAAA,6CAAiE,IAAA,CACpE,cAAA,QAAsB,KAAA,aAGtB,oBAAA,CAAqB,MAAA,EAAQ,QAAA,IAC7B,uBAAA;;;AAPiF;iBAYnE,iBAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"input.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"mappings":";;;;;;;KAQK,oBAAA,6CAAiE,IAAA,CACpE,cAAA,QAAsB,KAAA,aAGtB,oBAAA,CAAqB,MAAA,EAAQ,QAAA,IAC7B,uBAAA;;;AAPiF;iBAYnE,iBAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAoCzB,iBAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAiCzB,kBAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,oBAAA,WAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -16,7 +16,11 @@ function InlineStringInput({ initialValue, action, variant, className, permissio
|
|
|
16
16
|
action,
|
|
17
17
|
permission,
|
|
18
18
|
updateStrategy,
|
|
19
|
-
isRequired
|
|
19
|
+
isRequired,
|
|
20
|
+
parser: {
|
|
21
|
+
decode: (value) => value,
|
|
22
|
+
encode: (value) => value
|
|
23
|
+
}
|
|
20
24
|
});
|
|
21
25
|
return /* @__PURE__ */ jsx(Input, {
|
|
22
26
|
...props,
|
|
@@ -41,7 +45,11 @@ function InlineNumberInput({ initialValue, action, variant, className, permissio
|
|
|
41
45
|
action,
|
|
42
46
|
permission,
|
|
43
47
|
updateStrategy,
|
|
44
|
-
isRequired
|
|
48
|
+
isRequired,
|
|
49
|
+
parser: {
|
|
50
|
+
decode: (value) => value,
|
|
51
|
+
encode: (value) => value
|
|
52
|
+
}
|
|
45
53
|
});
|
|
46
54
|
return /* @__PURE__ */ jsx(Input, {
|
|
47
55
|
...props,
|
|
@@ -65,7 +73,11 @@ function InlineDecimalInput({ initialValue, action, variant, className, permissi
|
|
|
65
73
|
action,
|
|
66
74
|
permission,
|
|
67
75
|
updateStrategy,
|
|
68
|
-
isRequired
|
|
76
|
+
isRequired,
|
|
77
|
+
parser: {
|
|
78
|
+
decode: (value) => value,
|
|
79
|
+
encode: (value) => value
|
|
80
|
+
}
|
|
69
81
|
});
|
|
70
82
|
return /* @__PURE__ */ jsx(Input, {
|
|
71
83
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineEditInputProps<TValue, Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<TValue, Required> &\n InlineEditVariantsProps;\n\n/**\n * The inline edit string input component.\n */\nexport function InlineStringInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit number input component.\n */\nconst parseValueAsNumber = (valueAsNumber: number): number | null =>\n !Number.isNaN(Number(valueAsNumber)) ? valueAsNumber : null;\n\nexport function InlineNumberInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<number, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(parseValueAsNumber(e.target.valueAsNumber))}\n onBlur={(e) => handleBlur(parseValueAsNumber(e.target.valueAsNumber))}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit decimal input component.\n */\nexport function InlineDecimalInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,kBAAoD,EAClE,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"input.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/input.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\ntype InlineEditInputProps<TValue, Required extends boolean = false> = Omit<\n ComponentProps<typeof Input>,\n \"type\"\n> &\n useInlineEditOptions<TValue, Required> &\n InlineEditVariantsProps;\n\n/**\n * The inline edit string input component.\n */\nexport function InlineStringInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Input\n {...props}\n type=\"text\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit number input component.\n */\nconst parseValueAsNumber = (valueAsNumber: number): number | null =>\n !Number.isNaN(Number(valueAsNumber)) ? valueAsNumber : null;\n\nexport function InlineNumberInput<Required extends boolean = false>({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<number, Required>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(parseValueAsNumber(e.target.valueAsNumber))}\n onBlur={(e) => handleBlur(parseValueAsNumber(e.target.valueAsNumber))}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n\n/**\n * The inline edit decimal input component.\n */\nexport function InlineDecimalInput({\n initialValue,\n action,\n variant,\n className,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: InlineEditInputProps<string>) {\n const { value, handleChange, handleBlur, isAllowed, status } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Input\n {...props}\n type=\"number\"\n value={value ?? undefined}\n disabled={disabled || !isAllowed}\n onChange={(e) => handleChange(e.target.value ? e.target.value : null)}\n onBlur={(e) => handleBlur(e.target.value ? e.target.value : null)}\n className={cn(\n \"border-border/70 hover:border-border w-full\",\n inlineEditVariants({ variant, status }),\n className,\n )}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAgB,kBAAoD,EAClE,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACjE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD;;;;;AAON,MAAM,sBAAsB,kBAC1B,CAAC,OAAO,MAAM,OAAO,cAAc,CAAC,GAAG,gBAAgB;AAEzD,SAAgB,kBAAoD,EAClE,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SACsC;CACzC,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACzE,SAAS,MAAM,WAAW,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACrE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD;;;;;AAON,SAAgB,mBAAmB,EACjC,cACA,QACA,SACA,WACA,YACA,gBACA,YACA,UACA,GAAG,SAC4B;CAC/B,MAAM,EAAE,OAAO,cAAc,YAAY,WAAW,WAAW,cAAc;EAC3E;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,MAAK;EACL,OAAO,SAAS;EAChB,UAAU,YAAY,CAAC;EACvB,WAAW,MAAM,aAAa,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACrE,SAAS,MAAM,WAAW,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAAK;EACjE,WAAW,GACT,+CACA,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EACvC,UACD;GACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"mappings":";;;;;;iBAqBgB,YAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,WAAA,GAAc,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"mappings":";;;;;;iBAqBgB,YAAA,kCAAA,CAAA;EACd,YAAA;EACA,MAAA;EACA,UAAA;EACA,cAAA;EACA,UAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,WAAA,GAAc,oBAAA,SAA6B,QAAA,IAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KA0B3C,wBAAA,GAA2B,kBAAA;AAAA,iBAEvB,mBAAA,CAAA;EACd,OAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,wBAAA,GAA2B,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAQzC,wBAAA,GAA2B,kBAAA;AAAA,iBAEvB,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAIvD,sBAAA,GAAyB,gBAAA;AAAA,iBAErB,iBAAA,CAAkB,KAAA,EAAO,sBAAA,GAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAInD,qBAAA,GAAwB,eAAA;AAAA,iBAEpB,gBAAA,CAAiB,KAAA,EAAO,qBAAA,GAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -14,7 +14,11 @@ function InlineSelect({ initialValue, action, permission, updateStrategy, isRequ
|
|
|
14
14
|
action,
|
|
15
15
|
permission,
|
|
16
16
|
updateStrategy,
|
|
17
|
-
isRequired
|
|
17
|
+
isRequired,
|
|
18
|
+
parser: {
|
|
19
|
+
decode: (value) => value,
|
|
20
|
+
encode: (value) => value
|
|
21
|
+
}
|
|
18
22
|
});
|
|
19
23
|
return /* @__PURE__ */ jsx(Select, {
|
|
20
24
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n SelectContentProps,\n SelectItemProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n} from \"@radix-ui/react-select\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select.client\";\nimport { useIndicator } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport function InlineSelect<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SelectProps & useInlineEditOptions<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Select\n {...props}\n disabled={disabled || !isAllowed}\n defaultValue={value ?? undefined}\n onValueChange={(value) => {\n handleChange(value ? value : null);\n handleBlur(value ? value : null);\n }}\n />\n );\n}\n\nexport type InlineSelectTriggerProps = SelectTriggerProps;\n\nexport function InlineSelectTrigger({\n variant,\n className,\n ...props\n}: InlineSelectTriggerProps & InlineEditVariantsProps) {\n const { status } = useIndicator();\n\n return (\n <SelectTrigger {...props} className={cn(inlineEditVariants({ variant, status }), className)} />\n );\n}\n\nexport type InlineSelectContentProps = SelectContentProps;\n\nexport function InlineSelectContent(props: InlineSelectContentProps) {\n return <SelectContent {...props} />;\n}\n\nexport type InlineSelectValueProps = SelectValueProps;\n\nexport function InlineSelectValue(props: InlineSelectValueProps) {\n return <SelectValue {...props} />;\n}\n\nexport type InlineSelectItenProps = SelectItemProps;\n\nexport function InlineSelectItem(props: InlineSelectItenProps) {\n return <SelectItem {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACoD;CACvD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"select.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n SelectContentProps,\n SelectItemProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n} from \"@radix-ui/react-select\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select.client\";\nimport { useIndicator } from \"@/lib/entry.client\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\nimport { type InlineEditVariantsProps, inlineEditVariants } from \"../lib/variants\";\n\nexport function InlineSelect<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SelectProps & useInlineEditOptions<string, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Select\n {...props}\n disabled={disabled || !isAllowed}\n defaultValue={value ?? undefined}\n onValueChange={(value) => {\n handleChange(value ? value : null);\n handleBlur(value ? value : null);\n }}\n />\n );\n}\n\nexport type InlineSelectTriggerProps = SelectTriggerProps;\n\nexport function InlineSelectTrigger({\n variant,\n className,\n ...props\n}: InlineSelectTriggerProps & InlineEditVariantsProps) {\n const { status } = useIndicator();\n\n return (\n <SelectTrigger {...props} className={cn(inlineEditVariants({ variant, status }), className)} />\n );\n}\n\nexport type InlineSelectContentProps = SelectContentProps;\n\nexport function InlineSelectContent(props: InlineSelectContentProps) {\n return <SelectContent {...props} />;\n}\n\nexport type InlineSelectValueProps = SelectValueProps;\n\nexport function InlineSelectValue(props: InlineSelectValueProps) {\n return <SelectValue {...props} />;\n}\n\nexport type InlineSelectItenProps = SelectItemProps;\n\nexport function InlineSelectItem(props: InlineSelectItenProps) {\n return <SelectItem {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACoD;CACvD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,cAAc,SAAS;EACvB,gBAAgB,UAAU;AACxB,gBAAa,QAAQ,QAAQ,KAAK;AAClC,cAAW,QAAQ,QAAQ,KAAK;;GAElC;;AAMN,SAAgB,oBAAoB,EAClC,SACA,WACA,GAAG,SACkD;CACrD,MAAM,EAAE,WAAW,cAAc;AAEjC,QACE,oBAAC;EAAc,GAAI;EAAO,WAAW,GAAG,mBAAmB;GAAE;GAAS;GAAQ,CAAC,EAAE,UAAU;GAAI;;AAMnG,SAAgB,oBAAoB,OAAiC;AACnE,QAAO,oBAAC,iBAAc,GAAI,QAAS;;AAKrC,SAAgB,kBAAkB,OAA+B;AAC/D,QAAO,oBAAC,eAAY,GAAI,QAAS;;AAKnC,SAAgB,iBAAiB,OAA8B;AAC7D,QAAO,oBAAC,cAAW,GAAI,QAAS"}
|
|
@@ -11,7 +11,11 @@ function InlineSwitch({ initialValue, action, permission, updateStrategy, isRequ
|
|
|
11
11
|
action,
|
|
12
12
|
permission,
|
|
13
13
|
updateStrategy,
|
|
14
|
-
isRequired
|
|
14
|
+
isRequired,
|
|
15
|
+
parser: {
|
|
16
|
+
decode: (value) => value,
|
|
17
|
+
encode: (value) => value
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
20
|
return /* @__PURE__ */ jsx(Switch, {
|
|
17
21
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { SwitchProps } from \"@radix-ui/react-switch\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport function InlineSwitch<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SwitchProps & useInlineEditOptions<boolean, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <Switch\n {...props}\n disabled={disabled || !isAllowed}\n defaultChecked={value ?? undefined}\n onCheckedChange={(checked) => {\n handleChange(checked ?? null);\n handleBlur(checked ?? null);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACqD;CACxD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"switch.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type { SwitchProps } from \"@radix-ui/react-switch\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport function InlineSwitch<Required extends boolean = false>({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n disabled,\n ...props\n}: SwitchProps & useInlineEditOptions<boolean, Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <Switch\n {...props}\n disabled={disabled || !isAllowed}\n defaultChecked={value ?? undefined}\n onCheckedChange={(checked) => {\n handleChange(checked ?? null);\n handleBlur(checked ?? null);\n }}\n />\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,aAA+C,EAC7D,cACA,QACA,YACA,gBACA,YACA,UACA,GAAG,SACqD;CACxD,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,YAAY,CAAC;EACvB,gBAAgB,SAAS;EACzB,kBAAkB,YAAY;AAC5B,gBAAa,WAAW,KAAK;AAC7B,cAAW,WAAW,KAAK;;GAE7B"}
|
|
@@ -12,7 +12,11 @@ function InlineToggle({ initialValue, action, children, permission, updateStrate
|
|
|
12
12
|
action,
|
|
13
13
|
permission,
|
|
14
14
|
updateStrategy,
|
|
15
|
-
isRequired
|
|
15
|
+
isRequired,
|
|
16
|
+
parser: {
|
|
17
|
+
decode: (value) => value,
|
|
18
|
+
encode: (value) => value
|
|
19
|
+
}
|
|
16
20
|
});
|
|
17
21
|
return /* @__PURE__ */ jsx("div", {
|
|
18
22
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Toggle } from \"@/components/ui/toggle\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps<Required extends boolean = false> =\n React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;\n\nexport function InlineToggle<Required extends boolean = false>({\n initialValue,\n action,\n children,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineEditToggleProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value ?? undefined}\n defaultChecked={initialValue ?? undefined}\n onPressedChange={(value) => {\n handleChange(value);\n handleBlur(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAA+C,EAC7D,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SAC+B;CAClC,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;
|
|
1
|
+
{"version":3,"file":"toggle.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":["\"use client\";\n\nimport type React from \"react\";\nimport { Toggle } from \"@/components/ui/toggle\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { useInlineEdit, type useInlineEditOptions } from \"../hooks/use-inline.client\";\n\nexport type InlineEditToggleProps<Required extends boolean = false> =\n React.HTMLAttributes<HTMLDivElement> & useInlineEditOptions<boolean, Required>;\n\nexport function InlineToggle<Required extends boolean = false>({\n initialValue,\n action,\n children,\n permission,\n updateStrategy,\n isRequired,\n className,\n ...props\n}: InlineEditToggleProps<Required>) {\n const { value, handleChange, handleBlur, isAllowed } = useInlineEdit({\n initialValue,\n action,\n permission,\n updateStrategy,\n isRequired,\n parser: {\n decode: (value) => value,\n encode: (value) => value,\n },\n });\n\n return (\n <div {...props} className={cn(\"flex flex-wrap items-center justify-start gap-1\", className)}>\n <Toggle\n disabled={!isAllowed}\n variant=\"outline\"\n pressed={value ?? undefined}\n defaultChecked={initialValue ?? undefined}\n onPressedChange={(value) => {\n handleChange(value);\n handleBlur(value);\n }}\n >\n {children}\n </Toggle>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAA+C,EAC7D,cACA,QACA,UACA,YACA,gBACA,YACA,WACA,GAAG,SAC+B;CAClC,MAAM,EAAE,OAAO,cAAc,YAAY,cAAc,cAAc;EACnE;EACA;EACA;EACA;EACA;EACA,QAAQ;GACN,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB;EACF,CAAC;AAEF,QACE,oBAAC;EAAI,GAAI;EAAO,WAAW,GAAG,mDAAmD,UAAU;YACzF,oBAAC;GACC,UAAU,CAAC;GACX,SAAQ;GACR,SAAS,SAAS;GAClB,gBAAgB,gBAAgB;GAChC,kBAAkB,UAAU;AAC1B,iBAAa,MAAM;AACnB,eAAW,MAAM;;GAGlB;IACM;GACL"}
|
|
@@ -16,17 +16,17 @@ type MaybeValue<TValue, Required extends boolean> = Required extends true ? TVal
|
|
|
16
16
|
/**
|
|
17
17
|
* Use the inline edit hook options.
|
|
18
18
|
*/
|
|
19
|
-
type useInlineEditOptions<
|
|
19
|
+
type useInlineEditOptions<TResult, Required extends boolean = false> = {
|
|
20
20
|
/**
|
|
21
21
|
* Initial value
|
|
22
22
|
*/
|
|
23
|
-
initialValue?: MaybeValue<
|
|
23
|
+
initialValue?: MaybeValue<TResult, Required>;
|
|
24
24
|
/**
|
|
25
25
|
* Action to execute on update
|
|
26
26
|
*/
|
|
27
27
|
action: (value: {
|
|
28
28
|
id: string;
|
|
29
|
-
value: MaybeValue<
|
|
29
|
+
value: MaybeValue<TResult, Required>;
|
|
30
30
|
}) => Promise<unknown>;
|
|
31
31
|
/**
|
|
32
32
|
* Permission required to edit
|
|
@@ -45,10 +45,25 @@ type useInlineEditOptions<TValue, Required extends boolean = false> = {
|
|
|
45
45
|
*/
|
|
46
46
|
isRequired?: Required;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Inline edit hook props
|
|
50
|
+
*/
|
|
51
|
+
type UseInlineEditProps<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, TResult extends string | number | Date | boolean | JSON | EditorJSONContent, Required extends boolean = false> = useInlineEditOptions<TResult, Required> & {
|
|
52
|
+
parser: {
|
|
53
|
+
/**
|
|
54
|
+
* Transform the value from the result type to the value type
|
|
55
|
+
*/
|
|
56
|
+
decode: (value: TResult) => TValue;
|
|
57
|
+
/**
|
|
58
|
+
* Transform the value from the value type to the result type
|
|
59
|
+
*/
|
|
60
|
+
encode: (value: TValue) => TResult;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
48
63
|
/**
|
|
49
64
|
* Use the inline edit hook.
|
|
50
65
|
*/
|
|
51
|
-
declare function useInlineEdit<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, Required extends boolean = false>(props:
|
|
66
|
+
declare function useInlineEdit<TValue extends string | number | Date | boolean | JSON | EditorJSONContent, TResult extends string | number | Date | boolean | JSON | EditorJSONContent = TValue, Required extends boolean = false>(props: UseInlineEditProps<TValue, TResult, Required>): {
|
|
52
67
|
value: MaybeValue<TValue, Required> | undefined;
|
|
53
68
|
setValue: react.Dispatch<react.SetStateAction<MaybeValue<TValue, Required> | undefined>>;
|
|
54
69
|
handleChange: (next: MaybeValue<TValue, Required> | null) => void;
|
|
@@ -57,5 +72,5 @@ declare function useInlineEdit<TValue extends string | number | Date | boolean |
|
|
|
57
72
|
isAllowed: boolean;
|
|
58
73
|
};
|
|
59
74
|
//#endregion
|
|
60
|
-
export { useInlineEdit, useInlineEditOptions };
|
|
75
|
+
export { UseInlineEditProps, useInlineEdit, useInlineEditOptions };
|
|
61
76
|
//# sourceMappingURL=use-inline.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"mappings":";;;;;;;;KAYK,cAAA;EAEC,IAAA;EACA,KAAA;AAAA;EAGA,IAAA;AAAA;AAAA,KAOD,UAAA,qCAA+C,QAAA,gBAAwB,MAAA,GAAS,MAAA;;;;KAKzE,oBAAA;EAfN;;;EAmBJ,YAAA,GAAe,UAAA,CAAW,
|
|
1
|
+
{"version":3,"file":"use-inline.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"mappings":";;;;;;;;KAYK,cAAA;EAEC,IAAA;EACA,KAAA;AAAA;EAGA,IAAA;AAAA;AAAA,KAOD,UAAA,qCAA+C,QAAA,gBAAwB,MAAA,GAAS,MAAA;;;;KAKzE,oBAAA;EAfN;;;EAmBJ,YAAA,GAAe,UAAA,CAAW,OAAA,EAAS,QAAA;EAThC;;;EAaH,MAAA,GAAS,KAAA;IAAS,EAAA;IAAY,KAAA,EAAO,UAAA,CAAW,OAAA,EAAS,QAAA;EAAA,MAAgB,OAAA;EAbgB;;;EAiBzF,UAAA,GAAa,UAAA;EAjB6D;;;;AAK5E;;EAmBE,cAAA,GAAiB,cAAA;EAfS;;;;EAoB1B,UAAA,GAAa,QAAA;AAAA;;;;KAMH,kBAAA,kCACuB,IAAA,aAAiB,IAAA,GAAO,iBAAA,oCACvB,IAAA,aAAiB,IAAA,GAAO,iBAAA,sCAExD,oBAAA,CAAqB,OAAA,EAAS,QAAA;EAChC,MAAA;IAXqB;;;IAenB,MAAA,GAAS,KAAA,EAAO,OAAA,KAAY,MAAA;IAnCf;;;IAuCb,MAAA,GAAS,KAAA,EAAO,MAAA,KAAW,OAAA;EAAA;AAAA;;;;iBAOf,aAAA,kCACmB,IAAA,aAAiB,IAAA,GAAO,iBAAA,oCACvB,IAAA,aAAiB,IAAA,GAAO,iBAAA,GAAoB,MAAA,mCAAA,CAE9E,KAAA,EAAO,kBAAA,CAAmB,MAAA,EAAQ,OAAA,EAAS,QAAA;;;uBA8Ef,UAAA,CAAW,MAAA,EAAQ,QAAA;qBAsBrB,UAAA,CAAW,MAAA,EAAQ,QAAA;UAAT,eAAA"}
|
|
@@ -19,6 +19,7 @@ function useInlineEdit(props) {
|
|
|
19
19
|
*/
|
|
20
20
|
const strategy = props.updateStrategy ?? defaultUpdateStrategy;
|
|
21
21
|
const delay = strategy.mode === "change" ? strategy.delay ?? 0 : 0;
|
|
22
|
+
const initialValue = props.parser.decode(props.initialValue) ?? void 0;
|
|
22
23
|
/**
|
|
23
24
|
* The inline edit context.
|
|
24
25
|
*/
|
|
@@ -26,7 +27,7 @@ function useInlineEdit(props) {
|
|
|
26
27
|
/**
|
|
27
28
|
* The current value of the inline edit.
|
|
28
29
|
*/
|
|
29
|
-
const [value, setValue] = useState(
|
|
30
|
+
const [value, setValue] = useState(initialValue);
|
|
30
31
|
/**
|
|
31
32
|
* The indicator status.
|
|
32
33
|
*/
|
|
@@ -44,28 +45,30 @@ function useInlineEdit(props) {
|
|
|
44
45
|
setStatus("success");
|
|
45
46
|
},
|
|
46
47
|
onError: (error) => {
|
|
47
|
-
setValue(
|
|
48
|
+
setValue(initialValue);
|
|
48
49
|
toast.error("Er is iets misgegaan", { description: error instanceof Error ? error.message : void 0 });
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
/**
|
|
52
53
|
* Handle instant mutate
|
|
53
54
|
*/
|
|
54
|
-
const handleMutateInstant = useCallback((
|
|
55
|
+
const handleMutateInstant = useCallback((input) => {
|
|
55
56
|
if (!isAllowed) {
|
|
56
57
|
toast.error("Je hebt geen toestemming om dit te bewerken");
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
if (
|
|
60
|
+
if (input === initialValue) return;
|
|
61
|
+
const value = props.parser.encode(input);
|
|
60
62
|
return mutation.mutate({
|
|
61
63
|
id: context.id,
|
|
62
64
|
value
|
|
63
65
|
});
|
|
64
66
|
}, [
|
|
65
67
|
isAllowed,
|
|
66
|
-
|
|
68
|
+
initialValue,
|
|
67
69
|
mutation,
|
|
68
|
-
context.id
|
|
70
|
+
context.id,
|
|
71
|
+
props.parser
|
|
69
72
|
]);
|
|
70
73
|
/**
|
|
71
74
|
* Handle mutate with debounce
|
|
@@ -78,7 +81,7 @@ function useInlineEdit(props) {
|
|
|
78
81
|
setValue(next ?? void 0);
|
|
79
82
|
if (strategy.mode !== "change") return;
|
|
80
83
|
if (props.isRequired && next === null) {
|
|
81
|
-
setValue(
|
|
84
|
+
setValue(initialValue ?? void 0);
|
|
82
85
|
setStatus("error");
|
|
83
86
|
toast.error("Dit veld is verplicht");
|
|
84
87
|
return;
|
|
@@ -92,7 +95,7 @@ function useInlineEdit(props) {
|
|
|
92
95
|
setValue(next ?? void 0);
|
|
93
96
|
if (strategy.mode !== "blur") return;
|
|
94
97
|
if (props.isRequired && next === null) {
|
|
95
|
-
setValue(
|
|
98
|
+
setValue(initialValue ?? void 0);
|
|
96
99
|
setStatus("error");
|
|
97
100
|
toast.error("Dit veld is verplicht");
|
|
98
101
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-inline.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport type { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport type { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<
|
|
1
|
+
{"version":3,"file":"use-inline.client.mjs","names":[],"sources":["../../../../src/modules/inline-edit/hooks/use-inline.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport type { EditorJSONContent } from \"@/components/entry\";\nimport { useLocalIndicator } from \"@/lib/entry.client\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { usePermission } from \"@/modules/auth/hooks/use-permission\";\nimport type { Permission } from \"@/modules/auth/lib/permissions\";\nimport { useInlineEditContext } from \"./context.client\";\n\ntype UpdateStrategy =\n | {\n mode: \"change\";\n delay?: number;\n }\n | {\n mode: \"blur\";\n };\n\nconst defaultUpdateStrategy: UpdateStrategy = {\n mode: \"blur\",\n};\n\ntype MaybeValue<TValue, Required extends boolean> = Required extends true ? TValue : TValue | null;\n\n/**\n * Use the inline edit hook options.\n */\nexport type useInlineEditOptions<TResult, Required extends boolean = false> = {\n /**\n * Initial value\n */\n initialValue?: MaybeValue<TResult, Required>;\n /**\n * Action to execute on update\n */\n action: (value: { id: string; value: MaybeValue<TResult, Required> }) => Promise<unknown>;\n /**\n * Permission required to edit\n */\n permission?: Permission;\n /**\n * Update strategy\n * - trigger: when to update the value (default: \"blur\")\n * - delay: delay in milliseconds before updating the value (only for \"change\" trigger)\n * @default { trigger: \"blur\" }\n */\n updateStrategy?: UpdateStrategy;\n /**\n * Is the value required\n * @default false\n */\n isRequired?: Required;\n};\n\n/**\n * Inline edit hook props\n */\nexport type UseInlineEditProps<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n TResult extends string | number | Date | boolean | JSON | EditorJSONContent,\n Required extends boolean = false,\n> = useInlineEditOptions<TResult, Required> & {\n parser: {\n /**\n * Transform the value from the result type to the value type\n */\n decode: (value: TResult) => TValue;\n /**\n * Transform the value from the value type to the result type\n */\n encode: (value: TValue) => TResult;\n };\n};\n\n/**\n * Use the inline edit hook.\n */\nexport function useInlineEdit<\n TValue extends string | number | Date | boolean | JSON | EditorJSONContent,\n TResult extends string | number | Date | boolean | JSON | EditorJSONContent = TValue,\n Required extends boolean = false,\n>(props: UseInlineEditProps<TValue, TResult, Required>) {\n /**\n * The update strategy.\n */\n const strategy = props.updateStrategy ?? defaultUpdateStrategy;\n const delay = strategy.mode === \"change\" ? (strategy.delay ?? 0) : 0;\n const initialValue = props.parser.decode(props.initialValue as TResult) ?? undefined;\n\n /**\n * The inline edit context.\n */\n const context = useInlineEditContext();\n\n /**\n * The current value of the inline edit.\n */\n const [value, setValue] = useState<MaybeValue<TValue, Required> | undefined>(initialValue);\n\n /**\n * The indicator status.\n */\n const { status, setStatus } = useLocalIndicator();\n\n /**\n * Permission guard\n */\n const data = usePermission(props.permission ?? context.permission ?? {});\n const isAllowed = data?.success;\n\n /**\n * Execute the action to update the value.\n */\n const mutation = useAction({\n mutationFn: props.action,\n onMutate: () => {\n setStatus(\"pending\");\n },\n onSuccess: () => {\n setStatus(\"success\");\n },\n onError: (error) => {\n setValue(initialValue);\n toast.error(\"Er is iets misgegaan\", {\n description: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n /**\n * Handle instant mutate\n */\n const handleMutateInstant = useCallback(\n (input: TValue) => {\n // Permission guard\n if (!isAllowed) {\n toast.error(\"Je hebt geen toestemming om dit te bewerken\");\n return;\n }\n\n // If the value is the same as the initial value, do nothing\n if (input === initialValue) return;\n\n const value = props.parser.encode(input as TValue);\n\n // Update the value\n return mutation.mutate({ id: context.id, value });\n },\n [isAllowed, initialValue, mutation, context.id, props.parser],\n );\n\n /**\n * Handle mutate with debounce\n */\n const handleMutateDebounced = useDebouncedCallback(handleMutateInstant, delay);\n\n /**\n * Handle change updates\n */\n function handleChange(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not change, exit\n if (strategy.mode !== \"change\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is change, update the value after the delay\n handleMutateDebounced(next as TValue);\n }\n\n /**\n * Handle blur updates\n */\n function handleBlur(next: MaybeValue<TValue, Required> | null) {\n // Set value in state\n setValue(next ?? undefined);\n\n // If the strategy is not blur, exit\n if (strategy.mode !== \"blur\") return;\n\n // If it is required and the value is null or empty, reset to initial value\n if (props.isRequired && next === null) {\n setValue(initialValue ?? undefined);\n setStatus(\"error\");\n toast.error(\"Dit veld is verplicht\");\n return;\n }\n\n // If the strategy is blur, update the value\n handleMutateInstant(next as TValue);\n }\n\n return { value, setValue, handleChange, handleBlur, status, isAllowed };\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,wBAAwC,EAC5C,MAAM,QACP;;;;AAyDD,SAAgB,cAId,OAAsD;;;;CAItD,MAAM,WAAW,MAAM,kBAAkB;CACzC,MAAM,QAAQ,SAAS,SAAS,WAAY,SAAS,SAAS,IAAK;CACnE,MAAM,eAAe,MAAM,OAAO,OAAO,MAAM,aAAwB,IAAI;;;;CAK3E,MAAM,UAAU,sBAAsB;;;;CAKtC,MAAM,CAAC,OAAO,YAAY,SAAmD,aAAa;;;;CAK1F,MAAM,EAAE,QAAQ,cAAc,mBAAmB;CAMjD,MAAM,YADO,cAAc,MAAM,cAAc,QAAQ,cAAc,EAAE,CAAC,EAChD;;;;CAKxB,MAAM,WAAW,UAAU;EACzB,YAAY,MAAM;EAClB,gBAAgB;AACd,aAAU,UAAU;;EAEtB,iBAAiB;AACf,aAAU,UAAU;;EAEtB,UAAU,UAAU;AAClB,YAAS,aAAa;AACtB,SAAM,MAAM,wBAAwB,EAClC,aAAa,iBAAiB,QAAQ,MAAM,UAAU,QACvD,CAAC;;EAEL,CAAC;;;;CAKF,MAAM,sBAAsB,aACzB,UAAkB;AAEjB,MAAI,CAAC,WAAW;AACd,SAAM,MAAM,8CAA8C;AAC1D;;AAIF,MAAI,UAAU,aAAc;EAE5B,MAAM,QAAQ,MAAM,OAAO,OAAO,MAAgB;AAGlD,SAAO,SAAS,OAAO;GAAE,IAAI,QAAQ;GAAI;GAAO,CAAC;IAEnD;EAAC;EAAW;EAAc;EAAU,QAAQ;EAAI,MAAM;EAAO,CAC9D;;;;CAKD,MAAM,wBAAwB,qBAAqB,qBAAqB,MAAM;;;;CAK9E,SAAS,aAAa,MAA2C;AAE/D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,SAAU;AAGhC,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,gBAAgB,OAAU;AACnC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,wBAAsB,KAAe;;;;;CAMvC,SAAS,WAAW,MAA2C;AAE7D,WAAS,QAAQ,OAAU;AAG3B,MAAI,SAAS,SAAS,OAAQ;AAG9B,MAAI,MAAM,cAAc,SAAS,MAAM;AACrC,YAAS,gBAAgB,OAAU;AACnC,aAAU,QAAQ;AAClB,SAAM,MAAM,wBAAwB;AACpC;;AAIF,sBAAoB,KAAe;;AAGrC,QAAO;EAAE;EAAO;EAAU;EAAc;EAAY;EAAQ;EAAW"}
|
|
@@ -4,7 +4,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
4
4
|
//#region src/modules/inline-edit/lib/variants.d.ts
|
|
5
5
|
declare const inlineEditVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "table" | null | undefined;
|
|
7
|
-
status?: "
|
|
7
|
+
status?: "error" | "idle" | "pending" | "success" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
9
9
|
type InlineEditVariantsProps = VariantProps<typeof inlineEditVariants>;
|
|
10
10
|
//#endregion
|
|
@@ -36,7 +36,7 @@ type DropzoneContentProps = {
|
|
|
36
36
|
declare function DropzoneContent({
|
|
37
37
|
children,
|
|
38
38
|
className
|
|
39
|
-
}: DropzoneContentProps): string | number | bigint | true |
|
|
39
|
+
}: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
|
|
40
40
|
/**
|
|
41
41
|
* DropzoneEmptyState
|
|
42
42
|
*/
|
|
@@ -47,7 +47,7 @@ type DropzoneEmptyStateProps = {
|
|
|
47
47
|
declare function DropzoneEmptyState({
|
|
48
48
|
children,
|
|
49
49
|
className
|
|
50
|
-
}: DropzoneEmptyStateProps): string | number | bigint | true |
|
|
50
|
+
}: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime0.JSX.Element | null;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps };
|
|
53
53
|
//# sourceMappingURL=dropzone.client.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"mappings":";;;;;;;;;KAcY,aAAA,GAAgB,IAAA,CAAK,eAAA;EAC/B,GAAA,GAAM,IAAA;EACN,SAAA;EACA,MAAA,IAAU,aAAA,EAAe,IAAA,IAAQ,cAAA,EAAgB,aAAA,IAAiB,KAAA,EAAO,SAAA;EACzE,QAAA,GAAW,SAAA;AAAA;AAAA,iBAGG,QAAA,CAAA;EACd,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,GAAA;EACA,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA0CJ,oBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAKc,eAAA,CAAA;EAAkB,QAAA;EAAU;AAAA,GAAa,oBAAA,qCAAoB,
|
|
1
|
+
{"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"mappings":";;;;;;;;;KAcY,aAAA,GAAgB,IAAA,CAAK,eAAA;EAC/B,GAAA,GAAM,IAAA;EACN,SAAA;EACA,MAAA,IAAU,aAAA,EAAe,IAAA,IAAQ,cAAA,EAAgB,aAAA,IAAiB,KAAA,EAAO,SAAA;EACzE,QAAA,GAAW,SAAA;AAAA;AAAA,iBAGG,QAAA,CAAA;EACd,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,GAAA;EACA,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA0CJ,oBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAKc,eAAA,CAAA;EAAkB,QAAA;EAAU;AAAA,GAAa,oBAAA,qCAAoB,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,wBAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KA8BjE,uBAAA;EACV,QAAA,GAAW,SAAA;EACX,SAAA;AAAA;AAAA,iBAGc,kBAAA,CAAA;EAAqB,QAAA;EAAU;AAAA,GAAa,uBAAA,qCAAuB,QAAA,CAAA,SAAA,IAAA,OAAA,sCAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,wBAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,IAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IAAO,QAAA,EAAU,QAAA,KAAa,OAAA;IAC9B,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"upload-zone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"mappings":";;;;;;;AASA;KAAY,sBAAA;EACV,YAAA,EAAc,YAAA;EACd,QAAA,GAAW,IAAA,EAAM,IAAA,KAAS,OAAA,CAAQ,IAAA;EAClC,QAAA,GAAW,GAAA,eAAkB,OAAA;EAC7B,UAAA;IACE,GAAA,IAAO,QAAA,EAAU,QAAA,KAAa,OAAA;IAC9B,MAAA,IAAU,GAAA,eAAkB,OAAA;IAC5B,UAAA,SAAmB,OAAA;IACnB,MAAA,SAAe,OAAA;EAAA;EAEjB,QAAA;AAAA;;;;cAQW,iBAAA,EAAiB,KAAA,CAAA,OAAA,CAAA,sBAAA;;;;iBAKd,aAAA,CAAA,GAAa,sBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/create-upload.client\";\nimport type { FileNode, Node } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<Node>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (newValue: FileNode) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n // updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;\n // invalidateQuery: () => Promise<void> | void;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext({} as UploadZoneContextValue);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneProvider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"upload-zone-context.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { UploadClient } from \"../lib/create-upload.client\";\nimport type { FileNode, Node } from \"../lib/validators\";\n\n/**\n * Upload Zone Context Value\n */\nexport type UploadZoneContextValue = {\n uploadClient: UploadClient;\n onUpload: (file: File) => Promise<Node>;\n onRemove: (ids: string[]) => Promise<void>;\n optimistic?: {\n add?: (newValue: FileNode) => Promise<void> | void;\n remove?: (ids: string[]) => Promise<void> | void;\n invalidate?: () => Promise<void> | void;\n cancel?: () => Promise<void> | void;\n };\n disabled?: boolean;\n // updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;\n // invalidateQuery: () => Promise<void> | void;\n};\n\n/**\n * Upload Zone Context\n */\nexport const UploadZoneContext = React.createContext({} as UploadZoneContextValue);\n\n/**\n * Upload Zone Hook\n */\nexport function useUploadZone() {\n const context = React.useContext(UploadZoneContext);\n if (!context) {\n throw new Error(\"useUploadZone must be used within an UploadZoneProvider\");\n }\n return context;\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,oBAAoB,MAAM,cAAc,EAAE,CAA2B;;;;AAKlF,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,MAAM,WAAW,kBAAkB;AACnD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA0D;AAE5E,QAAO"}
|
|
@@ -5,7 +5,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
import { ComponentProps } from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/storage/components/upload-zone.client.d.ts
|
|
8
|
-
type UploadZoneProps = ComponentProps<"div"> & Pick<UploadZoneContextValue, "optimistic" | "uploadClient"> & {
|
|
8
|
+
type UploadZoneProps = ComponentProps<"div"> & Pick<UploadZoneContextValue, "optimistic" | "uploadClient" | "disabled"> & {
|
|
9
9
|
variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
|
|
10
10
|
uploadHooks?: UploadHooks;
|
|
11
11
|
onUploadCompleted?: (node: Node) => Promise<void> | void;
|
|
@@ -18,6 +18,7 @@ declare function UploadZone({
|
|
|
18
18
|
uploadHooks,
|
|
19
19
|
onUploadCompleted,
|
|
20
20
|
onUploadFailed,
|
|
21
|
+
disabled,
|
|
21
22
|
children,
|
|
22
23
|
className,
|
|
23
24
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"mappings":";;;;;;;KAWY,eAAA,GAAkB,cAAA,UAC5B,IAAA,CAAK,sBAAA;EACH,SAAA,EAAW,IAAA,CAAK,gBAAA;EAChB,WAAA,GAAc,WAAA;EAEd,iBAAA,IAAqB,IAAA,EAAM,IAAA,KAAS,OAAA;EACpC,cAAA,IAAkB,KAAA,cAAmB,OAAA;AAAA;AAAA,iBAGzB,UAAA,CAAA;EACd,SAAA;EACA,UAAA;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,cAAA;EACA,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"upload-zone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"mappings":";;;;;;;KAWY,eAAA,GAAkB,cAAA,UAC5B,IAAA,CAAK,sBAAA;EACH,SAAA,EAAW,IAAA,CAAK,gBAAA;EAChB,WAAA,GAAc,WAAA;EAEd,iBAAA,IAAqB,IAAA,EAAM,IAAA,KAAS,OAAA;EACpC,cAAA,IAAkB,KAAA,cAAmB,OAAA;AAAA;AAAA,iBAGzB,UAAA,CAAA;EACd,SAAA;EACA,UAAA;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,cAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|