@powerhousedao/design-system 6.0.0-dev.247 → 6.0.0-dev.249
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/button-49Walvwn.d.ts.map +1 -1
- package/dist/{command-CThXmS49.d.ts → command-CjupIOR8.d.ts} +8 -8
- package/dist/{command-CThXmS49.d.ts.map → command-CjupIOR8.d.ts.map} +1 -1
- package/dist/connect/components/toast/toast.js +1 -1
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +136 -136
- package/dist/connect/index.js.map +1 -1
- package/dist/{enum-field-8s8P6tjO.d.ts → enum-field-Db9I-jO3.d.ts} +2 -2
- package/dist/{enum-field-8s8P6tjO.d.ts.map → enum-field-Db9I-jO3.d.ts.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{radio-group-field-DNapUn2b.d.ts → radio-group-field-CY2UGZp_.d.ts} +2 -2
- package/dist/{radio-group-field-DNapUn2b.d.ts.map → radio-group-field-CY2UGZp_.d.ts.map} +1 -1
- package/dist/{src-D4e3Wkrz.js → src-BgCjYazJ.js} +6 -6
- package/dist/{src-D4e3Wkrz.js.map → src-BgCjYazJ.js.map} +1 -1
- package/dist/style.css +297 -200
- package/dist/ui/components/button/button.js +4 -4
- package/dist/ui/components/button/button.js.map +1 -1
- package/dist/ui/components/character-counter/character-counter.js +3 -3
- package/dist/ui/components/character-counter/character-counter.js.map +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js +2 -2
- package/dist/ui/components/checkbox/checkbox-base.js.map +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 +7 -7
- package/dist/ui/components/command/command.js.map +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/form-description/form-description.js +2 -2
- package/dist/ui/components/form-description/form-description.js.map +1 -1
- package/dist/ui/components/form-label/form-label.js +3 -3
- package/dist/ui/components/form-label/form-label.js.map +1 -1
- package/dist/ui/components/form-message/form-message.js +1 -1
- package/dist/ui/components/form-message/message-list.js +2 -2
- package/dist/ui/components/form-message/message-list.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +2 -2
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +9 -9
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js.map +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js +2 -2
- package/dist/ui/components/id-autocomplete/id-autocomplete.js.map +1 -1
- package/dist/ui/components/index.d.ts +3 -3
- package/dist/ui/components/input/input.js +1 -1
- package/dist/ui/components/input/input.js.map +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +2 -2
- package/dist/ui/components/input/splitted-input-diff.js.map +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js +2 -2
- package/dist/ui/components/input/subcomponent/input-diff.js.map +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.js +1 -1
- package/dist/ui/components/popover/popover.js +3 -3
- package/dist/ui/components/popover/popover.js.map +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 +2 -2
- package/dist/ui/components/radio-group-field/radio.js.map +1 -1
- package/dist/ui/components/search-autocomplete/search-autocomplete.js +1 -1
- package/dist/ui/components/select-field/content.js +3 -3
- package/dist/ui/components/select-field/content.js.map +1 -1
- package/dist/ui/components/select-field/select-field.js +2 -2
- package/dist/ui/components/select-field/select-field.js.map +1 -1
- package/dist/ui/components/select-field/selected-content.js +4 -4
- package/dist/ui/components/select-field/selected-content.js.map +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +4 -4
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js.map +1 -1
- package/dist/ui/components/text-input/text-input.js +1 -1
- package/dist/ui/components/tooltip/tooltip.js +2 -2
- package/dist/ui/components/tooltip/tooltip.js.map +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.js +5 -10
- package/dist/ui/components/with-field-validation/with-field-validation.js.map +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/package.json +5 -5
- package/theme.css +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgCjYazJ.js";
|
|
2
2
|
import { CharacterCounter } from "../character-counter/character-counter.js";
|
|
3
3
|
import { FormLabel } from "../form-label/form-label.js";
|
|
4
4
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgCjYazJ.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
|
|
@@ -7,7 +7,7 @@ const TooltipContent = /* @__PURE__ */ forwardRef(({ children, className, ...pro
|
|
|
7
7
|
return /* @__PURE__ */ jsx(Content, {
|
|
8
8
|
ref,
|
|
9
9
|
...props,
|
|
10
|
-
className: cn("z-50 overflow-hidden rounded-md text-sm", "border border-gray-200 bg-white text-gray-900 dark:border-gray-900 dark:bg-slate-900 dark:text-gray-200", "px-3 py-1.5 shadow-md", "data-[state=open]:animate-
|
|
10
|
+
className: cn("z-50 overflow-hidden rounded-md text-sm", "border border-gray-200 bg-white text-gray-900 dark:border-gray-900 dark:bg-slate-900 dark:text-gray-200", "px-3 py-1.5 shadow-md", "data-[state=open]:animate-zoom-in", "data-[state=closed]:animate-zoom-out", "data-[side=bottom]:animate-slide-in-from-top", "data-[side=left]:animate-slide-in-from-right", "data-[side=right]:animate-slide-in-from-left", "data-[side=top]:animate-slide-in-from-bottom", className),
|
|
11
11
|
children
|
|
12
12
|
});
|
|
13
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["cn","Content","Portal","Provider","Root","Trigger","forwardRef","TooltipContent","children","className","props","ref","Tooltip","content","triggerAsChild","delayDuration","open","defaultOpen","onOpenChange","rest","undefined","TooltipProvider","TooltipRoot","TooltipTrigger"],"sources":["../../../../src/ui/components/tooltip/tooltip.tsx"],"sourcesContent":["import { cn } from \"#design-system\";\nimport type {\n TooltipContentProps,\n TooltipProps as TooltipPrimitiveProps,\n} from \"@radix-ui/react-tooltip\";\nimport {\n Content,\n Portal,\n Provider,\n Root,\n Trigger,\n} from \"@radix-ui/react-tooltip\";\nimport { forwardRef } from \"react\";\n\ninterface TooltipProps\n extends TooltipPrimitiveProps, Omit<TooltipContentProps, \"content\"> {\n content: React.ReactNode;\n className?: string;\n triggerAsChild?: boolean;\n}\n\nconst TooltipContent = forwardRef<\n React.ElementRef<typeof Content>,\n TooltipContentProps\n>(({ children, className, ...props }, ref) => {\n return (\n <Content\n ref={ref}\n {...props}\n className={cn(\n // Base styles\n \"z-50 overflow-hidden rounded-md text-sm\",\n // Colors & Border\n \"border border-gray-200 bg-white text-gray-900 dark:border-gray-900 dark:bg-slate-900 dark:text-gray-200\",\n // Padding & Shadow\n \"px-3 py-1.5 shadow-md\",\n // Animations\n \"data-[state=open]:animate-
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["cn","Content","Portal","Provider","Root","Trigger","forwardRef","TooltipContent","children","className","props","ref","Tooltip","content","triggerAsChild","delayDuration","open","defaultOpen","onOpenChange","rest","undefined","TooltipProvider","TooltipRoot","TooltipTrigger"],"sources":["../../../../src/ui/components/tooltip/tooltip.tsx"],"sourcesContent":["import { cn } from \"#design-system\";\nimport type {\n TooltipContentProps,\n TooltipProps as TooltipPrimitiveProps,\n} from \"@radix-ui/react-tooltip\";\nimport {\n Content,\n Portal,\n Provider,\n Root,\n Trigger,\n} from \"@radix-ui/react-tooltip\";\nimport { forwardRef } from \"react\";\n\ninterface TooltipProps\n extends TooltipPrimitiveProps, Omit<TooltipContentProps, \"content\"> {\n content: React.ReactNode;\n className?: string;\n triggerAsChild?: boolean;\n}\n\nconst TooltipContent = forwardRef<\n React.ElementRef<typeof Content>,\n TooltipContentProps\n>(({ children, className, ...props }, ref) => {\n return (\n <Content\n ref={ref}\n {...props}\n className={cn(\n // Base styles\n \"z-50 overflow-hidden rounded-md text-sm\",\n // Colors & Border\n \"border border-gray-200 bg-white text-gray-900 dark:border-gray-900 dark:bg-slate-900 dark:text-gray-200\",\n // Padding & Shadow\n \"px-3 py-1.5 shadow-md\",\n // Animations\n \"data-[state=open]:animate-zoom-in\",\n \"data-[state=closed]:animate-zoom-out\",\n // Slide animations based on position\n \"data-[side=bottom]:animate-slide-in-from-top\",\n \"data-[side=left]:animate-slide-in-from-right\",\n \"data-[side=right]:animate-slide-in-from-left\",\n \"data-[side=top]:animate-slide-in-from-bottom\",\n className,\n )}\n >\n {children}\n </Content>\n );\n});\n\nconst Tooltip: React.FC<TooltipProps> = ({\n content,\n children,\n triggerAsChild = false,\n delayDuration = 0,\n ...props\n}) => {\n const { open, defaultOpen, onOpenChange, ...rest } = props;\n\n return (\n <Root\n defaultOpen={defaultOpen}\n delayDuration={delayDuration}\n onOpenChange={onOpenChange}\n open={open}\n >\n <Trigger\n asChild={triggerAsChild}\n type={triggerAsChild ? undefined : \"button\"} // Prevent form submission when default trigger is clicked\n >\n {children}\n </Trigger>\n <Portal>\n <TooltipContent sideOffset={3} {...rest}>\n {content}\n </TooltipContent>\n </Portal>\n </Root>\n );\n};\n\nexport {\n Tooltip,\n TooltipContent,\n Provider as TooltipProvider,\n Root as TooltipRoot,\n Trigger as TooltipTrigger,\n type TooltipProps,\n};\n"],"mappings":";;;;;AAqBA,MAAMO,iBAAiBD,4BAGpB,EAAEE,UAAUC,WAAW,GAAGC,SAASC,QAAQ;AAC5C,QACE,oBAAC,SAAD;EACOA;EACL,GAAID;EACJ,WAAWV,GAET,2CAEA,2GAEA,yBAEA,qCACA,wCAEA,gDACA,gDACA,gDACA,gDACAS,UACD;EAEAD;EACO,CAAA;EAEZ;AAEF,MAAMI,WAAmC,EACvCC,SACAL,UACAM,iBAAiB,OACjBC,gBAAgB,GAChB,GAAGL,YACC;CACJ,MAAM,EAAEM,MAAMC,aAAaC,cAAc,GAAGC,SAAST;AAErD,QACE,qBAAC,MAAD;EACeO;EACEF;EACDG;EACRF;YAJR,CAME,oBAAC,SAAD;GACE,SAASF;GACT,MAAMA,iBAAiBM,KAAAA,IAAY;GAElCZ;GACM,CAAA,EACT,oBAAC,QAAD,EAAA,UACE,oBAAC,gBAAD;GAAgB,YAAY;GAAG,GAAIW;aAChCN;GACa,CAAA,EACV,CAAA,CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef,
|
|
1
|
+
import { forwardRef, useEffect, useState } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Controller, useFormContext, useFormState } from "react-hook-form";
|
|
4
4
|
//#region src/ui/components/with-field-validation/with-field-validation.tsx
|
|
@@ -32,12 +32,12 @@ const withFieldValidation = (Component, options) => {
|
|
|
32
32
|
defaultValue: value ?? props.defaultValue,
|
|
33
33
|
disabled: props.disabled,
|
|
34
34
|
render: ({ field: { onChange: _, onBlur: onBlurController, value: internalValue, ...rest } }) => {
|
|
35
|
-
const onBlurCallback =
|
|
35
|
+
const onBlurCallback = (event) => {
|
|
36
36
|
if (showErrorOnBlur) trigger(name);
|
|
37
37
|
else onBlurController();
|
|
38
38
|
if (onBlurProp) onBlurProp(event);
|
|
39
|
-
}
|
|
40
|
-
const onChangeCallback =
|
|
39
|
+
};
|
|
40
|
+
const onChangeCallback = (event) => {
|
|
41
41
|
if (onChangeProp) {
|
|
42
42
|
if (Object.hasOwn(event, "target")) setValue(name, event.target.value);
|
|
43
43
|
else setValue(name, event);
|
|
@@ -50,12 +50,7 @@ const withFieldValidation = (Component, options) => {
|
|
|
50
50
|
if (showErrorOnChange === void 0 && showErrorOnBlur === void 0) {
|
|
51
51
|
if (submitCount > 0) trigger(name);
|
|
52
52
|
} else if (showErrorOnChange) trigger(name);
|
|
53
|
-
}
|
|
54
|
-
internalValue,
|
|
55
|
-
showErrorOnChange,
|
|
56
|
-
showErrorOnBlur,
|
|
57
|
-
submitCount
|
|
58
|
-
]);
|
|
53
|
+
};
|
|
59
54
|
const { ref: formFieldRef } = rest;
|
|
60
55
|
const combinedRef = (element) => {
|
|
61
56
|
if (typeof ref === "function") ref(element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-field-validation.js","names":["forwardRef","useCallback","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, useCallback, 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 = useCallback(\n (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 [onBlurController, showErrorOnBlur],\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 = useCallback(\n (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 // `internalValue` is the value of the field that is controlled by the form\n // it is used to trigger the validation on change, so we need to add it to the dependencies\n // otherwise the validation will not be triggered on change\n [internalValue, showErrorOnChange, showErrorOnBlur, submitCount],\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,MAAaO,uBAIXC,WACAC,YACqE;AACrE,QAAOT,4BAEH,EACEU,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,MAEtCa,QAAOa,KAAK,gBAAgB;AAG9BnC,kBAAgB;AACd,OAAI4B,cAAc,EACXH,SAAQhB,KAAK;KAKnB,CAACK,MAAMsB,SAAS,CAAC;AAEpBpC,kBAAgB;AAGd,OAAIc,MAAMQ,UAAUR,MAAMQ,OAAOY,SAAS,EACnCT,SAAQhB,KAAK;KAEnB;GAACA;GAAMK,MAAMQ;GAAQG;GAAQ,CAAC;EAEjC,MAAM,CAACY,aAAaC,kBAAkBrC,SAAS,MAAM;AACrDD,kBAAgB;AACd,OAAIqC,YACFX,UAASjB,MAAMD,MAAM;AAEvB8B,kBAAe,KAAK;KAGnB,CAAC7B,MAAMD,MAAM,CAAC;AAEjB,MAAIA,UAAU+B,KAAAA,KAAa,CAACtB,aAC1BuB,SAAQC,KACN,WAAWhC,KAAI,qHAChB;AAGH,SACE,oBAAC,YAAD;GACWW;GACHX;GACN,cAAeD,SAASM,MAAM4B;GAC9B,UAAU5B,MAAM6B;GAChB,SAA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M,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","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,OA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C9C,MAAMqD;KAC7D,EACD;IACDE,UAAU;KAER,GAAIvD,MAAMQ,SACNU,OAAOsC,YACLC,MAAMC,QAAQ1D,MAAMQ,OAAO,GACvBR,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"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { n as ButtonProps, r as buttonVariants, t as Button } from "../button-49
|
|
|
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
6
|
import { n as CheckboxProps, t as Checkbox } from "../checkbox-dqrYEK5V.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-
|
|
8
|
-
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../radio-group-field-
|
|
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-CjupIOR8.js";
|
|
8
|
+
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../radio-group-field-CY2UGZp_.js";
|
|
9
9
|
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../select-field-BClhLm83.js";
|
|
10
|
-
import { n as EnumFieldProps, t as EnumField } from "../enum-field-
|
|
10
|
+
import { n as EnumFieldProps, t as EnumField } from "../enum-field-Db9I-jO3.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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/design-system",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.249",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"@storybook/types": "^8.6.18",
|
|
81
81
|
"@tailwindcss/cli": "4.2.2",
|
|
82
82
|
"@tailwindcss/vite": "4.2.2",
|
|
83
|
+
"@tanstack/react-query": "^5.49.2",
|
|
83
84
|
"@testing-library/dom": "^10.4.0",
|
|
84
85
|
"@testing-library/jest-dom": "^6.6.3",
|
|
85
86
|
"@testing-library/react": "^16.0.1",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"tsx": "4.21.0",
|
|
102
103
|
"vite": "8.0.8",
|
|
103
104
|
"vitest": "4.1.1",
|
|
104
|
-
"@powerhousedao/config": "6.0.0-dev.
|
|
105
|
+
"@powerhousedao/config": "6.0.0-dev.249"
|
|
105
106
|
},
|
|
106
107
|
"peerDependencies": {
|
|
107
108
|
"react": ">=19.0.0",
|
|
@@ -117,7 +118,6 @@
|
|
|
117
118
|
"@radix-ui/react-tabs": "^1.1.1",
|
|
118
119
|
"@radix-ui/react-tooltip": "^1.1.3",
|
|
119
120
|
"@radix-ui/react-visually-hidden": "^1.1.0",
|
|
120
|
-
"@tanstack/react-query": "^5.49.2",
|
|
121
121
|
"@tanstack/react-virtual": "^3.8.1",
|
|
122
122
|
"@uiw/react-json-view": "2.0.0-alpha.42",
|
|
123
123
|
"change-case": "5.4.4",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"tailwind-merge": "3.4.0",
|
|
135
135
|
"type-fest": "5.6.0",
|
|
136
136
|
"usehooks-ts": "^3.1.1",
|
|
137
|
-
"@powerhousedao/
|
|
138
|
-
"@powerhousedao/
|
|
137
|
+
"@powerhousedao/reactor-browser": "6.0.0-dev.249",
|
|
138
|
+
"@powerhousedao/shared": "6.0.0-dev.249"
|
|
139
139
|
},
|
|
140
140
|
"scripts": {
|
|
141
141
|
"tsc": "tsc",
|
package/theme.css
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
--color-slate-700: hsl(204 9% 11%);
|
|
26
26
|
--color-slate-800: hsl(195 9% 9%);
|
|
27
27
|
--color-slate-900: hsl(195 6% 6%);
|
|
28
|
-
--color-slate-950: hsl(0 0% 0%);
|
|
29
28
|
--color-blue-100: hsl(209 100% 90%);
|
|
30
29
|
--color-blue-200: hsl(209 97% 85%);
|
|
31
30
|
--color-blue-300: hsl(209 100% 80%);
|
|
@@ -104,7 +103,8 @@
|
|
|
104
103
|
0px -1px 1px 0px rgba(0, 0, 0, 0.04) inset,
|
|
105
104
|
0px 2px 0px 0px rgba(255, 255, 255, 0.25) inset,
|
|
106
105
|
0px 4px 8px -4px rgba(0, 0, 0, 0.1);
|
|
107
|
-
|
|
106
|
+
--shadow-charcoal: 1px 4px 15px rgba(74, 88, 115, 0.25);
|
|
107
|
+
--shadow-inner: inset 0px 0px 2px rgba(255, 255, 255, 0.5);
|
|
108
108
|
--animate-fade-in: fadeIn 0.3s ease-in-out;
|
|
109
109
|
--animate-fade-out: fadeOut 0.1s ease-in-out;
|
|
110
110
|
--animate-zoom-in: zoomIn 0.3s ease-in-out;
|