neatkit 0.8.0 → 0.10.0
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/Boundary.cjs +1 -1
- package/dist/Boundary.js +29 -29
- package/dist/Button-CVe9T_Zw.cjs +1 -0
- package/dist/Button-D6rXvcqq.js +101 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.js +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.js +111 -110
- package/dist/{Code-JDb4VFl7.cjs → Code-B7s_rN0G.cjs} +1 -1
- package/dist/{Code-ClkozPlv.js → Code-Bp2X1k-g.js} +1 -4
- package/dist/Code.cjs +1 -1
- package/dist/Code.js +1 -1
- package/dist/Divider-C7XGlr26.cjs +1 -0
- package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
- package/dist/Divider.cjs +1 -1
- package/dist/Divider.js +1 -1
- package/dist/Icon-BIBzgznI.cjs +1 -0
- package/dist/{Icon-BoEUoOk7.js → Icon-CxK1wlGk.js} +98 -52
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.cjs +1 -1
- package/dist/Input.js +52 -51
- package/dist/Markdown.cjs +1 -1
- package/dist/Markdown.js +108 -104
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.js +57 -56
- package/dist/PinInput.cjs +1 -1
- package/dist/PinInput.js +88 -87
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.js +147 -141
- package/dist/Progress.cjs +1 -0
- package/dist/Progress.js +40 -0
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.js +48 -47
- package/dist/Select.cjs +1 -1
- package/dist/Select.js +363 -359
- package/dist/Sidebar.cjs +1 -1
- package/dist/Sidebar.js +326 -311
- package/dist/Spinner-BE0F4y2S.cjs +1 -0
- package/dist/Spinner-CmxlDlOk.js +23 -0
- package/dist/Spinner.cjs +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table-BqWBgMTU.cjs +1 -0
- package/dist/Table-DutHfiXR.js +423 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Tooltip-B4bajPtk.cjs → Tooltip-CCuE-hfp.cjs} +1 -1
- package/dist/{Tooltip-BVqdnKK_.js → Tooltip-CeyRKNv4.js} +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/albert-sans-cb3e34c4.woff2 +0 -0
- package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
- package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
- package/dist/components/Icon/utils/registry.d.ts +2 -0
- package/dist/components/Portal/hooks/useAnchoredPosition.d.ts +59 -0
- package/dist/components/Progress/Progress.d.ts +38 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/utils/value.d.ts +25 -0
- package/dist/components/Select/Select.d.ts +6 -74
- package/dist/components/Select/components/CustomSelect.d.ts +59 -0
- package/dist/components/Select/components/NativeSelect.d.ts +26 -0
- package/dist/components/Select/components/SelectListbox.d.ts +50 -0
- package/dist/components/Select/hooks/useSelectFormReset.d.ts +27 -0
- package/dist/components/Select/hooks/useSelectPosition.d.ts +12 -0
- package/dist/components/Select/hooks/useTypeahead.d.ts +14 -0
- package/dist/components/Select/utils/options.d.ts +38 -0
- package/dist/components/Sidebar/Sidebar.d.ts +36 -25
- package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
- package/dist/components/Sidebar/components/SidebarGroup.d.ts +5 -16
- package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
- package/dist/components/Sidebar/components/SidebarItem.d.ts +3 -0
- package/dist/components/Sidebar/components/SidebarOverlay.d.ts +3 -4
- package/dist/components/Sidebar/components/SidebarPanel.d.ts +4 -4
- package/dist/components/Sidebar/hooks/usePresentation.d.ts +2 -2
- package/dist/components/Sidebar/index.d.ts +1 -1
- package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
- package/dist/components/Sidebar/utils/state.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +21 -209
- package/dist/components/Table/components/TableAction.d.ts +18 -0
- package/dist/components/Table/components/TableActionCell.d.ts +15 -0
- package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
- package/dist/components/Table/components/TableBody.d.ts +27 -0
- package/dist/components/Table/components/TableCell.d.ts +42 -0
- package/dist/components/Table/components/TableFoot.d.ts +19 -0
- package/dist/components/Table/components/TableHead.d.ts +19 -0
- package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
- package/dist/components/Table/components/TableRow.d.ts +67 -0
- package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
- package/dist/components/Table/utils/cell.d.ts +25 -0
- package/dist/components/Table/utils/children.d.ts +18 -0
- package/dist/components/Table/utils/trigger.d.ts +54 -0
- package/dist/style.css +1 -1
- package/dist/useAnchoredPosition-C0VS7hm6.js +105 -0
- package/dist/useAnchoredPosition-D7GRFzoX.cjs +1 -0
- package/dist/useFloatingPosition-Dq8xpr3E.js +27 -0
- package/dist/useFloatingPosition-g5kXywoB.cjs +1 -0
- package/dist/useFocusTrap-C0IcCdNf.js +136 -0
- package/dist/useFocusTrap-gAK_402D.cjs +1 -0
- package/package.json +7 -1
- package/dist/Button-Chv4O66e.js +0 -99
- package/dist/Button-DCKtFvSo.cjs +0 -1
- package/dist/Divider-CJYbFcSX.cjs +0 -1
- package/dist/Icon-DJ4BigRz.cjs +0 -1
- package/dist/Spinner-BXgw60UC.cjs +0 -1
- package/dist/Spinner-CVYvk6YK.js +0 -25
- package/dist/Table-B30TBckZ.js +0 -402
- package/dist/Table-DceR12X9.cjs +0 -1
- package/dist/floating-position-5wJ5G5IT.js +0 -48
- package/dist/floating-position-Cy9xxdH4.cjs +0 -1
- package/dist/useFloatingPosition-BBEUHPqy.cjs +0 -1
- package/dist/useFloatingPosition-CMirP2-2.js +0 -43
- package/dist/useFocusTrap-BrFZdMqQ.cjs +0 -1
- package/dist/useFocusTrap-DhVnlboe.js +0 -136
package/dist/Select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react/jsx-runtime"),r=require("react"),S=require("./usePresence-B5RYv4e1.cjs"),U=require("./aria-Bntn6ad_.cjs"),ye=require("./reference-C2guRuR0.cjs"),q=require("./Icon-BIBzgznI.cjs"),xe=require("./useAnchoredPosition-D7GRFzoX.cjs");function Ie(t){const{form:n,onReset:s,resetValue:a,triggerReference:o}=t,l=r.useRef(null);return r.useEffect(()=>{var u;const i=(u=o.current)==null?void 0:u.form;if(!i)return;function h(){const b=l.current;if(b){const y=Array.from(b.options),g=y.find(x=>x.value===a)??y[0];y.forEach(x=>{x.defaultSelected=x===g})}s()}return i.addEventListener("reset",h),()=>i.removeEventListener("reset",h)},[n,s,a,o]),l}const H=8,z=4,ge=160,ke=72;function we(t,n,s){const a=s.bottom-t.bottom-z-H,o=t.top-s.top-z-H,l=a<ge&&o>a,i=Math.max(ke,l?o:a),h=Math.max(t.width,(n==null?void 0:n.width)??t.width),u=s.left+H,b=Math.min(Math.max(u,t.left),Math.max(u,s.right-H-h)),y=l?Math.max(s.top+H,t.top-z-Math.min((n==null?void 0:n.height)??i,i)):t.bottom+z;return{left:b,maxHeight:i,minWidth:t.width,top:y}}function Ee(t,n,s,a){const o=r.useCallback(l=>{const{panelBounds:i,triggerBounds:h,visibleBounds:u}=l;return we(h,i,u)},[]);return xe.useAnchoredPosition({active:t,boundary:a,fit:o,panel:s,trigger:n})}const Re=500;function _e(t){const n=r.useRef(""),s=r.useRef(null),a=r.useRef(null);return r.useEffect(()=>()=>{const o=a.current;o&&s.current!==null&&o.clearTimeout(s.current)},[]),r.useCallback(o=>{var u;const l=(u=t.current)==null?void 0:u.ownerDocument.defaultView;if(!l)return null;a.current=l;const i=n.current+o,h=Array.from(i).every(b=>b===o);return n.current=h?o:i,s.current!==null&&l.clearTimeout(s.current),s.current=l.setTimeout(()=>{n.current="",s.current=null},Re),n.current},[t])}function Q(t,n,s){if(t.length===0)return-1;for(let a=1;a<=t.length;a+=1){const o=(n+s*a+t.length)%t.length;if(!t[o].disabled)return o}return-1}function Oe(t,n,s){for(let a=1;a<=t.length;a+=1){const o=(s+a+t.length)%t.length,l=t[o];if(!l.disabled&&l.label.toLocaleLowerCase().startsWith(n))return o}return-1}function Se(t){const n=new Set;t.forEach(s=>{if(n.has(s.value))throw new Error("Select option values must be unique");n.add(s.value)})}function De(t){const{active:n,closeOnEscape:s,closeOnOutsideInteraction:a,highlightedIndex:o,id:l,listboxReference:i,onEscapeDismiss:h,onEscapeKeyDown:u,onHighlight:b,onOutsideDismiss:y,onPointerDownOutside:g,onSelect:x,options:k,ownerDocument:C,position:R,selectedValue:_,state:D,triggerReference:V}=t,m=r.useRef(null),W=S.useBoundary("Select").boundaryElement,O=S.useOverlayLayer(!0,W),$=r.useMemo(()=>[V,m],[V]),G=r.useCallback(f=>{m.current=f,i(f)},[i]);return S.useDismissableLayer({active:n,boundaries:$,boundary:W,dismissOnEscape:s,dismissOnPointerDownOutside:a,layerId:O.id,onEscapeDismiss:h,onEscapeKeyDown:u,onPointerDownOutside:g,onPointerDownOutsideDismiss:y,ownerDocument:C}),d.jsx("div",{"aria-hidden":n?void 0:!0,"aria-labelledby":l,className:"nk-select__listbox","data-state":D,id:`${l}-listbox`,ref:G,role:"listbox",style:R?{left:R.left,maxHeight:R.maxHeight,minWidth:R.minWidth,top:R.top,zIndex:O.zIndex}:{visibility:"hidden",zIndex:O.zIndex},children:k.map((f,N)=>d.jsxs("div",{"aria-disabled":f.disabled||void 0,"aria-selected":f.value===_,className:"nk-select__option","data-highlighted":N===o||void 0,"data-selected":f.value===_||void 0,id:`${l}-option-${N}`,onPointerDown:X=>{X.preventDefault(),f.disabled||x(f)},onPointerMove:()=>{f.disabled||b(N)},role:"option",children:[f.icon?d.jsx(q.Icon,{type:f.icon}):null,d.jsx("span",{className:"nk-select__option-label",children:f.label}),f.value===_?d.jsx(q.Icon,{className:"nk-select__check",type:"checkmark"}):null]},f.value))})}function je(t,n,s){n.current=t,ye.assignElementReference(s,t)}function Le(t){var B;const{"aria-invalid":n,className:s,closeOnEscape:a=!0,closeOnOutsideInteraction:o=!0,defaultValue:l="",disabled:i=!1,displayOverride:h,form:u,forwardedReference:b,id:y,invalid:g=!1,name:x,onChange:k,onClick:C,onEscapeKeyDown:R,onKeyDown:_,onOpenChange:D,onPointerDownOutside:V,options:m,placeholder:W,required:O=!1,style:$,value:G,width:f,...N}=t;Se(m);const X=r.useId(),j=y??X,I=r.useRef(null),[A,te]=r.useState(null),[v,ne]=r.useState(!1),[w,T]=r.useState(-1),[se,J]=r.useState(l),L=G!==void 0,P=L?G:se,ae=m.find(e=>e.value===P),le=g||U.hasInvalidState(n),ie=U.resolveAriaInvalid(g,n),Y=S.usePresence(v),M=((B=I.current)==null?void 0:B.ownerDocument)??(typeof document>"u"?null:document),re=S.useBoundary("Select").boundaryElement,oe=Ee(Y.present,I.current,A,re),ce=_e(I),de=f===void 0?$:{...$,width:f},K=h??ae,ue=r.useCallback(e=>je(e,I,b),[b]),p=r.useCallback(e=>{v!==e&&(ne(e),D==null||D(e))},[D,v]),fe=r.useCallback(()=>{L||J(l),p(!1)},[l,L,p]),me=Ie({form:u,onReset:fe,resetValue:L?P:l,triggerReference:I}),F=r.useCallback((e=1)=>{const c=m.findIndex(ee=>ee.value===P&&!ee.disabled),E=e===1?-1:m.length;T(c>=0?c:Q(m,E,e)),p(!0)},[m,P,p]),Z=r.useCallback(e=>{var c;i||e.disabled||(L||J(e.value),p(!1),(c=I.current)==null||c.focus(),k==null||k(e.value))},[i,L,k,p]),he=r.useCallback(()=>{var e;p(!1),(e=I.current)==null||e.focus()},[p]),ve=r.useCallback(()=>{p(!1)},[p]);function pe(e){C==null||C(e),!(e.defaultPrevented||i)&&(v?p(!1):F())}function be(e){if(_==null||_(e),!(e.defaultPrevented||i)){if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const c=e.key==="ArrowDown"?1:-1;v?T(E=>Q(m,E,c)):F(c);return}if(e.key==="Home"||e.key==="End"){if(e.preventDefault(),!v)F(e.key==="Home"?1:-1);else{const c=e.key==="Home"?1:-1,E=c===1?-1:m.length;T(Q(m,E,c))}return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const c=m[w];v&&c?Z(c):v||F();return}if(e.key==="Tab"){p(!1);return}if(e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const c=ce(e.key.toLocaleLowerCase());if(c===null)return;const E=Oe(m,c,w);E>=0&&(e.preventDefault(),v||p(!0),T(E))}}}return r.useEffect(()=>{i&&p(!1)},[i,p]),r.useEffect(()=>{var e;if(v&&w>=0){const c=M==null?void 0:M.getElementById(`${j}-option-${w}`);c&&(A!=null&&A.contains(c))&&((e=c.scrollIntoView)==null||e.call(c,{block:"nearest"}))}},[w,j,A,v]),d.jsxs("span",{className:["nk-select",s].filter(Boolean).join(" "),"data-disabled":i||void 0,"data-invalid":le||void 0,"data-mode":"custom","data-open":v||void 0,style:de,children:[d.jsxs("button",{...N,ref:ue,"aria-activedescendant":v&&w>=0?`${j}-option-${w}`:void 0,"aria-controls":`${j}-listbox`,"aria-expanded":v,"aria-haspopup":"listbox","aria-invalid":ie,"aria-required":O||void 0,"aria-autocomplete":"none",className:"nk-select__trigger",disabled:i,form:u,id:j,onClick:pe,onKeyDown:be,role:"combobox",type:"button",children:[K?d.jsxs("span",{className:"nk-select__value",children:[K.icon?d.jsx(q.Icon,{type:K.icon}):null,d.jsx("span",{className:"nk-select__value-label",children:K.label})]}):d.jsx("span",{className:"nk-select__placeholder",children:W}),d.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]}),x||O?d.jsxs("select",{ref:me,"aria-hidden":"true",className:"nk-select__form-control",disabled:i,form:u,name:x,onChange:()=>{},onInvalid:e=>{var c;e.preventDefault(),(c=I.current)==null||c.focus()},required:O,tabIndex:-1,value:P,children:[d.jsx("option",{value:""}),m.map(e=>d.jsx("option",{disabled:e.disabled,value:e.value,children:e.label},e.value))]}):null,Y.present&&M?d.jsx(S.Portal,{children:d.jsx(De,{active:v,closeOnEscape:a,closeOnOutsideInteraction:o,highlightedIndex:w,id:j,listboxReference:te,onEscapeDismiss:he,onEscapeKeyDown:R,onHighlight:T,onOutsideDismiss:ve,onPointerDownOutside:V,onSelect:Z,options:m,ownerDocument:M,position:oe,selectedValue:P,state:Y.state==="closing"?"closing":"open",triggerReference:I})}):null]})}function Pe(t){const{"aria-invalid":n,children:s,className:a,defaultValue:o,disabled:l=!1,forwardedReference:i,invalid:h=!1,placeholder:u,style:b,value:y,...g}=t,x=U.resolveAriaInvalid(h,n),k=h||U.hasInvalidState(n);return d.jsxs("span",{className:["nk-select",a].filter(Boolean).join(" "),"data-disabled":l||void 0,"data-invalid":k||void 0,"data-mode":"native",style:b,children:[d.jsxs("select",{...g,ref:i,"aria-invalid":x,className:"nk-select__control",defaultValue:y===void 0?o??(u!==void 0?"":void 0):void 0,disabled:l,value:y,children:[u!==void 0?d.jsx("option",{disabled:!0,value:"",children:u}):null,s]}),d.jsx(q.Icon,{className:"nk-select__icon",type:"chevron-down"})]})}const Ce=r.forwardRef(function(n,s){const{options:a}=n;return S.useBoundary("Select"),a!==void 0?d.jsx(Le,{...n,forwardedReference:s}):d.jsx(Pe,{...n,forwardedReference:s})});exports.default=Ce;
|