@gmcode/forms 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  //#region src/locales/en.ts
2
- var en_default = { translation: {
2
+ var en_default = { forms: {
3
3
  array: "The field must be an array.",
4
4
  date: "The field must be a valid date",
5
5
  decrease: "Decrease",
@@ -24,4 +24,4 @@ var en_default = { translation: {
24
24
 
25
25
  //#endregion
26
26
  export { en_default as t };
27
- //# sourceMappingURL=en-kNGdq3xk.mjs.map
27
+ //# sourceMappingURL=en-Bh8xi5UO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-Bh8xi5UO.mjs","names":[],"sources":["../src/locales/en.ts"],"sourcesContent":["import type { Resource } from 'i18next'\n\nexport default {\n forms: {\n array: 'The field must be an array.',\n date: 'The field must be a valid date',\n decrease: 'Decrease',\n email: 'The field must be a valid email address.',\n hasMixed:\n 'The field must contain at least one uppercase and one lowercase letter.',\n hasNumber: 'The field must contain at least one number.',\n hasSymbol: 'The field must contain at least one symbol.',\n increase: 'Increase',\n integer: 'The field must be an integer.',\n maxChars: 'The field must not be greater than {{max}} characters.',\n maxValue: 'The field must not be greater than {{max}}.',\n minChars: 'The field must be at least {{min}} characters.',\n minValue: 'The field must be at least {{min}}.',\n missing: 'The value is not supported.',\n number: 'The field must be a number.',\n numeric: 'The field must be a number.',\n required: 'The field is required.',\n reset: 'Reset',\n string: 'The field must be a string.',\n submit: 'Submit'\n }\n} satisfies Resource\n"],"mappings":";AAEA,iBAAe,EACb,OAAO;CACL,OAAO;CACP,MAAM;CACN,UAAU;CACV,OAAO;CACP,UACE;CACF,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,EACF"}
package/dist/index.d.mts CHANGED
@@ -9,6 +9,9 @@ import { Checkbox as Checkbox$1 } from "radix-ui";
9
9
  import { CancelTokenCallback, FormDataErrors, GlobalEventCallback, RequestPayload } from "@inertiajs/core";
10
10
  import { TextareaHeightChangeMeta } from "react-textarea-autosize";
11
11
  //#region src/i18n.d.ts
12
+ /**
13
+ * @deprecated Use the `forms` namespace instead.
14
+ */
12
15
  declare const i18n: i18n$1;
13
16
  //#endregion
14
17
  //#region src/types/index.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/i18n.ts","../src/types/index.d.ts","../src/components/calendar-field.tsx","../src/components/checkbox-field.tsx","../src/components/input-field.tsx","../src/components/email-field.tsx","../src/components/error-monitor.tsx","../src/components/fancy-radio-field.tsx","../src/components/form.tsx","../src/components/hidden-field.tsx","../src/components/info-checkbox-field.tsx","../src/components/nullable-select-field.tsx","../src/components/numeric-field.tsx","../src/components/password-field.tsx","../src/components/select-field.tsx","../src/components/submit.tsx","../src/components/switch-field.tsx","../src/components/text-field.tsx","../src/components/textarea-field.tsx"],"mappings":";;;;;;;;;;;cAGM,MAAM;;;KCAA;KAEA,gBAAgB,gBAAgB,SAAS;EACnD;KACG,gBAAgB;EAAa,SAAS;;EAAc,QAAQ;;UAEhD;EACf;EACA;EACA,OAAO;EACP;;UAGe;EACf;EACA,SAAS;;;;iBCPK,cAAc,qBAAqB,gBAAc,iBAC/D,SACA,cACA,UACA,SACA,WACA,OACA,QACA,iBACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB,gBAAgB,MAAM;EACtB,WAAW,UAAU;EACrB;EACA,WAAW,UAAU;EACrB;EACA,SAAS,QAAQ;EACjB,gBAAgB,+BAA+B;oBAChD,IAAA;;;iBCvBe,cAAc,qBAAqB,gBAAc,iBAC/D,SACA,UACA,SACA,WACA,OACA,iBACA,aACA,UACA,gBACA,UACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB;EACA;EACA,WAAW,UAAU;EACrB;E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MA;;;;;;;;;;EAUA;EACA,OAAO,gBAAgB;EACvB,QAAQ,OAAO;;;;;;EAMf;oBACD,IAAA;;;iBCtGe,YAAY,qBAAqB,gBAAc,iBAC7D,cACA,WACA,SACG,SACF,sBAAsB,WAAW,iCAAc,IAAA;;;iBCHlC,kBACd,qBAAqB,gBAAc,iBAEnC,UACA,WACA,SACA,UACA,SACA,WACA,OACA,iBACA,aACA,UACA,MACA,gBACA,UACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB;EACA;EACA,WAAW,UAAU;EACrB;EACA,mBACE,SAAS,WAAkB,cAC3B,OAAO,sBAAsB,cAAc,UAAU;EAEvD;EACA;EACA;EACA;oBACD,IAAA;;;iBCXe,oBACd,qBAAqB,gBAAc,iBAEnC,cACA,SACA,aACA,UACA,SACA,WACA,OACA,SACA,aACA,aACG,SACF,sBAAsB;EACvB,eAAe;EACf,SAAS,QAAQ;EACjB;EACA;EACA;EACA,WAAW,UAAU;EACrB;EACA,SAAS;EACT;EACA,UAAU,gBAAgB;EAC1B,OAAO;oBACR,IAAA;;;iBCAe,aAAa,qBAAqB,gBAAc,iBAC9D,cACA,SACA,UACA,SACA,WACA,WACA,OACA,aACA,MACA,OACG,SACF,sBAAsB;EACvB,eAAe;EACf,SAAS,QAAQ;EACjB;EACA;EACA;EACA,WAAW,UAAU;EACrB;EACA;EACA,OAAO;EACP;IACE;IACA;IACA,UAAU,gBAAgB;IAC1B;;oBAEH,IAAA;;;iBC7Ee,cAAc,qBAAqB,gBAAc,iBAC/D,cACA,SACG,SACF,sBAAsB,WAAW,iCAAc,IAAA;;;iBCYlC,YAAY,qBAAqB,gBAAc,iBAC7D,cACA,SACA,aACA,UACA,SACA,WACA,OACA,SACA,gBACG,SACF,sBAAsB;EACvB,eAAe;EACf,SAAS,QAAQ;EACjB;EACA;EACA;EACA,WAAW,UAAU;EACrB;EACA,SAAS;EACT;EACA,OAAO;oBACR,IAAA;;;iBCtCe,SACd,OACA,SACA,SACG,SACF,sBAAsB;EACvB;EACA;oBACD,IAAA;;;iBCLe,YAAY,qBAAqB,gBAAc,iBAC7D,SACA,UACA,SACA,WACA,OACA,iBACA,aACA,UACA,gBACA,UACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB;EACA;EACA,WAAW,UAAU;EACrB;EACA,mBACE,SAAS,WAAkB,cAC3B,OAAO,sBAAsB,cAAc,UAAU;EAEvD;EACA;EACA;oBACD,IAAA;;;iBC5Be,UAAU,qBAAqB,gBAAc,iBAC3D,cACA,SACG,SACF,sBAAsB,WAAW,iCAAc,IAAA;;;iBCDlC,cAAc,qBAAqB,gBAAc,iBAC/D,mBACA,SACA,SACA,WACA,OACA,SACA,SACA,gBACA,aACA,WACG,SACF,sBAAsB;EACvB;EACA,SAAS,QAAQ;EACjB;EACA,WAAW,UAAU;EACrB;EACA;EACA;EACA,kBAAkB,gBAAgB,MAAM;EACxC;EACA;oBACD,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/i18n.ts","../src/types/index.d.ts","../src/components/calendar-field.tsx","../src/components/checkbox-field.tsx","../src/components/input-field.tsx","../src/components/email-field.tsx","../src/components/error-monitor.tsx","../src/components/fancy-radio-field.tsx","../src/components/form.tsx","../src/components/hidden-field.tsx","../src/components/info-checkbox-field.tsx","../src/components/nullable-select-field.tsx","../src/components/numeric-field.tsx","../src/components/password-field.tsx","../src/components/select-field.tsx","../src/components/submit.tsx","../src/components/switch-field.tsx","../src/components/text-field.tsx","../src/components/textarea-field.tsx"],"mappings":";;;;;;;;;;;;;;cAMM,MAAM;;;KCHA;KAEA,gBAAgB,gBAAgB,SAAS;EACnD;KACG,gBAAgB;EAAa,SAAS;;EAAc,QAAQ;;UAEhD;EACf;EACA;EACA,OAAO;EACP;;UAGe;EACf;EACA,SAAS;;;;iBCPK,cAAc,qBAAqB,gBAAc,iBAC/D,SACA,cACA,UACA,SACA,WACA,OACA,QACA,iBACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB,gBA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sBAAsB,WAAW,iCAAc,IAAA;;;iBCYlC,YAAY,qBAAqB,gBAAc,iBAC7D,cACA,SACA,aACA,UACA,SACA,WACA,OACA,SACA,gBACG,SACF,sBAAsB;EACvB,eAAe;EACf,SAAS,QAAQ;EACjB;EACA;EACA;EACA,WAAW,UAAU;EACrB;EACA,SAAS;EACT;EACA,OAAO;oBACR,IAAA;;;iBCtCe,SACd,OACA,SACA,SACG,SACF,sBAAsB;EACvB;EACA;oBACD,IAAA;;;iBCLe,YAAY,qBAAqB,gBAAc,iBAC7D,SACA,UACA,SACA,WACA,OACA,iBACA,aACA,UACA,gBACA,UACG,SACF,sBAAsB;EACvB,SAAS,QAAQ;EACjB;EACA;EACA,WAAW,UAAU;EACrB;EACA,mBACE,SAAS,WAAkB,cAC3B,OAAO,sBAAsB,cAAc,UAAU;EAEvD;EACA;EACA;oBACD,IAAA;;;iBC5Be,UAAU,qBAAqB,gBAAc,iBAC3D,cACA,SACG,SACF,sBAAsB,WAAW,iCAAc,IAAA;;;iBCDlC,cAAc,qBAAqB,gBAAc,iBAC/D,mBACA,SACA,SACA,WACA,OACA,SACA,SACA,gBACA,aACA,WACG,SACF,sBAAsB;EACvB;EACA,SAAS,QAAQ;EACjB;EACA,WAAW,UAAU;EACrB;EACA;EACA;EACA,kBAAkB,gBAAgB,MAAM;EACxC;EACA;oBACD,IAAA"}
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { t as en_default } from "./en-kNGdq3xk.mjs";
1
+ import { t as en_default } from "./en-Bh8xi5UO.mjs";
2
2
  import { createInstance } from "i18next";
3
3
  import { Button, Calendar, Checkbox, Field, FieldDescription, FieldError, FieldLabel, FieldSet, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, Label, RadioGroup, RadioGroupItem, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Spinner, Switch, TextareaAutosize, cn, flash } from "@gmcode/react-ui";
4
4
  import { Controller, useForm } from "react-hook-form";
5
5
  import { c } from "react/compiler-runtime";
6
- import { I18nextProvider, useTranslation } from "react-i18next";
6
+ import { useTranslation } from "react-i18next";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useTsvResolver, useTsvResolver as useTsvResolver$1 } from "@gmcode/tsv-hookform";
9
9
  import { useForm as useForm$1 } from "@inertiajs/react";
@@ -12,6 +12,9 @@ import { Minus, Plus, X } from "lucide-react";
12
12
  import { InputCheckboxRule, InputColorRule, InputEmailRule, InputNumberRule, InputPasswordRule, InputRule, InputSelectRule, InputTextRule, Message, Schema } from "@gmcode/tsv-input";
13
13
 
14
14
  //#region src/i18n.ts
15
+ /**
16
+ * @deprecated Use the `forms` namespace instead.
17
+ */
15
18
  const i18n = createInstance({
16
19
  fallbackLng: "en",
17
20
  interpolation: { escapeValue: false },
@@ -23,12 +26,12 @@ i18n.init();
23
26
  //#region src/components/error-monitor.tsx
24
27
  function ErrorMonitor(t0) {
25
28
  const $ = c(9);
26
- if ($[0] !== "c1152b8b10c8eb9b2d5487945cb5eb86f0f91985c5c6904e6837c158e73942d1") {
29
+ if ($[0] !== "4185ab3b9d5624a225bf3d08ec0ddd8347c2bbb39f4ff9967b130ed447ad202f") {
27
30
  for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
28
- $[0] = "c1152b8b10c8eb9b2d5487945cb5eb86f0f91985c5c6904e6837c158e73942d1";
31
+ $[0] = "4185ab3b9d5624a225bf3d08ec0ddd8347c2bbb39f4ff9967b130ed447ad202f";
29
32
  }
30
33
  const { error } = t0;
31
- const { t } = useTranslation();
34
+ const { t } = useTranslation("forms");
32
35
  if (!error?.message) return null;
33
36
  if (t.name === "notReadyT") {
34
37
  let t1;
@@ -417,20 +420,17 @@ function Form({ children, className, defaults = {}, onBefore, onBeforeUpdate, on
417
420
  type: "inertia"
418
421
  });
419
422
  }, [inertiaForm.errors, reactForm]);
420
- return /* @__PURE__ */ jsx(I18nextProvider, {
421
- i18n,
422
- children: /* @__PURE__ */ jsxs("form", {
423
- action: route.url,
424
- className: cn("grid gap-6", className),
425
- method: route.method,
426
- onSubmit: reactForm.handleSubmit(onSubmit),
427
- ...props,
428
- children: [/* @__PURE__ */ jsx(Fragment, { children: children({
429
- errors: inertiaForm.errors,
430
- form: reactForm,
431
- loading: inertiaForm.processing
432
- }) }), displayRootError === "monitor" && /* @__PURE__ */ jsx(ErrorMonitor, { error: rootError })]
433
- })
423
+ return /* @__PURE__ */ jsxs("form", {
424
+ action: route.url,
425
+ className: cn("grid gap-6", className),
426
+ method: route.method,
427
+ onSubmit: reactForm.handleSubmit(onSubmit),
428
+ ...props,
429
+ children: [/* @__PURE__ */ jsx(Fragment, { children: children({
430
+ errors: inertiaForm.errors,
431
+ form: reactForm,
432
+ loading: inertiaForm.processing
433
+ }) }), displayRootError === "monitor" && /* @__PURE__ */ jsx(ErrorMonitor, { error: rootError })]
434
434
  });
435
435
  }
436
436
 
@@ -500,9 +500,9 @@ function InfoCheckboxField({ children, className, control, disabled, inputId, in
500
500
  //#region src/components/nullable-select-field.tsx
501
501
  function NullableSelectField(t0) {
502
502
  const $ = c(29);
503
- if ($[0] !== "fa464e82ea599f229aec23b6d5f7a56a07f7b4011320bb3b2b9ddd2f6ed96f93") {
503
+ if ($[0] !== "4241b7c1224c26bab74eb6559e248d38a21f64ef8ec55fe1c619e2f94d80ec64") {
504
504
  for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
505
- $[0] = "fa464e82ea599f229aec23b6d5f7a56a07f7b4011320bb3b2b9ddd2f6ed96f93";
505
+ $[0] = "4241b7c1224c26bab74eb6559e248d38a21f64ef8ec55fe1c619e2f94d80ec64";
506
506
  }
507
507
  let autoComplete;
508
508
  let control;
@@ -542,7 +542,7 @@ function NullableSelectField(t0) {
542
542
  props = $[11];
543
543
  setValue = $[12];
544
544
  }
545
- const { t } = useTranslation();
545
+ const { t } = useTranslation("forms");
546
546
  let t1;
547
547
  if ($[13] !== autoComplete || $[14] !== description || $[15] !== inputId || $[16] !== inputName || $[17] !== label || $[18] !== options || $[19] !== placeholder || $[20] !== props || $[21] !== setValue || $[22] !== t) {
548
548
  t1 = (t2) => {
@@ -634,7 +634,7 @@ function stepInput(original, add, step, min, max) {
634
634
  return parsed.toString();
635
635
  }
636
636
  function NumericField({ autoComplete, control, disabled, inputId, inputMode = "numeric", inputName, label, placeholder, type, ui, ...props }) {
637
- const { t } = useTranslation();
637
+ const { t } = useTranslation("forms");
638
638
  function stepValue(value, add) {
639
639
  if (ui?.setValue) ui.setValue(inputName, stepInput(value, add, ui.step, ui.min, ui.max), { shouldValidate: true });
640
640
  }
@@ -799,7 +799,7 @@ function _temp(option) {
799
799
  //#endregion
800
800
  //#region src/components/submit.tsx
801
801
  function Submit({ label, loading = false, type = "submit", ...props }) {
802
- const { t } = useTranslation();
802
+ const { t } = useTranslation("forms");
803
803
  return /* @__PURE__ */ jsx(Button, {
804
804
  disabled: loading,
805
805
  type,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["error","label","autoComplete","placeholder","readOnly","type","control","disabled","inputName","label","description","defaultValue","control","disabled","inputName","label","autoComplete","placeholder","description","control","disabled","inputName","$","label","autoComplete","placeholder","description","control","disabled","inputName"],"sources":["../src/i18n.ts","../src/components/error-monitor.tsx","../src/lib/utils.ts","../src/components/calendar-field.tsx","../src/components/checkbox-field.tsx","../src/components/input-field.tsx","../src/components/email-field.tsx","../src/components/fancy-radio-field.tsx","../src/components/form.tsx","../src/components/hidden-field.tsx","../src/components/info-checkbox-field.tsx","../src/components/nullable-select-field.tsx","../src/components/numeric-field.tsx","../src/components/password-field.tsx","../src/components/select-field.tsx","../src/components/submit.tsx","../src/components/switch-field.tsx","../src/components/text-field.tsx","../src/components/textarea-field.tsx"],"sourcesContent":["import { type i18n as Ti18n, createInstance } from 'i18next'\nimport en from '@/locales/en'\n\nconst i18n: Ti18n = createInstance({\n fallbackLng: 'en',\n interpolation: { escapeValue: false },\n resources: { en }\n})\n\nvoid i18n.init()\n\nexport default i18n\n","import { FieldError } from '@gmcode/react-ui'\nimport { useTranslation } from 'react-i18next'\nimport type { ErrorData } from '@/types'\n\nexport function ErrorMonitor({ error }: { error?: ErrorData }) {\n // i18n\n const { t } = useTranslation()\n\n if (!error?.message) {\n return null\n }\n\n if (t.name === 'notReadyT') {\n return <FieldError errors={error} />\n }\n\n // @ts-expect-error: assert error.message to be a translation key\n return <FieldError errors={{ message: t(error.message, error.params) }} />\n}\n","/**\n * Convert a javascript `Date` object to a string with the format `aaaa-mm-dd`.\n */\nexport function dateToString(date: Date): string {\n return `${date.getFullYear()}-${(date.getMonth() + 1 + '').padStart(2, '0')}-${(date.getDate() + '').padStart(2, '0')}`\n}\n\n/**\n * Convert a string to a javascript `Date` object or undefined if the string is\n * not a valid date.\n */\nexport function stringToDate(string: string | undefined): Date | undefined {\n if (!string) {\n return undefined\n }\n\n const date = new Date(string)\n\n if (isNaN(date.getFullYear())) {\n return undefined\n }\n\n return date\n}\n","import { Calendar, Field, FieldLabel } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport type { DayPickerLocale, Matcher } from 'react-day-picker'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport {\n dateToString as defaultDateToString,\n stringToDate as defaultStringToDate\n} from '@/lib/utils'\n\nexport function CalendarField<TFieldValues extends FieldValues = FieldValues>({\n control,\n dateToString = defaultDateToString,\n disabled,\n inputId,\n inputName,\n label,\n locale,\n stringToDate = defaultStringToDate,\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n dateToString?: (date: Date) => string\n disabled?: Matcher | Matcher[]\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n locale?: Partial<DayPickerLocale>\n stringToDate?: (string: string | undefined) => Date | undefined\n}) {\n return (\n <Controller\n control={control}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Calendar\n aria-invalid={fieldState.invalid}\n className=\"w-full rounded-md border\"\n disabled={disabled}\n fixedWeeks={true}\n id={inputId ?? (label ? inputName : undefined)}\n locale={locale}\n mode=\"single\"\n onSelect={(date) => field.onChange(date ? dateToString(date) : '')}\n selected={stringToDate(field.value)}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Checkbox, Field, FieldLabel } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function CheckboxField<TFieldValues extends FieldValues = FieldValues>({\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Checkbox\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50\"\n disabled={field.disabled}\n id={inputId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Field, FieldLabel, Input } from '@gmcode/react-ui'\nimport type {\n ChangeEventHandler,\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function InputField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n disabled,\n inputId,\n inputName,\n label,\n placeholder,\n readOnly,\n type,\n ...props\n}: Omit<ComponentProps<typeof Field>, 'onChange'> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onChange?: ChangeEventHandler<HTMLDivElement, HTMLInputElement>\n placeholder?: string\n readOnly?: boolean\n type?: HTMLInputTypeAttribute\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Input\n aria-invalid={fieldState.invalid}\n autoComplete={autoComplete}\n id={inputId ?? (label ? inputName : undefined)}\n placeholder={placeholder}\n readOnly={readOnly}\n type={type}\n {...field}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function EmailField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'on',\n type = 'email',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import {\n FieldDescription,\n FieldLabel,\n FieldSet,\n Label,\n RadioGroup,\n RadioGroupItem\n} from '@gmcode/react-ui'\nimport type { ComponentProps, FC, SVGProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function FancyRadioField<\n TFieldValues extends FieldValues = FieldValues\n>({\n control,\n defaultValue,\n description,\n disabled,\n groupId,\n inputName,\n label,\n options,\n ...props\n}: ComponentProps<typeof FieldSet> & {\n control: Control<TFieldValues>\n defaultValue: string\n description?: string\n disabled?: boolean\n groupId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Array<Option & { Icon?: FC<SVGProps<SVGSVGElement>> }>\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <FieldSet\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={groupId ?? inputName}>{label}</FieldLabel>\n )}\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n\n <RadioGroup\n defaultValue={defaultValue}\n disabled={field.disabled}\n id={groupId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onValueChange={field.onChange}\n ref={field.ref}\n >\n {options.map((option) => (\n <Label\n className=\"rounded-md border ring-ring/50 transition-all hover:bg-accent/50 has-focus-visible:ring-[3px]\"\n data-slot=\"field-label\"\n key={option.key ?? option.id ?? option.value}\n >\n <div className=\"flex w-full items-center gap-3 rounded-md p-3 transition-all has-aria-checked:border-l-8 has-aria-checked:border-ring\">\n <RadioGroupItem\n className=\"sr-only\"\n id={option.id}\n value={option.value}\n />\n {option.Icon && <option.Icon />}\n {option.label}\n </div>\n </Label>\n ))}\n </RadioGroup>\n </FieldSet>\n )}\n />\n )\n}\n","import { cn, flash } from '@gmcode/react-ui'\nimport { type InferSchema, useTsvResolver } from '@gmcode/tsv-hookform'\nimport type { Ruleset } from '@gmcode/tsv-input'\nimport type {\n CancelTokenCallback,\n Errors,\n FormDataErrors,\n GlobalEventCallback,\n Page,\n RequestPayload,\n SharedPageProps\n} from '@inertiajs/core'\nimport { useForm as useInertiaForm } from '@inertiajs/react'\nimport { type ComponentProps, type ReactNode, useEffect, useState } from 'react'\nimport type {\n DefaultValues,\n FieldValues,\n Path,\n UseFormReturn\n} from 'react-hook-form'\nimport { useForm as userReactForm } from 'react-hook-form'\nimport { I18nextProvider } from 'react-i18next'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport i18n from '@/i18n'\nimport type { Schema } from '@/index'\nimport type { ErrorData, Method, RouteDefinition } from '@/types'\n\ntype RenderFN<TValues extends FieldValues> = ({\n errors,\n form,\n loading\n}: {\n errors: FormDataErrors<object>\n form: UseFormReturn<TValues>\n loading: boolean\n}) => ReactNode\n\nexport function Form<\n TRuleset extends Ruleset,\n TSchema extends Schema<TRuleset>,\n TValues extends InferSchema<TSchema>\n>({\n children,\n className,\n defaults = {},\n onBefore,\n onBeforeUpdate,\n onCancel,\n onCancelToken,\n onError,\n onFinish,\n onFlash,\n onPrefetched,\n onPrefetching,\n onProgress,\n onStart,\n onSuccess,\n preserveScroll = true,\n resetOnSuccess = true,\n rootError: displayRootError = 'flash',\n route,\n schema,\n setDefaultsOnSuccess = false,\n ...props\n}: Omit<\n ComponentProps<'form'>,\n 'action' | 'children' | 'method' | 'onSubmit'\n> & {\n children: RenderFN<TValues>\n defaults?: Partial<DefaultValues<TValues>>\n onBefore?: GlobalEventCallback<'before', RequestPayload>\n onBeforeUpdate?: GlobalEventCallback<'beforeUpdate', RequestPayload>\n onCancel?: GlobalEventCallback<'cancel', RequestPayload>\n onCancelToken?: CancelTokenCallback\n onError?: GlobalEventCallback<'error', RequestPayload>\n onFinish?: GlobalEventCallback<'finish', RequestPayload>\n onFlash?: GlobalEventCallback<'flash', RequestPayload>\n onPrefetched?: GlobalEventCallback<'prefetched', RequestPayload>\n onPrefetching?: GlobalEventCallback<'prefetching', RequestPayload>\n onProgress?: GlobalEventCallback<'progress', RequestPayload>\n onStart?: GlobalEventCallback<'start', RequestPayload>\n onSuccess?: GlobalEventCallback<'success', RequestPayload>\n preserveScroll?: boolean\n /**\n * Reset input values to their defaults on success.\n *\n * @defaultValue `true`\n */\n resetOnSuccess?: boolean\n /**\n * How to display the root error from inertia.\n *\n * - `\"flash\"` - use the Toaster component\n * - `\"monitor\"` - use the ErrorMonitor component\n * - `\"none\"` - don't display the root error\n *\n * @defaultValue `\"flash\"`\n */\n rootError?: 'flash' | 'monitor' | 'none'\n route: RouteDefinition<Method>\n schema: Schema<TRuleset>\n /**\n * Set the submitted values as default values on success.\n *\n * @defaultValue `false`\n */\n setDefaultsOnSuccess?: boolean\n}) {\n const [rootError, setRootError] = useState<ErrorData>()\n\n const defaultValues = Object.fromEntries(\n Object.keys(schema.ruleset).map((field) => [field, defaults[field] ?? ''])\n ) as DefaultValues<TValues>\n\n // React Hook Form\n const reactForm = userReactForm<TValues>({\n defaultValues,\n resolver: useTsvResolver(schema)\n })\n\n // Inertia\n const inertiaForm = useInertiaForm<object>(defaultValues)\n\n function onErrorWithToast(errors: Errors) {\n if (errors.root) {\n if (displayRootError === 'flash') {\n flash({ level: 'error', title: errors.root })\n } else if (displayRootError === 'monitor') {\n setRootError({ message: errors.root })\n }\n }\n\n if (onError) {\n onError(errors)\n }\n }\n\n function onSuccessWithReset(page: Page<SharedPageProps>) {\n if (setDefaultsOnSuccess) {\n inertiaForm.setDefaults()\n reactForm.reset(reactForm.getValues())\n }\n\n if (resetOnSuccess) {\n inertiaForm.reset()\n reactForm.reset()\n }\n\n if (onSuccess) {\n onSuccess(page)\n }\n }\n\n // Submit handler\n function onSubmit(values: TValues) {\n inertiaForm.transform(() => values)\n inertiaForm[route.method](route.url, {\n onBefore,\n onBeforeUpdate,\n onCancel,\n onCancelToken,\n onError: onErrorWithToast,\n onFinish,\n onFlash,\n onPrefetched,\n onPrefetching,\n onProgress,\n onStart,\n onSuccess: onSuccessWithReset,\n preserveScroll\n })\n }\n\n // Add inertia (server) errors to react form.\n useEffect(() => {\n for (const [key, error] of Object.entries(inertiaForm.errors)) {\n if (error) {\n reactForm.setError(key as Path<TValues>, {\n message: error as string,\n type: 'inertia'\n })\n }\n }\n }, [inertiaForm.errors, reactForm])\n\n return (\n <I18nextProvider i18n={i18n}>\n <form\n action={route.url}\n className={cn('grid gap-6', className)}\n method={route.method}\n onSubmit={reactForm.handleSubmit(onSubmit)}\n {...props}\n >\n <>\n {children({\n errors: inertiaForm.errors,\n form: reactForm,\n loading: inertiaForm.processing\n })}\n </>\n\n {displayRootError === 'monitor' && <ErrorMonitor error={rootError} />}\n </form>\n </I18nextProvider>\n )\n}\n","import { cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function HiddenField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'off',\n className,\n type = 'hidden',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n className={cn('hidden', className)}\n type={type}\n {...props}\n />\n )\n}\n","import { Checkbox, Field, Label, cn } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function InfoCheckboxField<\n TFieldValues extends FieldValues = FieldValues\n>({\n children,\n className,\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n text,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n text?: string\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n className={cn('block', className)}\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Label\n className=\"flex items-start gap-3 rounded-lg border p-3 hover:bg-accent/50 has-aria-checked:border-info-foreground has-aria-checked:bg-info\"\n data-slot=\"field-label\"\n >\n <Checkbox\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50 data-[state=checked]:border-info-foreground data-[state=checked]:bg-info-foreground data-[state=checked]:text-white dark:data-[state=checked]:border-info-foreground dark:data-[state=checked]:bg-info-foreground\"\n disabled={field.disabled}\n id={inputId}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n <div className=\"grid gap-1.5 font-normal\">\n <p className=\"text-sm leading-none font-medium\">{label}</p>\n {text ? (\n <p className=\"text-sm text-muted-foreground\">{text}</p>\n ) : (\n children\n )}\n <ErrorMonitor error={fieldState.error} />\n </div>\n </Label>\n </Field>\n )}\n />\n )\n}\n","import {\n Button,\n Field,\n FieldDescription,\n FieldLabel,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue\n} from '@gmcode/react-ui'\nimport { X } from 'lucide-react'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type {\n FieldPathValue,\n FieldValues,\n UseFormSetValue\n} from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function NullableSelectField<\n TFieldValues extends FieldValues = FieldValues\n>({\n autoComplete,\n control,\n description,\n disabled,\n inputId,\n inputName,\n label,\n options,\n placeholder,\n setValue,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n description?: string\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Option[]\n placeholder?: string\n setValue: UseFormSetValue<TFieldValues>\n type?: HTMLInputTypeAttribute\n}) {\n // i18n\n const { t } = useTranslation()\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <div className=\"flex items-end gap-4\">\n <Select\n autoComplete={autoComplete}\n disabled={field.disabled}\n name={field.name}\n onValueChange={field.onChange}\n value={field.value}\n >\n <SelectTrigger\n aria-invalid={fieldState.invalid}\n className=\"flex-1 overflow-hidden\"\n id={inputId ?? (label ? inputName : undefined)}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem\n id={option.id}\n key={option.key ?? option.id ?? option.value}\n value={option.value}\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n <Button\n aria-label={t(($) => $.reset)}\n className=\"flex-none\"\n onClick={() =>\n setValue(\n inputName,\n '' as FieldPathValue<TFieldValues, FieldPath<TFieldValues>>\n )\n }\n type=\"button\"\n variant=\"outline\"\n >\n <X />\n </Button>\n </div>\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import {\n Field,\n FieldLabel,\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput\n} from '@gmcode/react-ui'\nimport { Minus, Plus } from 'lucide-react'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type {\n FieldPathValue,\n FieldValues,\n UseFormSetValue\n} from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nfunction stepInput(\n original: string,\n add: boolean,\n step?: number,\n min?: number,\n max?: number\n) {\n let parsed = Number(original)\n\n if (isNaN(parsed)) {\n return ''\n }\n\n if (add) {\n parsed += step === undefined ? 1 : step\n } else {\n parsed -= step === undefined ? 1 : step\n }\n\n if (min !== undefined) {\n parsed = Math.max(parsed, min)\n }\n\n if (max !== undefined) {\n parsed = Math.min(parsed, max)\n }\n\n return parsed.toString()\n}\n\nexport function NumericField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n disabled,\n inputId,\n inputMode = 'numeric',\n inputName,\n label,\n placeholder,\n type,\n ui,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputMode?: 'decimal' | 'numeric'\n inputName: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n type?: HTMLInputTypeAttribute\n ui?: {\n max?: number\n min?: number\n setValue: UseFormSetValue<TFieldValues>\n step?: number\n }\n}) {\n // i18n\n const { t } = useTranslation()\n\n function stepValue(value: string, add: boolean) {\n if (ui?.setValue) {\n ui.setValue(\n inputName,\n stepInput(value, add, ui.step, ui.min, ui.max) as FieldPathValue<\n TFieldValues,\n FieldPath<TFieldValues>\n >,\n { shouldValidate: true }\n )\n }\n }\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <InputGroup>\n <InputGroupInput\n aria-invalid={fieldState.invalid}\n autoComplete={autoComplete}\n id={inputId ?? (label ? inputName : undefined)}\n inputMode={inputMode}\n placeholder={placeholder}\n type={type}\n {...field}\n />\n\n {ui && (\n <InputGroupAddon align=\"inline-end\">\n <InputGroupButton\n aria-label={t(($) => $.decrease)}\n disabled={disabled}\n onClick={() => stepValue(field.value, false)}\n size=\"icon-xs\"\n >\n <Minus />\n </InputGroupButton>\n\n <InputGroupButton\n aria-label={t(($) => $.increase)}\n disabled={disabled}\n onClick={() => stepValue(field.value, true)}\n size=\"icon-xs\"\n >\n <Plus />\n </InputGroupButton>\n </InputGroupAddon>\n )}\n </InputGroup>\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function PasswordField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'off',\n type = 'password',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import {\n Field,\n FieldDescription,\n FieldLabel,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue\n} from '@gmcode/react-ui'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function SelectField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n description,\n disabled,\n inputId,\n inputName,\n label,\n options,\n placeholder,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n description?: string\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Option[]\n placeholder?: string\n type?: HTMLInputTypeAttribute\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Select\n autoComplete={autoComplete}\n disabled={field.disabled}\n name={field.name}\n onValueChange={field.onChange}\n value={field.value}\n >\n <SelectTrigger\n aria-invalid={fieldState.invalid}\n id={inputId ?? (label ? inputName : undefined)}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem\n id={option.id}\n key={option.key ?? option.id ?? option.value}\n value={option.value}\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Button, Spinner, cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport { useTranslation } from 'react-i18next'\n\nexport function Submit({\n label,\n loading = false,\n type = 'submit',\n ...props\n}: ComponentProps<typeof Button> & {\n label?: string\n loading?: boolean\n}) {\n // i18n\n const { t } = useTranslation()\n\n return (\n <Button\n disabled={loading}\n type={type}\n {...props}\n >\n <div className=\"relative\">\n <span className={cn({ invisible: loading })}>\n {label ?? t(($) => $.submit)}\n </span>\n <Spinner\n className={cn(\n 'trans absolute top-1/2 left-1/2 hidden -translate-x-1/2 -translate-y-1/2',\n { block: loading }\n )}\n />\n </div>\n </Button>\n )\n}\n","import { Field, FieldLabel, Switch } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function SwitchField<TFieldValues extends FieldValues = FieldValues>({\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Switch\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50\"\n disabled={field.disabled}\n id={inputId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function TextField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'on',\n type = 'text',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import { Field, FieldLabel, TextareaAutosize, cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport type { TextareaHeightChangeMeta } from 'react-textarea-autosize'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function TextareaField<TFieldValues extends FieldValues = FieldValues>({\n cacheMeasurements,\n control,\n inputId,\n inputName,\n label,\n maxRows,\n minRows,\n onHeightChange,\n placeholder,\n resize = 'none',\n ...props\n}: ComponentProps<typeof Field> & {\n cacheMeasurements?: boolean\n control: Control<TFieldValues>\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n maxRows?: number\n minRows?: number\n onHeightChange?: (height: number, meta: TextareaHeightChangeMeta) => void\n placeholder?: string\n resize?: 'both' | 'none' | 'x' | 'y'\n}) {\n return (\n <Controller\n control={control}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <TextareaAutosize\n aria-invalid={fieldState.invalid}\n autoComplete=\"off\"\n cacheMeasurements={cacheMeasurements}\n className={cn({\n resize: resize === 'both',\n 'resize-none': resize === 'none',\n 'resize-x': resize === 'x',\n 'resize-y': resize === 'y'\n })}\n id={inputId ?? (label ? inputName : undefined)}\n maxRows={maxRows}\n minRows={minRows}\n onHeightChange={onHeightChange}\n placeholder={placeholder}\n {...field}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAM,OAAc,eAAe;CACjC,aAAa;CACb,eAAe,EAAE,aAAa,MAAM;CACpC,WAAW,EAAE,eAAG;AAClB,CAAC;AAEI,KAAK,KAAK;;;;ACLf,SAAO,aAAA,IAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAA,KAAA,GAAA,KAAA,GAAA,MAAA,GAAA,EAAA,MAAA,OAAA,IAAA,2BAAA;EAAA,EAAA,KAAA;CAAA;CAAsB,MAAA,EAAA,UAAA;CAE3B,MAAA,EAAA,MAAc,eAAe;CAE7B,IAAI,CAAC,OAAK,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ACxD,IAAI,iBAAiB,gBAAgB,SAAS,KAAK;MACrD;KACF;KACA,KAAK,MAAM;KACJ;IAAM;IAGd,SACC,oBAAC,YAAD;KAAY,SAAS,WAAW;eAAY;IAAkB;IAGhE,oBAAC,cAAD,EAAc,OAAO,WAAW,MAAM;GACjC;;CACP;AAGR;;;;ACpEA,SAAgB,UAA0D,EACxE,eAAe,MACf,OAAO,QACP,GAAG,SAC+C;CAClD,OACE,oBAAC,YAAD;EACgB;EACR;EACN,GAAI;CAAM;AAGhB;;;;ACTA,SAAgB,cAA8D,EAC5E,mBACA,SACA,SACA,WACA,OACA,SACA,SACA,gBACA,aACA,SAAS,QACT,GAAG,SAYF;CACD,OACE,oBAAC,YAAD;EACW;EACT,MAAM;EACN,SAAS,EAAE,OAAO,iBAChB,qBAAC,OAAD;GACE,gBAAc,WAAW;GACzB,GAAI;aAFN;IAIG,SACC,oBAAC,YAAD;KAAY,SAAS,WAAW;eAAY;IAAkB;IAGhE,oBAAC,kBAAD;KACE,gBAAc,WAAW;KACzB,cAAa;KACM;KACnB,WAAW,GAAG;MACZ,QAAQ,WAAW;MACnB,eAAe,WAAW;MAC1B,YAAY,WAAW;MACvB,YAAY,WAAW;KACzB,CAAC;KACD,IAAI,YAAY,QAAQ,YAAY;KAC3B;KACA;KACO;KACH;KACb,GAAI;IAAM;IAGZ,oBAAC,cAAD,EAAc,OAAO,WAAW,MAAM;GACjC;;CACP;AAGR"}
1
+ {"version":3,"file":"index.mjs","names":["error","label","autoComplete","placeholder","readOnly","type","control","disabled","inputName","label","description","defaultValue","control","disabled","inputName","label","autoComplete","placeholder","description","control","disabled","inputName","$","label","autoComplete","placeholder","description","control","disabled","inputName"],"sources":["../src/i18n.ts","../src/components/error-monitor.tsx","../src/lib/utils.ts","../src/components/calendar-field.tsx","../src/components/checkbox-field.tsx","../src/components/input-field.tsx","../src/components/email-field.tsx","../src/components/fancy-radio-field.tsx","../src/components/form.tsx","../src/components/hidden-field.tsx","../src/components/info-checkbox-field.tsx","../src/components/nullable-select-field.tsx","../src/components/numeric-field.tsx","../src/components/password-field.tsx","../src/components/select-field.tsx","../src/components/submit.tsx","../src/components/switch-field.tsx","../src/components/text-field.tsx","../src/components/textarea-field.tsx"],"sourcesContent":["import { type i18n as Ti18n, createInstance } from 'i18next'\nimport en from '@/locales/en'\n\n/**\n * @deprecated Use the `forms` namespace instead.\n */\nconst i18n: Ti18n = createInstance({\n fallbackLng: 'en',\n interpolation: { escapeValue: false },\n resources: { en }\n})\n\nvoid i18n.init()\n\nexport default i18n\n","import { FieldError } from '@gmcode/react-ui'\nimport { useTranslation } from 'react-i18next'\nimport type { ErrorData } from '@/types'\n\nexport function ErrorMonitor({ error }: { error?: ErrorData }) {\n // i18n\n const { t } = useTranslation('forms')\n\n if (!error?.message) {\n return null\n }\n\n if (t.name === 'notReadyT') {\n return <FieldError errors={error} />\n }\n\n // @ts-expect-error: assert error.message to be a translation key\n return <FieldError errors={{ message: t(error.message, error.params) }} />\n}\n","/**\n * Convert a javascript `Date` object to a string with the format `aaaa-mm-dd`.\n */\nexport function dateToString(date: Date): string {\n return `${date.getFullYear()}-${(date.getMonth() + 1 + '').padStart(2, '0')}-${(date.getDate() + '').padStart(2, '0')}`\n}\n\n/**\n * Convert a string to a javascript `Date` object or undefined if the string is\n * not a valid date.\n */\nexport function stringToDate(string: string | undefined): Date | undefined {\n if (!string) {\n return undefined\n }\n\n const date = new Date(string)\n\n if (isNaN(date.getFullYear())) {\n return undefined\n }\n\n return date\n}\n","import { Calendar, Field, FieldLabel } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport type { DayPickerLocale, Matcher } from 'react-day-picker'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport {\n dateToString as defaultDateToString,\n stringToDate as defaultStringToDate\n} from '@/lib/utils'\n\nexport function CalendarField<TFieldValues extends FieldValues = FieldValues>({\n control,\n dateToString = defaultDateToString,\n disabled,\n inputId,\n inputName,\n label,\n locale,\n stringToDate = defaultStringToDate,\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n dateToString?: (date: Date) => string\n disabled?: Matcher | Matcher[]\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n locale?: Partial<DayPickerLocale>\n stringToDate?: (string: string | undefined) => Date | undefined\n}) {\n return (\n <Controller\n control={control}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Calendar\n aria-invalid={fieldState.invalid}\n className=\"w-full rounded-md border\"\n disabled={disabled}\n fixedWeeks={true}\n id={inputId ?? (label ? inputName : undefined)}\n locale={locale}\n mode=\"single\"\n onSelect={(date) => field.onChange(date ? dateToString(date) : '')}\n selected={stringToDate(field.value)}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Checkbox, Field, FieldLabel } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function CheckboxField<TFieldValues extends FieldValues = FieldValues>({\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Checkbox\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50\"\n disabled={field.disabled}\n id={inputId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Field, FieldLabel, Input } from '@gmcode/react-ui'\nimport type {\n ChangeEventHandler,\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function InputField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n disabled,\n inputId,\n inputName,\n label,\n placeholder,\n readOnly,\n type,\n ...props\n}: Omit<ComponentProps<typeof Field>, 'onChange'> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onChange?: ChangeEventHandler<HTMLDivElement, HTMLInputElement>\n placeholder?: string\n readOnly?: boolean\n type?: HTMLInputTypeAttribute\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Input\n aria-invalid={fieldState.invalid}\n autoComplete={autoComplete}\n id={inputId ?? (label ? inputName : undefined)}\n placeholder={placeholder}\n readOnly={readOnly}\n type={type}\n {...field}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function EmailField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'on',\n type = 'email',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import {\n FieldDescription,\n FieldLabel,\n FieldSet,\n Label,\n RadioGroup,\n RadioGroupItem\n} from '@gmcode/react-ui'\nimport type { ComponentProps, FC, SVGProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function FancyRadioField<\n TFieldValues extends FieldValues = FieldValues\n>({\n control,\n defaultValue,\n description,\n disabled,\n groupId,\n inputName,\n label,\n options,\n ...props\n}: ComponentProps<typeof FieldSet> & {\n control: Control<TFieldValues>\n defaultValue: string\n description?: string\n disabled?: boolean\n groupId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Array<Option & { Icon?: FC<SVGProps<SVGSVGElement>> }>\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <FieldSet\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={groupId ?? inputName}>{label}</FieldLabel>\n )}\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n\n <RadioGroup\n defaultValue={defaultValue}\n disabled={field.disabled}\n id={groupId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onValueChange={field.onChange}\n ref={field.ref}\n >\n {options.map((option) => (\n <Label\n className=\"rounded-md border ring-ring/50 transition-all hover:bg-accent/50 has-focus-visible:ring-[3px]\"\n data-slot=\"field-label\"\n key={option.key ?? option.id ?? option.value}\n >\n <div className=\"flex w-full items-center gap-3 rounded-md p-3 transition-all has-aria-checked:border-l-8 has-aria-checked:border-ring\">\n <RadioGroupItem\n className=\"sr-only\"\n id={option.id}\n value={option.value}\n />\n {option.Icon && <option.Icon />}\n {option.label}\n </div>\n </Label>\n ))}\n </RadioGroup>\n </FieldSet>\n )}\n />\n )\n}\n","import { cn, flash } from '@gmcode/react-ui'\nimport { type InferSchema, useTsvResolver } from '@gmcode/tsv-hookform'\nimport type { Ruleset } from '@gmcode/tsv-input'\nimport type {\n CancelTokenCallback,\n Errors,\n FormDataErrors,\n GlobalEventCallback,\n Page,\n RequestPayload,\n SharedPageProps\n} from '@inertiajs/core'\nimport { useForm as useInertiaForm } from '@inertiajs/react'\nimport { type ComponentProps, type ReactNode, useEffect, useState } from 'react'\nimport type {\n DefaultValues,\n FieldValues,\n Path,\n UseFormReturn\n} from 'react-hook-form'\nimport { useForm as userReactForm } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Schema } from '@/index'\nimport type { ErrorData, Method, RouteDefinition } from '@/types'\n\ntype RenderFN<TValues extends FieldValues> = ({\n errors,\n form,\n loading\n}: {\n errors: FormDataErrors<object>\n form: UseFormReturn<TValues>\n loading: boolean\n}) => ReactNode\n\nexport function Form<\n TRuleset extends Ruleset,\n TSchema extends Schema<TRuleset>,\n TValues extends InferSchema<TSchema>\n>({\n children,\n className,\n defaults = {},\n onBefore,\n onBeforeUpdate,\n onCancel,\n onCancelToken,\n onError,\n onFinish,\n onFlash,\n onPrefetched,\n onPrefetching,\n onProgress,\n onStart,\n onSuccess,\n preserveScroll = true,\n resetOnSuccess = true,\n rootError: displayRootError = 'flash',\n route,\n schema,\n setDefaultsOnSuccess = false,\n ...props\n}: Omit<\n ComponentProps<'form'>,\n 'action' | 'children' | 'method' | 'onSubmit'\n> & {\n children: RenderFN<TValues>\n defaults?: Partial<DefaultValues<TValues>>\n onBefore?: GlobalEventCallback<'before', RequestPayload>\n onBeforeUpdate?: GlobalEventCallback<'beforeUpdate', RequestPayload>\n onCancel?: GlobalEventCallback<'cancel', RequestPayload>\n onCancelToken?: CancelTokenCallback\n onError?: GlobalEventCallback<'error', RequestPayload>\n onFinish?: GlobalEventCallback<'finish', RequestPayload>\n onFlash?: GlobalEventCallback<'flash', RequestPayload>\n onPrefetched?: GlobalEventCallback<'prefetched', RequestPayload>\n onPrefetching?: GlobalEventCallback<'prefetching', RequestPayload>\n onProgress?: GlobalEventCallback<'progress', RequestPayload>\n onStart?: GlobalEventCallback<'start', RequestPayload>\n onSuccess?: GlobalEventCallback<'success', RequestPayload>\n preserveScroll?: boolean\n /**\n * Reset input values to their defaults on success.\n *\n * @defaultValue `true`\n */\n resetOnSuccess?: boolean\n /**\n * How to display the root error from inertia.\n *\n * - `\"flash\"` - use the Toaster component\n * - `\"monitor\"` - use the ErrorMonitor component\n * - `\"none\"` - don't display the root error\n *\n * @defaultValue `\"flash\"`\n */\n rootError?: 'flash' | 'monitor' | 'none'\n route: RouteDefinition<Method>\n schema: Schema<TRuleset>\n /**\n * Set the submitted values as default values on success.\n *\n * @defaultValue `false`\n */\n setDefaultsOnSuccess?: boolean\n}) {\n const [rootError, setRootError] = useState<ErrorData>()\n\n const defaultValues = Object.fromEntries(\n Object.keys(schema.ruleset).map((field) => [field, defaults[field] ?? ''])\n ) as DefaultValues<TValues>\n\n // React Hook Form\n const reactForm = userReactForm<TValues>({\n defaultValues,\n resolver: useTsvResolver(schema)\n })\n\n // Inertia\n const inertiaForm = useInertiaForm<object>(defaultValues)\n\n function onErrorWithToast(errors: Errors) {\n if (errors.root) {\n if (displayRootError === 'flash') {\n flash({ level: 'error', title: errors.root })\n } else if (displayRootError === 'monitor') {\n setRootError({ message: errors.root })\n }\n }\n\n if (onError) {\n onError(errors)\n }\n }\n\n function onSuccessWithReset(page: Page<SharedPageProps>) {\n if (setDefaultsOnSuccess) {\n inertiaForm.setDefaults()\n reactForm.reset(reactForm.getValues())\n }\n\n if (resetOnSuccess) {\n inertiaForm.reset()\n reactForm.reset()\n }\n\n if (onSuccess) {\n onSuccess(page)\n }\n }\n\n // Submit handler\n function onSubmit(values: TValues) {\n inertiaForm.transform(() => values)\n inertiaForm[route.method](route.url, {\n onBefore,\n onBeforeUpdate,\n onCancel,\n onCancelToken,\n onError: onErrorWithToast,\n onFinish,\n onFlash,\n onPrefetched,\n onPrefetching,\n onProgress,\n onStart,\n onSuccess: onSuccessWithReset,\n preserveScroll\n })\n }\n\n // Add inertia (server) errors to react form.\n useEffect(() => {\n for (const [key, error] of Object.entries(inertiaForm.errors)) {\n if (error) {\n reactForm.setError(key as Path<TValues>, {\n message: error as string,\n type: 'inertia'\n })\n }\n }\n }, [inertiaForm.errors, reactForm])\n\n return (\n <form\n action={route.url}\n className={cn('grid gap-6', className)}\n method={route.method}\n onSubmit={reactForm.handleSubmit(onSubmit)}\n {...props}\n >\n <>\n {children({\n errors: inertiaForm.errors,\n form: reactForm,\n loading: inertiaForm.processing\n })}\n </>\n\n {displayRootError === 'monitor' && <ErrorMonitor error={rootError} />}\n </form>\n )\n}\n","import { cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function HiddenField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'off',\n className,\n type = 'hidden',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n className={cn('hidden', className)}\n type={type}\n {...props}\n />\n )\n}\n","import { Checkbox, Field, Label, cn } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function InfoCheckboxField<\n TFieldValues extends FieldValues = FieldValues\n>({\n children,\n className,\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n text,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n text?: string\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n className={cn('block', className)}\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Label\n className=\"flex items-start gap-3 rounded-lg border p-3 hover:bg-accent/50 has-aria-checked:border-info-foreground has-aria-checked:bg-info\"\n data-slot=\"field-label\"\n >\n <Checkbox\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50 data-[state=checked]:border-info-foreground data-[state=checked]:bg-info-foreground data-[state=checked]:text-white dark:data-[state=checked]:border-info-foreground dark:data-[state=checked]:bg-info-foreground\"\n disabled={field.disabled}\n id={inputId}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n <div className=\"grid gap-1.5 font-normal\">\n <p className=\"text-sm leading-none font-medium\">{label}</p>\n {text ? (\n <p className=\"text-sm text-muted-foreground\">{text}</p>\n ) : (\n children\n )}\n <ErrorMonitor error={fieldState.error} />\n </div>\n </Label>\n </Field>\n )}\n />\n )\n}\n","import {\n Button,\n Field,\n FieldDescription,\n FieldLabel,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue\n} from '@gmcode/react-ui'\nimport { X } from 'lucide-react'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type {\n FieldPathValue,\n FieldValues,\n UseFormSetValue\n} from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function NullableSelectField<\n TFieldValues extends FieldValues = FieldValues\n>({\n autoComplete,\n control,\n description,\n disabled,\n inputId,\n inputName,\n label,\n options,\n placeholder,\n setValue,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n description?: string\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Option[]\n placeholder?: string\n setValue: UseFormSetValue<TFieldValues>\n type?: HTMLInputTypeAttribute\n}) {\n // i18n\n const { t } = useTranslation('forms')\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <div className=\"flex items-end gap-4\">\n <Select\n autoComplete={autoComplete}\n disabled={field.disabled}\n name={field.name}\n onValueChange={field.onChange}\n value={field.value}\n >\n <SelectTrigger\n aria-invalid={fieldState.invalid}\n className=\"flex-1 overflow-hidden\"\n id={inputId ?? (label ? inputName : undefined)}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem\n id={option.id}\n key={option.key ?? option.id ?? option.value}\n value={option.value}\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n <Button\n aria-label={t(($) => $.reset)}\n className=\"flex-none\"\n onClick={() =>\n setValue(\n inputName,\n '' as FieldPathValue<TFieldValues, FieldPath<TFieldValues>>\n )\n }\n type=\"button\"\n variant=\"outline\"\n >\n <X />\n </Button>\n </div>\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import {\n Field,\n FieldLabel,\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput\n} from '@gmcode/react-ui'\nimport { Minus, Plus } from 'lucide-react'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type {\n FieldPathValue,\n FieldValues,\n UseFormSetValue\n} from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nfunction stepInput(\n original: string,\n add: boolean,\n step?: number,\n min?: number,\n max?: number\n) {\n let parsed = Number(original)\n\n if (isNaN(parsed)) {\n return ''\n }\n\n if (add) {\n parsed += step === undefined ? 1 : step\n } else {\n parsed -= step === undefined ? 1 : step\n }\n\n if (min !== undefined) {\n parsed = Math.max(parsed, min)\n }\n\n if (max !== undefined) {\n parsed = Math.min(parsed, max)\n }\n\n return parsed.toString()\n}\n\nexport function NumericField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n disabled,\n inputId,\n inputMode = 'numeric',\n inputName,\n label,\n placeholder,\n type,\n ui,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputMode?: 'decimal' | 'numeric'\n inputName: FieldPath<TFieldValues>\n label?: string\n placeholder?: string\n type?: HTMLInputTypeAttribute\n ui?: {\n max?: number\n min?: number\n setValue: UseFormSetValue<TFieldValues>\n step?: number\n }\n}) {\n // i18n\n const { t } = useTranslation('forms')\n\n function stepValue(value: string, add: boolean) {\n if (ui?.setValue) {\n ui.setValue(\n inputName,\n stepInput(value, add, ui.step, ui.min, ui.max) as FieldPathValue<\n TFieldValues,\n FieldPath<TFieldValues>\n >,\n { shouldValidate: true }\n )\n }\n }\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <InputGroup>\n <InputGroupInput\n aria-invalid={fieldState.invalid}\n autoComplete={autoComplete}\n id={inputId ?? (label ? inputName : undefined)}\n inputMode={inputMode}\n placeholder={placeholder}\n type={type}\n {...field}\n />\n\n {ui && (\n <InputGroupAddon align=\"inline-end\">\n <InputGroupButton\n aria-label={t(($) => $.decrease)}\n disabled={disabled}\n onClick={() => stepValue(field.value, false)}\n size=\"icon-xs\"\n >\n <Minus />\n </InputGroupButton>\n\n <InputGroupButton\n aria-label={t(($) => $.increase)}\n disabled={disabled}\n onClick={() => stepValue(field.value, true)}\n size=\"icon-xs\"\n >\n <Plus />\n </InputGroupButton>\n </InputGroupAddon>\n )}\n </InputGroup>\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function PasswordField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'off',\n type = 'password',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import {\n Field,\n FieldDescription,\n FieldLabel,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue\n} from '@gmcode/react-ui'\nimport type {\n ComponentProps,\n HTMLInputAutoCompleteAttribute,\n HTMLInputTypeAttribute\n} from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\nimport type { Option } from '@/types'\n\nexport function SelectField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete,\n control,\n description,\n disabled,\n inputId,\n inputName,\n label,\n options,\n placeholder,\n ...props\n}: ComponentProps<typeof Field> & {\n autoComplete?: HTMLInputAutoCompleteAttribute\n control: Control<TFieldValues>\n description?: string\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n options: Option[]\n placeholder?: string\n type?: HTMLInputTypeAttribute\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <Select\n autoComplete={autoComplete}\n disabled={field.disabled}\n name={field.name}\n onValueChange={field.onChange}\n value={field.value}\n >\n <SelectTrigger\n aria-invalid={fieldState.invalid}\n id={inputId ?? (label ? inputName : undefined)}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem\n id={option.id}\n key={option.key ?? option.id ?? option.value}\n value={option.value}\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {description && <FieldDescription>{description}</FieldDescription>}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import { Button, Spinner, cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport { useTranslation } from 'react-i18next'\n\nexport function Submit({\n label,\n loading = false,\n type = 'submit',\n ...props\n}: ComponentProps<typeof Button> & {\n label?: string\n loading?: boolean\n}) {\n // i18n\n const { t } = useTranslation('forms')\n\n return (\n <Button\n disabled={loading}\n type={type}\n {...props}\n >\n <div className=\"relative\">\n <span className={cn({ invisible: loading })}>\n {label ?? t(($) => $.submit)}\n </span>\n <Spinner\n className={cn(\n 'trans absolute top-1/2 left-1/2 hidden -translate-x-1/2 -translate-y-1/2',\n { block: loading }\n )}\n />\n </div>\n </Button>\n )\n}\n","import { Field, FieldLabel, Switch } from '@gmcode/react-ui'\nimport type { Checkbox as CheckboxPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { ControllerRenderProps, FieldValues } from 'react-hook-form'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function SwitchField<TFieldValues extends FieldValues = FieldValues>({\n control,\n disabled,\n inputId,\n inputName,\n label,\n onCheckedChange,\n orientation = 'horizontal',\n readOnly,\n uncheckedValue = '',\n value = 'true',\n ...props\n}: ComponentProps<typeof Field> & {\n control: Control<TFieldValues>\n disabled?: boolean\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n onCheckedChange?: (\n checked: CheckboxPrimitive.CheckedState,\n field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>\n ) => void\n readOnly?: boolean\n uncheckedValue?: string\n value?: string\n}) {\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n orientation={orientation}\n {...props}\n >\n <Switch\n aria-invalid={fieldState.invalid}\n aria-readonly={readOnly}\n checked={field.value === value}\n className=\"aria-readonly:opacity-50\"\n disabled={field.disabled}\n id={inputId ?? (label ? inputName : undefined)}\n name={field.name}\n onBlur={field.onBlur}\n onCheckedChange={(checked) => {\n if (!readOnly) {\n field.onChange(checked === true ? value : uncheckedValue)\n if (onCheckedChange) onCheckedChange(checked, field)\n }\n }}\n ref={field.ref}\n value={value}\n />\n\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n","import type { ComponentProps } from 'react'\nimport type { FieldValues } from 'react-hook-form'\nimport { InputField } from '@/components/input-field'\n\nexport function TextField<TFieldValues extends FieldValues = FieldValues>({\n autoComplete = 'on',\n type = 'text',\n ...props\n}: ComponentProps<typeof InputField<TFieldValues>>) {\n return (\n <InputField\n autoComplete={autoComplete}\n type={type}\n {...props}\n />\n )\n}\n","import { Field, FieldLabel, TextareaAutosize, cn } from '@gmcode/react-ui'\nimport type { ComponentProps } from 'react'\nimport { type Control, Controller, type FieldPath } from 'react-hook-form'\nimport type { FieldValues } from 'react-hook-form'\nimport type { TextareaHeightChangeMeta } from 'react-textarea-autosize'\nimport { ErrorMonitor } from '@/components/error-monitor'\n\nexport function TextareaField<TFieldValues extends FieldValues = FieldValues>({\n cacheMeasurements,\n control,\n inputId,\n inputName,\n label,\n maxRows,\n minRows,\n onHeightChange,\n placeholder,\n resize = 'none',\n ...props\n}: ComponentProps<typeof Field> & {\n cacheMeasurements?: boolean\n control: Control<TFieldValues>\n inputId?: string\n inputName: FieldPath<TFieldValues>\n label?: string\n maxRows?: number\n minRows?: number\n onHeightChange?: (height: number, meta: TextareaHeightChangeMeta) => void\n placeholder?: string\n resize?: 'both' | 'none' | 'x' | 'y'\n}) {\n return (\n <Controller\n control={control}\n name={inputName}\n render={({ field, fieldState }) => (\n <Field\n data-invalid={fieldState.invalid}\n {...props}\n >\n {label && (\n <FieldLabel htmlFor={inputId ?? inputName}>{label}</FieldLabel>\n )}\n\n <TextareaAutosize\n aria-invalid={fieldState.invalid}\n autoComplete=\"off\"\n cacheMeasurements={cacheMeasurements}\n className={cn({\n resize: resize === 'both',\n 'resize-none': resize === 'none',\n 'resize-x': resize === 'x',\n 'resize-y': resize === 'y'\n })}\n id={inputId ?? (label ? inputName : undefined)}\n maxRows={maxRows}\n minRows={minRows}\n onHeightChange={onHeightChange}\n placeholder={placeholder}\n {...field}\n />\n\n <ErrorMonitor error={fieldState.error} />\n </Field>\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAM,OAAc,eAAe;CACjC,aAAa;CACb,eAAe,EAAE,aAAa,MAAM;CACpC,WAAW,EAAE,eAAG;AAClB,CAAC;AAEI,KAAK,KAAK;;;;ACRf,SAAO,aAAA,IAAA;CAA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js";
1
+ import { t as en_default } from "./en-Bh8xi5UO.mjs";
2
2
 
3
3
  //#region src/locales/it.ts
4
- var it_default = { translation: {
4
+ var it_default = { forms: {
5
5
  array: "Il campo deve essere un array.",
6
6
  date: "Il campo deve essere una data valida",
7
7
  decrease: "Diminuisci",
@@ -26,8 +26,8 @@ var it_default = { translation: {
26
26
 
27
27
  //#endregion
28
28
  //#region src/locales/index.ts
29
- const en = en_default.translation;
30
- const it = it_default.translation;
29
+ const en = en_default.forms;
30
+ const it = it_default.forms;
31
31
 
32
32
  //#endregion
33
33
  export { en, it };
@@ -1 +1 @@
1
- {"version":3,"file":"locales.mjs","names":["enResource","itResource"],"sources":["../src/locales/it.ts","../src/locales/index.ts"],"sourcesContent":["import type en from '@/locales/en'\n\nexport default {\n translation: {\n array: 'Il campo deve essere un array.',\n date: 'Il campo deve essere una data valida',\n decrease: 'Diminuisci',\n email: 'Il campo deve essere un indirizzo email valido.',\n hasMixed:\n 'Il campo deve contenere almeno un carattere maiuscolo ed un carattere minuscolo.',\n hasNumber: 'Il campo deve contenere almeno un numero.',\n hasSymbol: 'Il campo deve contenere almeno un simbolo.',\n increase: 'Aumenta',\n integer: 'Il campo deve essere un numero intero.',\n maxChars: 'Il campo non può contenere più di {{max}} caratteri.',\n maxValue: 'Il campo non può essere superiore a {{max}}.',\n minChars: 'Il campo deve contenere almeno {{min}} caratteri.',\n minValue: 'Il campo deve essere almeno {{min}}.',\n missing: 'Il valore non è supportato.',\n number: 'Il campo deve essere un numero.',\n numeric: 'Il campo deve essere un numero.',\n required: 'Il campo è obbligatorio.',\n reset: 'Reset',\n string: 'Il campo deve essere una stringa.',\n submit: 'Invia'\n }\n} satisfies typeof en\n","import enResource from './en'\nimport itResource from './it'\n\nconst en = enResource.translation\nconst it = itResource.translation\n\nexport { en, it }\n"],"mappings":";;;AAEA,iBAAe,EACb,aAAa;CACX,OAAO;CACP,MAAM;CACN,UAAU;CACV,OAAO;CACP,UACE;CACF,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,EACF;;;;ACvBA,MAAM,KAAKA,WAAW;AACtB,MAAM,KAAKC,WAAW"}
1
+ {"version":3,"file":"locales.mjs","names":["enResource","itResource"],"sources":["../src/locales/it.ts","../src/locales/index.ts"],"sourcesContent":["import type en from '@/locales/en'\n\nexport default {\n forms: {\n array: 'Il campo deve essere un array.',\n date: 'Il campo deve essere una data valida',\n decrease: 'Diminuisci',\n email: 'Il campo deve essere un indirizzo email valido.',\n hasMixed:\n 'Il campo deve contenere almeno un carattere maiuscolo ed un carattere minuscolo.',\n hasNumber: 'Il campo deve contenere almeno un numero.',\n hasSymbol: 'Il campo deve contenere almeno un simbolo.',\n increase: 'Aumenta',\n integer: 'Il campo deve essere un numero intero.',\n maxChars: 'Il campo non può contenere più di {{max}} caratteri.',\n maxValue: 'Il campo non può essere superiore a {{max}}.',\n minChars: 'Il campo deve contenere almeno {{min}} caratteri.',\n minValue: 'Il campo deve essere almeno {{min}}.',\n missing: 'Il valore non è supportato.',\n number: 'Il campo deve essere un numero.',\n numeric: 'Il campo deve essere un numero.',\n required: 'Il campo è obbligatorio.',\n reset: 'Reset',\n string: 'Il campo deve essere una stringa.',\n submit: 'Invia'\n }\n} satisfies typeof en\n","import enResource from './en'\nimport itResource from './it'\n\nconst en = enResource.forms\nconst it = itResource.forms\n\nexport { en, it }\n"],"mappings":";;;AAEA,iBAAe,EACb,OAAO;CACL,OAAO;CACP,MAAM;CACN,UAAU;CACV,OAAO;CACP,UACE;CACF,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,EACF;;;;ACvBA,MAAM,KAAKA,WAAW;AACtB,MAAM,KAAKC,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcode/forms",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Fully functional inertia react forms with client side validations.",
5
5
  "keywords": [
6
6
  "i18next",
@@ -32,30 +32,30 @@
32
32
  "./package.json": "./package.json"
33
33
  },
34
34
  "dependencies": {
35
+ "@gmcode/react-ui": "0.3.8",
36
+ "@gmcode/tsv-hookform": "0.1.8",
37
+ "@gmcode/tsv-input": "0.3.3",
35
38
  "i18next": "^26.3.4",
36
39
  "lucide-react": "^1.16.0",
37
40
  "radix-ui": "^1.4.3",
38
41
  "react-day-picker": "^10.0.1",
39
42
  "react-hook-form": "^7.71.2",
40
43
  "react-i18next": "^17.0.8",
41
- "react-textarea-autosize": "^8.5.9",
42
- "@gmcode/react-ui": "0.3.6",
43
- "@gmcode/tsv-hookform": "0.1.6",
44
- "@gmcode/tsv-input": "0.3.1"
44
+ "react-textarea-autosize": "^8.5.9"
45
45
  },
46
46
  "devDependencies": {
47
+ "@repo/badge": "0.0.1",
48
+ "@repo/mock-inertia": "3.5.0",
49
+ "@repo/themes": "0.0.1",
50
+ "@repo/typescript": "0.0.1",
47
51
  "@types/react": "^19.2.17",
48
52
  "@types/react-dom": "^19.2.3",
49
53
  "msw": "^2.15.0",
50
54
  "typescript": "^6.0.3",
51
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.7",
52
- "vite-plus": "0.2.7",
55
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
56
+ "vite-plus": "0.3.0",
53
57
  "vitest": "4.1.10",
54
- "vitest-browser-react": "^2.2.0",
55
- "@repo/typescript": "0.0.1",
56
- "@repo/mock-inertia": "3.5.0",
57
- "@repo/themes": "0.0.1",
58
- "@repo/badge": "0.0.1"
58
+ "vitest-browser-react": "^2.2.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@inertiajs/core": "^3.5.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-kNGdq3xk.mjs","names":[],"sources":["../src/locales/en.ts"],"sourcesContent":["import type { Resource } from 'i18next'\n\nexport default {\n translation: {\n array: 'The field must be an array.',\n date: 'The field must be a valid date',\n decrease: 'Decrease',\n email: 'The field must be a valid email address.',\n hasMixed:\n 'The field must contain at least one uppercase and one lowercase letter.',\n hasNumber: 'The field must contain at least one number.',\n hasSymbol: 'The field must contain at least one symbol.',\n increase: 'Increase',\n integer: 'The field must be an integer.',\n maxChars: 'The field must not be greater than {{max}} characters.',\n maxValue: 'The field must not be greater than {{max}}.',\n minChars: 'The field must be at least {{min}} characters.',\n minValue: 'The field must be at least {{min}}.',\n missing: 'The value is not supported.',\n number: 'The field must be a number.',\n numeric: 'The field must be a number.',\n required: 'The field is required.',\n reset: 'Reset',\n string: 'The field must be a string.',\n submit: 'Submit'\n }\n} satisfies Resource\n"],"mappings":";AAEA,iBAAe,EACb,aAAa;CACX,OAAO;CACP,MAAM;CACN,UAAU;CACV,OAAO;CACP,UACE;CACF,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,EACF"}