@nild/components 0.0.21 → 0.0.23
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/button/contexts/index.js +1 -1
- package/dist/checkbox/Checkbox.js +1 -1
- package/dist/checkbox/Group.d.ts +3 -0
- package/dist/checkbox/Group.js +1 -0
- package/dist/checkbox/contexts/index.d.ts +9 -2
- package/dist/checkbox/contexts/index.js +1 -1
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/style/index.d.ts +2 -1
- package/dist/checkbox/style/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/switch/contexts/index.js +1 -1
- package/dist/typography/Link.d.ts +1 -5
- package/dist/typography/Link.js +1 -1
- package/dist/typography/Paragraph.d.ts +1 -2
- package/dist/typography/Paragraph.js +1 -1
- package/dist/typography/Text.d.ts +1 -12
- package/dist/typography/Text.js +1 -1
- package/dist/typography/Title.d.ts +1 -5
- package/dist/typography/Title.js +1 -1
- package/dist/typography/Typography.d.ts +2 -15
- package/dist/typography/Typography.js +1 -1
- package/dist/typography/index.d.ts +10 -7
- package/dist/typography/index.js +1 -1
- package/dist/typography/style/index.d.ts +9 -2
- package/dist/typography/style/index.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContextSuite as e}from"@nild/shared";const[a,o]=e({defaultValue:{variant:"solid",size:"medium",equal:!1,disabled:!1}});export{a as GroupProvider,o as useGroupContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{useControllableState as w,useEffectCallback as E}from"@nild/hooks";import{isString as u,cnMerge as M}from"@nild/shared";import{forwardRef as S,Children as V,isValidElement as j}from"react";import{useGroupContext as G,CheckboxProvider as P}from"./contexts/index.js";import i from"./Indicator.js";import r from"./Label.js";import{checkboxClassNames as I}from"./style/index.js";const h=S((f,p)=>{const t=[],l=new Map,e=G(),{className:v,children:o,variant:C=e?.variant??"solid",size:n=e?.size??"medium",disabled:c=e?.disabled??!1,checked:b,defaultChecked:k,value:d,onChange:m,...x}=f,[z,N]=w(e?e.value.includes(d):b,k??!1),g=E(()=>{c||N(a=>(e?e.setValue(a?e.value.filter(y=>y!==d):e.value.concat(d)):m?.(!a),!a))});return V.forEach(o,a=>{j(a)?a.type===i?(l.delete(i),l.set(i,a)):a.type===r&&(l.delete(r),l.set(r,a)):u(a)&&(l.has(r)||l.set(r,s(r,{children:a})))}),t.push(...l.values()),l.has(i)||t.unshift(s(i,{})),!l.has(r)&&u(o)&&t.push(s(r,{children:o})),s(P,{value:{variant:C,size:n,checked:z,handleChange:g},children:s("label",{...x,className:M(I({size:n,disabled:c}),v),ref:p,children:t})})});h.displayName="Checkbox";export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useControllableState as b,useEffectCallback as C}from"@nild/hooks";import{forwardRefWithGenerics as N,cnMerge as x}from"@nild/shared";import{GroupProvider as G}from"./contexts/index.js";import{groupClassNames as g}from"./style/index.js";const o=N(({className:s,children:i,direction:l="horizontal",variant:t="solid",size:d="medium",disabled:n=!1,value:m,defaultValue:u=[],onChange:e,...c},f)=>{const[p,v]=b(m,u),h=C(a=>{v(()=>(e?.(a),a))});return r(G,{value:{variant:t,size:d,disabled:n,value:p,setValue:h},children:r("div",{...c,className:x(g({direction:l}),s),ref:f,children:i})})});o.displayName="Checkbox.Group";export{o as default};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { CheckboxProps } from '../interfaces';
|
|
1
|
+
import { CheckboxProps, GroupProps } from '../interfaces';
|
|
2
2
|
declare const CheckboxProvider: import('react').Provider<Pick<CheckboxProps, "variant" | "size" | "checked"> & {
|
|
3
3
|
handleChange?: () => void;
|
|
4
4
|
}>, useCheckboxContext: () => Pick<CheckboxProps, "variant" | "size" | "checked"> & {
|
|
5
5
|
handleChange?: () => void;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
declare const GroupProvider: import('react').Provider<(Pick<GroupProps<unknown>, "variant" | "size" | "disabled"> & {
|
|
8
|
+
value: any[];
|
|
9
|
+
setValue: (value: any[]) => void;
|
|
10
|
+
}) | undefined>, useGroupContext: () => (Pick<GroupProps<unknown>, "variant" | "size" | "disabled"> & {
|
|
11
|
+
value: any[];
|
|
12
|
+
setValue: (value: any[]) => void;
|
|
13
|
+
}) | undefined;
|
|
14
|
+
export { CheckboxProvider, GroupProvider, useCheckboxContext, useGroupContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContextSuite as e}from"@nild/shared";const[o,t]=e({defaultValue:{}}),[r,a]=e({defaultValue:void 0});export{o as CheckboxProvider,r as GroupProvider,t as useCheckboxContext,a as useGroupContext};
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
declare const Checkbox: import('react').ForwardRefExoticComponent<import('./interfaces').CheckboxProps & import('react').RefAttributes<HTMLLabelElement>> & {
|
|
5
5
|
Indicator: import('react').ForwardRefExoticComponent<import('./interfaces').IndicatorProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Label: import('react').ForwardRefExoticComponent<import('./interfaces').LabelProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
Group: <T>(props: import('./interfaces').GroupProps<T> & import('react').RefAttributes<HTMLDivElement>) => import('react').ReactElement | null;
|
|
7
8
|
};
|
|
8
9
|
export type * from './interfaces';
|
|
9
10
|
export default Checkbox;
|
package/dist/checkbox/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./Checkbox.js";import r from"./
|
|
1
|
+
import o from"./Checkbox.js";import r from"./Group.js";import t from"./Indicator.js";import m from"./Label.js";const i=Object.assign(o,{Indicator:t,Label:m,Group:r});export{i as default};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CheckboxProps } from '../interfaces';
|
|
1
|
+
import { CheckboxProps, GroupProps } from '../interfaces';
|
|
2
2
|
export declare const checkboxClassNames: (props?: Pick<CheckboxProps, "size" | "disabled"> | undefined) => string;
|
|
3
3
|
export declare const indicatorClassNames: (props?: Pick<CheckboxProps, "size"> | undefined) => string;
|
|
4
4
|
export declare const indicatorInputClassNames: (props?: object | undefined) => string;
|
|
5
5
|
export declare const defaultIndicatorBlockClassNames: (props?: Pick<CheckboxProps, "variant" | "checked"> | undefined) => string;
|
|
6
6
|
export declare const defaultIndicatorIconClassNames: (props?: object | undefined) => string;
|
|
7
7
|
export declare const labelClassNames: (props?: Pick<CheckboxProps, "size"> | undefined) => string;
|
|
8
|
+
export declare const groupClassNames: (props?: Pick<GroupProps<unknown>, "direction"> | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cva as e}from"@nild/shared";import{DISABLED_CLS as a}from"../../_shared/style/index.js";const r=e(["nd-checkbox","group",["flex","items-center"],"cursor-pointer",a],{variants:{size:{small:"gap-1.5",medium:"gap-2",large:"gap-2.5"},disabled:{true:"disabled",false:""}}}),
|
|
1
|
+
import{cva as e}from"@nild/shared";import{DISABLED_CLS as a}from"../../_shared/style/index.js";const r=e(["nd-checkbox","group",["flex","items-center"],"cursor-pointer",a],{variants:{size:{small:"gap-1.5",medium:"gap-2",large:"gap-2.5"},disabled:{true:"disabled",false:""}}}),s=e(["relative",["flex","items-center","justify-center"]],{variants:{size:{small:"w-3.5 h-3.5 text-sm",medium:"w-4 h-4 text-md",large:"w-4.5 h-4.5 text-lg"}}}),t=e([["absolute","inset-0","opacity-0"],["group-enabled:cursor-pointer","group-disabled:cursor-not-allowed"]]),o=e([["flex","items-center","justify-center"],["w-full","h-full","rounded-sm","border-solid","border-1","border-primary"],"transition-[background-color,color]"],{compoundVariants:[{checked:!0,variant:"solid",className:["bg-primary text-contrast","group-enabled:group-hover:bg-primary-hover"]},{checked:!0,variant:"outlined",className:["bg-transparent text-primary","group-enabled:group-hover:bg-tertiary-hover"]},{checked:!1,className:["bg-transparent text-transparent","group-enabled:group-hover:bg-tertiary-hover"]}]}),l=e(["w-full"]),i=e(["text-sm"],{variants:{size:{small:"text-sm",medium:"text-md",large:"text-lg"}}}),n=e(["nd-checkbox-group",["flex","gap-x-4","gap-y-2"]],{variants:{direction:{horizontal:"flex-row flex-wrap",vertical:"flex-col"}}});export{r as checkboxClassNames,o as defaultIndicatorBlockClassNames,l as defaultIndicatorIconClassNames,n as groupClassNames,s as indicatorClassNames,t as indicatorInputClassNames,i as labelClassNames};
|
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/
|
|
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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContextSuite as t}from"@nild/shared";const[e,o]=t({defaultValue:{}});export{e as SwitchProvider,o as useSwitchContext};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
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;
|
package/dist/typography/Link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
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 {
|
|
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
|
|
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 {
|
|
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;
|
package/dist/typography/Text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
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 {
|
|
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;
|
package/dist/typography/Title.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
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 {
|
|
2
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
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;
|
package/dist/typography/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./Typography.js";export{
|
|
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
|
-
|
|
2
|
-
export declare const
|
|
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{
|
|
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.
|
|
4
|
+
"version": "0.0.23",
|
|
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.
|
|
35
|
-
"@nild/
|
|
36
|
-
"@nild/
|
|
34
|
+
"@nild/shared": "0.0.11",
|
|
35
|
+
"@nild/icons": "0.0.12",
|
|
36
|
+
"@nild/hooks": "0.0.13"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vite build --mode PROD",
|