@jakubmazanec/ui 0.4.1 → 0.4.2-unstable.aad0af37

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,3 +1,3 @@
1
1
  import { z } from 'zod';
2
- export declare const dataTableColumnOrderSchema: z.ZodArray<z.ZodString, "many">;
2
+ export declare const dataTableColumnOrderSchema: z.ZodArray<z.ZodString>;
3
3
  export type DataTableColumnOrder = z.infer<typeof dataTableColumnOrderSchema>;
@@ -1,3 +1,6 @@
1
1
  import { z } from 'zod';
2
- export declare const dataTableColumnPinningSchema: z.ZodRecord<z.ZodString, z.ZodEnum<["left", "right"]>>;
2
+ export declare const dataTableColumnPinningSchema: z.ZodRecord<z.ZodString, z.ZodEnum<{
3
+ left: "left";
4
+ right: "right";
5
+ }>>;
3
6
  export type DataTableColumnPinning = z.infer<typeof dataTableColumnPinningSchema>;
@@ -1,15 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const dataTableFacetingSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
3
- values: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
3
+ values: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
4
4
  min: z.ZodOptional<z.ZodUnknown>;
5
5
  max: z.ZodOptional<z.ZodUnknown>;
6
- }, "strip", z.ZodTypeAny, {
7
- values?: unknown[] | undefined;
8
- max?: unknown;
9
- min?: unknown;
10
- }, {
11
- values?: unknown[] | undefined;
12
- max?: unknown;
13
- min?: unknown;
14
- }>>;
6
+ }, z.core.$strip>>;
15
7
  export type DataTableFaceting = z.infer<typeof dataTableFacetingSchema>;
@@ -1,12 +1,6 @@
1
1
  import { z } from 'zod';
2
- export declare const dataTableFiltersSchema: z.ZodUnion<[z.ZodNull, z.ZodArray<z.ZodObject<{
2
+ export declare const dataTableFiltersSchema: z.ZodUnion<readonly [z.ZodNull, z.ZodArray<z.ZodObject<{
3
3
  column: z.ZodString;
4
- filter: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodTuple<[z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>], null>]>;
5
- }, "strip", z.ZodTypeAny, {
6
- filter: string | number | boolean | [number | null | undefined, number | null | undefined];
7
- column: string;
8
- }, {
9
- filter: string | number | boolean | [number | null | undefined, number | null | undefined];
10
- column: string;
11
- }>, "many">]>;
4
+ filter: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodTuple<[z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>], null>]>;
5
+ }, z.core.$strip>>]>;
12
6
  export type DataTableFilters = z.infer<typeof dataTableFiltersSchema>;
@@ -1,16 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const dataTablePaginationSchema: z.ZodObject<{
3
- /** Page number, starts with 1. */
4
3
  page: z.ZodNumber;
5
- pageSize: z.ZodUnion<[z.ZodLiteral<10>, z.ZodLiteral<25>, z.ZodLiteral<50>, z.ZodLiteral<75>, z.ZodLiteral<100>]>;
4
+ pageSize: z.ZodUnion<readonly [z.ZodLiteral<10>, z.ZodLiteral<25>, z.ZodLiteral<50>, z.ZodLiteral<75>, z.ZodLiteral<100>]>;
6
5
  pageCount: z.ZodNumber;
7
- }, "strip", z.ZodTypeAny, {
8
- page: number;
9
- pageCount: number;
10
- pageSize: 10 | 25 | 50 | 75 | 100;
11
- }, {
12
- page: number;
13
- pageCount: number;
14
- pageSize: 10 | 25 | 50 | 75 | 100;
15
- }>;
6
+ }, z.core.$strip>;
16
7
  export type DataTablePagination = z.infer<typeof dataTablePaginationSchema>;
@@ -1,12 +1,9 @@
1
1
  import { z } from 'zod';
2
- export declare const dataTableSortingSchema: z.ZodUnion<[z.ZodNull, z.ZodObject<{
2
+ export declare const dataTableSortingSchema: z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
3
3
  column: z.ZodString;
4
- direction: z.ZodEnum<["ascending", "descending"]>;
5
- }, "strip", z.ZodTypeAny, {
6
- direction: "ascending" | "descending";
7
- column: string;
8
- }, {
9
- direction: "ascending" | "descending";
10
- column: string;
11
- }>]>;
4
+ direction: z.ZodEnum<{
5
+ ascending: "ascending";
6
+ descending: "descending";
7
+ }>;
8
+ }, z.core.$strip>]>;
12
9
  export type DataTableSorting = z.infer<typeof dataTableSortingSchema>;
@@ -1,5 +1,5 @@
1
1
  import { type DataTableProps } from '../DataTable.js';
