@powerhousedao/design-system 6.1.0-dev.0 → 6.1.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{checkbox-dqrYEK5V.d.ts → checkbox-Bxc7-H_k.d.ts} +2 -2
- package/dist/{checkbox-dqrYEK5V.d.ts.map → checkbox-Bxc7-H_k.d.ts.map} +1 -1
- package/dist/{command-BtOLY735.d.ts → command-D0fF-dZo.d.ts} +13 -13
- package/dist/{command-BtOLY735.d.ts.map → command-D0fF-dZo.d.ts.map} +1 -1
- package/dist/connect/components/toast/toast.js +1 -1
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +18 -18
- package/dist/connect/index.js.map +1 -1
- package/dist/{content-OpXUtrTe.d.ts → content-Ce1V2wTc.d.ts} +2 -2
- package/dist/{content-OpXUtrTe.d.ts.map → content-Ce1V2wTc.d.ts.map} +1 -1
- package/dist/{enum-field-BEyFQh8A.d.ts → enum-field-AfeEpmPc.d.ts} +4 -4
- package/dist/{enum-field-BEyFQh8A.d.ts.map → enum-field-AfeEpmPc.d.ts.map} +1 -1
- package/dist/{id-autocomplete-jkaREmPP.d.ts → id-autocomplete-ClooY-ur.d.ts} +2 -2
- package/dist/{id-autocomplete-jkaREmPP.d.ts.map → id-autocomplete-ClooY-ur.d.ts.map} +1 -1
- package/dist/{id-autocomplete-input-container-NIuWfCB_.d.ts → id-autocomplete-input-container-O7l0T0zJ.d.ts} +2 -2
- package/dist/{id-autocomplete-input-container-NIuWfCB_.d.ts.map → id-autocomplete-input-container-O7l0T0zJ.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-Bi2IXdXg.d.ts → id-autocomplete-list-CpPWWmw0.d.ts} +2 -2
- package/dist/{id-autocomplete-list-Bi2IXdXg.d.ts.map → id-autocomplete-list-CpPWWmw0.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-option-CA9HIqEh.d.ts → id-autocomplete-list-option-QmSvQwgn.d.ts} +2 -2
- package/dist/{id-autocomplete-list-option-CA9HIqEh.d.ts.map → id-autocomplete-list-option-QmSvQwgn.d.ts.map} +1 -1
- package/dist/{index-DtPJq-vz.d.ts → index-BEiWWMW2.d.ts} +2 -2
- package/dist/{index-DtPJq-vz.d.ts.map → index-BEiWWMW2.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{radio-group-field-C8MQjHb7.d.ts → radio-group-field-KY8q5UAC.d.ts} +3 -3
- package/dist/{radio-group-field-C8MQjHb7.d.ts.map → radio-group-field-KY8q5UAC.d.ts.map} +1 -1
- package/dist/{select-field-BClhLm83.d.ts → select-field-B9KcyWc1.d.ts} +2 -2
- package/dist/{select-field-BClhLm83.d.ts.map → select-field-B9KcyWc1.d.ts.map} +1 -1
- package/dist/{selected-content-q33DjCYy.d.ts → selected-content-HHOKK679.d.ts} +2 -2
- package/dist/{selected-content-q33DjCYy.d.ts.map → selected-content-HHOKK679.d.ts.map} +1 -1
- package/dist/{splitted-input-diff-Ch6IKdEa.d.ts → splitted-input-diff-DZ_0mBKD.d.ts} +2 -2
- package/dist/{splitted-input-diff-Ch6IKdEa.d.ts.map → splitted-input-diff-DZ_0mBKD.d.ts.map} +1 -1
- package/dist/{src-BgCjYazJ.js → src-BgKEHW0i.js} +2 -2
- package/dist/src-BgKEHW0i.js.map +1 -0
- package/dist/{text-field-Cx-EfZP6.d.ts → text-field-CwxxUhUk.d.ts} +3 -3
- package/dist/{text-field-Cx-EfZP6.d.ts.map → text-field-CwxxUhUk.d.ts.map} +1 -1
- package/dist/{text-input-DUddj4-C.d.ts → text-input-By73a1-n.d.ts} +2 -2
- package/dist/{text-input-DUddj4-C.d.ts.map → text-input-By73a1-n.d.ts.map} +1 -1
- package/dist/{text-input-diff-4i2zuulO.d.ts → text-input-diff-C6OK2A4u.d.ts} +2 -2
- package/dist/{text-input-diff-4i2zuulO.d.ts.map → text-input-diff-C6OK2A4u.d.ts.map} +1 -1
- package/dist/ui/components/button/button.js +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js +1 -1
- package/dist/ui/components/checkbox/checkbox.d.ts +1 -1
- package/dist/ui/components/checkbox/checkbox.js +1 -1
- package/dist/ui/components/command/command.d.ts +1 -1
- package/dist/ui/components/command/command.js +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/enum-field/types.d.ts +1 -1
- package/dist/ui/components/form/form.js +1 -1
- package/dist/ui/components/form/form.js.map +1 -1
- package/dist/ui/components/form-description/form-description.js +1 -1
- package/dist/ui/components/form-label/form-label.js +1 -1
- package/dist/ui/components/form-message/form-message.js +1 -1
- package/dist/ui/components/form-message/message-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js +1 -1
- package/dist/ui/components/id-autocomplete/types.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/use-id-autocomplete.d.ts +1 -1
- package/dist/ui/components/index.d.ts +16 -16
- package/dist/ui/components/input/splitted-input-diff.d.ts +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.d.ts +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.js +1 -1
- package/dist/ui/components/popover/popover.js +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.js +1 -1
- package/dist/ui/components/radio-group-field/radio.js +1 -1
- package/dist/ui/components/search-autocomplete/search-autocomplete.js +1 -1
- package/dist/ui/components/search-autocomplete/use-search-autocomplete.js.map +1 -1
- package/dist/ui/components/select-field/content.d.ts +1 -1
- package/dist/ui/components/select-field/content.js +1 -1
- package/dist/ui/components/select-field/select-field.d.ts +1 -1
- package/dist/ui/components/select-field/select-field.js +1 -1
- package/dist/ui/components/select-field/selected-content.d.ts +1 -1
- package/dist/ui/components/select-field/selected-content.js +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +1 -1
- package/dist/ui/components/select-field/use-select-field.d.ts +1 -1
- package/dist/ui/components/text-field/text-field.d.ts +1 -1
- package/dist/ui/components/text-input/text-input-diff.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.js +1 -1
- package/dist/ui/components/tooltip/tooltip.js +1 -1
- package/dist/ui/components/types.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.js +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.js.map +1 -1
- package/dist/ui/index.d.ts +17 -17
- package/dist/ui/types.d.ts +1 -1
- package/dist/{use-id-autocomplete-BPHVmVE8.d.ts → use-id-autocomplete-BcL_O50p.d.ts} +2 -2
- package/dist/{use-id-autocomplete-BPHVmVE8.d.ts.map → use-id-autocomplete-BcL_O50p.d.ts.map} +1 -1
- package/dist/{with-field-validation-vt0l1Sp7.d.ts → with-field-validation-BIac25Sm.d.ts} +2 -2
- package/dist/{with-field-validation-vt0l1Sp7.d.ts.map → with-field-validation-BIac25Sm.d.ts.map} +1 -1
- package/package.json +4 -4
- package/dist/src-BgCjYazJ.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-field-validation.js","names":["forwardRef","useEffect","useState","Controller","useFormContext","useFormState","withFieldValidation","Component","options","value","name","showErrorOnBlur","showErrorOnChange","validators","customValidators","props","ref","onChange","onChangeProp","onBlur","onBlurProp","control","formState","errors","formErrors","defaultValues","trigger","setValue","getValues","submitCount","Error","displayName","types","Object","values","length","push","required","initialized","setInitialized","undefined","console","warn","defaultValue","disabled","field","_","onBlurController","internalValue","rest","onBlurCallback","event","onChangeCallback","hasOwn","target","Event","HTMLElement","formFieldRef","combinedRef","element","current","message","pattern","RegExp","maxLength","minLength","minValue","min","maxValue","max","validate","fromEntries","Array","isArray","map","error","index","validations","entries","key","validatorFactory","propsWithValues","validator"],"sources":["../../../../src/ui/components/with-field-validation/with-field-validation.tsx"],"sourcesContent":["import type {\n ChangeEvent,\n ComponentType,\n ElementRef,\n FocusEvent,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport { Controller, useFormContext, useFormState } from \"react-hook-form\";\nimport type {\n FieldErrorHandling,\n InputBaseProps,\n ValidatorHandler,\n} from \"../../types.js\";\n\ninterface PossibleProps extends InputBaseProps<unknown>, FieldErrorHandling {\n pattern?: RegExp;\n maxLength?: number;\n minLength?: number;\n minValue?: number;\n maxValue?: number;\n}\n\ninterface PossibleEventsProps {\n onChange?: (event: ChangeEvent<unknown>) => unknown;\n onBlur?: (event: FocusEvent<unknown>) => unknown;\n}\n\nexport interface ValidationOptions<T> {\n validations?: Record<string, (parentProps: T) => ValidatorHandler>;\n transformValue?: (value: any) => any;\n}\n\nexport const withFieldValidation = <\n T extends PossibleProps,\n R extends ElementRef<any> = ElementRef<any>,\n>(\n Component: ComponentType<T>,\n options?: ValidationOptions<T>,\n): ForwardRefExoticComponent<PropsWithoutRef<T> & RefAttributes<R>> => {\n return forwardRef<R, T>(\n (\n {\n value,\n name,\n showErrorOnBlur,\n showErrorOnChange,\n validators: customValidators,\n ...props\n },\n ref,\n ) => {\n const { onChange: onChangeProp, onBlur: onBlurProp } =\n props as PossibleEventsProps;\n const {\n control,\n formState: { errors: formErrors, defaultValues },\n trigger,\n setValue,\n getValues,\n } = useFormContext();\n const { submitCount } = useFormState();\n\n if (!name) {\n throw new Error(\n `[Field: ${Component.displayName}] The name prop is required.`,\n );\n }\n\n const errors = [\n ...(formErrors[name]?.types\n ? (Object.values(formErrors[name].types ?? []) as string[])\n : []),\n ];\n if (errors.length === 0 && !!formErrors[name]) {\n // the field is invalid but no error message was provided\n errors.push(\"Invalid value\");\n }\n\n useEffect(() => {\n if (submitCount > 0) {\n void trigger(name);\n }\n // we should trigger a re-validation after the form is submitted, the errors are shown\n // and the required prop is changed. Other deps can not be added, otherwise a revalidation\n // will be triggered unnecessarily\n }, [props.required]);\n\n useEffect(() => {\n // if custom errors are provided, then we need to trigger the validation\n // otherwise the errors will not be shown till the form is submitted\n if (props.errors && props.errors.length > 0) {\n void trigger(name);\n }\n }, [name, props.errors, trigger]);\n\n const [initialized, setInitialized] = useState(false);\n useEffect(() => {\n if (initialized) {\n setValue(name, value);\n }\n setInitialized(true);\n // initialized can not be in the dependencies because it would cause\n // a change of the value on initial render\n }, [name, value]);\n\n if (value !== undefined && !onChangeProp) {\n console.warn(\n `[Field: ${name}] Value prop provided without onChange so it will be ignored. Use disabled/readOnly if you want to prevent changes.`,\n );\n }\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={(value ?? props.defaultValue) as unknown}\n disabled={props.disabled}\n render={({\n field: {\n // just preventing that onChange is included in the rest of the props\n onChange: _,\n onBlur: onBlurController,\n value: internalValue,\n ...rest\n },\n }) => {\n // ignore eslint that flags an error here:\n // React Hook \"useCallback\" cannot be called inside a callback.\n // React Hooks must be called in a React function component or a custom React Hook function.\n\n const onBlurCallback = (event: FocusEvent<HTMLInputElement>) => {\n if (showErrorOnBlur) {\n void trigger(name);\n } else {\n onBlurController(); // default behavior\n }\n\n // trigger parent onBlur\n if (onBlurProp) {\n onBlurProp(event);\n }\n };\n\n // ignore eslint that flags an error here:\n // React Hook \"useCallback\" cannot be called inside a callback.\n // React Hooks must be called in a React function component or a custom React Hook function.\n\n const onChangeCallback = (event: ChangeEvent<HTMLInputElement>) => {\n // update value state\n if (onChangeProp) {\n if (Object.hasOwn(event, \"target\")) {\n // it is probably an actual event\n setValue(name, event.target.value);\n } else {\n // it is a custom onChange and it pass the value directly\n setValue(name, event);\n }\n\n // the fields is controlled by the parent\n onChangeProp(event);\n } else {\n // sometimes the onChange is overridden by the parent and use the new value as parameter instead of event\n let value: unknown = event;\n if (\n event instanceof Event ||\n event.target instanceof HTMLElement\n ) {\n value = event.target.value;\n }\n setValue(name, value); // default behavior\n }\n\n // now let's validate the field\n if (\n showErrorOnChange === undefined &&\n showErrorOnBlur === undefined\n ) {\n // use form validation mode...\n // if previously validated, then validate on change\n if (submitCount > 0) {\n void trigger(name);\n }\n } else {\n // default validation behavior was overridden\n if (showErrorOnChange) {\n void trigger(name);\n }\n }\n };\n\n // extract ref from rest\n const { ref: formFieldRef } = rest;\n\n // create a combined ref\n const combinedRef = (element: R) => {\n // apply external ref if exists\n if (typeof ref === \"function\") {\n ref(element);\n } else if (ref) {\n ref.current = element;\n }\n // apply field ref\n formFieldRef(element);\n };\n\n return (\n <Component\n {...(props as unknown as T)}\n {...rest}\n value={internalValue as unknown}\n onBlur={onBlurCallback}\n onChange={onChangeCallback}\n errors={errors}\n ref={combinedRef}\n />\n );\n }}\n rules={{\n ...(props.required\n ? {\n required: {\n value: props.required,\n message: \"This field is required\",\n },\n }\n : {\n required: undefined,\n }),\n ...(props.pattern && {\n pattern: {\n value: new RegExp(props.pattern),\n message: \"This field does not match the required pattern\",\n },\n }),\n ...(props.maxLength !== undefined && props.maxLength >= 0\n ? {\n maxLength: {\n value: props.maxLength,\n message: `This field must be at most ${props.maxLength} characters`,\n },\n }\n : {\n maxLength: undefined,\n }),\n ...(props.minLength !== undefined && props.minLength >= 0\n ? {\n minLength: {\n value: props.minLength,\n message: `This field must be at least ${props.minLength} characters`,\n },\n }\n : {\n minLength: undefined,\n }),\n ...(props.minValue && {\n min: {\n value: props.minValue,\n message: `This field must be greater than or equal to ${props.minValue}`,\n },\n }),\n ...(props.maxValue && {\n max: {\n value: props.maxValue,\n message: `This field must be less than or equal to ${props.maxValue}`,\n },\n }),\n validate: {\n // custom errors provided as props\n ...(props.errors\n ? Object.fromEntries(\n Array.isArray(props.errors)\n ? props.errors.map((error, index) => [\n `_propError${index}`,\n () => error,\n ])\n : [],\n )\n : {}),\n // built in validations by the field in the library\n ...(options?.validations\n ? Object.fromEntries(\n Object.entries(options.validations).map(\n ([key, validatorFactory]) => {\n const propsWithValues = {\n value: getValues(name) as unknown, // get the actual value of the field in the form\n name,\n showErrorOnBlur,\n showErrorOnChange,\n ...props,\n };\n return [\n key,\n validatorFactory(propsWithValues as unknown as T),\n ];\n },\n ),\n )\n : {}),\n // custom validations by the user/developer\n ...(customValidators !== undefined\n ? Object.fromEntries(\n (Array.isArray(customValidators)\n ? customValidators\n : [customValidators]\n ).map((validator, index) => [\n `customValidation${index}`,\n validator,\n ]),\n )\n : {}),\n },\n }}\n />\n );\n },\n );\n};\n"],"mappings":";;;;AAmCA,MAAaM,uBAIXC,WACAC,YACqE;AACrE,QAAOR,4BAEH,EACES,OACAC,MACAC,iBACAC,mBACAC,YAAYC,kBACZ,GAAGC,SAELC,QACG;EACH,MAAM,EAAEC,UAAUC,cAAcC,QAAQC,eACtCL;EACF,MAAM,EACJM,SACAC,WAAW,EAAEC,QAAQC,YAAYC,iBACjCC,SACAC,UACAC,cACExB,gBAAgB;EACpB,MAAM,EAAEyB,gBAAgBxB,cAAc;AAEtC,MAAI,CAACK,KACH,OAAM,IAAIoB,MACR,WAAWvB,UAAUwB,YAAW,8BACjC;EAGH,MAAMR,SAAS,CACb,GAAIC,WAAWd,OAAOsB,QACjBC,OAAOC,OAAOV,WAAWd,MAAMsB,SAAS,EAAE,CAAC,GAC5C,EAAE,CACP;AACD,MAAIT,OAAOY,WAAW,KAAK,CAAC,CAACX,WAAWd,MAE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MAAMQ,OAAOmD,KAAKC,OAAOC,UAAU,CACjC,aAAaA,eACPD,MACP,CAAC,GACF,EACN,CAAC,GACD,EAAE;KAEN,GAAInE,SAASqE,cACT5C,OAAOsC,YACLtC,OAAO6C,QAAQtE,QAAQqE,YAAY,CAACH,KACjC,CAACK,KAAKC,sBAAsB;AAQ3B,aAAO,CACLD,KACAC,iBATsB;OACtBvE,OAAOmB,UAAUlB,KAAgB;OACjCA;OACAC;OACAC;OACA,GAAGG;OACJ,CAGkD,CAClD;OAGP,CAAC,GACD,EAAE;KAEN,GAAID,qBAAqB0B,KAAAA,IACrBP,OAAOsC,aACJC,MAAMC,QAAQ3D,iBAAiB,GAC5BA,mBACA,CAACA,iBAAiB,EACpB4D,KAAKQ,WAAWN,UAAU,CAC1B,mBAAmBA,SACnBM,UACD,CACH,CAAC,GACD,EAAE;KACR;IACD;GACD,CAAA;GAGP"}
|
|
1
|
+
{"version":3,"file":"with-field-validation.js","names":["forwardRef","useEffect","useState","Controller","useFormContext","useFormState","withFieldValidation","Component","options","value","name","showErrorOnBlur","showErrorOnChange","validators","customValidators","props","ref","onChange","onChangeProp","onBlur","onBlurProp","control","formState","errors","formErrors","defaultValues","_defaultValues","trigger","setValue","getValues","submitCount","Error","displayName","types","Object","values","length","push","required","initialized","setInitialized","undefined","console","warn","defaultValue","disabled","field","_","onBlurController","internalValue","rest","onBlurCallback","event","onChangeCallback","hasOwn","target","Event","HTMLElement","formFieldRef","combinedRef","element","current","message","pattern","RegExp","maxLength","minLength","minValue","min","maxValue","max","validate","fromEntries","Array","isArray","map","error","index","validations","entries","key","validatorFactory","propsWithValues","validator"],"sources":["../../../../src/ui/components/with-field-validation/with-field-validation.tsx"],"sourcesContent":["import type {\n ChangeEvent,\n ComponentType,\n ElementRef,\n FocusEvent,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport { Controller, useFormContext, useFormState } from \"react-hook-form\";\nimport type {\n FieldErrorHandling,\n InputBaseProps,\n ValidatorHandler,\n} from \"../../types.js\";\n\ninterface PossibleProps extends InputBaseProps<unknown>, FieldErrorHandling {\n pattern?: RegExp;\n maxLength?: number;\n minLength?: number;\n minValue?: number;\n maxValue?: number;\n}\n\ninterface PossibleEventsProps {\n onChange?: (event: ChangeEvent<unknown>) => unknown;\n onBlur?: (event: FocusEvent<unknown>) => unknown;\n}\n\nexport interface ValidationOptions<T> {\n validations?: Record<string, (parentProps: T) => ValidatorHandler>;\n transformValue?: (value: any) => any;\n}\n\nexport const withFieldValidation = <\n T extends PossibleProps,\n R extends ElementRef<any> = ElementRef<any>,\n>(\n Component: ComponentType<T>,\n options?: ValidationOptions<T>,\n): ForwardRefExoticComponent<PropsWithoutRef<T> & RefAttributes<R>> => {\n return forwardRef<R, T>(\n (\n {\n value,\n name,\n showErrorOnBlur,\n showErrorOnChange,\n validators: customValidators,\n ...props\n },\n ref,\n ) => {\n const { onChange: onChangeProp, onBlur: onBlurProp } =\n props as PossibleEventsProps;\n const {\n control,\n formState: { errors: formErrors, defaultValues: _defaultValues },\n trigger,\n setValue,\n getValues,\n } = useFormContext();\n const { submitCount } = useFormState();\n\n if (!name) {\n throw new Error(\n `[Field: ${Component.displayName}] The name prop is required.`,\n );\n }\n\n const errors = [\n ...(formErrors[name]?.types\n ? (Object.values(formErrors[name].types ?? []) as string[])\n : []),\n ];\n if (errors.length === 0 && !!formErrors[name]) {\n // the field is invalid but no error message was provided\n errors.push(\"Invalid value\");\n }\n\n useEffect(() => {\n if (submitCount > 0) {\n void trigger(name);\n }\n // we should trigger a re-validation after the form is submitted, the errors are shown\n // and the required prop is changed. Other deps can not be added, otherwise a revalidation\n // will be triggered unnecessarily\n }, [props.required]);\n\n useEffect(() => {\n // if custom errors are provided, then we need to trigger the validation\n // otherwise the errors will not be shown till the form is submitted\n if (props.errors && props.errors.length > 0) {\n void trigger(name);\n }\n }, [name, props.errors, trigger]);\n\n const [initialized, setInitialized] = useState(false);\n useEffect(() => {\n if (initialized) {\n setValue(name, value);\n }\n setInitialized(true);\n // initialized can not be in the dependencies because it would cause\n // a change of the value on initial render\n }, [name, value]);\n\n if (value !== undefined && !onChangeProp) {\n console.warn(\n `[Field: ${name}] Value prop provided without onChange so it will be ignored. Use disabled/readOnly if you want to prevent changes.`,\n );\n }\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={(value ?? props.defaultValue) as unknown}\n disabled={props.disabled}\n render={({\n field: {\n // just preventing that onChange is included in the rest of the props\n onChange: _,\n onBlur: onBlurController,\n value: internalValue,\n ...rest\n },\n }) => {\n // ignore eslint that flags an error here:\n // React Hook \"useCallback\" cannot be called inside a callback.\n // React Hooks must be called in a React function component or a custom React Hook function.\n\n const onBlurCallback = (event: FocusEvent<HTMLInputElement>) => {\n if (showErrorOnBlur) {\n void trigger(name);\n } else {\n onBlurController(); // default behavior\n }\n\n // trigger parent onBlur\n if (onBlurProp) {\n onBlurProp(event);\n }\n };\n\n // ignore eslint that flags an error here:\n // React Hook \"useCallback\" cannot be called inside a callback.\n // React Hooks must be called in a React function component or a custom React Hook function.\n\n const onChangeCallback = (event: ChangeEvent<HTMLInputElement>) => {\n // update value state\n if (onChangeProp) {\n if (Object.hasOwn(event, \"target\")) {\n // it is probably an actual event\n setValue(name, event.target.value);\n } else {\n // it is a custom onChange and it pass the value directly\n setValue(name, event);\n }\n\n // the fields is controlled by the parent\n onChangeProp(event);\n } else {\n // sometimes the onChange is overridden by the parent and use the new value as parameter instead of event\n let value: unknown = event;\n if (\n event instanceof Event ||\n event.target instanceof HTMLElement\n ) {\n value = event.target.value;\n }\n setValue(name, value); // default behavior\n }\n\n // now let's validate the field\n if (\n showErrorOnChange === undefined &&\n showErrorOnBlur === undefined\n ) {\n // use form validation mode...\n // if previously validated, then validate on change\n if (submitCount > 0) {\n void trigger(name);\n }\n } else {\n // default validation behavior was overridden\n if (showErrorOnChange) {\n void trigger(name);\n }\n }\n };\n\n // extract ref from rest\n const { ref: formFieldRef } = rest;\n\n // create a combined ref\n const combinedRef = (element: R) => {\n // apply external ref if exists\n if (typeof ref === \"function\") {\n ref(element);\n } else if (ref) {\n ref.current = element;\n }\n // apply field ref\n formFieldRef(element);\n };\n\n return (\n <Component\n {...(props as unknown as T)}\n {...rest}\n value={internalValue as unknown}\n onBlur={onBlurCallback}\n onChange={onChangeCallback}\n errors={errors}\n ref={combinedRef}\n />\n );\n }}\n rules={{\n ...(props.required\n ? {\n required: {\n value: props.required,\n message: \"This field is required\",\n },\n }\n : {\n required: undefined,\n }),\n ...(props.pattern && {\n pattern: {\n value: new RegExp(props.pattern),\n message: \"This field does not match the required pattern\",\n },\n }),\n ...(props.maxLength !== undefined && props.maxLength >= 0\n ? {\n maxLength: {\n value: props.maxLength,\n message: `This field must be at most ${props.maxLength} characters`,\n },\n }\n : {\n maxLength: undefined,\n }),\n ...(props.minLength !== undefined && props.minLength >= 0\n ? {\n minLength: {\n value: props.minLength,\n message: `This field must be at least ${props.minLength} characters`,\n },\n }\n : {\n minLength: undefined,\n }),\n ...(props.minValue && {\n min: {\n value: props.minValue,\n message: `This field must be greater than or equal to ${props.minValue}`,\n },\n }),\n ...(props.maxValue && {\n max: {\n value: props.maxValue,\n message: `This field must be less than or equal to ${props.maxValue}`,\n },\n }),\n validate: {\n // custom errors provided as props\n ...(props.errors\n ? Object.fromEntries(\n Array.isArray(props.errors)\n ? props.errors.map((error, index) => [\n `_propError${index}`,\n () => error,\n ])\n : [],\n )\n : {}),\n // built in validations by the field in the library\n ...(options?.validations\n ? Object.fromEntries(\n Object.entries(options.validations).map(\n ([key, validatorFactory]) => {\n const propsWithValues = {\n value: getValues(name) as unknown, // get the actual value of the field in the form\n name,\n showErrorOnBlur,\n showErrorOnChange,\n ...props,\n };\n return [\n key,\n validatorFactory(propsWithValues as unknown as T),\n ];\n },\n ),\n )\n : {}),\n // custom validations by the user/developer\n ...(customValidators !== undefined\n ? Object.fromEntries(\n (Array.isArray(customValidators)\n ? customValidators\n : [customValidators]\n ).map((validator, index) => [\n `customValidation${index}`,\n validator,\n ]),\n )\n : {}),\n },\n }}\n />\n );\n },\n );\n};\n"],"mappings":";;;;AAmCA,MAAaM,uBAIXC,WACAC,YACqE;AACrE,QAAOR,4BAEH,EACES,OACAC,MACAC,iBACAC,mBACAC,YAAYC,kBACZ,GAAGC,SAELC,QACG;EACH,MAAM,EAAEC,UAAUC,cAAcC,QAAQC,eACtCL;EACF,MAAM,EACJM,SACAC,WAAW,EAAEC,QAAQC,YAAYC,eAAeC,kBAChDC,SACAC,UACAC,cACEzB,gBAAgB;EACpB,MAAM,EAAE0B,gBAAgBzB,cAAc;AAEtC,MAAI,CAACK,KACH,OAAM,IAAIqB,MACR,WAAWxB,UAAUyB,YAAW,8BACjC;EAGH,MAAMT,SAAS,CACb,GAAIC,WAAWd,OAAOuB,QACjBC,OAAOC,OAAOX,WAAWd,MAAMuB,SAAS,EAAE,CAAC,GAC5C,EAAE,CACP;AACD,MAAIV,OAAOa,WAAW,KAAK,CAAC,CAACZ,WAAWd,MAEtCa,QAAOc,KAAK,gBAAgB;AAG9BpC,kBAAgB;AACd,OAAI6B,cAAc,EACXH,SAAQjB,KAAK;KAKnB,CAACK,MAAMuB,SAAS,CAAC;AAEpBrC,kBAAgB;AAGd,OAAIc,MAAMQ,UAAUR,MAAMQ,OAAOa,SAAS,EACnCT,SAAQjB,KAAK;KAEnB;GAACA;GAAMK,MAAMQ;GAAQI;GAAQ,CAAC;EAEjC,MAAM,CAACY,aAAaC,kBAAkBtC,SAAS,MAAM;AACrDD,kBAAgB;AACd,OAAIsC,YACFX,UAASlB,MAAMD,MAAM;AAEvB+B,kBAAe,KAAK;KAGnB,CAAC9B,MAAMD,MAAM,CAAC;AAEjB,MAAIA,UAAUgC,KAAAA,KAAa,CAACvB,aAC1BwB,SAAQC,KACN,WAAWjC,KAAI,qHAChB;AAGH,SACE,oBAAC,YAAD;GACWW;GACHX;GACN,cAAeD,SAASM,MAAM6B;GAC9B,UAAU7B,MAA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
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as SelectProps, S as SelectOption, _ as WithDifference, a as AmountInputPropsGeneric, b as RadioGroupProps, c as Currency, d as ErrorMessage, f as FieldErrorHandling, g as ViewMode, h as ValidatorResult, i as AmountFiat, l as CurrencyTicker, m as ValidatorHandler, n as AmountCrypto, o as AmountPercentage, p as InputBaseProps, r as AmountCurrency, s as AmountValue, t as Amount, u as DiffMode, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../index-
|
|
1
|
+
import { C as SelectProps, S as SelectOption, _ as WithDifference, a as AmountInputPropsGeneric, b as RadioGroupProps, c as Currency, d as ErrorMessage, f as FieldErrorHandling, g as ViewMode, h as ValidatorResult, i as AmountFiat, l as CurrencyTicker, m as ValidatorHandler, n as AmountCrypto, o as AmountPercentage, p as InputBaseProps, r as AmountCurrency, s as AmountValue, t as Amount, u as DiffMode, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../index-BEiWWMW2.js";
|
|
2
2
|
import { a as TransformerType, c as WeekStartDayNumber, i as TransformerTrigger, n as DatePickerView, o as ValueTransformerFn, r as TransformerObject, s as ValueTransformerProps, t as DateFieldValue } from "../types-tThrTH_c.js";
|
|
3
3
|
import { n as ButtonProps, r as buttonVariants, t as Button } from "../button-49Walvwn.js";
|
|
4
4
|
import { n as CharacterCounterProps, t as CharacterCounter } from "../character-counter-BcuG4STA.js";
|
|
5
5
|
import { n as CheckboxValue, t as CheckboxBase } from "../checkbox-base-8xXJvAbj.js";
|
|
6
|
-
import { n as CheckboxProps, t as Checkbox } from "../checkbox-
|
|
7
|
-
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../command-
|
|
8
|
-
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../radio-group-field-
|
|
9
|
-
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../select-field-
|
|
10
|
-
import { n as EnumFieldProps, t as EnumField } from "../enum-field-
|
|
6
|
+
import { n as CheckboxProps, t as Checkbox } from "../checkbox-Bxc7-H_k.js";
|
|
7
|
+
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../command-D0fF-dZo.js";
|
|
8
|
+
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../radio-group-field-KY8q5UAC.js";
|
|
9
|
+
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../select-field-B9KcyWc1.js";
|
|
10
|
+
import { n as EnumFieldProps, t as EnumField } from "../enum-field-AfeEpmPc.js";
|
|
11
11
|
import { n as FormDescriptionProps, t as FormDescription } from "../form-description-BpST5Ww-.js";
|
|
12
12
|
import { t as FormGroup } from "../form-group-BauWlFkQ.js";
|
|
13
13
|
import { n as FormLabelProps, t as FormLabel } from "../form-label-Cz_gcj-B.js";
|
|
@@ -15,13 +15,13 @@ import { n as FormMessageProps, r as FormMessageType, t as FormMessage } from ".
|
|
|
15
15
|
import { t as FormServerErrorMessage } from "../form-server-error-message-CzMQQ8ru.js";
|
|
16
16
|
import { t as FormMessageList } from "../message-list-aysvo-xf.js";
|
|
17
17
|
import { t as Form } from "../form-B9JNvrH6.js";
|
|
18
|
-
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../id-autocomplete-input-container-
|
|
19
|
-
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../id-autocomplete-list-option-
|
|
20
|
-
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../id-autocomplete-list-
|
|
21
|
-
import { t as IdAutocomplete } from "../id-autocomplete-
|
|
22
|
-
import { t as useIdAutocomplete } from "../use-id-autocomplete-
|
|
18
|
+
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../id-autocomplete-input-container-O7l0T0zJ.js";
|
|
19
|
+
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../id-autocomplete-list-option-QmSvQwgn.js";
|
|
20
|
+
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../id-autocomplete-list-CpPWWmw0.js";
|
|
21
|
+
import { t as IdAutocomplete } from "../id-autocomplete-ClooY-ur.js";
|
|
22
|
+
import { t as useIdAutocomplete } from "../use-id-autocomplete-BcL_O50p.js";
|
|
23
23
|
import { n as InputProps, t as Input } from "../input-D11GgWGm.js";
|
|
24
|
-
import { t as SplittedInputDiff } from "../splitted-input-diff-
|
|
24
|
+
import { t as SplittedInputDiff } from "../splitted-input-diff-DZ_0mBKD.js";
|
|
25
25
|
import { t as JsonViewer } from "../json-viewer-vWp8vOvz.js";
|
|
26
26
|
import { i as PopoverTrigger, n as PopoverAnchor, r as PopoverContent, t as Popover } from "../popover-glLRVxPS.js";
|
|
27
27
|
import { n as RadioGroup, t as CustomizableRadioGroupProps } from "../radio-group-DjJbcDzB.js";
|
|
@@ -29,11 +29,11 @@ import { n as RadioProps, t as Radio } from "../radio-DZ4xl9oz.js";
|
|
|
29
29
|
import { n as SearchAutocompleteProps, r as SearchAutocompleteRowContext, t as SearchAutocompleteOption } from "../types-9JRQnd7a.js";
|
|
30
30
|
import { t as SearchAutocomplete } from "../search-autocomplete-OeZbE-VN.js";
|
|
31
31
|
import { t as useSearchAutocomplete } from "../use-search-autocomplete-Xf7shCtk.js";
|
|
32
|
-
import { t as Content } from "../content-
|
|
33
|
-
import { t as SelectedContent } from "../selected-content-
|
|
34
|
-
import { n as TextInputProps, t as TextInput } from "../text-input-
|
|
35
|
-
import { n as TextFieldProps, t as TextField } from "../text-field-
|
|
32
|
+
import { t as Content } from "../content-Ce1V2wTc.js";
|
|
33
|
+
import { t as SelectedContent } from "../selected-content-HHOKK679.js";
|
|
34
|
+
import { n as TextInputProps, t as TextInput } from "../text-input-By73a1-n.js";
|
|
35
|
+
import { n as TextFieldProps, t as TextField } from "../text-field-CwxxUhUk.js";
|
|
36
36
|
import { a as TooltipProps, i as TooltipContent, n as Root, o as Trigger, r as Tooltip, t as Provider } from "../tooltip-Cf5jSzdt.js";
|
|
37
37
|
import { t as ValueTransformer } from "../value-transformer-DCiU65Qa.js";
|
|
38
|
-
import { n as withFieldValidation, t as ValidationOptions } from "../with-field-validation-
|
|
38
|
+
import { n as withFieldValidation, t as ValidationOptions } from "../with-field-validation-BIac25Sm.js";
|
|
39
39
|
export { Amount, AmountCrypto, AmountCurrency, AmountFiat, AmountInputPropsGeneric, AmountPercentage, AmountValue, Button, ButtonProps, CharacterCounter, CharacterCounterProps, Checkbox, CheckboxBase, CheckboxProps, CheckboxValue, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, Content, Currency, CurrencyTicker, CustomizableRadioGroupProps, DateFieldValue, DatePickerView, DiffMode, EnumField, EnumFieldProps, ErrorMessage, FieldErrorHandling, Form, FormDescription, FormDescriptionProps, FormGroup, FormLabel, FormLabelProps, FormMessage, FormMessageList, FormMessageProps, FormMessageType, FormServerErrorMessage, IdAutocomplete, IdAutocompleteInputContainer, IdAutocompleteInputContainerProps, IdAutocompleteList, IdAutocompleteListOption, IdAutocompleteListOptionProps, IdAutocompleteListProps, IdAutocompleteOption, IdAutocompleteProps, Input, InputBaseProps, InputProps, JsonViewer, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Radio, RadioGroup, RadioGroupField, RadioGroupFieldProps, RadioGroupProps, RadioProps, SearchAutocomplete, SearchAutocompleteOption, SearchAutocompleteProps, SearchAutocompleteRowContext, SelectBaseProps, SelectField, SelectFieldProps, SelectFieldRaw, SelectOption, SelectProps, SelectedContent, SplittedInputDiff, TextField, TextFieldProps, TextInput, TextInputProps, Tooltip, TooltipContent, TooltipProps, Provider as TooltipProvider, Root as TooltipRoot, Trigger as TooltipTrigger, TransformerObject, TransformerTrigger, TransformerType, ValidationOptions, ValidatorHandler, ValidatorResult, ValueTransformer, ValueTransformerFn, ValueTransformerProps, ViewMode, WeekStartDayNumber, WithDifference, buttonVariants, useIdAutocomplete, useSearchAutocomplete, withFieldValidation };
|
package/dist/ui/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as SelectProps, S as SelectOption, _ as WithDifference, a as AmountInputPropsGeneric, b as RadioGroupProps, c as Currency, d as ErrorMessage, f as FieldErrorHandling, g as ViewMode, h as ValidatorResult, i as AmountFiat, l as CurrencyTicker, m as ValidatorHandler, n as AmountCrypto, o as AmountPercentage, p as InputBaseProps, r as AmountCurrency, s as AmountValue, t as Amount, u as DiffMode, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../index-
|
|
1
|
+
import { C as SelectProps, S as SelectOption, _ as WithDifference, a as AmountInputPropsGeneric, b as RadioGroupProps, c as Currency, d as ErrorMessage, f as FieldErrorHandling, g as ViewMode, h as ValidatorResult, i as AmountFiat, l as CurrencyTicker, m as ValidatorHandler, n as AmountCrypto, o as AmountPercentage, p as InputBaseProps, r as AmountCurrency, s as AmountValue, t as Amount, u as DiffMode, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../index-BEiWWMW2.js";
|
|
2
2
|
import { a as TransformerType, c as WeekStartDayNumber, i as TransformerTrigger, n as DatePickerView, o as ValueTransformerFn, r as TransformerObject, s as ValueTransformerProps, t as DateFieldValue } from "../types-tThrTH_c.js";
|
|
3
3
|
export { Amount, AmountCrypto, AmountCurrency, AmountFiat, AmountInputPropsGeneric, AmountPercentage, AmountValue, Currency, CurrencyTicker, DateFieldValue, DatePickerView, DiffMode, ErrorMessage, FieldErrorHandling, IdAutocompleteOption, IdAutocompleteProps, InputBaseProps, RadioGroupProps, SelectBaseProps, SelectOption, SelectProps, TransformerObject, TransformerTrigger, TransformerType, ValidatorHandler, ValidatorResult, ValueTransformerFn, ValueTransformerProps, ViewMode, WeekStartDayNumber, WithDifference };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as IdAutocompleteOption, y as IdAutocompleteProps } from "./index-
|
|
1
|
+
import { v as IdAutocompleteOption, y as IdAutocompleteProps } from "./index-BEiWWMW2.js";
|
|
2
2
|
import * as react from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/ui/components/id-autocomplete/use-id-autocomplete.d.ts
|
|
@@ -44,4 +44,4 @@ declare function useIdAutocomplete({
|
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
export { useIdAutocomplete as t };
|
|
47
|
-
//# sourceMappingURL=use-id-autocomplete-
|
|
47
|
+
//# sourceMappingURL=use-id-autocomplete-BcL_O50p.d.ts.map
|
package/dist/{use-id-autocomplete-BPHVmVE8.d.ts.map → use-id-autocomplete-BcL_O50p.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-id-autocomplete-
|
|
1
|
+
{"version":3,"file":"use-id-autocomplete-BcL_O50p.d.ts","names":[],"sources":["../src/ui/components/id-autocomplete/use-id-autocomplete.ts"],"mappings":";;;;UAKU,uBAAA;EACR,YAAA,EAAc,mBAAA;EACd,YAAA;EACA,KAAA;EACA,eAAA,EAAiB,mBAAA;EACjB,cAAA,EAAgB,mBAAA;EAChB,QAAA,GAAW,mBAAA;EACX,MAAA,GAAS,KAAA,CAAM,iBAAA,CAAkB,gBAAA;EACjC,YAAA,EAAc,mBAAA;EACd,mBAAA,EAAqB,mBAAA;AAAA;AAAA,iBAGP,iBAAA,CAAA;EACd,YAAA;EACA,YAAA;EACA,KAAA;EACA,eAAA;EACA,cAAA;EACA,QAAA;EACA,MAAA;EACA,YAAA;EACA;AAAA,GACC,uBAAA;;;;;;;;;;;;;qBAkKK,KAAA,CAAM,UAAA,CAAW,gBAAA;oBAfjB,KAAA,CAAM,WAAA,CAAY,gBAAA;;;mBAwBlB,KAAA,CAAM,cAAA,CAAe,gBAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as FieldErrorHandling, m as ValidatorHandler, p as InputBaseProps } from "./index-
|
|
1
|
+
import { f as FieldErrorHandling, m as ValidatorHandler, p as InputBaseProps } from "./index-BEiWWMW2.js";
|
|
2
2
|
import { ComponentType, ElementRef, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/ui/components/with-field-validation/with-field-validation.d.ts
|
|
@@ -16,4 +16,4 @@ interface ValidationOptions<T> {
|
|
|
16
16
|
declare const withFieldValidation: <T extends PossibleProps, R extends ElementRef<any> = ElementRef<any>>(Component: ComponentType<T>, options?: ValidationOptions<T>) => ForwardRefExoticComponent<PropsWithoutRef<T> & RefAttributes<R>>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { withFieldValidation as n, ValidationOptions as t };
|
|
19
|
-
//# sourceMappingURL=with-field-validation-
|
|
19
|
+
//# sourceMappingURL=with-field-validation-BIac25Sm.d.ts.map
|
package/dist/{with-field-validation-vt0l1Sp7.d.ts.map → with-field-validation-BIac25Sm.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-field-validation-
|
|
1
|
+
{"version":3,"file":"with-field-validation-BIac25Sm.d.ts","names":[],"sources":["../src/ui/components/with-field-validation/with-field-validation.tsx"],"mappings":";;;;UAiBU,aAAA,SAAsB,cAAA,WAAyB,kBAAA;EACvD,OAAA,GAAU,MAAA;EACV,SAAA;EACA,SAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,UAQe,iBAAA;EACf,WAAA,GAAc,MAAA,UAAgB,WAAA,EAAa,CAAA,KAAM,gBAAA;EACjD,cAAA,IAAkB,KAAA;AAAA;AAAA,cAGP,mBAAA,aACD,aAAA,YACA,UAAA,QAAkB,UAAA,OAE5B,SAAA,EAAW,aAAA,CAAc,CAAA,GACzB,OAAA,GAAU,iBAAA,CAAkB,CAAA,MAC3B,yBAAA,CAA0B,eAAA,CAAgB,CAAA,IAAK,aAAA,CAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/design-system",
|
|
3
|
-
"version": "6.1.0-dev.
|
|
3
|
+
"version": "6.1.0-dev.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"tsx": "4.21.0",
|
|
108
108
|
"vite": "8.0.8",
|
|
109
109
|
"vitest": "4.1.1",
|
|
110
|
-
"@powerhousedao/config": "6.1.0-dev.
|
|
110
|
+
"@powerhousedao/config": "6.1.0-dev.10"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"react": ">=19.0.0",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"tailwind-merge": "3.4.0",
|
|
140
140
|
"type-fest": "5.6.0",
|
|
141
141
|
"usehooks-ts": "^3.1.1",
|
|
142
|
-
"@powerhousedao/reactor-browser": "6.1.0-dev.
|
|
143
|
-
"@powerhousedao/shared": "6.1.0-dev.
|
|
142
|
+
"@powerhousedao/reactor-browser": "6.1.0-dev.10",
|
|
143
|
+
"@powerhousedao/shared": "6.1.0-dev.10"
|
|
144
144
|
},
|
|
145
145
|
"scripts": {
|
|
146
146
|
"tsc": "tsc",
|