@bitrise/bitkit-v2 0.3.481-beta.3095 → 0.3.481-beta.3099
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.
|
@@ -11,12 +11,12 @@ var FilterSearchInput = forwardRef((props, ref) => {
|
|
|
11
11
|
const { css, description, label, onValueChange, placeholder, renderInput = (input) => input, value, ...rest } = props;
|
|
12
12
|
const { isMobile, styles } = useFilterContext();
|
|
13
13
|
return /* @__PURE__ */ jsxs(Box, {
|
|
14
|
-
as: "label",
|
|
15
14
|
css: [isMobile ? styles.mobileSearch : styles.search, css],
|
|
16
15
|
...rest,
|
|
17
|
-
children: [
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
children: [/* @__PURE__ */ jsxs(Box, {
|
|
17
|
+
as: "label",
|
|
18
|
+
display: "contents",
|
|
19
|
+
children: [/* @__PURE__ */ jsx(IconMagnifier, { size: isMobile ? "24" : "16" }), renderInput(/* @__PURE__ */ jsx(chakra.input, {
|
|
20
20
|
"aria-description": description,
|
|
21
21
|
"aria-label": label,
|
|
22
22
|
css: isMobile ? styles.mobileSearchInput : styles.searchInput,
|
|
@@ -25,14 +25,13 @@ var FilterSearchInput = forwardRef((props, ref) => {
|
|
|
25
25
|
ref,
|
|
26
26
|
type: "search",
|
|
27
27
|
value
|
|
28
|
-
}))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
]
|
|
28
|
+
}))]
|
|
29
|
+
}), !!value && /* @__PURE__ */ jsx(BitkitCloseButton, {
|
|
30
|
+
"aria-label": "Clear search",
|
|
31
|
+
colorVariant: "neutral",
|
|
32
|
+
onClick: () => onValueChange(""),
|
|
33
|
+
size: "sm"
|
|
34
|
+
})]
|
|
36
35
|
});
|
|
37
36
|
});
|
|
38
37
|
FilterSearchInput.displayName = "FilterSearchInput";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSearchInput.js","names":[],"sources":["../../../../lib/components/BitkitFilter/components/FilterSearchInput.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\n// `chakra.input`: the filter's search fields are borderless rows from the filter recipe, unlike the\n// bordered BitkitSearchInput.\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactElement } from 'react';\n\nimport { IconMagnifier } from '../../../icons';\nimport BitkitCloseButton from '../../BitkitCloseButton/BitkitCloseButton';\nimport { useFilterContext } from '../BitkitFilter.context';\n\nexport interface FilterSearchInputProps extends Omit<BoxProps, 'children' | 'defaultValue' | 'onChange'> {\n /** Extra hint read out with the field, e.g. what the search matches. */\n description?: string;\n label: string;\n onValueChange: (value: string) => void;\n placeholder: string;\n /** Wraps the input, e.g. in a tooltip. */\n renderInput?: (input: ReactElement) => ReactElement;\n value: string;\n}\n\n/** The borderless search field of the bar — and, on mobile, of each filter's view too. */\nconst FilterSearchInput = forwardRef<HTMLInputElement, FilterSearchInputProps>((props, ref) => {\n const { css, description, label, onValueChange, placeholder, renderInput = (input) => input, value, ...rest } = props;\n const { isMobile, styles } = useFilterContext();\n\n return (\n
|
|
1
|
+
{"version":3,"file":"FilterSearchInput.js","names":[],"sources":["../../../../lib/components/BitkitFilter/components/FilterSearchInput.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\n// `chakra.input`: the filter's search fields are borderless rows from the filter recipe, unlike the\n// bordered BitkitSearchInput.\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactElement } from 'react';\n\nimport { IconMagnifier } from '../../../icons';\nimport BitkitCloseButton from '../../BitkitCloseButton/BitkitCloseButton';\nimport { useFilterContext } from '../BitkitFilter.context';\n\nexport interface FilterSearchInputProps extends Omit<BoxProps, 'children' | 'defaultValue' | 'onChange'> {\n /** Extra hint read out with the field, e.g. what the search matches. */\n description?: string;\n label: string;\n onValueChange: (value: string) => void;\n placeholder: string;\n /** Wraps the input, e.g. in a tooltip. */\n renderInput?: (input: ReactElement) => ReactElement;\n value: string;\n}\n\n/** The borderless search field of the bar — and, on mobile, of each filter's view too. */\nconst FilterSearchInput = forwardRef<HTMLInputElement, FilterSearchInputProps>((props, ref) => {\n const { css, description, label, onValueChange, placeholder, renderInput = (input) => input, value, ...rest } = props;\n const { isMobile, styles } = useFilterContext();\n\n return (\n <Box css={[isMobile ? styles.mobileSearch : styles.search, css]} {...rest}>\n {/* A label around the icon and the input only, so a click on the icon focuses the input too. The clear\n button stays outside: a label can't hold a second control. `contents` keeps the field's layout. */}\n <Box as=\"label\" display=\"contents\">\n <IconMagnifier size={isMobile ? '24' : '16'} />\n {renderInput(\n <chakra.input\n aria-description={description}\n aria-label={label}\n css={isMobile ? styles.mobileSearchInput : styles.searchInput}\n onChange={(event) => onValueChange(event.target.value)}\n placeholder={placeholder}\n ref={ref}\n type=\"search\"\n value={value}\n />,\n )}\n </Box>\n {!!value && (\n <BitkitCloseButton\n aria-label=\"Clear search\"\n colorVariant=\"neutral\"\n onClick={() => onValueChange('')}\n size=\"sm\"\n />\n )}\n </Box>\n );\n});\n\nFilterSearchInput.displayName = 'FilterSearchInput';\n\nexport default FilterSearchInput;\n"],"mappings":";;;;;;;;;AAsBA,IAAM,oBAAoB,YAAsD,OAAO,QAAQ;CAC7F,MAAM,EAAE,KAAK,aAAa,OAAO,eAAe,aAAa,eAAe,UAAU,OAAO,OAAO,GAAG,SAAS;CAChH,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAE9C,OACE,qBAAC,KAAD;EAAK,KAAK,CAAC,WAAW,OAAO,eAAe,OAAO,QAAQ,GAAG;EAAG,GAAI;EAArE,UAAA,CAGE,qBAAC,KAAD;GAAK,IAAG;GAAQ,SAAQ;GAAxB,UAAA,CACE,oBAAC,eAAD,EAAe,MAAM,WAAW,OAAO,KAAO,CAAA,GAC7C,YACC,oBAAC,OAAO,OAAR;IACE,oBAAkB;IAClB,cAAY;IACZ,KAAK,WAAW,OAAO,oBAAoB,OAAO;IAClD,WAAW,UAAU,cAAc,MAAM,OAAO,KAAK;IACxC;IACR;IACL,MAAK;IACE;GACR,CAAA,CACH,CACG;EACJ,CAAA,GAAA,CAAC,CAAC,SACD,oBAAC,mBAAD;GACE,cAAW;GACX,cAAa;GACb,eAAe,cAAc,EAAE;GAC/B,MAAK;EACN,CAAA,CAEA;;AAET,CAAC;AAED,kBAAkB,cAAc"}
|