@nild/components 0.0.18 → 0.0.20
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/portal/Arrow.d.ts +1 -7
- package/dist/portal/Arrow.js +1 -1
- package/dist/portal/Portal.d.ts +1 -11
- package/dist/portal/Portal.js +1 -1
- package/dist/portal/index.d.ts +3 -4
- package/dist/portal/style/index.d.ts +5 -8
- package/dist/portal/style/index.js +1 -1
- package/dist/switch/style/index.js +1 -1
- package/dist/transition/Transition.d.ts +2 -6
- package/dist/transition/Transition.js +1 -1
- package/dist/transition/index.d.ts +2 -2
- package/dist/transition/interfaces/index.d.ts +13 -0
- package/dist/transition/interfaces/index.js +1 -0
- package/dist/transition/style/index.d.ts +4 -0
- package/dist/transition/style/index.js +1 -0
- package/package.json +3 -3
package/dist/portal/Arrow.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowSize, ArrowOrientation } from './style';
|
|
3
|
-
export interface ArrowProps extends HTMLAttributes<HTMLSpanElement> {
|
|
4
|
-
style?: CSSProperties;
|
|
5
|
-
orientation?: ArrowOrientation;
|
|
6
|
-
size?: ArrowSize;
|
|
7
|
-
}
|
|
1
|
+
import { ArrowProps } from './interfaces';
|
|
8
2
|
declare const Arrow: import('react').ForwardRefExoticComponent<ArrowProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
3
|
export default Arrow;
|
package/dist/portal/Arrow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{cnMerge as t}from"@nild/shared";import{forwardRef as f}from"react";import{arrowClassNames as p}from"./style/index.js";const r=f(({className:a,orientation:s="up",size:o="medium",...e},i)=>m("div",{...e,className:t(p({orientation:s,size:o}),a),ref:i}));r.displayName="Arrow";export{r as default};
|
package/dist/portal/Portal.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowProps } from './Arrow';
|
|
3
|
-
import { PaddingSize } from './style';
|
|
4
|
-
export interface ArrowOptions extends ArrowProps {
|
|
5
|
-
ref: Ref<HTMLDivElement>;
|
|
6
|
-
}
|
|
7
|
-
export interface PortalProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
container?: Element | DocumentFragment;
|
|
9
|
-
paddingSize?: PaddingSize;
|
|
10
|
-
arrow?: ArrowOptions | false;
|
|
11
|
-
}
|
|
1
|
+
import { PortalProps } from './interfaces';
|
|
12
2
|
/**
|
|
13
3
|
* @category Components
|
|
14
4
|
*/
|
package/dist/portal/Portal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as p,jsx as
|
|
1
|
+
import{jsxs as p,jsx as f}from"react/jsx-runtime";import{cnMerge as e,cnJoin as N}from"@nild/shared";import{forwardRef as u,Children as C,isValidElement as v,cloneElement as x}from"react";import{createPortal as y}from"react-dom";import g from"./Arrow.js";import{portalContentClassNames as h,portalArrowClassNames as j,portalClassNames as w}from"./style/index.js";const o=u(({className:l,children:m,container:t=document.body,paddingSize:i="medium",arrow:s=!1,...n},d)=>{var r;const a=C.toArray(m).find(c=>v(c));return a?y(p("div",{...n,className:e(w(),l),ref:d,children:[x(a,{...a.props,className:e(h({paddingSize:i}),(r=a?.props)==null?void 0:r.className)}),s!==!1&&f(g,{...s,className:N(j(),s.className)})]}),t):null});o.displayName="Portal";export{o as default};
|
package/dist/portal/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { default as Arrow
|
|
2
|
-
import { default as Portal
|
|
3
|
-
|
|
4
|
-
export type { ArrowProps, PortalProps, PaddingSize, ArrowOptions };
|
|
1
|
+
import { default as Arrow } from './Arrow';
|
|
2
|
+
import { default as Portal } from './Portal';
|
|
3
|
+
export type * from './interfaces';
|
|
5
4
|
export { Arrow };
|
|
6
5
|
export default Portal;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
export declare const
|
|
4
|
-
export
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const ARROW_ORIENTATION_CLS_MAP: Record<ArrowOrientation, string>;
|
|
7
|
-
export type PaddingSize = 'small' | 'medium' | 'large';
|
|
8
|
-
export declare const PADDING_SIZE_CLS_MAP: Record<PaddingSize, string>;
|
|
1
|
+
import { ArrowProps, PortalProps } from '../interfaces';
|
|
2
|
+
export declare const arrowClassNames: (props?: ArrowProps | undefined) => string;
|
|
3
|
+
export declare const portalClassNames: (props?: PortalProps | undefined) => string;
|
|
4
|
+
export declare const portalContentClassNames: (props?: PortalProps | undefined) => string;
|
|
5
|
+
export declare const portalArrowClassNames: (props?: ArrowProps | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r
|
|
1
|
+
import{cva as r}from"@nild/shared";const e=r(["nd-arrow","bg-container",["border-solid","border-edge"]],{variants:{orientation:{up:["transform-[translateY(-50%)_rotate(45deg)]",["rounded-tl-sm","border-l-1","border-t-1"]],down:["transform-[translateY(50%)_rotate(45deg)]",["rounded-br-sm","border-r-1","border-b-1"]],left:["transform-[translateX(-50%)_rotate(45deg)]",["rounded-bl-sm","border-l-1","border-b-1"]],right:["transform-[translateX(50%)_rotate(45deg)]",["rounded-tr-sm","border-r-1","border-t-1"]]},size:{small:["w-1.5","h-1.5"],medium:["w-3","h-3"],large:["w-4.5","h-4.5"]}}}),a=r(["nd-portal",["absolute","top-0","left-0"]]),o=r(["bg-container","rounded-md",["outline-solid","outline-1","outline-edge"],"shadow-lg"],{variants:{paddingSize:{small:["px-2","py-1"],medium:["px-4","py-3"],large:["px-6","py-5"]}}}),t=r(["absolute"]);export{e as arrowClassNames,t as portalArrowClassNames,a as portalClassNames,o as portalContentClassNames};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cva as e}from"@nild/shared";import{DISABLED_CLS as r}from"../../_shared/style/index.js";const a=e(["nd-switch","group","h-[var(--nd-switch-height)]",["relative","inline-block","font-nd","overflow-hidden","cursor-pointer"],r],{variants:{variant:{solid:"",outlined:["
|
|
1
|
+
import{cva as e}from"@nild/shared";import{DISABLED_CLS as r}from"../../_shared/style/index.js";const a=e(["nd-switch","group","h-[var(--nd-switch-height)]",["relative","inline-block","font-nd","overflow-hidden","cursor-pointer"],r],{variants:{variant:{solid:"",outlined:["outline-solid","outline","outline-primary"]},size:{small:["min-w-8","text-sm"],medium:["min-w-10","text-md"],large:["min-w-12","text-lg"]},shape:{round:"rounded-full",square:"rounded-md"}}}),t=e(["h-[var(--nd-switch-height)]","transition-[margin-inline,background-color]",["flex","justify-center","items-center"],["text-center","text-contrast"],["ps-[calc(var(--nd-switch-height)/3)]","pe-[calc(var(--nd-switch-height)*1.1)]"]],{variants:{checked:{true:["ms-0","me-0"],false:["-ms-[100%]","me-[100%]"]}},compoundVariants:[{variant:"solid",checked:!0,className:["bg-primary","group-enabled:group-hover:bg-primary-hover"]},{variant:"solid",checked:!1,className:["bg-[--alpha(var(--color-primary)/40%)]","group-enabled:group-hover:bg-[--alpha(var(--color-primary)/50%)]"]},{variant:"outlined",className:["bg-transparent","group-enabled:group-hover:bg-tertiary-hover"]}]}),i=e(["h-[var(--nd-switch-height)]","-mt-[var(--nd-switch-height)]","transition-[margin-inline,background-color]",["flex","justify-center","items-center"],["text-center","text-contrast"],["ps-[calc(var(--nd-switch-height)*1.1)]","pe-[calc(var(--nd-switch-height)/3)]"]],{variants:{checked:{true:["ms-[100%]","-me-[100%]"],false:["ms-0","me-0"]}},compoundVariants:[{variant:"solid",checked:!0,className:["bg-primary","group-enabled:group-hover:bg-primary-hover"]},{variant:"solid",checked:!1,className:["bg-[--alpha(var(--color-primary)/40%)]","group-enabled:group-hover:bg-[--alpha(var(--color-primary)/50%)]"]},{variant:"outlined",className:["bg-transparent","group-enabled:group-hover:bg-tertiary-hover"]}]}),s=e(["h-[var(--nd-switch-height)]",["flex","justify-center","items-center"],["absolute","aspect-square","scale-80"],["text-contrast","transition-[left,background-color]"]],{variants:{variant:{solid:["bg-contrast","top-0"],outlined:["bg-primary","top-0","group-enabled:group-hover:bg-primary-hover"]},shape:{round:"rounded-full",square:"rounded-md"},checked:{true:"left-[calc(100%-var(--nd-switch-height))]",false:"left-0"}}});export{t as checkedClassNames,a as switchClassNames,s as thumbClassNames,i as uncheckedClassNames};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
|
|
3
|
-
className?: string;
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
visible?: boolean;
|
|
6
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TransitionProps } from './interfaces';
|
|
7
3
|
/**
|
|
8
4
|
* @category Components
|
|
9
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffectCallback as o}from"@nild/hooks";import{cnMerge as
|
|
1
|
+
import{useEffectCallback as o}from"@nild/hooks";import{cnMerge as R}from"@nild/shared";import{Children as X,isValidElement as M,useState as O,useRef as m,useEffect as D,cloneElement as b}from"react";import{Status as r}from"./interfaces/index.js";import{transitionClassNames as G}from"./style/index.js";const I=({className:U,children:f,visible:i=!0})=>{const a=X.toArray(f).find(N=>M(N)),c=a?i?r.ENTERED:r.EXITED:r.UNMOUNTED,[t,E]=O(c),e=m(),n=m(a);n.current=t===r.UNMOUNTED?a:a??n.current;const s=o(N=>{u();let T=!0;const l=()=>{T&&(T=!1,e.current=void 0,N?.())};l.cancel=()=>{T=!1},e.current=l}),d=o(()=>{e.current&&(e.current(),e.current=void 0)}),u=o(()=>{e.current&&(e.current.cancel(),e.current=void 0)}),p=o(()=>{c===r.UNMOUNTED&&t===r.EXITED&&E(r.UNMOUNTED)});return D(()=>{d()},[t]),D(()=>{switch(c){case r.ENTERED:t!==r.ENTERING&&t!==r.ENTERED&&(t===r.UNMOUNTED?E(r.EXITED):(u(),E(r.ENTERING),s(()=>{s(()=>{E(r.ENTERED)}),e.current&&setTimeout(e.current,0)})));break;case r.EXITED:(t===r.ENTERING||t===r.ENTERED)&&(u(),E(r.EXITING),s(()=>{s(()=>{E(r.EXITED)}),e.current&&setTimeout(e.current,0)}));break;case r.UNMOUNTED:default:t!==r.EXITED&&t!==r.UNMOUNTED&&(u(),E(r.EXITING),s(()=>{s(()=>{E(r.EXITED)}),e.current&&setTimeout(e.current,0)}));break}},[i,c,t]),n.current?b(n.current,{...n.current.props,className:R(n.current.props.className,G({status:t}),U),onTransitionEnd:p}):null};I.displayName="Transition";export{I as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { default as Transition
|
|
2
|
-
export type
|
|
1
|
+
import { default as Transition } from './Transition';
|
|
2
|
+
export type * from './interfaces';
|
|
3
3
|
export default Transition;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare enum Status {
|
|
3
|
+
UNMOUNTED = "unmounted",
|
|
4
|
+
ENTERING = "entering",
|
|
5
|
+
ENTERED = "entered",
|
|
6
|
+
EXITING = "exiting",
|
|
7
|
+
EXITED = "exited"
|
|
8
|
+
}
|
|
9
|
+
export interface TransitionProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=(E=>(E.UNMOUNTED="unmounted",E.ENTERING="entering",E.ENTERED="entered",E.EXITING="exiting",E.EXITED="exited",E))(t||{});export{t as Status};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cva as a}from"@nild/shared";import{Status as s}from"../interfaces/index.js";const i=a(["transition-[opacity,visibility]"],{compoundVariants:[{status:s.ENTERED,className:["opacity-100","visible"]},{status:[s.UNMOUNTED,s.ENTERING,s.EXITING,s.EXITED],className:["opacity-0","invisible"]}]});export{i as transitionClassNames};
|
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.20",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"react": ">=18.2.0",
|
|
33
33
|
"react-dom": ">=18.2.0",
|
|
34
34
|
"@nild/shared": "0.0.9",
|
|
35
|
-
"@nild/
|
|
36
|
-
"@nild/
|
|
35
|
+
"@nild/icons": "0.0.10",
|
|
36
|
+
"@nild/hooks": "0.0.11"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "vite build --mode PROD",
|