@bitrise/bitkit-v2 0.3.311 → 0.3.312
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BitkitTextInputProps } from '../BitkitTextInput/BitkitTextInput';
|
|
2
|
-
export interface BitkitSearchInputProps extends Omit<BitkitTextInputProps, 'badge' | 'counter' | 'counterText' | 'endAddon' | 'endAddonProps' | 'endElement' | 'errorText' | 'inputProps' | 'maxLength' | 'onChange' | '
|
|
2
|
+
export interface BitkitSearchInputProps extends Omit<BitkitTextInputProps, 'badge' | 'counter' | 'counterText' | 'endAddon' | 'endAddonProps' | 'endElement' | 'errorText' | 'inputProps' | 'maxLength' | 'onChange' | 'startAddon' | 'startAddonProps' | 'startElement' | 'state' | 'tooltip' | 'warningText'> {
|
|
3
3
|
onChange?: (value: string) => void;
|
|
4
4
|
state?: 'disabled';
|
|
5
5
|
value?: string;
|
|
@@ -5,7 +5,7 @@ import { forwardRef } from "react";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region lib/components/BitkitSearchInput/BitkitSearchInput.tsx
|
|
7
7
|
var BitkitSearchInput = forwardRef((props, ref) => {
|
|
8
|
-
const { label = "Search", labelHidden = true, onChange, placeholder, size = "lg", state, value, ...rest } = props;
|
|
8
|
+
const { label = "Search", labelHidden = true, onChange, optional = true, placeholder, required = false, size = "lg", state, value, ...rest } = props;
|
|
9
9
|
const showClearButton = Boolean(value) && state !== "disabled";
|
|
10
10
|
const iconSize = size === "lg" ? "24" : "16";
|
|
11
11
|
const closeButtonSize = size === "lg" ? "md" : "sm";
|
|
@@ -19,7 +19,9 @@ var BitkitSearchInput = forwardRef((props, ref) => {
|
|
|
19
19
|
},
|
|
20
20
|
label,
|
|
21
21
|
labelHidden,
|
|
22
|
+
optional,
|
|
22
23
|
placeholder,
|
|
24
|
+
required,
|
|
23
25
|
size,
|
|
24
26
|
startElement: /* @__PURE__ */ jsx(IconMagnifier, { size: iconSize }),
|
|
25
27
|
state,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitSearchInput.js","names":[],"sources":["../../../lib/components/BitkitSearchInput/BitkitSearchInput.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { IconMagnifier } from '../../icons';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\nimport BitkitTextInput, { type BitkitTextInputProps } from '../BitkitTextInput/BitkitTextInput';\n\nexport interface BitkitSearchInputProps extends Omit<\n BitkitTextInputProps,\n | 'badge'\n | 'counter'\n | 'counterText'\n | 'endAddon'\n | 'endAddonProps'\n | 'endElement'\n | 'errorText'\n | 'inputProps'\n | 'maxLength'\n | 'onChange'\n | '
|
|
1
|
+
{"version":3,"file":"BitkitSearchInput.js","names":[],"sources":["../../../lib/components/BitkitSearchInput/BitkitSearchInput.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { IconMagnifier } from '../../icons';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\nimport BitkitTextInput, { type BitkitTextInputProps } from '../BitkitTextInput/BitkitTextInput';\n\nexport interface BitkitSearchInputProps extends Omit<\n BitkitTextInputProps,\n | 'badge'\n | 'counter'\n | 'counterText'\n | 'endAddon'\n | 'endAddonProps'\n | 'endElement'\n | 'errorText'\n | 'inputProps'\n | 'maxLength'\n | 'onChange'\n | 'startAddon'\n | 'startAddonProps'\n | 'startElement'\n | 'state'\n | 'tooltip'\n | 'warningText'\n> {\n onChange?: (value: string) => void;\n state?: 'disabled';\n value?: string;\n}\n\nconst BitkitSearchInput = forwardRef<HTMLDivElement, BitkitSearchInputProps>((props, ref) => {\n // A search/filter field should never be a required form control, so default it out of\n // BitkitField's `required: !optional` behaviour — an empty box was silently blocking form submit.\n const {\n label = 'Search',\n labelHidden = true,\n onChange,\n optional = true,\n placeholder,\n required = false,\n size = 'lg',\n state,\n value,\n ...rest\n } = props;\n\n const showClearButton = Boolean(value) && state !== 'disabled';\n const iconSize = size === 'lg' ? '24' : '16';\n const closeButtonSize = size === 'lg' ? 'md' : 'sm';\n\n return (\n <BitkitTextInput\n ref={ref}\n {...rest}\n inputProps={{\n onChange: (e) => onChange?.(e.target.value),\n type: 'search',\n value,\n }}\n label={label}\n labelHidden={labelHidden}\n optional={optional}\n placeholder={placeholder}\n required={required}\n size={size}\n startElement={<IconMagnifier size={iconSize} />}\n state={state}\n endElement={\n showClearButton ? (\n <BitkitCloseButton\n aria-label=\"Clear\"\n colorVariant=\"neutral\"\n onClick={() => onChange?.('')}\n size={closeButtonSize}\n />\n ) : undefined\n }\n />\n );\n});\n\nBitkitSearchInput.displayName = 'BitkitSearchInput';\n\nexport default BitkitSearchInput;\n"],"mappings":";;;;;;AA8BA,IAAM,oBAAoB,YAAoD,OAAO,QAAQ;CAG3F,MAAM,EACJ,QAAQ,UACR,cAAc,MACd,UACA,WAAW,MACX,aACA,WAAW,OACX,OAAO,MACP,OACA,OACA,GAAG,SACD;CAEJ,MAAM,kBAAkB,QAAQ,KAAK,KAAK,UAAU;CACpD,MAAM,WAAW,SAAS,OAAO,OAAO;CACxC,MAAM,kBAAkB,SAAS,OAAO,OAAO;CAE/C,OACE,oBAAC,iBAAD;EACO;EACL,GAAI;EACJ,YAAY;GACV,WAAW,MAAM,WAAW,EAAE,OAAO,KAAK;GAC1C,MAAM;GACN;EACF;EACO;EACM;EACH;EACG;EACH;EACJ;EACN,cAAc,oBAAC,eAAD,EAAe,MAAM,SAAW,CAAA;EACvC;EACP,YACE,kBACE,oBAAC,mBAAD;GACE,cAAW;GACX,cAAa;GACb,eAAe,WAAW,EAAE;GAC5B,MAAM;EACP,CAAA,IACC,KAAA;CAEP,CAAA;AAEL,CAAC;AAED,kBAAkB,cAAc"}
|