2
2
  export declare function addFilter(filters: DataTableProps<any, any>['filters'], column: string, newFilter: unknown): {
3
- filter: string | number | boolean | [number | null | undefined, number | null | undefined];
4
3
  column: string;
4
+ filter: string | number | boolean | [(number | null | undefined)?, (number | null | undefined)?];
5
5
  }[];
@@ -1,5 +1,5 @@
1
1
  import { type DataTableProps } from '../DataTable.js';
2
2
  export declare function removeFilter(filters: DataTableProps<any, any>['filters'], column: string): {
3
- filter: string | number | boolean | [number | null | undefined, number | null | undefined];
4
3
  column: string;
4
+ filter: string | number | boolean | [(number | null | undefined)?, (number | null | undefined)?];
5
5
  }[] | null;
@@ -1,10 +1,11 @@
1
1
  import { useForm as useBaseForm } from '@conform-to/react';
2
- import { type ZodTypeAny } from 'zod';
3
- export type UseFormOptions<S extends ZodTypeAny> = {
2
+ import { type output, type ZodObject } from 'zod';
3
+ export type UseFormOptions<S extends ZodObject> = {
4
4
  schema: S;
5
5
  onSubmit?: Parameters<typeof useBaseForm<S>>[0]['onSubmit'] | undefined;
6
6
  };
7
- export declare function useForm<S extends ZodTypeAny>({ schema, onSubmit }: UseFormOptions<S>): {
8
- form: import("@conform-to/react").FormMetadata<import("zod").input<S>, string[]>;
9
- fields: Required<{ [Key in keyof import("@conform-to/dom").Combine<import("zod").input<S>>]: import("@conform-to/react").FieldMetadata<import("@conform-to/dom").Combine<import("zod").input<S>>[Key], import("zod").input<S>, string[]>; }>;
7
+ export type UseFormReturn<S extends ZodObject> = {
8
+ form: ReturnType<typeof useBaseForm<output<S>>>[0];
9
+ fields: ReturnType<typeof useBaseForm<output<S>>>[1];
10
10
  };
11
+ export declare function useForm<S extends ZodObject>({ schema, onSubmit, }: UseFormOptions<S>): UseFormReturn<S>;
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  import { useForm as useBaseForm } from "@conform-to/react";
3
- import { parseWithZod } from "@conform-to/zod";
4
- export function useForm({ schema, onSubmit }) {
3
+ import { parseWithZod } from "@conform-to/zod/v4";
4
+ export function useForm({
5
+ schema,
6
+ onSubmit
7
+ }) {
5
8
  let [form, fields] = useBaseForm({
6
9
  shouldValidate: "onBlur",
7
10
  shouldRevalidate: "onInput",
11
+ // TODO: fix this
12
+ // @ts-expect-error -- fix this
8
13
  onValidate({ formData }) {
9
14
  return parseWithZod(formData, { schema });
10
15
  },
11
16
  onSubmit
12
- // TODO: remove when this is fixed: https://github.com/edmundhung/conform/issues/697
13
17
  });
14
18
  return {
15
19
  form,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../source/components/useForm.ts"],
4
- "sourcesContent": ["import {useForm as useBaseForm} from '@conform-to/react';\nimport {parseWithZod} from '@conform-to/zod';\nimport {type ZodTypeAny} from 'zod';\n\nexport type UseFormOptions<S extends ZodTypeAny> = {\n schema: S;\n onSubmit?: Parameters<typeof useBaseForm<S>>[0]['onSubmit'] | undefined;\n};\n\nexport function useForm<S extends ZodTypeAny>({schema, onSubmit}: UseFormOptions<S>) {\n let [form, fields] = useBaseForm({\n shouldValidate: 'onBlur',\n shouldRevalidate: 'onInput',\n onValidate({formData}) {\n return parseWithZod(formData, {schema});\n },\n onSubmit: onSubmit as NonNullable<typeof onSubmit>, // TODO: remove when this is fixed: https://github.com/edmundhung/conform/issues/697\n });\n\n return {\n form,\n fields,\n };\n}\n"],
5
- "mappings": ";AAAA,SAAQ,WAAW,mBAAkB;AACrC,SAAQ,oBAAmB;AAQpB,gBAAS,QAA8B,EAAC,QAAQ,SAAQ,GAAsB;AACnF,MAAI,CAAC,MAAM,MAAM,IAAI,YAAY;AAAA,IAC/B,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,IAClB,WAAW,EAAC,SAAQ,GAAG;AACrB,aAAO,aAAa,UAAU,EAAC,OAAM,CAAC;AAAA,IACxC;AAAA,IACA;AAAA;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import {useForm as useBaseForm} from '@conform-to/react';\nimport {parseWithZod} from '@conform-to/zod/v4';\nimport {type output, type ZodObject} from 'zod';\n\nexport type UseFormOptions<S extends ZodObject> = {\n schema: S;\n onSubmit?: Parameters<typeof useBaseForm<S>>[0]['onSubmit'] | undefined;\n};\n\nexport type UseFormReturn<S extends ZodObject> = {\n form: ReturnType<typeof useBaseForm<output<S>>>[0];\n fields: ReturnType<typeof useBaseForm<output<S>>>[1];\n};\n\nexport function useForm<S extends ZodObject>({\n schema,\n onSubmit,\n}: UseFormOptions<S>): UseFormReturn<S> {\n let [form, fields] = useBaseForm({\n shouldValidate: 'onBlur',\n shouldRevalidate: 'onInput',\n // TODO: fix this\n // @ts-expect-error -- fix this\n onValidate({formData}) {\n return parseWithZod(formData, {schema});\n },\n onSubmit,\n });\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- false positive\n return {\n form,\n fields,\n } as UseFormReturn<S>;\n}\n"],
5
+ "mappings": ";AAAA,SAAQ,WAAW,mBAAkB;AACrC,SAAQ,oBAAmB;AAapB,gBAAS,QAA6B;AAAA,EAC3C;AAAA,EACA;AACF,GAAwC;AACtC,MAAI,CAAC,MAAM,MAAM,IAAI,YAAY;AAAA,IAC/B,gBAAgB;AAAA,IAChB,kBAAkB;AAAA;AAAA;AAAA,IAGlB,WAAW,EAAC,SAAQ,GAAG;AACrB,aAAO,aAAa,UAAU,EAAC,OAAM,CAAC;AAAA,IACxC;AAAA,IACA;AAAA,EACF,CAAC;AAGD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakubmazanec/ui",
3
- "version": "0.4.1",
3
+ "version": "0.4.2-unstable.aad0af37",
4
4
  "description": "React component library.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,8 +33,8 @@
33
33
  "typecheck": "tsc --project tsconfig.typecheck.json"
34
34
  },
35
35
  "dependencies": {
36
- "@conform-to/react": "^1.2.2",
37
- "@conform-to/zod": "^1.2.2",
36
+ "@conform-to/react": "^1.8.2",
37
+ "@conform-to/zod": "^1.8.2",
38
38
  "@dnd-kit/core": "^6.3.1",
39
39
  "@dnd-kit/modifiers": "^9.0.0",
40
40
  "@dnd-kit/sortable": "^10.0.0",
@@ -47,7 +47,7 @@
47
47
  "culori": "^4.0.1",
48
48
  "lodash": "^4.17.21",
49
49
  "tailwind-merge": "^3.3.1",
50
- "zod": "^3.25.67"
50
+ "zod": "^4.0.17"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@chromatic-com/storybook": "^4.0.1",
@@ -1,24 +1,35 @@
1
1
  import {useForm as useBaseForm} from '@conform-to/react';
2
- import {parseWithZod} from '@conform-to/zod';
3
- import {type ZodTypeAny} from 'zod';
2
+ import {parseWithZod} from '@conform-to/zod/v4';
3
+ import {type output, type ZodObject} from 'zod';
4
4
 
5
- export type UseFormOptions<S extends ZodTypeAny> = {
5
+ export type UseFormOptions<S extends ZodObject> = {
6
6
  schema: S;
7
7
  onSubmit?: Parameters<typeof useBaseForm<S>>[0]['onSubmit'] | undefined;
8
8
  };
9
9
 
10
- export function useForm<S extends ZodTypeAny>({schema, onSubmit}: UseFormOptions<S>) {
10
+ export type UseFormReturn<S extends ZodObject> = {
11
+ form: ReturnType<typeof useBaseForm<output<S>>>[0];
12
+ fields: ReturnType<typeof useBaseForm<output<S>>>[1];
13
+ };
14
+
15
+ export function useForm<S extends ZodObject>({
16
+ schema,
17
+ onSubmit,
18
+ }: UseFormOptions<S>): UseFormReturn<S> {
11
19
  let [form, fields] = useBaseForm({
12
20
  shouldValidate: 'onBlur',
13
21
  shouldRevalidate: 'onInput',
22
+ // TODO: fix this
23
+ // @ts-expect-error -- fix this
14
24
  onValidate({formData}) {
15
25
  return parseWithZod(formData, {schema});
16
26
  },
17
- onSubmit: onSubmit as NonNullable<typeof onSubmit>, // TODO: remove when this is fixed: https://github.com/edmundhung/conform/issues/697
27
+ onSubmit,
18
28
  });
19
29
 
30
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- false positive
20
31
  return {
21
32
  form,
22
33
  fields,
23
- };
34
+ } as UseFormReturn<S>;
24
35
  }