@bikdotai/bik-component-library 0.0.567-beta.b-1 → 0.0.567-beta.b-2
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/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/searchBar/searchBar.d.ts +2 -2
- package/dist/cjs/components/searchBar/searchBar.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/searchBar/searchBar.d.ts +2 -2
- package/dist/esm/components/searchBar/searchBar.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonProps } from '../button/model';
|
|
2
2
|
import { InputVariant } from '../input/Input';
|
|
3
3
|
export interface SearchBarProps {
|
|
4
4
|
width: string;
|
|
@@ -12,6 +12,6 @@ export interface SearchBarProps {
|
|
|
12
12
|
reset?: boolean;
|
|
13
13
|
onClickCross?: () => void;
|
|
14
14
|
isActive?: boolean;
|
|
15
|
-
|
|
15
|
+
suffixButton?: ButtonProps;
|
|
16
16
|
}
|
|
17
17
|
export declare const SearchBar: (props: SearchBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/searchIcon.js"),s=require("react"),a=require("../../assets/icons/cross.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/searchIcon.js"),s=require("react"),a=require("../../assets/icons/cross.svg.js"),n=require("../input/Input.js");exports.SearchBar=r=>{const{isEnabled:o,onEnter:c,placeholder:i,width:u,variant:l,validate:d,isActive:h}=r,[v,f]=s.useState("search"),[p,b]=s.useState("default"),[g,C]=s.useState(h?"active":o?"none":"disabled"),[x,j]=s.useState(r.initialValue||"");s.useEffect((()=>{C(h?"active":o?"none":"disabled")}),[o,h]),s.useEffect((()=>{r.reset&&I()}),[null==r?void 0:r.reset]);const k=e=>{o&&c(e)},I=()=>{f("search"),b("default"),j(""),r.onChange(""),C("none"),c("")};return e.jsx(n.Input,{id:"search-bar",validate:d,onFocus:()=>{x.length&&f("cross"),"default"===p&&o&&(b("clicked"),C("active"))},width:u,state:g,leftIcon:"search"===v&&"default"===p?{icon:t.SearchIcon}:void 0,rightIcon:"cross"===v?{icon:a.default,callback:()=>{I(),r.onClickCross&&r.onClickCross()}}:void 0,onChangeText:(e,t)=>{r.onChange(e),j(e),"keydown"!==(null==t?void 0:t.type)||13!==t.which&&13!==t.keyCode?e.trim().length?f("cross"):f("search"):k(e)},placeholder:i,variant:l,value:x,onBlur:()=>{x.length||b("default"),C("none")},button:{text:"",buttonProps:r.suffixButton}})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonProps } from '../button/model';
|
|
2
2
|
import { InputVariant } from '../input/Input';
|
|
3
3
|
export interface SearchBarProps {
|
|
4
4
|
width: string;
|
|
@@ -12,6 +12,6 @@ export interface SearchBarProps {
|
|
|
12
12
|
reset?: boolean;
|
|
13
13
|
onClickCross?: () => void;
|
|
14
14
|
isActive?: boolean;
|
|
15
|
-
|
|
15
|
+
suffixButton?: ButtonProps;
|
|
16
16
|
}
|
|
17
17
|
export declare const SearchBar: (props: SearchBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{SearchIcon as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{SearchIcon as t}from"../../assets/icons/searchIcon.js";import{useState as o,useEffect as n}from"react";import s from"../../assets/icons/cross.svg.js";import{Input as a}from"../input/Input.js";const i=i=>{const{isEnabled:r,onEnter:c,placeholder:l,width:d,variant:h,validate:u,isActive:v}=i,[f,m]=o("search"),[p,g]=o("default"),[C,b]=o(v?"active":r?"none":"disabled"),[k,x]=o(i.initialValue||"");n((()=>{b(v?"active":r?"none":"disabled")}),[r,v]),n((()=>{i.reset&&w()}),[null==i?void 0:i.reset]);const j=e=>{r&&c(e)},w=()=>{m("search"),g("default"),x(""),i.onChange(""),b("none"),c("")};return e(a,{id:"search-bar",validate:u,onFocus:()=>{k.length&&m("cross"),"default"===p&&r&&(g("clicked"),b("active"))},width:d,state:C,leftIcon:"search"===f&&"default"===p?{icon:t}:void 0,rightIcon:"cross"===f?{icon:s,callback:()=>{w(),i.onClickCross&&i.onClickCross()}}:void 0,onChangeText:(e,t)=>{i.onChange(e),x(e),"keydown"!==(null==t?void 0:t.type)||13!==t.which&&13!==t.keyCode?e.trim().length?m("cross"):m("search"):j(e)},placeholder:l,variant:h,value:k,onBlur:()=>{k.length||g("default"),b("none")},button:{text:"",buttonProps:i.suffixButton}})};export{i as SearchBar};
|