@purr-react-styled-components/components.flex-box 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 { IFlexBoxProps } from './_types';
3
+
4
+ export declare const FlexBox: ({ children, className, flexDirection, alignItems, justifyContent, variant, gap, wrap, fullWidth, htmlAttributes, }: IFlexBoxProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { IStyledFlexBoxProps } from './_types';
2
+
3
+ export declare const Styled: {
4
+ Div: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IStyledFlexBoxProps>> & string;
5
+ Span: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, IStyledFlexBoxProps>> & string;
6
+ };
@@ -0,0 +1,24 @@
1
+ import { Property } from 'csstype';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+ import { IExtendable } from '@purr-core/utils.definitions';
4
+
5
+ export interface IFlexBoxProps {
6
+ alignItems?: Property.AlignItems;
7
+ justifyContent?: Property.JustifyContent;
8
+ flexDirection?: Property.FlexDirection;
9
+ variant?: keyof JSX.IntrinsicElements;
10
+ gap?: Property.Gap;
11
+ wrap?: Property.FlexWrap;
12
+ fullWidth?: boolean;
13
+ htmlAttributes?: HTMLAttributes<HTMLElement> & IExtendable;
14
+ children?: ReactNode;
15
+ className?: string;
16
+ }
17
+ export interface IStyledFlexBoxProps {
18
+ $alignItems?: Property.AlignItems;
19
+ $justifyContent?: Property.JustifyContent;
20
+ $flexDirection?: Property.FlexDirection;
21
+ $gap?: Property.Gap;
22
+ $wrap?: Property.FlexWrap;
23
+ $fullWidth?: boolean;
24
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),y=require("clsx"),g=require("react"),$=require("@purr-core/utils.helpers"),i=require("styled-components"),c=({$alignItems:l,$justifyContent:n,$flexDirection:t,$gap:o,$wrap:s,$fullWidth:e})=>i.css(["display:flex;justify-content:",";align-items:",";flex-direction:",";gap:",";flex-wrap:",";width:",";"],n,l,t,o,s,e?"100%":"auto"),m={Div:i.div.withConfig({displayName:"_style__Div",componentId:"sc-1ds73kg-0"})(["",";"],c),Span:i.span.withConfig({displayName:"_style__Span",componentId:"sc-1ds73kg-1"})(["",";"],c)},b=({children:l,className:n,flexDirection:t="row",alignItems:o="center",justifyContent:s="center",variant:e="div",gap:r="0px",wrap:x="nowrap",fullWidth:a=!1,htmlAttributes:d})=>{const f=g.useMemo(()=>{const p=$.capitalize(e);return m[p]},[e]);return u.jsx(f,{...d,$flexDirection:t,$alignItems:o,$justifyContent:s,$gap:r,$wrap:x,$fullWidth:a,className:y("flex-box",`flex-box--direction-${t}`,`flex-box--alignItems-${o}`,`flex-box--justifyContent-${s}`,`flex-box--gap-${r}`,`flex-box--wrap-${x}`,`flex-box--variant-${e}`,n),children:l})};exports.FlexBox=b;
@@ -0,0 +1,2 @@
1
+ export * from './_components';
2
+ export * from './_types';
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import y from "clsx";
3
+ import { useMemo as $ } from "react";
4
+ import { capitalize as g } from "@purr-core/utils.helpers";
5
+ import x, { css as u } from "styled-components";
6
+ const f = ({
7
+ $alignItems: l,
8
+ $justifyContent: s,
9
+ $flexDirection: o,
10
+ $gap: t,
11
+ $wrap: i,
12
+ $fullWidth: e
13
+ }) => u(["display:flex;justify-content:", ";align-items:", ";flex-direction:", ";gap:", ";flex-wrap:", ";width:", ";"], s, l, o, t, i, e ? "100%" : "auto"), b = {
14
+ Div: x.div.withConfig({
15
+ displayName: "_style__Div",
16
+ componentId: "sc-1ds73kg-0"
17
+ })(["", ";"], f),
18
+ Span: x.span.withConfig({
19
+ displayName: "_style__Span",
20
+ componentId: "sc-1ds73kg-1"
21
+ })(["", ";"], f)
22
+ }, v = ({
23
+ children: l,
24
+ className: s,
25
+ flexDirection: o = "row",
26
+ alignItems: t = "center",
27
+ justifyContent: i = "center",
28
+ variant: e = "div",
29
+ gap: n = "0px",
30
+ wrap: r = "nowrap",
31
+ fullWidth: p = !1,
32
+ htmlAttributes: a
33
+ }) => {
34
+ const m = $(() => {
35
+ const c = g(e);
36
+ return b[c];
37
+ }, [e]);
38
+ return /* @__PURE__ */ d(m, { ...a, $flexDirection: o, $alignItems: t, $justifyContent: i, $gap: n, $wrap: r, $fullWidth: p, className: y("flex-box", `flex-box--direction-${o}`, `flex-box--alignItems-${t}`, `flex-box--justifyContent-${i}`, `flex-box--gap-${n}`, `flex-box--wrap-${r}`, `flex-box--variant-${e}`, s), children: l });
39
+ };
40
+ export {
41
+ v as FlexBox
42
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@purr-react-styled-components/components.flex-box",
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
+ "csstype": "*",
28
+ "clsx": "*",
29
+ "@purr-core/utils.definitions": "0.0.4",
30
+ "@purr-core/utils.helpers": "0.0.4"
31
+ },
32
+ "author": "@DinhThienPhuc",
33
+ "license": "ISC",
34
+ "description": "",
35
+ "sideEffects": false,
36
+ "scripts": {
37
+ "dev": "vite build --watch",
38
+ "build": "tsc && vite build",
39
+ "lint": "eslint . --ext ts,tsx --max-warnings 0"
40
+ }
41
+ }