@crossed/primitive
Version:
A universal & performant styling library for React Native, Next.js & React
35 lines (30 loc) • 994 B
text/typescript
/**
* Copyright (c) Paymium.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root of this projects source tree.
*/
import type { ComponentType } from 'react';
import { createLabelMain } from './Label';
import { createLabelText } from './LabelText';
import { LabelInput } from './LabelInput';
import { withStaticProperties } from '@crossed/core';
export { useContext as useLabelContext } from './context';
export const createLabel = <
LabelProps extends Record<string, any>,
TextProps extends Record<string, any>,
>(components: {
Root: ComponentType<LabelProps>;
Text: ComponentType<TextProps>;
}) => {
const { Root, Text } = components;
const Label = createLabelMain(Root);
const LabelText = createLabelText(Text);
Label.displayName = 'Label';
LabelText.displayName = 'Label.Text';
LabelInput.displayName = 'Label.Input';
return withStaticProperties(Label, {
Text: LabelText,
Input: LabelInput,
} as const);
};