@nild/components 0.0.15 → 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.
- package/dist/button/style/index.d.ts +5 -5
- package/dist/checkbox/Checkbox.d.ts +5 -13
- package/dist/checkbox/Checkbox.js +1 -1
- package/dist/checkbox/index.d.ts +2 -3
- package/dist/checkbox/style/index.d.ts +7 -4
- package/dist/checkbox/style/index.js +1 -1
- package/dist/divider/Divider.d.ts +1 -7
- package/dist/divider/Divider.js +1 -1
- package/dist/divider/index.d.ts +2 -3
- package/dist/divider/style/index.d.ts +4 -6
- package/dist/divider/style/index.js +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ButtonProps, ButtonGroupProps } from '../interfaces';
|
|
2
|
-
export declare const buttonClassNames: (props
|
|
2
|
+
export declare const buttonClassNames: (props?: (ButtonProps & {
|
|
3
3
|
plain?: boolean;
|
|
4
|
-
}) => string;
|
|
5
|
-
export declare const groupClassNames: (props
|
|
6
|
-
export declare const groupButtonClassNames: (props
|
|
4
|
+
}) | undefined) => string;
|
|
5
|
+
export declare const groupClassNames: (props?: ButtonGroupProps | undefined) => string;
|
|
6
|
+
export declare const groupButtonClassNames: (props?: (ButtonGroupProps & {
|
|
7
7
|
first?: boolean;
|
|
8
8
|
last?: boolean;
|
|
9
|
-
}) => string;
|
|
9
|
+
}) | undefined) => string;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ForwardRefExoticComponent, RefAttributes, ChangeEventHandler } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface CheckboxProps extends Omit<HTMLAttributes<HTMLLabelElement>, 'onChange' | 'defaultValue'> {
|
|
4
|
-
variant?: CheckboxVariant;
|
|
5
|
-
size?: CheckboxSize;
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
defaultChecked?: boolean;
|
|
8
|
-
value?: boolean;
|
|
9
|
-
defaultValue?: boolean;
|
|
10
|
-
indeterminate?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
onChange?: (checked: boolean) => void;
|
|
13
|
-
}
|
|
2
|
+
import { CheckboxProps, CheckboxSize } from './interfaces';
|
|
14
3
|
/**
|
|
15
4
|
* @category Components
|
|
16
5
|
*/
|
|
@@ -19,10 +8,13 @@ declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<
|
|
|
19
8
|
Label: typeof Label;
|
|
20
9
|
};
|
|
21
10
|
interface IndicatorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
11
|
+
size?: CheckboxSize;
|
|
22
12
|
checked?: boolean;
|
|
23
13
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
24
14
|
}
|
|
25
15
|
declare const Indicator: ForwardRefExoticComponent<IndicatorProps & RefAttributes<HTMLDivElement>>;
|
|
26
|
-
|
|
16
|
+
interface LabelProps extends HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
size?: CheckboxSize;
|
|
18
|
+
}
|
|
27
19
|
declare const Label: ForwardRefExoticComponent<LabelProps & RefAttributes<HTMLSpanElement>>;
|
|
28
20
|
export default Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as S}from"react/jsx-runtime";import{useControllableState as V,useEffectCallback as L,usePureCallback as x}from"@nild/hooks";import{Icon as M}from"@nild/icons";import P from"@nild/icons/CheckSmall";import{isString as g,cnMerge as u}from"@nild/shared";import{forwardRef as N,Children as R,isValidElement as W,cloneElement as I}from"react";import{defaultIndicatorClassNames as q,defaultIndicatorIconClassNames as A,checkboxClassNames as B,indicatorInputClassNames as D,indicatorWrapperClassNames as F,labelClassNames as G}from"./style/index.js";const m=N(({className:n,children:c,variant:o="solid",size:a="medium",checked:t,defaultChecked:h,value:p,defaultValue:v,indeterminate:H,disabled:C,onChange:b,...y},E)=>{const d=[],s=new Map,[f,j]=V(t??p,h??v??!1),k=L(()=>{C||j(e=>(b?.(!e),!e))}),w=x(()=>i(r,{size:a,checked:f,onChange:k,children:i("div",{className:q({variant:o,checked:f}),children:i(M,{className:A(),component:P})})})),z=x(e=>i(l,{size:a,children:e}));return R.forEach(c,e=>{W(e)?e.type===r?(s.delete(r),s.set(r,I(e,{...e.props,size:a,checked:f,onChange:k}))):e.type===l&&(s.delete(l),s.set(l,I(e,{...e.props,size:a}))):g(e)&&(s.has(l)||s.set(l,z(e)))}),d.push(...s.values()),s.has(r)||d.unshift(w()),!s.has(l)&&g(c)&&d.push(z(c)),i("label",{...y,className:u(B({size:a,disabled:C}),n),ref:E,children:d})}),r=N(({className:n,children:c,size:o,checked:a,onChange:t,...h},p)=>S("div",{...h,className:u(F({size:o}),n),ref:p,children:[c,i("input",{type:"checkbox",className:D(),checked:a,onChange:t})]}));r.displayName="Checkbox.Indicator";const l=N(({className:n,children:c,size:o,...a},t)=>i("span",{...a,className:u(G({size:o}),n),ref:t,children:c}));l.displayName="Checkbox.Label",m.Indicator=r,m.Label=l,m.displayName="Checkbox";export{m as default};
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as Checkbox
|
|
2
|
-
|
|
3
|
-
export type { CheckboxProps, CheckboxVariant, CheckboxSize };
|
|
1
|
+
import { default as Checkbox } from './Checkbox';
|
|
2
|
+
export type * from './interfaces';
|
|
4
3
|
export default Checkbox;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
4
|
-
export declare const
|
|
1
|
+
import { CheckboxProps } from '../interfaces';
|
|
2
|
+
export declare const checkboxClassNames: (props?: Pick<CheckboxProps, "size" | "disabled"> | undefined) => string;
|
|
3
|
+
export declare const indicatorWrapperClassNames: (props?: Pick<CheckboxProps, "size"> | undefined) => string;
|
|
4
|
+
export declare const indicatorInputClassNames: (props?: object | undefined) => string;
|
|
5
|
+
export declare const defaultIndicatorClassNames: (props?: Pick<CheckboxProps, "variant" | "checked"> | undefined) => string;
|
|
6
|
+
export declare const defaultIndicatorIconClassNames: (props?: object | undefined) => string;
|
|
7
|
+
export declare const labelClassNames: (props?: Pick<CheckboxProps, "size"> | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r={
|
|
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:""}}}),t=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-xl"}}}),s=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(["mr-[0.25px]"]),i=e(["text-sm"],{variants:{size:{small:"text-sm",medium:"text-md",large:"text-lg"}}});export{r as checkboxClassNames,o as defaultIndicatorClassNames,l as defaultIndicatorIconClassNames,s as indicatorInputClassNames,t as indicatorWrapperClassNames,i as labelClassNames};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
*/
|
package/dist/divider/Divider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
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};
|
package/dist/divider/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as Divider
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
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.
|
|
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/
|
|
35
|
-
"@nild/hooks": "0.0.
|
|
36
|
-
"@nild/
|
|
34
|
+
"@nild/icons": "0.0.10",
|
|
35
|
+
"@nild/hooks": "0.0.11",
|
|
36
|
+
"@nild/shared": "0.0.9"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vite build --mode PROD",
|