@bioturing/components 0.41.1 → 0.42.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.d.ts +1 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -0
- package/dist/base.js.map +1 -1
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +153 -155
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/form/FormItem/FormItemInput.d.ts +50 -0
- package/dist/components/form/FormItem/FormItemInput.d.ts.map +1 -0
- package/dist/components/form/FormItem/FormItemInput.js +137 -0
- package/dist/components/form/FormItem/FormItemInput.js.map +1 -0
- package/dist/components/form/FormItem/FormItemLabel.d.ts +48 -0
- package/dist/components/form/FormItem/FormItemLabel.d.ts.map +1 -0
- package/dist/components/form/FormItem/FormItemLabel.js +80 -0
- package/dist/components/form/FormItem/FormItemLabel.js.map +1 -0
- package/dist/components/form/FormItem/ItemHolder.d.ts +33 -0
- package/dist/components/form/FormItem/ItemHolder.d.ts.map +1 -0
- package/dist/components/form/FormItem/ItemHolder.js +168 -0
- package/dist/components/form/FormItem/ItemHolder.js.map +1 -0
- package/dist/components/form/FormItem/index.d.ts +106 -0
- package/dist/components/form/FormItem/index.d.ts.map +1 -0
- package/dist/components/form/FormItem/index.js +234 -0
- package/dist/components/form/FormItem/index.js.map +1 -0
- package/dist/components/form/component.d.ts +7 -1
- package/dist/components/form/component.d.ts.map +1 -1
- package/dist/components/form/component.js +4 -4
- package/dist/components/form/item.d.ts +27 -23
- package/dist/components/form/item.d.ts.map +1 -1
- package/dist/components/form/label.d.ts.map +1 -1
- package/dist/components/form/label.js +33 -31
- package/dist/components/form/label.js.map +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/toast/function.d.ts +1 -1
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/utils/renderProp.d.ts +1 -1
- package/dist/components/utils/renderProp.d.ts.map +1 -1
- package/dist/components/utils/renderProp.js +16 -10
- package/dist/components/utils/renderProp.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +4 -3
- package/dist/components/form/item.js +0 -43
- package/dist/components/form/item.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderProp.js","sources":["../../../src/components/utils/renderProp.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { clsx } from \"./cn\";\nimport type { ClassValue } from \"./types\";\n\n/**\n * Utility function to handle render prop patterns with proper TypeScript typing.\n * Supports both function render props and ReactElement children.\n *\n * @param children - Either a render function or a ReactElement\n * @param props - Props to pass to the render function or merge with the ReactElement\n * @param state - Optional state to pass to the render function\n * @returns The rendered element\n *\n * @example\n * // With function children\n * <Component>\n * {(props, state) => <button {...props}>Click me</button>}\n * </Component>\n *\n * @example\n * // With ReactElement children\n * <Component>\n * <button>Click me</button>\n * </Component>\n */\nexport function createRenderProp<\n TProps extends object = object,\n TState = unknown
|
|
1
|
+
{"version":3,"file":"renderProp.js","sources":["../../../src/components/utils/renderProp.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { clsx } from \"./cn\";\nimport type { ClassValue } from \"./types\";\nimport mergeRefs from \"merge-refs\";\n\n/**\n * Utility function to handle render prop patterns with proper TypeScript typing.\n * Supports both function render props and ReactElement children.\n *\n * @param children - Either a render function or a ReactElement\n * @param props - Props to pass to the render function or merge with the ReactElement\n * @param state - Optional state to pass to the render function\n * @returns The rendered element\n *\n * @example\n * // With function children\n * <Component>\n * {(props, state) => <button {...props}>Click me</button>}\n * </Component>\n *\n * @example\n * // With ReactElement children\n * <Component>\n * <button>Click me</button>\n * </Component>\n */\nexport function createRenderProp<\n TProps extends object = object,\n TState = unknown,\n TElement = Element,\n>(\n children:\n | ((props: TProps, state: TState) => React.ReactElement)\n | React.ReactElement,\n props: TProps,\n state?: TState,\n): React.ReactElement {\n if (typeof children === \"function\") {\n return children(props, state as TState);\n } else {\n const childElement = children as React.ReactElement<{\n className?: ClassValue;\n ref?: React.Ref<TElement>;\n }>;\n\n // Extract className and ref from props with proper typing\n const propsWithPossibleClassNameAndRef = props as TProps & {\n className?: ClassValue;\n ref?: React.Ref<TElement>;\n };\n\n const propsClassName = propsWithPossibleClassNameAndRef.className;\n const propsRef = propsWithPossibleClassNameAndRef.ref;\n const mergedClassName = clsx(propsClassName, childElement.props.className);\n\n // Merge refs from both props and child element\n // React internally stores ref on the element, so we need to access it\n const childRef = (\n childElement as React.ReactElement & { ref?: React.Ref<TElement> }\n ).ref;\n const mergedRef =\n propsRef && childRef\n ? mergeRefs(childRef, propsRef)\n : propsRef || childRef;\n\n // Remove className and ref from props to handle them separately\n const {\n className: _propsClassName,\n ref: _propsRef,\n ...propsWithoutClassNameAndRef\n } = propsWithPossibleClassNameAndRef;\n const { className: _childClassName, ...childPropsWithoutClassName } =\n childElement.props;\n\n // Spread trigger props first, then child props on top to preserve child's explicit props\n // This ensures that props like 'type', 'size', etc. from the child element are preserved\n const clonedElement = React.cloneElement(childElement, {\n ...propsWithoutClassNameAndRef,\n ...childPropsWithoutClassName,\n className: mergedClassName,\n ref: mergedRef,\n } as React.HTMLAttributes<TElement> & { ref?: React.Ref<TElement> });\n return clonedElement;\n }\n}\n"],"names":["createRenderProp","children","props","state","childElement","propsWithPossibleClassNameAndRef","propsClassName","propsRef","mergedClassName","clsx","childRef","mergedRef","mergeRefs","_propsClassName","_propsRef","propsWithoutClassNameAndRef","_childClassName","childPropsWithoutClassName","React"],"mappings":";;;;AA2BO,SAASA,EAKdC,GAGAC,GACAC,GACoB;AACpB,MAAI,OAAOF,KAAa;AACtB,WAAOA,EAASC,GAAOC,CAAe;AACjC;AACL,UAAMC,IAAeH,GAMfI,IAAmCH,GAKnCI,IAAiBD,EAAiC,WAClDE,IAAWF,EAAiC,KAC5CG,IAAkBC,EAAKH,GAAgBF,EAAa,MAAM,SAAS,GAInEM,IACJN,EACA,KACIO,IACJJ,KAAYG,IACRE,EAAUF,GAAUH,CAAQ,IAC5BA,KAAYG,GAGZ;AAAA,MACJ,WAAWG;AAAA,MACX,KAAKC;AAAA,MACL,GAAGC;AAAA,IAAA,IACDV,GACE,EAAE,WAAWW,GAAiB,GAAGC,EAAA,IACrCb,EAAa;AAUf,WANsBc,EAAM,aAAad,GAAc;AAAA,MACrD,GAAGW;AAAA,MACH,GAAGE;AAAA,MACH,WAAWT;AAAA,MACX,KAAKG;AAAA,IAAA,CAC4D;AAAA,EAErE;AACF;"}
|