mostly finished rewrite

This commit is contained in:
Violet
2024-12-18 12:31:06 -07:00
parent bab7a0ca27
commit d28c65e66b
2906 changed files with 227775 additions and 105 deletions
+34
View File
@@ -0,0 +1,34 @@
"use client";
import classNames from 'classnames';
import camelize from 'dom-helpers/camelize';
import * as React from 'react';
import { useBootstrapPrefix } from './ThemeProvider';
import { jsx as _jsx } from "react/jsx-runtime";
const pascalCase = str => str[0].toUpperCase() + camelize(str).slice(1);
// TODO: emstricten & fix the typing here! `createWithBsPrefix<TElementType>...`
export default function createWithBsPrefix(prefix, {
displayName = pascalCase(prefix),
Component,
defaultProps
} = {}) {
const BsComponent = /*#__PURE__*/React.forwardRef(({
className,
bsPrefix,
as: Tag = Component || 'div',
...props
}, ref) => {
const componentProps = {
...defaultProps,
...props
};
const resolvedPrefix = useBootstrapPrefix(bsPrefix, prefix);
return /*#__PURE__*/_jsx(Tag, {
ref: ref,
className: classNames(className, resolvedPrefix),
...componentProps
});
});
BsComponent.displayName = displayName;
return BsComponent;
}