@nild/components 0.0.21 → 0.0.22

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.js CHANGED
@@ -1 +1 @@
1
- import{default as a}from"./button/index.js";import{default as o}from"./checkbox/index.js";import{default as r}from"./divider/Divider.js";import{default as t}from"./popover/Popover.js";import{default as s}from"./switch/index.js";import{default as f}from"./transition/Transition.js";import{default as m}from"./typography/Typography.js";/* empty css */export{a as Button,o as Checkbox,r as Divider,t as Popover,s as Switch,f as Transition,m as Typography};
1
+ import{default as a}from"./button/index.js";import{default as o}from"./checkbox/index.js";import{default as r}from"./divider/Divider.js";import{default as t}from"./popover/Popover.js";import{default as s}from"./switch/index.js";import{default as f}from"./transition/Transition.js";import{default as m}from"./typography/index.js";/* empty css */export{a as Button,o as Checkbox,r as Divider,t as Popover,s as Switch,f as Transition,m as Typography};
@@ -1,7 +1,3 @@
1
- import { AnchorHTMLAttributes } from 'react';
2
- export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
3
- disabled?: boolean;
4
- underlined?: boolean;
5
- }
1
+ import { LinkProps } from './interfaces';
6
2
  declare const Link: import('react').ForwardRefExoticComponent<LinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
7
3
  export default Link;
@@ -1 +1 @@
1
- import{jsx as l}from"react/jsx-runtime";import{cnMerge as s}from"@nild/shared";import{forwardRef as f}from"react";import{DISABLED_CLS as m}from"../_shared/style/index.js";const r=f(({className:n,children:i,disabled:e,underlined:a,href:t="#",...d},o)=>l("a",{...d,href:e?void 0:t,className:s("nd-link",["font-nd","text-link","text-[length:inherit]","cursor-pointer","enabled:hover:text-link-hover","enabled:active:text-link-active"],m,a?"underline":"no-underline",e&&"disabled",n),ref:o,children:i}));r.displayName="Typography.Link";export{r as default};
1
+ import{jsx as m}from"react/jsx-runtime";import{cnMerge as n}from"@nild/shared";import{forwardRef as f}from"react";import{linkClassNames as p}from"./style/index.js";const a=f(({className:r,children:s,underlined:i=!1,disabled:e=!1,href:d="#",...l},o)=>m("a",{...l,href:e?void 0:d,className:n(p({underlined:i,disabled:e}),r),ref:o,children:s}));a.displayName="Typography.Link";export{a as default};
@@ -1,4 +1,3 @@
1
- import { HTMLAttributes } from 'react';
2
- export type ParagraphProps = HTMLAttributes<HTMLParagraphElement>;
1
+ import { ParagraphProps } from './interfaces';
3
2
  declare const Paragraph: import('react').ForwardRefExoticComponent<ParagraphProps & import('react').RefAttributes<HTMLParagraphElement>>;
