@nild/components 0.0.16 → 0.0.17

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.
@@ -1,10 +1,4 @@
1
- import { HTMLAttributes } from 'react';
2
- import { DividerVariant, DividerDirection, DividerAlign } from './style';
3
- export interface DividerProps extends HTMLAttributes<HTMLDivElement> {
4
- variant?: DividerVariant;
5
- direction?: DividerDirection;
6
- align?: DividerAlign;
7
- }
1
+ import { DividerProps } from './interfaces';
8
2
  /**
9
3
  * @category Components
10
4
  */
@@ -1 +1 @@
1
- import{jsx as m}from"react/jsx-runtime";import{cnMerge as c,isEmpty as _}from"@nild/shared";import{forwardRef as p,Children as I}from"react";import{DIRECTION_WITH_CHILDREN_CLS_MAP as f,DIRECTION_WITHOUT_CHILDREN_CLS_MAP as C,ALIGN_CLS_MAP as N}from"./style/index.js";const s=p(({className:e,children:o,variant:a="solid",direction:r="horizontal",align:t="center",...n},d)=>{const l=r==="horizontal",i=I.toArray(o);return m("div",{...n,className:c("nd-divider","border-split","text-primary",l&&!_(i)?f[r][a].concat(N[t]):C[r][a],e),ref:d,children:i})});s.displayName="Divider";export{s as default};
1
+ import{jsx as l}from"react/jsx-runtime";import{cnMerge as m,isEmpty as c}from"@nild/shared";import{forwardRef as f,Children as p}from"react";import{dividerClassNames as h}from"./style/index.js";const a=f(({className:i,children:e,variant:s="solid",direction:o="horizontal",align:t="center",...n},d)=>{const r=p.toArray(e);return l("div",{...n,className:m(h({emptyChildren:c(r),variant:s,direction:o,align:t}),i),ref:d,children:r})});a.displayName="Divider";export{a as default};
@@ -1,4 +1,3 @@
1
- import { default as Divider, DividerProps } from './Divider';
2
- import { DividerVariant, DividerDirection, DividerAlign } from './style';
3
- export type { DividerProps, DividerVariant, DividerDirection, DividerAlign };
1
+ import { default as Divider } from './Divider';
2
+ export type * from './interfaces';
4
3
  export default Divider;
@@ -1,6 +1,4 @@
1
- export type DividerVariant = 'solid' | 'dashed' | 'dotted';
2
- export type DividerDirection = 'horizontal' | 'vertical';
3
- export declare const DIRECTION_WITHOUT_CHILDREN_CLS_MAP: Record<DividerDirection, Record<DividerVariant, string[]>>;
4
- export declare const DIRECTION_WITH_CHILDREN_CLS_MAP: Record<DividerDirection, Record<DividerVariant, string[]>>;
5
- export type DividerAlign = 'left' | 'center' | 'right';
6
- export declare const ALIGN_CLS_MAP: Record<DividerAlign, string[]>;
1
+ import { DividerProps } from '../interfaces';
2
+ export declare const dividerClassNames: (props?: (DividerProps & {
3
+ emptyChildren: boolean;
4
+ }) | undefined) => string;
@@ -1 +1 @@
1
- const e=["w-full min-w-full","border-b","my-6"],r=["inline-block","h-[1em]","align-middle","border-r","ms-3 me-3"],d={horizontal:{solid:e.concat("border-solid"),dashed:e.concat("border-dashed"),dotted:e.concat("border-dotted")},vertical:{solid:r.concat("border-solid"),dashed:r.concat("border-dashed"),dotted:r.concat("border-dotted")}},o=["flex items-center text-center",'before:h-0 before:content-[""] before:border-b before:border-[color:inherit]','after:h-0 after:content-[""] after:border-b after:border-[color:inherit]',"my-6"],t={horizontal:{solid:o.concat(["before:border-solid","after:border-solid"]),dashed:o.concat(["before:border-dashed","after:border-dashed"]),dotted:o.concat(["before:border-dotted","after:border-dotted"])},vertical:{solid:[],dashed:[],dotted:[]}},a={left:["before:basis-1/12 before:grow-0","after:flex-1"],center:["before:flex-1","after:flex-1"],right:["before:flex-1","after:basis-1/12 after:grow-0"]};export{a as ALIGN_CLS_MAP,d as DIRECTION_WITHOUT_CHILDREN_CLS_MAP,t as DIRECTION_WITH_CHILDREN_CLS_MAP};
1
+ import{cva as e}from"@nild/shared";const r=e(["nd-divider","border-split","text-primary"],{compoundVariants:[{emptyChildren:!0,direction:"horizontal",className:["w-full","min-w-full","border-b","my-6"]},{emptyChildren:!0,direction:"vertical",className:["inline-block","h-[1em]","align-middle","border-r","ms-3 me-3"]},{emptyChildren:!0,variant:"solid",className:["border-solid"]},{emptyChildren:!0,variant:"dashed",className:["border-dashed"]},{emptyChildren:!0,variant:"dotted",className:["border-dotted"]},{emptyChildren:!1,direction:"horizontal",className:["flex items-center text-center",'before:h-0 before:content-[""] before:border-b before:border-[color:inherit]','after:h-0 after:content-[""] after:border-b after:border-[color:inherit]',"my-6"]},{emptyChildren:!1,direction:"horizontal",variant:"solid",className:["before:border-solid","after:border-solid"]},{emptyChildren:!1,direction:"horizontal",variant:"dashed",className:["before:border-dashed","after:border-dashed"]},{emptyChildren:!1,direction:"horizontal",variant:"dotted",className:["before:border-dotted","after:border-dotted"]},{emptyChildren:!1,direction:"horizontal",align:"left",className:["before:basis-1/12","before:grow-0","after:flex-1"]},{emptyChildren:!1,direction:"horizontal",align:"center",className:["before:flex-1","after:flex-1"]},{emptyChildren:!1,direction:"horizontal",align:"right",className:["before:flex-1","after:basis-1/12","after:grow-0"]}]});export{r as dividerClassNames};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nild/components",
3
3
  "private": false,
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
7
7
  "exports": {
@@ -31,9 +31,9 @@
31
31
  "peerDependencies": {
32
32
  "react": ">=18.2.0",
33
33
  "react-dom": ">=18.2.0",
34
- "@nild/shared": "0.0.9",
34
+ "@nild/icons": "0.0.10",
35
35
  "@nild/hooks": "0.0.11",
36
- "@nild/icons": "0.0.10"
36
+ "@nild/shared": "0.0.9"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "vite build --mode PROD",