New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hudoro/dropdown

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hudoro/dropdown - npm Package Compare versions

Comparing version 0.0.1-beta.8 to 0.0.1-beta.9

2

dist/dropdown.es.js

@@ -822,3 +822,3 @@ import K, { useState as se, useRef as dr, useEffect as le, useMemo as fr } from "react";

}, [y]), le(() => {
j.length && !(y != null && y.length) && w([]);
j.length && (y != null && y.length);
}, [j]), /* @__PURE__ */ u.jsxs(

@@ -825,0 +825,0 @@ "div",

@@ -173,2 +173,2 @@ (function(I,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(I=typeof globalThis<"u"?globalThis:I||self,g(I.Dropdown={},I.React))})(this,function(I,g){"use strict";var Z={exports:{}},Y={};/**

}
`;function Ve(d){const[m,w]=g.useState(d),y=g.useRef(null),C=P=>{y.current&&!y.current.contains(P.target)&&w(!1)};return g.useEffect(()=>(document.addEventListener("click",C,!0),()=>{document.removeEventListener("click",C,!0)}),[]),{ref:y,isComponentVisible:m,setIsComponentVisible:w}}const de="hudoro-input-dropdown-styles";(d=>{if(!document.getElementById(de)){const m=document.createElement("style");m.id=de,m.textContent=d,document.head.appendChild(m)}})(Ye);const Me=({dropdownLists:d,onChange:m,defaultValue:w,size:y="md",multiSelect:C,searchAble:P,iconLeft:F,placeholder:j,onSearch:v})=>{const[D,b]=g.useState(""),[c,E]=g.useState(),{isComponentVisible:A,ref:B,setIsComponentVisible:z}=Ve(!1),Q=d==null?void 0:d.filter(s=>s.label.toLowerCase().includes(D.toLowerCase())),T=g.useMemo(()=>d.map(s=>s),[d]),h=()=>{z(s=>!s),b("")},q=(s,R)=>{if(!C)E([{label:s,value:R}]),m([{label:s,value:R}]),z(!1);else if(c==null?void 0:c.find(S=>S.value===R)){const S=[...c?c.filter(ee=>ee.value!==R):[]];E(S),m(S)}else{const S=[...c||[],{label:s,value:R}];E(S),m(S)}};return g.useEffect(()=>{w&&E(w)},[w]),g.useEffect(()=>{T.length&&!(w!=null&&w.length)&&E([])},[T]),u.jsxs("div",{className:`hsd-input-dropdown-container hsd-input-dropdown-size-${y} ${A?"active":""}`,ref:B,onClick:h,children:[u.jsxs("div",{className:"hsd-input-dropdown-preview-container",children:[F?u.jsx(u.Fragment,{children:g.cloneElement(F,{width:fe(y),color:"#939E99"})}):null,u.jsx("div",{className:"hsd-input-dropdown-container-preview-item",children:(c==null?void 0:c.map((s,R)=>C?u.jsx("p",{className:"hsd-input-dropdown-preview-item",children:s==null?void 0:s.label},R):u.jsx("p",{children:s==null?void 0:s.label},R)))||u.jsx("p",{className:"hsd-input-dropdown-placeholder",children:j||"Search"})}),u.jsx(Be,{strokeWidth:2,width:fe(y)})]}),A?u.jsxs("div",{className:"hsd-input-dropdown-lists-container",onClick:s=>s.stopPropagation(),children:[P?u.jsxs("div",{className:"hsd-input-dropdown-container-dropdown-search",children:[u.jsx("div",{style:{display:"flex"},children:u.jsx(Ue,{strokeWidth:2,width:20})}),u.jsx("input",{onChange:s=>{b(s.target.value),v&&v(s.target.value)}})]}):null,u.jsx("div",{className:"hsd-input-dropdwon-item-container",children:Q.map((s,R)=>u.jsxs("div",{className:`hsd-input-dropdwon-item ${c!=null&&c.find(J=>J.value===s.value)?"active":""}`,onClick:()=>q(s.label,s.value),children:[s.icon?u.jsx(u.Fragment,{children:g.cloneElement(s.icon,{width:16})}):null,u.jsx("p",{children:s.label})]},R))})]}):null]})},Ue=({...d})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...d,viewBox:"0 0 20 20",fill:"none",children:[u.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Be=({...d})=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...d,viewBox:"0 0 24 24",fill:"none",color:"#1976D2",children:u.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),fe=d=>{if(d==="sm")return 16;if(d==="md")return 20;if(d==="lg")return 20};I.Dropdown=Me,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
`;function Ve(d){const[m,w]=g.useState(d),y=g.useRef(null),C=P=>{y.current&&!y.current.contains(P.target)&&w(!1)};return g.useEffect(()=>(document.addEventListener("click",C,!0),()=>{document.removeEventListener("click",C,!0)}),[]),{ref:y,isComponentVisible:m,setIsComponentVisible:w}}const de="hudoro-input-dropdown-styles";(d=>{if(!document.getElementById(de)){const m=document.createElement("style");m.id=de,m.textContent=d,document.head.appendChild(m)}})(Ye);const Me=({dropdownLists:d,onChange:m,defaultValue:w,size:y="md",multiSelect:C,searchAble:P,iconLeft:F,placeholder:j,onSearch:v})=>{const[D,b]=g.useState(""),[c,E]=g.useState(),{isComponentVisible:A,ref:B,setIsComponentVisible:z}=Ve(!1),Q=d==null?void 0:d.filter(s=>s.label.toLowerCase().includes(D.toLowerCase())),T=g.useMemo(()=>d.map(s=>s),[d]),h=()=>{z(s=>!s),b("")},q=(s,R)=>{if(!C)E([{label:s,value:R}]),m([{label:s,value:R}]),z(!1);else if(c==null?void 0:c.find(S=>S.value===R)){const S=[...c?c.filter(ee=>ee.value!==R):[]];E(S),m(S)}else{const S=[...c||[],{label:s,value:R}];E(S),m(S)}};return g.useEffect(()=>{w&&E(w)},[w]),g.useEffect(()=>{T.length&&(w!=null&&w.length)},[T]),u.jsxs("div",{className:`hsd-input-dropdown-container hsd-input-dropdown-size-${y} ${A?"active":""}`,ref:B,onClick:h,children:[u.jsxs("div",{className:"hsd-input-dropdown-preview-container",children:[F?u.jsx(u.Fragment,{children:g.cloneElement(F,{width:fe(y),color:"#939E99"})}):null,u.jsx("div",{className:"hsd-input-dropdown-container-preview-item",children:(c==null?void 0:c.map((s,R)=>C?u.jsx("p",{className:"hsd-input-dropdown-preview-item",children:s==null?void 0:s.label},R):u.jsx("p",{children:s==null?void 0:s.label},R)))||u.jsx("p",{className:"hsd-input-dropdown-placeholder",children:j||"Search"})}),u.jsx(Be,{strokeWidth:2,width:fe(y)})]}),A?u.jsxs("div",{className:"hsd-input-dropdown-lists-container",onClick:s=>s.stopPropagation(),children:[P?u.jsxs("div",{className:"hsd-input-dropdown-container-dropdown-search",children:[u.jsx("div",{style:{display:"flex"},children:u.jsx(Ue,{strokeWidth:2,width:20})}),u.jsx("input",{onChange:s=>{b(s.target.value),v&&v(s.target.value)}})]}):null,u.jsx("div",{className:"hsd-input-dropdwon-item-container",children:Q.map((s,R)=>u.jsxs("div",{className:`hsd-input-dropdwon-item ${c!=null&&c.find(J=>J.value===s.value)?"active":""}`,onClick:()=>q(s.label,s.value),children:[s.icon?u.jsx(u.Fragment,{children:g.cloneElement(s.icon,{width:16})}):null,u.jsx("p",{children:s.label})]},R))})]}):null]})},Ue=({...d})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...d,viewBox:"0 0 20 20",fill:"none",children:[u.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Be=({...d})=>u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...d,viewBox:"0 0 24 24",fill:"none",color:"#1976D2",children:u.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),fe=d=>{if(d==="sm")return 16;if(d==="md")return 20;if(d==="lg")return 20};I.Dropdown=Me,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
{
"name": "@hudoro/dropdown",
"version": "0.0.1-beta.8",
"version": "0.0.1-beta.9",
"description": "dropdown component for Hudoro UI",

@@ -5,0 +5,0 @@ "author": "Prawito Hudoro",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc