@purr-react-styled-components/components.form-field 0.0.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.
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { IFormFieldProps } from './_types';
3
+
4
+ export declare const FormField: ({ children, className, htmlAttributes, label, helperText, errorMessage, }: IFormFieldProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const Styled: {
2
+ Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ HelperText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ ExplainText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
+ ErrorMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
+ };
@@ -0,0 +1,11 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { IExtendable } from '@purr-core/utils.definitions';
3
+
4
+ export interface IFormFieldProps extends IExtendable {
5
+ label?: ReactNode;
6
+ htmlAttributes?: HTMLAttributes<HTMLElement> & IExtendable;
7
+ children?: ReactNode;
8
+ className?: string;
9
+ helperText?: ReactNode;
10
+ errorMessage?: ReactNode;
11
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("clsx"),e=require("styled-components"),i={Container:e.div.withConfig({displayName:"_style__Container",componentId:"sc-4mt1q9-0"})(["display:flex;flex-direction:column;row-gap:8px;position:relative;"]),HelperText:e.div.withConfig({displayName:"_style__HelperText",componentId:"sc-4mt1q9-1"})(["color:#00000073;"]),ExplainText:e.div.withConfig({displayName:"_style__ExplainText",componentId:"sc-4mt1q9-2"})(["position:absolute;bottom:0px;color:#00000073;"]),ErrorMessage:e.div.withConfig({displayName:"_style__ErrorMessage",componentId:"sc-4mt1q9-3"})(["position:absolute;bottom:-21px;color:#ff4d4f;"])},m=({children:l,className:n,htmlAttributes:a,label:s,helperText:o,errorMessage:r})=>t.jsxs(i.Container,{...a,className:d("form-field",!!s&&"form-field--has-label",!!o&&"form-field--has-helper-text",n),children:[s,l,!!o&&t.jsx(i.HelperText,{className:"form-field__helper-text",children:o}),!!r&&t.jsx(i.ErrorMessage,{className:"form-field__error-message",children:r})]});exports.FormField=m;
@@ -0,0 +1,2 @@
1
+ export * from './_components';
2
+ export * from './_types';
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
+ import d from "clsx";
3
+ import e from "styled-components";
4
+ const t = {
5
+ Container: e.div.withConfig({
6
+ displayName: "_style__Container",
7
+ componentId: "sc-4mt1q9-0"
8
+ })(["display:flex;flex-direction:column;row-gap:8px;position:relative;"]),
9
+ HelperText: e.div.withConfig({
10
+ displayName: "_style__HelperText",
11
+ componentId: "sc-4mt1q9-1"
12
+ })(["color:#00000073;"]),
13
+ ExplainText: e.div.withConfig({
14
+ displayName: "_style__ExplainText",
15
+ componentId: "sc-4mt1q9-2"
16
+ })(["position:absolute;bottom:0px;color:#00000073;"]),
17
+ ErrorMessage: e.div.withConfig({
18
+ displayName: "_style__ErrorMessage",
19
+ componentId: "sc-4mt1q9-3"
20
+ })(["position:absolute;bottom:-21px;color:#ff4d4f;"])
21
+ }, x = ({
22
+ children: l,
23
+ className: m,
24
+ htmlAttributes: n,
25
+ label: i,
26
+ helperText: o,
27
+ errorMessage: r
28
+ }) => /* @__PURE__ */ a(t.Container, { ...n, className: d("form-field", !!i && "form-field--has-label", !!o && "form-field--has-helper-text", m), children: [
29
+ i,
30
+ l,
31
+ !!o && /* @__PURE__ */ s(t.HelperText, { className: "form-field__helper-text", children: o }),
32
+ !!r && /* @__PURE__ */ s(t.ErrorMessage, { className: "form-field__error-message", children: r })
33
+ ] });
34
+ export {
35
+ x as FormField
36
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@purr-react-styled-components/components.form-field",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "peerDependencies": {
24
+ "typescript": "*",
25
+ "react": "*",
26
+ "styled-components": "*",
27
+ "clsx": "*",
28
+ "@purr-core/utils.definitions": "0.0.10",
29
+ "@purr-core/utils.helpers": "0.0.10"
30
+ },
31
+ "author": "@DinhThienPhuc",
32
+ "license": "ISC",
33
+ "description": "",
34
+ "sideEffects": false,
35
+ "scripts": {
36
+ "dev": "vite build --watch",
37
+ "build": "tsc && vite build",
38
+ "lint": "eslint . --ext ts,tsx --max-warnings 0"
39
+ }
40
+ }