4
3
  export default Paragraph;
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{cnMerge as o}from"@nild/shared";import{forwardRef as s}from"react";const r=s(({className:a,children:e,...m},p)=>t("p",{...m,className:o("nd-paragraph","text-primary text-[length:inherit]","mt-0 mb-[1em]",a),ref:p,children:e}));r.displayName="Typography.Paragraph";export{r as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{cnMerge as p}from"@nild/shared";import{forwardRef as f}from"react";import{paragraphClassNames as t}from"./style/index.js";const a=f(({className:r,children:s,...e},m)=>o("p",{...e,className:p(t(),r),ref:m,children:s}));a.displayName="Typography.Paragraph";export{a as default};
@@ -1,14 +1,3 @@
1
- import { HTMLAttributes } from 'react';
2
- export interface TextProps extends HTMLAttributes<HTMLSpanElement> {
3
- disabled?: boolean;
4
- secondary?: boolean;
5
- strong?: boolean;
6
- deleted?: boolean;
7
- underlined?: boolean;
8
- italic?: boolean;
9
- marked?: boolean;
10
- coded?: boolean;
11
- keyboarded?: boolean;
12
- }
1
+ import { TextProps } from './interfaces';
13
2
  declare const Text: import('react').ForwardRefExoticComponent<TextProps & import('react').RefAttributes<HTMLSpanElement>>;
14
3
  export default Text;
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import{cnJoin as d,cnMerge as x}from"@nild/shared";import{forwardRef as g}from"react";import{DISABLED_CLS as u}from"../_shared/style/index.js";const s=g(({className:a,children:o,disabled:n,secondary:t,strong:i,deleted:l,underlined:c,italic:m,marked:p,coded:b,keyboarded:h,...y},f)=>{let e=o;return i&&(e=r("strong",{children:e})),l&&(e=r("del",{children:e})),c&&(e=r("u",{className:"underline",children:e})),m&&(e=r("i",{children:e})),p&&(e=r("mark",{className:"text-contrast bg-primary",children:e})),b&&(e=r("code",{className:d("text-sm","ps-1.5 pe-1.5","bg-secondary rounded-sm border border-solid border-secondary"),children:e})),h&&(e=r("kbd",{className:d("text-sm","ps-1.5 pe-1.5","rounded-sm border border-b-2 border-solid border-secondary"),children:e})),r("span",{...y,className:x("nd-text","font-nd text-[length:inherit]",u,n&&"disabled",t?"text-secondary":"text-primary",a),ref:f,children:e})});s.displayName="Typography.Text";export{s as default};
1
+ import{jsx as s}from"react/jsx-runtime";import{cnMerge as p}from"@nild/shared";import{forwardRef as f}from"react";import{textTagClassNames as x,textClassNames as N}from"./style/index.js";const e=f(({className:r,children:t,variants:o=[],secondary:d=!1,disabled:m=!1,...n},i)=>{const c=[...new Set(o)].reduce((l,a)=>s(a,{className:x({variant:a}),children:l}),t);return s("span",{...n,className:p(N({secondary:d,disabled:m}),r),ref:i,children:c})});e.displayName="Typography.Text";export{e as default};
@@ -1,7 +1,3 @@
1
- import { HTMLAttributes } from 'react';
2
- import { HeadingLevel } from './style';
3
- export interface TitleProps extends HTMLAttributes<HTMLHeadingElement> {
4
- level?: HeadingLevel;
5
- }
1
+ import { TitleProps } from './interfaces';
6
2
  declare const Title: import('react').ForwardRefExoticComponent<TitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
7
3
  export default Title;
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{cnMerge as f}from"@nild/shared";import{forwardRef as l}from"react";import{HEADING_LEVEL_CLS_MAP as n}from"./style/index.js";const r=l(({className:m,children:a,level:e=1,...o},t)=>{const s=`h${e}`;return i(s,{...o,className:f(["nd-title","font-nd font-semibold text-primary","mt-[1em] mb-[0.5em]"],n[e],m),ref:t,children:a})});r.displayName="Typography.Title";export{r as default};
1
+ import{jsx as t}from"react/jsx-runtime";import{cnMerge as i}from"@nild/shared";import{forwardRef as f}from"react";import{titleClassNames as p}from"./style/index.js";const r=f(({className:s,children:a,level:e=1,...l},m)=>{const o=`h${e}`;return t(o,{...l,className:i(p({level:e}),s),ref:m,children:a})});r.displayName="Typography.Title";export{r as default};
@@ -1,16 +1,3 @@
1
- import { HTMLAttributes, ForwardRefExoticComponent } from 'react';
2
- import { default as Link } from './Link';
3
- import { default as Paragraph } from './Paragraph';
4
- import { default as Text } from './Text';
5
- import { default as Title } from './Title';
6
- export type TypographyProps = HTMLAttributes<HTMLElement>;
7
- /**
8
- * @category Components
9
- */
10
- declare const Typography: ForwardRefExoticComponent<TypographyProps> & {
11
- Link: typeof Link;
12
- Paragraph: typeof Paragraph;
13
- Text: typeof Text;
14
- Title: typeof Title;
15
- };
1
+ import { TypographyProps } from './interfaces';
2
+ declare const Typography: import('react').ForwardRefExoticComponent<TypographyProps & import('react').RefAttributes<HTMLElement>>;
16
3
  export default Typography;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{cnMerge as p}from"@nild/shared";import{forwardRef as i}from"react";import f from"./Link.js";import s from"./Paragraph.js";import d from"./Text.js";import n from"./Title.js";const r=i(({className:o,children:a,...m},t)=>e("article",{...m,className:p("nd-typography","font-nd text-md",o),ref:t,children:a}));r.Link=f,r.Paragraph=s,r.Text=d,r.Title=n,r.displayName="Typography";export{r as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{cnMerge as p}from"@nild/shared";import{forwardRef as t}from"react";import{typographyClassNames as f}from"./style/index.js";const a=t(({className:r,children:s,...e},m)=>o("article",{...e,className:p(f(),r),ref:m,children:s}));a.displayName="Typography";export{a as default};
@@ -1,8 +1,11 @@
1
- import { LinkProps } from './Link';
2
- import { ParagraphProps } from './Paragraph';
3
- import { HeadingLevel } from './style';
4
- import { TextProps } from './Text';
5
- import { TitleProps } from './Title';
6
- import { default as Typography, TypographyProps } from './Typography';
7
- export type { TypographyProps, LinkProps, ParagraphProps, TextProps, TitleProps, HeadingLevel };
1
+ /**
2
+ * @category Components
3
+ */
4
+ declare const Typography: import('react').ForwardRefExoticComponent<import('./interfaces').TypographyProps & import('react').RefAttributes<HTMLElement>> & {
5
+ Link: import('react').ForwardRefExoticComponent<import('./interfaces').LinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
6
+ Paragraph: import('react').ForwardRefExoticComponent<import('./interfaces').ParagraphProps & import('react').RefAttributes<HTMLParagraphElement>>;
7
+ Text: import('react').ForwardRefExoticComponent<import('./interfaces').TextProps & import('react').RefAttributes<HTMLSpanElement>>;
8
+ Title: import('react').ForwardRefExoticComponent<import('./interfaces').TitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
9
+ };
10
+ export type * from './interfaces';
8
11
  export default Typography;
@@ -1 +1 @@
1
- import o from"./Typography.js";export{o as default};
1
+ import r from"./Link.js";import o from"./Paragraph.js";import t from"./Text.js";import m from"./Title.js";import i from"./Typography.js";const p=Object.assign(i,{Link:r,Paragraph:o,Text:t,Title:m});export{p as default};
@@ -1,2 +1,9 @@
1
- export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
2
- export declare const HEADING_LEVEL_CLS_MAP: Record<HeadingLevel, string[]>;
1
+ import { LinkProps, ParagraphProps, TextProps, TextVariant, TitleProps, TypographyProps } from '../interfaces';
2
+ export declare const linkClassNames: (props?: LinkProps | undefined) => string;
3
+ export declare const paragraphClassNames: (props?: ParagraphProps | undefined) => string;
4
+ export declare const textClassNames: (props?: TextProps | undefined) => string;
5
+ export declare const textTagClassNames: (props?: {
6
+ variant: TextVariant;
7
+ } | undefined) => string;
8
+ export declare const titleClassNames: (props?: TitleProps | undefined) => string;
9
+ export declare const typographyClassNames: (props?: TypographyProps | undefined) => string;
@@ -1 +1 @@
1
- const t={1:["text-6xl"],2:["text-5xl"],3:["text-4xl"],4:["text-3xl"],5:["text-2xl"],6:["text-lg"]};export{t as HEADING_LEVEL_CLS_MAP};
1
+ import{cva as e}from"@nild/shared";import{DISABLED_CLS as t}from"../../_shared/style/index.js";const a=e(["nd-link",["font-nd","text-link","text-[length:inherit]","cursor-pointer","enabled:hover:text-link-hover","enabled:active:text-link-active"],t],{variants:{disabled:{true:"disabled",false:""},underlined:{true:"underline",false:"no-underline"}}}),r=e(["nd-paragraph",["font-nd","text-primary","text-[length:inherit]"],["mt-0","mb-[1em]"]]),s=e(["nd-text",["font-nd","text-[length:inherit]"],t],{variants:{secondary:{true:"text-secondary",false:"text-primary"},disabled:{true:"disabled",false:""}}}),n=e("",{variants:{variant:{strong:"",del:"",u:["underline"],i:"",mark:["bg-primary","text-contrast"],code:[["ps-1.5","pe-1.5"],["bg-secondary","text-sm","rounded-sm"],["border","border-solid","border-secondary"]],kbd:[["ps-1.5","pe-1.5"],["text-sm","rounded-sm"],["border","border-b-2","border-solid","border-secondary"]]}}}),d=e(["nd-title",["font-nd","font-semibold","text-primary"],["mt-[1em]","mb-[0.5em]"]],{variants:{level:{1:["text-6xl"],2:["text-5xl"],3:["text-4xl"],4:["text-3xl"],5:["text-2xl"],6:["text-lg"]}}}),l=e(["nd-typography",["font-nd","text-md"]]);export{a as linkClassNames,r as paragraphClassNames,s as textClassNames,n as textTagClassNames,d as titleClassNames,l as typographyClassNames};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nild/components",
3
3
  "private": false,
4
- "version": "0.0.21",
4
+ "version": "0.0.22",
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.10",
35
34
  "@nild/hooks": "0.0.12",
36
- "@nild/icons": "0.0.11"
35
+ "@nild/icons": "0.0.11",
36
+ "@nild/shared": "0.0.10"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "vite build --mode PROD",