@purr-react-styled-components/components.flex-box 0.0.8 → 0.0.10

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/index.cjs CHANGED
@@ -1 +1,13 @@
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;
1
+ 'use strict';var c=require('clsx'),S=require('react'),utils_helpers=require('@purr-core/utils.helpers'),f=require('styled-components');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var c__default=/*#__PURE__*/_interopDefault(c);var S__default=/*#__PURE__*/_interopDefault(S);var f__default=/*#__PURE__*/_interopDefault(f);var i=({$alignItems:x,$justifyContent:l,$flexDirection:e,$gap:t,$wrap:r,$fullWidth:o})=>f.css`
2
+ display: flex;
3
+ justify-content: ${l};
4
+ align-items: ${x};
5
+ flex-direction: ${e};
6
+ gap: ${t};
7
+ flex-wrap: ${r};
8
+ width: ${o?"100%":"auto"};
9
+ `,m={Div:f__default.default.div`
10
+ ${i};
11
+ `,Span:f__default.default.span`
12
+ ${i};
13
+ `};var T=({children:x,className:l,flexDirection:e="row",alignItems:t="center",justifyContent:r="center",variant:o="div",gap:p="0px",wrap:s="nowrap",fullWidth:n=false,htmlAttributes:$})=>{let d=S.useMemo(()=>{let a=utils_helpers.capitalize(o);return m[a]},[o]);return S__default.default.createElement(d,{...$,$flexDirection:e,$alignItems:t,$justifyContent:r,$gap:p,$wrap:s,$fullWidth:n,className:c__default.default("flex-box",`flex-box--direction-${e}`,`flex-box--alignItems-${t}`,`flex-box--justifyContent-${r}`,`flex-box--gap-${p}`,`flex-box--wrap-${s}`,`flex-box--variant-${o}`,l)},x)};exports.FlexBox=T;
@@ -1,8 +1,8 @@
1
+ import React, { JSX, HTMLAttributes, ReactNode } from 'react';
1
2
  import { Property } from 'csstype';
2
- import { HTMLAttributes, JSX, ReactNode } from 'react';
3
3
  import { IExtendable } from '@purr-core/utils.definitions';
4
4
 
5
- export interface IFlexBoxProps {
5
+ interface IFlexBoxProps {
6
6
  alignItems?: Property.AlignItems;
7
7
  justifyContent?: Property.JustifyContent;
8
8
  flexDirection?: Property.FlexDirection;
@@ -14,7 +14,7 @@ export interface IFlexBoxProps {
14
14
  children?: ReactNode;
15
15
  className?: string;
16
16
  }
17
- export interface IStyledFlexBoxProps {
17
+ interface IStyledFlexBoxProps {
18
18
  $alignItems?: Property.AlignItems;
19
19
  $justifyContent?: Property.JustifyContent;
20
20
  $flexDirection?: Property.FlexDirection;
@@ -22,3 +22,7 @@ export interface IStyledFlexBoxProps {
22
22
  $wrap?: Property.FlexWrap;
23
23
  $fullWidth?: boolean;
24
24
  }
25
+
26
+ declare const FlexBox: ({ children, className, flexDirection, alignItems, justifyContent, variant, gap, wrap, fullWidth, htmlAttributes, }: IFlexBoxProps) => React.JSX.Element;
27
+
28
+ export { FlexBox, type IFlexBoxProps, type IStyledFlexBoxProps };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,28 @@
1
- export * from './_components';
2
- export * from './_types';
1
+ import React, { JSX, HTMLAttributes, ReactNode } from 'react';
2
+ import { Property } from 'csstype';
3
+ import { IExtendable } from '@purr-core/utils.definitions';
4
+
5
+ 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
+ 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
+ }
25
+
26
+ declare const FlexBox: ({ children, className, flexDirection, alignItems, justifyContent, variant, gap, wrap, fullWidth, htmlAttributes, }: IFlexBoxProps) => React.JSX.Element;
27
+
28
+ export { FlexBox, type IFlexBoxProps, type IStyledFlexBoxProps };
package/dist/index.js CHANGED
@@ -1,42 +1,13 @@
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
- };
1
+ import c from'clsx';import S,{useMemo}from'react';import {capitalize}from'@purr-core/utils.helpers';import f,{css}from'styled-components';var i=({$alignItems:x,$justifyContent:l,$flexDirection:e,$gap:t,$wrap:r,$fullWidth:o})=>css`
2
+ display: flex;
3
+ justify-content: ${l};
4
+ align-items: ${x};
5
+ flex-direction: ${e};
6
+ gap: ${t};
7
+ flex-wrap: ${r};
8
+ width: ${o?"100%":"auto"};
9
+ `,m={Div:f.div`
10
+ ${i};
11
+ `,Span:f.span`
12
+ ${i};
13
+ `};var T=({children:x,className:l,flexDirection:e="row",alignItems:t="center",justifyContent:r="center",variant:o="div",gap:p="0px",wrap:s="nowrap",fullWidth:n=false,htmlAttributes:$})=>{let d=useMemo(()=>{let a=capitalize(o);return m[a]},[o]);return S.createElement(d,{...$,$flexDirection:e,$alignItems:t,$justifyContent:r,$gap:p,$wrap:s,$fullWidth:n,className:c("flex-box",`flex-box--direction-${e}`,`flex-box--alignItems-${t}`,`flex-box--justifyContent-${r}`,`flex-box--gap-${p}`,`flex-box--wrap-${s}`,`flex-box--variant-${o}`,l)},x)};export{T as FlexBox};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purr-react-styled-components/components.flex-box",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -26,8 +26,8 @@
26
26
  "styled-components": "*",
27
27
  "csstype": "*",
28
28
  "clsx": "*",
29
- "@purr-core/utils.definitions": "0.0.10",
30
- "@purr-core/utils.helpers": "0.0.10"
29
+ "@purr-core/utils.definitions": "0.0.12",
30
+ "@purr-core/utils.helpers": "0.0.12"
31
31
  },
32
32
  "author": "@DinhThienPhuc",
33
33
  "license": "ISC",
@@ -36,6 +36,8 @@
36
36
  "scripts": {
37
37
  "dev": "vite build --watch",
38
38
  "build": "tsc && vite build",
39
+ "build:vite": "tsc && vite build",
40
+ "build:tsup": "tsup",
39
41
  "lint": "eslint . --ext ts,tsx --max-warnings 0"
40
42
  }
41
43
  }
@@ -1,4 +0,0 @@
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;
package/dist/_style.d.ts DELETED
@@ -1,6 +0,0 @@
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
- };