@bitrise/bitkit-v2 0.3.475-beta.3012 → 0.3.475-beta.3014

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,6 +1,8 @@
1
1
  import { BitkitIconComponent } from '../../../icons';
2
2
  import { BitkitColorToken } from '../../../theme/themeUtils';
3
3
  export interface BitkitFilterSelectItem {
4
+ /** Lists the option under this heading, with the others of the same group. */
5
+ group?: string;
4
6
  icon?: BitkitIconComponent;
5
7
  /** Colors the icon, e.g. a status: `icon/positive` for "Passed". */
6
8
  iconColor?: BitkitColorToken<'icon'>;
@@ -1,4 +1,5 @@
1
1
  import IconCheck from "../../../icons/IconCheck.js";
2
+ import BitkitGroupHeading from "../../BitkitGroupHeading/BitkitGroupHeading.js";
2
3
  import BitkitCheckbox from "../../BitkitCheckbox/BitkitCheckbox.js";
3
4
  import BitkitCheckboxGroup from "../../BitkitCheckboxGroup/BitkitCheckboxGroup.js";
4
5
  import { compilePattern, isEqualFilterValue, isPattern, toRunningText } from "../BitkitFilter.utils.js";
@@ -11,12 +12,25 @@ import BitkitTextInput from "../../BitkitTextInput/BitkitTextInput.js";
11
12
  import BitkitSearchInput from "../../BitkitSearchInput/BitkitSearchInput.js";
12
13
  import { Box } from "@chakra-ui/react/box";
13
14
  import { useSlotRecipe } from "@chakra-ui/react/styled-system";
14
- import { useEffect, useMemo, useRef, useState } from "react";
15
+ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
15
16
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
17
  import { Text } from "@chakra-ui/react/text";
17
18
  import { createListCollection } from "@chakra-ui/react/collection";
18
19
  import { HStack } from "@chakra-ui/react/stack";
19
20
  import { Listbox } from "@chakra-ui/react/listbox";
21
+ //#region lib/components/BitkitFilter/components/FilterSelectForm.tsx
22
+ /**
23
+ * Gathers the options by `group`, in the order each group first appears, so the list (and its
24
+ * keyboard order) runs group by group. Ungrouped options come under an empty-named group.
25
+ */
26
+ var groupItems = (items) => {
27
+ const groups = /* @__PURE__ */ new Map();
28
+ items.forEach((item) => {
29
+ const key = item.group ?? "";
30
+ groups.set(key, [...groups.get(key) ?? [], item]);
31
+ });
32
+ return [...groups];
33
+ };
20
34
  /** Below this many options the list is short enough to scan, so there is no search input. */
21
35
  var SEARCH_THRESHOLD = 5;
22
36
  /** The body of a select filter's panel: search, the option list or wildcard pattern, and the footer. */
@@ -50,7 +64,8 @@ var FilterSelectForm = (props) => {
50
64
  selectedItems,
51
65
  value
52
66
  ]);
53
- const visibleItems = matchingItems.slice(0, 100);
67
+ const visibleGroups = useMemo(() => groupItems(matchingItems.slice(0, 100)), [matchingItems]);
68
+ const visibleItems = visibleGroups.flatMap(([, groupItems]) => groupItems);
54
69
  const isInitialLoading = !!loading && !hasLoaded;
55
70
  const showSearch = !isInitialLoading && (!!onSearchChange || items.length > SEARCH_THRESHOLD);
56
71
  const searchLabel = `Search ${toRunningText(pluralLabel)}`;
@@ -95,7 +110,11 @@ var FilterSelectForm = (props) => {
95
110
  onValueChange: setDraft,
96
111
  size: "md",
97
112
  value: draft,
98
- children: visibleItems.map((item) => /* @__PURE__ */ jsx(BitkitCheckbox, {
113
+ children: visibleGroups.map(([group, groupItems]) => /* @__PURE__ */ jsxs(Fragment, { children: [!!group && /* @__PURE__ */ jsx(BitkitGroupHeading, {
114
+ label: group,
115
+ paddingBlockStart: "12",
116
+ paddingInline: "4"
117
+ }), groupItems.map((item) => /* @__PURE__ */ jsx(BitkitCheckbox, {
99
118
  labelText: item.icon ? /* @__PURE__ */ jsxs(HStack, {
100
119
  gap: "4",
101
120
  children: [/* @__PURE__ */ jsx(item.icon, {
@@ -104,10 +123,11 @@ var FilterSelectForm = (props) => {
104
123
  }), item.label]
105
124
  }) : item.label,
106
125
  value: item.value
107
- }, item.value))
126
+ }, item.value))] }, group))
108
127
  }), showLimitHelper && /* @__PURE__ */ jsx(LimitHelper, { marginBlockStart: "16" })]
109
128
  });
110
129
  else list = /* @__PURE__ */ jsx(FilterListbox, {
130
+ groups: visibleGroups,
111
131
  items: visibleItems,
112
132
  label,
113
133
  multiple,
@@ -177,11 +197,38 @@ var LimitHelper = ({ marginBlockStart }) => {
177
197
  * The option list for a single select, and on mobile for a multiple one too — there the rows are
178
198
  * full-width and highlighted when selected, with a checkbox drawn in front.
179
199
  */
180
- var FilterListbox = ({ items, label, multiple, onValueChange, showLimitHelper, value }) => {
200
+ var FilterListbox = (props) => {
201
+ const { groups, items, label, multiple, onValueChange, showLimitHelper, value } = props;
181
202
  const { isMobile, styles } = useFilterContext();
182
203
  const collection = useMemo(() => createListCollection({ items }), [items]);
183
204
  const checkboxStyles = useSlotRecipe({ key: "checkbox" })({ size: "lg" });
184
205
  const checkIndicator = /* @__PURE__ */ jsx(Listbox.ItemIndicator, { children: /* @__PURE__ */ jsx(IconCheck, { size: "16" }) });
206
+ const renderItem = (item) => {
207
+ const state = value.includes(item.value) ? "checked" : "unchecked";
208
+ const check = multiple ? /* @__PURE__ */ jsx(Box, {
209
+ "aria-hidden": true,
210
+ css: [checkboxStyles.control, styles.mobileListCheckbox],
211
+ "data-state": state,
212
+ children: /* @__PURE__ */ jsx(IconCheck, {})
213
+ }) : /* @__PURE__ */ jsx(Box, {
214
+ "aria-hidden": true,
215
+ css: styles.mobileListCheck,
216
+ "data-state": state,
217
+ children: /* @__PURE__ */ jsx(IconCheck, { size: "16" })
218
+ });
219
+ return /* @__PURE__ */ jsxs(Listbox.Item, {
220
+ item,
221
+ children: [
222
+ isMobile && check,
223
+ !!item.icon && /* @__PURE__ */ jsx(item.icon, {
224
+ color: item.iconColor,
225
+ size: isMobile ? "24" : "16"
226
+ }),
227
+ /* @__PURE__ */ jsx(Listbox.ItemText, { children: item.label }),
228
+ !isMobile && checkIndicator
229
+ ]
230
+ }, item.value);
231
+ };
185
232
  return /* @__PURE__ */ jsxs(Listbox.Root, {
186
233
  collection,
187
234
  onValueChange: (details) => onValueChange(details.value),
@@ -191,32 +238,14 @@ var FilterListbox = ({ items, label, multiple, onValueChange, showLimitHelper, v
191
238
  children: [/* @__PURE__ */ jsx(Listbox.Label, {
192
239
  srOnly: true,
193
240
  children: label
194
- }), /* @__PURE__ */ jsxs(Listbox.Content, { children: [items.map((item) => {
195
- const state = value.includes(item.value) ? "checked" : "unchecked";
196
- const check = multiple ? /* @__PURE__ */ jsx(Box, {
197
- "aria-hidden": true,
198
- css: [checkboxStyles.control, styles.mobileListCheckbox],
199
- "data-state": state,
200
- children: /* @__PURE__ */ jsx(IconCheck, {})
201
- }) : /* @__PURE__ */ jsx(Box, {
202
- "aria-hidden": true,
203
- css: styles.mobileListCheck,
204
- "data-state": state,
205
- children: /* @__PURE__ */ jsx(IconCheck, { size: "16" })
206
- });
207
- return /* @__PURE__ */ jsxs(Listbox.Item, {
208
- item,
209
- children: [
210
- isMobile && check,
211
- !!item.icon && /* @__PURE__ */ jsx(item.icon, {
212
- color: item.iconColor,
213
- size: isMobile ? "24" : "16"
214
- }),
215
- /* @__PURE__ */ jsx(Listbox.ItemText, { children: item.label }),
216
- !isMobile && checkIndicator
217
- ]
218
- }, item.value);
219
- }), showLimitHelper && /* @__PURE__ */ jsx(Box, {
241
+ }), /* @__PURE__ */ jsxs(Listbox.Content, { children: [groups.map(([group, groupItems]) => /* @__PURE__ */ jsxs(Listbox.ItemGroup, { children: [!!group && /* @__PURE__ */ jsx(Listbox.ItemGroupLabel, {
242
+ asChild: true,
243
+ children: /* @__PURE__ */ jsx(BitkitGroupHeading, {
244
+ label: group,
245
+ paddingBlockStart: "12",
246
+ paddingInline: "24"
247
+ })
248
+ }), groupItems.map(renderItem)] }, group)), showLimitHelper && /* @__PURE__ */ jsx(Box, {
220
249
  paddingBlockStart: "8",
221
250
  paddingInline: "24",
222
251
  children: /* @__PURE__ */ jsx(LimitHelper, {})
@@ -1 +1 @@
1
- {"version":3,"file":"FilterSelectForm.js","names":[],"sources":["../../../../lib/components/BitkitFilter/components/FilterSelectForm.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { createListCollection } from '@chakra-ui/react/collection';\nimport { Listbox } from '@chakra-ui/react/listbox';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { type BitkitIconComponent, IconCheck } from '../../../icons';\nimport { type BitkitColorToken } from '../../../theme/themeUtils';\nimport BitkitCheckbox from '../../BitkitCheckbox/BitkitCheckbox';\nimport BitkitCheckboxGroup from '../../BitkitCheckboxGroup/BitkitCheckboxGroup';\nimport BitkitInlineLoading from '../../BitkitInlineLoading/BitkitInlineLoading';\nimport BitkitList from '../../BitkitList/BitkitList';\nimport BitkitSearchInput from '../../BitkitSearchInput/BitkitSearchInput';\nimport BitkitTextInput from '../../BitkitTextInput/BitkitTextInput';\nimport { useFilterContext } from '../BitkitFilter.context';\nimport { compilePattern, isEqualFilterValue, isPattern, toRunningText } from '../BitkitFilter.utils';\nimport { FilterPanelFooter, FilterPanelHeader } from './FilterPanel';\nimport FilterSearchInput from './FilterSearchInput';\n\nexport interface BitkitFilterSelectItem {\n icon?: BitkitIconComponent;\n /** Colors the icon, e.g. a status: `icon/positive` for \"Passed\". */\n iconColor?: BitkitColorToken<'icon'>;\n label: string;\n value: string;\n}\n\n/** The list renders at most this many options; search narrows down the rest. */\nexport const MAX_VISIBLE_ITEMS = 100;\n\n/** Below this many options the list is short enough to scan, so there is no search input. */\nconst SEARCH_THRESHOLD = 5;\n\nexport interface FilterSelectFormProps {\n /** The filter holds a value: the footer offers \"Clear\" instead of the wildcard-mode switch. */\n isEditing: boolean;\n /** Keeps `items` in their own order instead of listing the applied ones first — for a switch's fixed options. */\n isOrderFixed?: boolean;\n /** A value is always applied: no \"Clear\" in the footer. */\n isRequired?: boolean;\n items: BitkitFilterSelectItem[];\n label: string;\n loading?: boolean;\n loadingLabel?: string;\n multiple?: boolean;\n onApply: (value: string[]) => void;\n onCancel: () => void;\n onSearchChange?: (searchText: string) => void;\n pattern?: boolean;\n pluralLabel: string;\n searchPlaceholder?: string;\n /**\n * The applied selection with its labels. Without a search, any of it missing from `items` — e.g.\n * left behind by a server search — is listed first, so it can still be unchecked.\n */\n selectedItems?: BitkitFilterSelectItem[];\n value: string[];\n}\n\n/** The body of a select filter's panel: search, the option list or wildcard pattern, and the footer. */\nconst FilterSelectForm = (props: FilterSelectFormProps) => {\n const {\n isEditing,\n isOrderFixed,\n isRequired,\n items,\n label,\n loading,\n loadingLabel = 'Loading...',\n multiple,\n onApply,\n onCancel,\n onSearchChange,\n pattern,\n pluralLabel,\n searchPlaceholder = 'Search for options',\n selectedItems = [],\n value,\n } = props;\n const { isMobile, styles } = useFilterContext();\n\n const [draft, setDraft] = useState(value);\n const [mode, setMode] = useState<'list' | 'pattern'>(pattern && value[0] && isPattern(value[0]) ? 'pattern' : 'list');\n const [searchText, setSearchText] = useState('');\n // Set once the options have loaded, so a later reload (a search, or clearing it) keeps the search and footer.\n const [hasLoaded, setHasLoaded] = useState(!loading);\n if (!loading && !hasLoaded) setHasLoaded(true);\n\n const onSearchTextChange = (text: string) => {\n setSearchText(text);\n onSearchChange?.(text);\n };\n\n // With `onSearchChange` the consumer filters `items` itself, e.g. on the server. Without a search,\n // the applied options come first. `value` doesn't change while the panel is open, so the order is\n // set when it opens and rows don't jump as options are (un)checked.\n const matchingItems = useMemo(() => {\n if (!searchText) {\n if (isOrderFixed) return items;\n const applied = value.flatMap((selected) => {\n const item = items.find((option) => option.value === selected);\n return item ?? selectedItems.find((option) => option.value === selected) ?? [];\n });\n return [...applied, ...items.filter((item) => !value.includes(item.value))];\n }\n if (onSearchChange) return items;\n const query = searchText.toLowerCase();\n return items.filter((item) => item.label.toLowerCase().includes(query));\n }, [isOrderFixed, items, onSearchChange, searchText, selectedItems, value]);\n\n const visibleItems = matchingItems.slice(0, MAX_VISIBLE_ITEMS);\n // The first load shows only the title and a loading row; later loads keep the input and footer in place.\n const isInitialLoading = !!loading && !hasLoaded;\n const showSearch = !isInitialLoading && (!!onSearchChange || items.length > SEARCH_THRESHOLD);\n const searchLabel = `Search ${toRunningText(pluralLabel)}`;\n const showLimitHelper = matchingItems.length > MAX_VISIBLE_ITEMS;\n\n const patternValue = draft[0] ?? '';\n const isApplyDisabled =\n isEqualFilterValue(draft, value) ||\n (mode === 'pattern' && !(patternValue && isPattern(patternValue))) ||\n (!!isRequired && !draft.length);\n\n // Switching between the list and the pattern moves focus into the new view, so typing goes there.\n const bodyRef = useRef<HTMLDivElement>(null);\n const hasSwitchedMode = useRef(false);\n useEffect(() => {\n if (!hasSwitchedMode.current) return;\n bodyRef.current\n ?.querySelector<HTMLElement>('input:not([type=hidden]), [role=listbox], input[type=checkbox]')\n ?.focus();\n }, [mode]);\n\n let start;\n if (isEditing && !isRequired) {\n start = { label: multiple && isMobile ? 'Clear all' : 'Clear', onClick: () => onApply([]) };\n } else if (pattern && !isEditing) {\n start = {\n label: mode === 'list' ? 'Use wildcard pattern' : 'Select from list',\n onClick: () => {\n hasSwitchedMode.current = true;\n setMode(mode === 'list' ? 'pattern' : 'list');\n setDraft([]);\n },\n };\n }\n\n let list;\n if (loading) {\n list = <BitkitInlineLoading css={styles.loading} label={loadingLabel} size={isMobile ? 'lg' : 'md'} />;\n } else if (!visibleItems.length) {\n list = (\n <Text css={styles.loading} color=\"text/secondary\" textStyle={isMobile ? 'body/lg/regular' : 'body/md/regular'}>\n {searchText ? 'No result. Refine your search term.' : 'No options available.'}\n </Text>\n );\n } else if (multiple && !isMobile) {\n list = (\n <Box css={styles.checkboxList}>\n <BitkitCheckboxGroup aria-label={label} onValueChange={setDraft} size=\"md\" value={draft}>\n {visibleItems.map((item) => (\n <BitkitCheckbox\n key={item.value}\n labelText={\n item.icon ? (\n <HStack gap=\"4\">\n <item.icon color={item.iconColor} size=\"16\" />\n {item.label}\n </HStack>\n ) : (\n item.label\n )\n }\n value={item.value}\n />\n ))}\n </BitkitCheckboxGroup>\n {showLimitHelper && <LimitHelper marginBlockStart=\"16\" />}\n </Box>\n );\n } else {\n list = (\n <FilterListbox\n items={visibleItems}\n label={label}\n multiple={multiple}\n onValueChange={setDraft}\n showLimitHelper={showLimitHelper}\n value={draft}\n />\n );\n }\n\n let search = null;\n if (showSearch && isMobile) {\n search = (\n <FilterSearchInput\n label={searchLabel}\n onValueChange={onSearchTextChange}\n placeholder={searchPlaceholder}\n value={searchText}\n />\n );\n } else if (showSearch) {\n search = (\n <Box css={styles.popoverSearch}>\n <BitkitSearchInput\n label={searchLabel}\n onChange={onSearchTextChange}\n placeholder={searchPlaceholder}\n size=\"md\"\n value={searchText}\n />\n </Box>\n );\n }\n\n const body = (\n <Box css={styles.popoverBody} ref={bodyRef}>\n {mode === 'pattern' ? (\n <FilterPatternBody items={items} onValueChange={setDraft} pluralLabel={pluralLabel} value={patternValue} />\n ) : (\n <>\n {search}\n {list}\n </>\n )}\n </Box>\n );\n\n return (\n <>\n <FilterPanelHeader\n count={multiple && mode === 'list' ? draft.length : undefined}\n title={multiple ? pluralLabel : label}\n />\n {isMobile ? (\n <Box flex=\"1\" overflowY=\"auto\">\n {body}\n </Box>\n ) : (\n body\n )}\n {!isInitialLoading && (\n <FilterPanelFooter\n applyLabel={multiple && mode === 'list' && draft.length ? `Apply (${draft.length})` : undefined}\n isApplyDisabled={isApplyDisabled}\n onApply={() => onApply(mode === 'pattern' ? [patternValue] : draft)}\n onCancel={onCancel}\n start={start}\n />\n )}\n </>\n );\n};\n\nconst LimitHelper = ({ marginBlockStart }: { marginBlockStart?: '16' }) => {\n const { styles } = useFilterContext();\n\n return (\n <Text css={styles.listHelperText} marginBlockStart={marginBlockStart}>\n Showing the first {MAX_VISIBLE_ITEMS} options. Search to find more.\n </Text>\n );\n};\n\ninterface FilterListboxProps {\n items: BitkitFilterSelectItem[];\n label: string;\n multiple?: boolean;\n onValueChange: (value: string[]) => void;\n showLimitHelper: boolean;\n value: string[];\n}\n\n/**\n * The option list for a single select, and on mobile for a multiple one too — there the rows are\n * full-width and highlighted when selected, with a checkbox drawn in front.\n */\nconst FilterListbox = ({ items, label, multiple, onValueChange, showLimitHelper, value }: FilterListboxProps) => {\n const { isMobile, styles } = useFilterContext();\n const collection = useMemo(() => createListCollection({ items }), [items]);\n const checkboxStyles = useSlotRecipe({ key: 'checkbox' })({ size: 'lg' });\n\n const checkIndicator = (\n <Listbox.ItemIndicator>\n <IconCheck size=\"16\" />\n </Listbox.ItemIndicator>\n );\n\n return (\n <Listbox.Root\n collection={collection}\n onValueChange={(details) => onValueChange(details.value)}\n selectionMode={multiple ? 'multiple' : 'single'}\n size={isMobile ? 'lg' : 'md'}\n value={value}\n >\n {/* Zag points the content's aria-labelledby at the label, so it has to exist. */}\n <Listbox.Label srOnly>{label}</Listbox.Label>\n <Listbox.Content>\n {items.map((item) => {\n const state = value.includes(item.value) ? 'checked' : 'unchecked';\n const check = multiple ? (\n // Drawn, not a real checkbox: the option row is the control, and a nested input would be a second one.\n <Box aria-hidden css={[checkboxStyles.control, styles.mobileListCheckbox]} data-state={state}>\n <IconCheck />\n </Box>\n ) : (\n <Box aria-hidden css={styles.mobileListCheck} data-state={state}>\n <IconCheck size=\"16\" />\n </Box>\n );\n return (\n <Listbox.Item item={item} key={item.value}>\n {isMobile && check}\n {!!item.icon && <item.icon color={item.iconColor} size={isMobile ? '24' : '16'} />}\n <Listbox.ItemText>{item.label}</Listbox.ItemText>\n {!isMobile && checkIndicator}\n </Listbox.Item>\n );\n })}\n {showLimitHelper && (\n <Box paddingBlockStart=\"8\" paddingInline=\"24\">\n <LimitHelper />\n </Box>\n )}\n </Listbox.Content>\n </Listbox.Root>\n );\n};\n\ninterface FilterPatternBodyProps {\n items: BitkitFilterSelectItem[];\n onValueChange: (value: string[]) => void;\n pluralLabel: string;\n value: string;\n}\n\nconst FilterPatternBody = ({ items, onValueChange, pluralLabel, value }: FilterPatternBodyProps) => {\n const { isMobile, styles } = useFilterContext();\n const noun = toRunningText(pluralLabel);\n const matches = useMemo(() => {\n if (!isPattern(value)) return null;\n const regExp = compilePattern(value);\n return items.filter((item) => !isPattern(item.label) && regExp.test(item.label));\n }, [items, value]);\n\n let results;\n if (!matches) {\n results = (\n <Text color=\"text/secondary\" textStyle=\"body/md/regular\">\n Enter a pattern with the wildcard &lsquo;*&rsquo; to view {noun} with matching names.\n </Text>\n );\n } else if (!matches.length) {\n results = (\n <Text color=\"text/tertiary\" textStyle=\"body/md/regular\">\n (no matching {noun})\n </Text>\n );\n } else {\n results = (\n <BitkitList size=\"md\">\n {matches.map((item) => (\n <BitkitList.Item key={item.value}>{item.label}</BitkitList.Item>\n ))}\n </BitkitList>\n );\n }\n\n return (\n <Box css={styles.pattern}>\n <BitkitTextInput\n helperText=\"Allowed wildcard character: *\"\n label=\"Wildcard pattern\"\n onValueChange={(text) => onValueChange(text ? [text] : [])}\n placeholder=\"(e.g. *main*, release-*)\"\n size={isMobile ? 'lg' : 'md'}\n value={value}\n />\n <Box css={styles.patternResults}>\n <Text css={styles.patternResultsLabel}>Matching results{matches?.length ? ` (${matches.length})` : ''}</Text>\n {results}\n </Box>\n </Box>\n );\n};\n\nexport default FilterSelectForm;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,mBAAmB;;AA6BzB,IAAM,oBAAoB,UAAiC;CACzD,MAAM,EACJ,WACA,cACA,YACA,OACA,OACA,SACA,eAAe,cACf,UACA,SACA,UACA,gBACA,SACA,aACA,oBAAoB,sBACpB,gBAAgB,CAAC,GACjB,UACE;CACJ,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAE9C,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CACxC,MAAM,CAAC,MAAM,WAAW,SAA6B,WAAW,MAAM,MAAM,UAAU,MAAM,EAAE,IAAI,YAAY,MAAM;CACpH,MAAM,CAAC,YAAY,iBAAiB,SAAS,EAAE;CAE/C,MAAM,CAAC,WAAW,gBAAgB,SAAS,CAAC,OAAO;CACnD,IAAI,CAAC,WAAW,CAAC,WA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AK,GAAG,OAAO;EAC9B,MAAM,SAAS,eAAe,KAAK;EACnC,OAAO,MAAM,QAAQ,SAAS,CAAC,UAAU,KAAK,KAAK,KAAK,OAAO,KAAK,KAAK,KAAK,CAAC;CACjF,GAAG,CAAC,OAAO,KAAK,CAAC;CAEjB,IAAI;CACJ,IAAI,CAAC,SACH,UACE,qBAAC,MAAD;EAAM,OAAM;EAAiB,WAAU;EAAvC,UAAA;GAAyD;GACI;GAAK;EAC5D;;MAEH,IAAI,CAAC,QAAQ,QAClB,UACE,qBAAC,MAAD;EAAM,OAAM;EAAgB,WAAU;EAAtC,UAAA;GAAwD;GACxC;GAAK;EACf;;MAGR,UACE,oBAAC,oBAAD;EAAY,MAAK;EACd,UAAA,QAAQ,KAAK,SACZ,oBAAC,mBAAW,MAAZ,EAAA,UAAmC,KAAK,MAAuB,GAAzC,KAAK,KAAoC,CAChE;CACS,CAAA;CAIhB,OACE,qBAAC,KAAD;EAAK,KAAK,OAAO;EAAjB,UAAA,CACE,oBAAC,iBAAD;GACE,YAAW;GACX,OAAM;GACN,gBAAgB,SAAS,cAAc,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;GACzD,aAAY;GACZ,MAAM,WAAW,OAAO;GACjB;EACR,CAAA,GACD,qBAAC,KAAD;GAAK,KAAK,OAAO;GAAjB,UAAA,CACE,qBAAC,MAAD;IAAM,KAAK,OAAO;IAAlB,UAAA,CAAuC,oBAAiB,SAAS,SAAS,KAAK,QAAQ,OAAO,KAAK,EAAS;GAC3G,CAAA,GAAA,OACE;EACF,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"FilterSelectForm.js","names":[],"sources":["../../../../lib/components/BitkitFilter/components/FilterSelectForm.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { createListCollection } from '@chakra-ui/react/collection';\nimport { Listbox } from '@chakra-ui/react/listbox';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { Fragment, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { type BitkitIconComponent, IconCheck } from '../../../icons';\nimport { type BitkitColorToken } from '../../../theme/themeUtils';\nimport BitkitCheckbox from '../../BitkitCheckbox/BitkitCheckbox';\nimport BitkitCheckboxGroup from '../../BitkitCheckboxGroup/BitkitCheckboxGroup';\nimport BitkitGroupHeading from '../../BitkitGroupHeading/BitkitGroupHeading';\nimport BitkitInlineLoading from '../../BitkitInlineLoading/BitkitInlineLoading';\nimport BitkitList from '../../BitkitList/BitkitList';\nimport BitkitSearchInput from '../../BitkitSearchInput/BitkitSearchInput';\nimport BitkitTextInput from '../../BitkitTextInput/BitkitTextInput';\nimport { useFilterContext } from '../BitkitFilter.context';\nimport { compilePattern, isEqualFilterValue, isPattern, toRunningText } from '../BitkitFilter.utils';\nimport { FilterPanelFooter, FilterPanelHeader } from './FilterPanel';\nimport FilterSearchInput from './FilterSearchInput';\n\nexport interface BitkitFilterSelectItem {\n /** Lists the option under this heading, with the others of the same group. */\n group?: string;\n icon?: BitkitIconComponent;\n /** Colors the icon, e.g. a status: `icon/positive` for \"Passed\". */\n iconColor?: BitkitColorToken<'icon'>;\n label: string;\n value: string;\n}\n\n/**\n * Gathers the options by `group`, in the order each group first appears, so the list (and its\n * keyboard order) runs group by group. Ungrouped options come under an empty-named group.\n */\nconst groupItems = (items: BitkitFilterSelectItem[]) => {\n const groups = new Map<string, BitkitFilterSelectItem[]>();\n items.forEach((item) => {\n const key = item.group ?? '';\n groups.set(key, [...(groups.get(key) ?? []), item]);\n });\n return [...groups];\n};\n\n/** The list renders at most this many options; search narrows down the rest. */\nexport const MAX_VISIBLE_ITEMS = 100;\n\n/** Below this many options the list is short enough to scan, so there is no search input. */\nconst SEARCH_THRESHOLD = 5;\n\nexport interface FilterSelectFormProps {\n /** The filter holds a value: the footer offers \"Clear\" instead of the wildcard-mode switch. */\n isEditing: boolean;\n /** Keeps `items` in their own order instead of listing the applied ones first — for a switch's fixed options. */\n isOrderFixed?: boolean;\n /** A value is always applied: no \"Clear\" in the footer. */\n isRequired?: boolean;\n items: BitkitFilterSelectItem[];\n label: string;\n loading?: boolean;\n loadingLabel?: string;\n multiple?: boolean;\n onApply: (value: string[]) => void;\n onCancel: () => void;\n onSearchChange?: (searchText: string) => void;\n pattern?: boolean;\n pluralLabel: string;\n searchPlaceholder?: string;\n /**\n * The applied selection with its labels. Without a search, any of it missing from `items` — e.g.\n * left behind by a server search — is listed first, so it can still be unchecked.\n */\n selectedItems?: BitkitFilterSelectItem[];\n value: string[];\n}\n\n/** The body of a select filter's panel: search, the option list or wildcard pattern, and the footer. */\nconst FilterSelectForm = (props: FilterSelectFormProps) => {\n const {\n isEditing,\n isOrderFixed,\n isRequired,\n items,\n label,\n loading,\n loadingLabel = 'Loading...',\n multiple,\n onApply,\n onCancel,\n onSearchChange,\n pattern,\n pluralLabel,\n searchPlaceholder = 'Search for options',\n selectedItems = [],\n value,\n } = props;\n const { isMobile, styles } = useFilterContext();\n\n const [draft, setDraft] = useState(value);\n const [mode, setMode] = useState<'list' | 'pattern'>(pattern && value[0] && isPattern(value[0]) ? 'pattern' : 'list');\n const [searchText, setSearchText] = useState('');\n // Set once the options have loaded, so a later reload (a search, or clearing it) keeps the search and footer.\n const [hasLoaded, setHasLoaded] = useState(!loading);\n if (!loading && !hasLoaded) setHasLoaded(true);\n\n const onSearchTextChange = (text: string) => {\n setSearchText(text);\n onSearchChange?.(text);\n };\n\n // With `onSearchChange` the consumer filters `items` itself, e.g. on the server. Without a search,\n // the applied options come first. `value` doesn't change while the panel is open, so the order is\n // set when it opens and rows don't jump as options are (un)checked.\n const matchingItems = useMemo(() => {\n if (!searchText) {\n if (isOrderFixed) return items;\n const applied = value.flatMap((selected) => {\n const item = items.find((option) => option.value === selected);\n return item ?? selectedItems.find((option) => option.value === selected) ?? [];\n });\n return [...applied, ...items.filter((item) => !value.includes(item.value))];\n }\n if (onSearchChange) return items;\n const query = searchText.toLowerCase();\n return items.filter((item) => item.label.toLowerCase().includes(query));\n }, [isOrderFixed, items, onSearchChange, searchText, selectedItems, value]);\n\n const visibleGroups = useMemo(() => groupItems(matchingItems.slice(0, MAX_VISIBLE_ITEMS)), [matchingItems]);\n const visibleItems = visibleGroups.flatMap(([, groupItems]) => groupItems);\n // The first load shows only the title and a loading row; later loads keep the input and footer in place.\n const isInitialLoading = !!loading && !hasLoaded;\n const showSearch = !isInitialLoading && (!!onSearchChange || items.length > SEARCH_THRESHOLD);\n const searchLabel = `Search ${toRunningText(pluralLabel)}`;\n const showLimitHelper = matchingItems.length > MAX_VISIBLE_ITEMS;\n\n const patternValue = draft[0] ?? '';\n const isApplyDisabled =\n isEqualFilterValue(draft, value) ||\n (mode === 'pattern' && !(patternValue && isPattern(patternValue))) ||\n (!!isRequired && !draft.length);\n\n // Switching between the list and the pattern moves focus into the new view, so typing goes there.\n const bodyRef = useRef<HTMLDivElement>(null);\n const hasSwitchedMode = useRef(false);\n useEffect(() => {\n if (!hasSwitchedMode.current) return;\n bodyRef.current\n ?.querySelector<HTMLElement>('input:not([type=hidden]), [role=listbox], input[type=checkbox]')\n ?.focus();\n }, [mode]);\n\n let start;\n if (isEditing && !isRequired) {\n start = { label: multiple && isMobile ? 'Clear all' : 'Clear', onClick: () => onApply([]) };\n } else if (pattern && !isEditing) {\n start = {\n label: mode === 'list' ? 'Use wildcard pattern' : 'Select from list',\n onClick: () => {\n hasSwitchedMode.current = true;\n setMode(mode === 'list' ? 'pattern' : 'list');\n setDraft([]);\n },\n };\n }\n\n let list;\n if (loading) {\n list = <BitkitInlineLoading css={styles.loading} label={loadingLabel} size={isMobile ? 'lg' : 'md'} />;\n } else if (!visibleItems.length) {\n list = (\n <Text css={styles.loading} color=\"text/secondary\" textStyle={isMobile ? 'body/lg/regular' : 'body/md/regular'}>\n {searchText ? 'No result. Refine your search term.' : 'No options available.'}\n </Text>\n );\n } else if (multiple && !isMobile) {\n list = (\n <Box css={styles.checkboxList}>\n <BitkitCheckboxGroup aria-label={label} onValueChange={setDraft} size=\"md\" value={draft}>\n {visibleGroups.map(([group, groupItems]) => (\n <Fragment key={group}>\n {/* The list pads 20; the heading lines up 24 from the popover's edge, like the listbox's. */}\n {!!group && <BitkitGroupHeading label={group} paddingBlockStart=\"12\" paddingInline=\"4\" />}\n {groupItems.map((item) => (\n <BitkitCheckbox\n key={item.value}\n labelText={\n item.icon ? (\n <HStack gap=\"4\">\n <item.icon color={item.iconColor} size=\"16\" />\n {item.label}\n </HStack>\n ) : (\n item.label\n )\n }\n value={item.value}\n />\n ))}\n </Fragment>\n ))}\n </BitkitCheckboxGroup>\n {showLimitHelper && <LimitHelper marginBlockStart=\"16\" />}\n </Box>\n );\n } else {\n list = (\n <FilterListbox\n groups={visibleGroups}\n items={visibleItems}\n label={label}\n multiple={multiple}\n onValueChange={setDraft}\n showLimitHelper={showLimitHelper}\n value={draft}\n />\n );\n }\n\n let search = null;\n if (showSearch && isMobile) {\n search = (\n <FilterSearchInput\n label={searchLabel}\n onValueChange={onSearchTextChange}\n placeholder={searchPlaceholder}\n value={searchText}\n />\n );\n } else if (showSearch) {\n search = (\n <Box css={styles.popoverSearch}>\n <BitkitSearchInput\n label={searchLabel}\n onChange={onSearchTextChange}\n placeholder={searchPlaceholder}\n size=\"md\"\n value={searchText}\n />\n </Box>\n );\n }\n\n const body = (\n <Box css={styles.popoverBody} ref={bodyRef}>\n {mode === 'pattern' ? (\n <FilterPatternBody items={items} onValueChange={setDraft} pluralLabel={pluralLabel} value={patternValue} />\n ) : (\n <>\n {search}\n {list}\n </>\n )}\n </Box>\n );\n\n return (\n <>\n <FilterPanelHeader\n count={multiple && mode === 'list' ? draft.length : undefined}\n title={multiple ? pluralLabel : label}\n />\n {isMobile ? (\n <Box flex=\"1\" overflowY=\"auto\">\n {body}\n </Box>\n ) : (\n body\n )}\n {!isInitialLoading && (\n <FilterPanelFooter\n applyLabel={multiple && mode === 'list' && draft.length ? `Apply (${draft.length})` : undefined}\n isApplyDisabled={isApplyDisabled}\n onApply={() => onApply(mode === 'pattern' ? [patternValue] : draft)}\n onCancel={onCancel}\n start={start}\n />\n )}\n </>\n );\n};\n\nconst LimitHelper = ({ marginBlockStart }: { marginBlockStart?: '16' }) => {\n const { styles } = useFilterContext();\n\n return (\n <Text css={styles.listHelperText} marginBlockStart={marginBlockStart}>\n Showing the first {MAX_VISIBLE_ITEMS} options. Search to find more.\n </Text>\n );\n};\n\ninterface FilterListboxProps {\n groups: [string, BitkitFilterSelectItem[]][];\n /** `groups` flattened, in the same order: the collection's (and so the keyboard's) order. */\n items: BitkitFilterSelectItem[];\n label: string;\n multiple?: boolean;\n onValueChange: (value: string[]) => void;\n showLimitHelper: boolean;\n value: string[];\n}\n\n/**\n * The option list for a single select, and on mobile for a multiple one too — there the rows are\n * full-width and highlighted when selected, with a checkbox drawn in front.\n */\nconst FilterListbox = (props: FilterListboxProps) => {\n const { groups, items, label, multiple, onValueChange, showLimitHelper, value } = props;\n const { isMobile, styles } = useFilterContext();\n const collection = useMemo(() => createListCollection({ items }), [items]);\n const checkboxStyles = useSlotRecipe({ key: 'checkbox' })({ size: 'lg' });\n\n const checkIndicator = (\n <Listbox.ItemIndicator>\n <IconCheck size=\"16\" />\n </Listbox.ItemIndicator>\n );\n\n const renderItem = (item: BitkitFilterSelectItem) => {\n const state = value.includes(item.value) ? 'checked' : 'unchecked';\n const check = multiple ? (\n // Drawn, not a real checkbox: the option row is the control, and a nested input would be a second one.\n <Box aria-hidden css={[checkboxStyles.control, styles.mobileListCheckbox]} data-state={state}>\n <IconCheck />\n </Box>\n ) : (\n <Box aria-hidden css={styles.mobileListCheck} data-state={state}>\n <IconCheck size=\"16\" />\n </Box>\n );\n return (\n <Listbox.Item item={item} key={item.value}>\n {isMobile && check}\n {!!item.icon && <item.icon color={item.iconColor} size={isMobile ? '24' : '16'} />}\n <Listbox.ItemText>{item.label}</Listbox.ItemText>\n {!isMobile && checkIndicator}\n </Listbox.Item>\n );\n };\n\n return (\n <Listbox.Root\n collection={collection}\n onValueChange={(details) => onValueChange(details.value)}\n selectionMode={multiple ? 'multiple' : 'single'}\n size={isMobile ? 'lg' : 'md'}\n value={value}\n >\n {/* Zag points the content's aria-labelledby at the label, so it has to exist. */}\n <Listbox.Label srOnly>{label}</Listbox.Label>\n <Listbox.Content>\n {groups.map(([group, groupItems]) => (\n <Listbox.ItemGroup key={group}>\n {!!group && (\n <Listbox.ItemGroupLabel asChild>\n <BitkitGroupHeading label={group} paddingBlockStart=\"12\" paddingInline=\"24\" />\n </Listbox.ItemGroupLabel>\n )}\n {groupItems.map(renderItem)}\n </Listbox.ItemGroup>\n ))}\n {showLimitHelper && (\n <Box paddingBlockStart=\"8\" paddingInline=\"24\">\n <LimitHelper />\n </Box>\n )}\n </Listbox.Content>\n </Listbox.Root>\n );\n};\n\ninterface FilterPatternBodyProps {\n items: BitkitFilterSelectItem[];\n onValueChange: (value: string[]) => void;\n pluralLabel: string;\n value: string;\n}\n\nconst FilterPatternBody = ({ items, onValueChange, pluralLabel, value }: FilterPatternBodyProps) => {\n const { isMobile, styles } = useFilterContext();\n const noun = toRunningText(pluralLabel);\n const matches = useMemo(() => {\n if (!isPattern(value)) return null;\n const regExp = compilePattern(value);\n return items.filter((item) => !isPattern(item.label) && regExp.test(item.label));\n }, [items, value]);\n\n let results;\n if (!matches) {\n results = (\n <Text color=\"text/secondary\" textStyle=\"body/md/regular\">\n Enter a pattern with the wildcard &lsquo;*&rsquo; to view {noun} with matching names.\n </Text>\n );\n } else if (!matches.length) {\n results = (\n <Text color=\"text/tertiary\" textStyle=\"body/md/regular\">\n (no matching {noun})\n </Text>\n );\n } else {\n results = (\n <BitkitList size=\"md\">\n {matches.map((item) => (\n <BitkitList.Item key={item.value}>{item.label}</BitkitList.Item>\n ))}\n </BitkitList>\n );\n }\n\n return (\n <Box css={styles.pattern}>\n <BitkitTextInput\n helperText=\"Allowed wildcard character: *\"\n label=\"Wildcard pattern\"\n onValueChange={(text) => onValueChange(text ? [text] : [])}\n placeholder=\"(e.g. *main*, release-*)\"\n size={isMobile ? 'lg' : 'md'}\n value={value}\n />\n <Box css={styles.patternResults}>\n <Text css={styles.patternResultsLabel}>Matching results{matches?.length ? ` (${matches.length})` : ''}</Text>\n {results}\n </Box>\n </Box>\n );\n};\n\nexport default FilterSelectForm;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,cAAc,UAAoC;CACtD,MAAM,yBAAS,IAAI,IAAsC;CACzD,MAAM,SAAS,SAAS;EACtB,MAAM,MAAM,KAAK,SAAS;EAC1B,OAAO,IAAI,KAAK,CAAC,GAAI,OAAO,IAAI,GAAG,KAAK,CAAC,GAAI,IAAI,CAAC;CACpD,CAAC;CACD,OAAO,CAAC,GAAG,MAAM;AACnB;;AAMA,IAAM,mBAAmB;;AA6BzB,IAAM,oBAAoB,UAAiC;CACzD,MAAM,EACJ,WACA,cACA,YACA,OACA,OACA,SACA,eAAe,cACf,UACA,SACA,UACA,gBACA,SACA,aACA,oBAAoB,sBACpB,gBAAgB,CAAC,GACjB,UACE;CACJ,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAE9C,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CACxC,MAAM,CAAC,MAAM,WAAW,SAA6B,WAAW,MAAM,MAAM,UAAU,MAAM,EAAE,IAAI,YAAY,MAAM;CACpH,MAAM,CAAC,YAAY,iBAAiB,SAAS,EAAE;CAE/C,MAAM,CAAC,WAAW,gBAAgB,SAAS,CAAC,OAAO;CACnD,IAAI,CAAC,WAAW,CAAC,WAAW,aAAa,IAAI;CAE7C,MAAM,sBAAsB,SAAiB;EAC3C,cAAc,IAAI;EAClB,iBAAiB,IAAI;CACvB;CAKA,MAAM,gBAAgB,cAAc;EAClC,IAAI,CAAC,YAAY;GACf,IAAI,cAAc,OAAO;GAKzB,OAAO,CAAC,GAJQ,MAAM,SAAS,aAAa;IAE1C,OADa,MAAM,MAAM,WAAW,OAAO,UAAU,QAC9C,KAAQ,cAAc,MA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EAAS;GAC3G,CAAA,GAAA,OACE;EACF,CAAA,CAAA;;AAET"}
@@ -1,4 +1,4 @@
1
- declare const filterSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"search" | "content" | "pattern" | "switch" | "icon" | "field" | "root" | "loading" | "items" | "searchInput" | "addSheetBackdrop" | "addSheetPositioner" | "addSheet" | "addMenu" | "addMenuLabel" | "addSheetItem" | "addMenuItem" | "addMenuIcon" | "addSheetItemReason" | "chip" | "chipLabel" | "chipTrigger" | "chipRemove" | "chipIcon" | "chipValue" | "chipChevron" | "fieldLabel" | "fieldControl" | "fieldTrigger" | "fieldRemove" | "fieldIcon" | "fieldValue" | "fieldChevron" | "mobilePanelHeader" | "popoverFooter" | "mobileFooter" | "popoverFooterStart" | "mobilePanelOverline" | "mobilePanelTitle" | "popoverContent" | "calendarFooter" | "mobileSearch" | "mobileSearchInput" | "popoverBody" | "checkboxList" | "popoverSearch" | "listHelperText" | "patternResults" | "patternResultsLabel" | "mobileListCheckbox" | "mobileListCheck" | "switchItem" | "switchItemText" | "filters" | "searchBlock" | "mobileBar" | "mobileTrigger" | "mobileHeader" | "mobileTitle" | "mobileBody", {
1
+ declare const filterSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"search" | "content" | "pattern" | "switch" | "icon" | "field" | "root" | "loading" | "items" | "searchInput" | "addSheetBackdrop" | "addSheetPositioner" | "addSheet" | "addMenu" | "addMenuLabel" | "addSheetItem" | "addMenuItem" | "addMenuIcon" | "addSheetItemReason" | "chip" | "chipLabel" | "chipTrigger" | "chipRemove" | "chipIcon" | "chipValue" | "chipChevron" | "fieldLabel" | "fieldControl" | "fieldTrigger" | "fieldRemove" | "fieldIcon" | "fieldValue" | "fieldChevron" | "mobilePanelHeader" | "popoverFooter" | "mobileFooter" | "popoverFooterStart" | "mobilePanelOverline" | "mobilePanelTitle" | "popoverContent" | "calendarFooter" | "mobileSearch" | "mobileSearchInput" | "popoverBody" | "checkboxList" | "popoverSearch" | "listHelperText" | "mobileListCheckbox" | "mobileListCheck" | "patternResults" | "patternResultsLabel" | "switchItem" | "switchItemText" | "filters" | "searchBlock" | "mobileBar" | "mobileTrigger" | "mobileHeader" | "mobileTitle" | "mobileBody", {
2
2
  pageLayout: {
3
3
  capped: {
4
4
  root: {
@@ -55,12 +55,7 @@ var listboxSlotRecipe = defineSlotRecipe({
55
55
  flexShrink: 0
56
56
  },
57
57
  itemGroup: {},
58
- itemGroupLabel: {
59
- color: "text/secondary",
60
- paddingBlock: "8",
61
- paddingInline: "24",
62
- textStyle: "body/sm/regular"
63
- },
58
+ itemGroupLabel: {},
64
59
  empty: {
65
60
  color: "text/secondary",
66
61
  paddingBlock: "8",
@@ -1 +1 @@
1
- {"version":3,"file":"Listbox.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Listbox.recipe.ts"],"sourcesContent":["import { listboxAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst listboxSlotRecipe = defineSlotRecipe({\n className: 'listbox',\n slots: listboxAnatomy.keys(),\n base: {\n root: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n content: {\n display: 'flex',\n flexDirection: 'column',\n maxHeight: rem(200),\n outline: 'none',\n overflowY: 'auto',\n paddingBlockEnd: '16',\n },\n item: {\n alignItems: 'center',\n color: 'text/body',\n cursor: 'pointer',\n display: 'flex',\n gap: '12',\n minHeight: '40',\n paddingBlock: '8',\n paddingInline: '24',\n textAlign: 'start',\n textStyle: 'body/md/regular',\n userSelect: 'none',\n _highlighted: {\n background: 'background/hover',\n },\n _selected: {\n background: 'background/selected',\n color: 'text/primary',\n textStyle: 'body/md/semibold',\n _highlighted: {\n background: 'background/selected-hover',\n },\n },\n _disabled: {\n color: 'text/disabled',\n cursor: 'not-allowed',\n _highlighted: {\n background: 'transparent',\n },\n },\n },\n itemText: {\n flex: '1',\n minWidth: 0,\n truncate: true,\n },\n itemIndicator: {\n color: 'icon/interactive',\n display: 'flex',\n flexShrink: 0,\n },\n itemGroup: {},\n itemGroupLabel: {\n color: 'text/secondary',\n paddingBlock: '8',\n paddingInline: '24',\n textStyle: 'body/sm/regular',\n },\n empty: {\n color: 'text/secondary',\n paddingBlock: '8',\n paddingInline: '24',\n textStyle: 'body/md/regular',\n },\n label: {\n color: 'text/primary',\n textStyle: 'comp/input/label',\n },\n valueText: {\n truncate: true,\n },\n input: {},\n },\n variants: {\n size: {\n md: {},\n // The full-screen mobile filter list: taller rows, larger text, unbounded height.\n lg: {\n content: {\n maxHeight: 'none',\n paddingBlock: '8',\n },\n item: {\n minHeight: '48',\n textStyle: 'body/lg/regular',\n _selected: {\n textStyle: 'body/lg/regular',\n },\n },\n empty: {\n textStyle: 'body/lg/regular',\n },\n },\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport default listboxSlotRecipe;\n"],"mappings":";;;;AAKA,IAAM,oBAAoB,iBAAiB;CACzC,WAAW;CACX,OAAO,eAAe,KAAK;CAC3B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,OAAO;EACT;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,WAAW,IAAI,GAAG;GAClB,SAAS;GACT,WAAW;GACX,iBAAiB;EACnB;EACA,MAAM;GACJ,YAAY;GACZ,OAAO;GACP,QAAQ;GACR,SAAS;GACT,KAAK;GACL,WAAW;GACX,cAAc;GACd,eAAe;GACf,WAAW;GACX,WAAW;GACX,YAAY;GACZ,cAAc,EACZ,YAAY,mBACd;GACA,WAAW;IACT,YAAY;IACZ,OAAO;IACP,WAAW;IACX,cAAc,EACZ,YAAY,4BACd;GACF;GACA,WAAW;IACT,OAAO;IACP,QAAQ;IACR,cAAc,EACZ,YAAY,cACd;GACF;EACF;EACA,UAAU;GACR,MAAM;GACN,UAAU;GACV,UAAU;EACZ;EACA,eAAe;GACb,OAAO;GACP,SAAS;GACT,YAAY;EACd;EACA,WAAW,CAAC;EACZ,gBAAgB;GACd,OAAO;GACP,cAAc;GACd,eAAe;GACf,WAAW;EACb;EACA,OAAO;GACL,OAAO;GACP,cAAc;GACd,eAAe;GACf,WAAW;EACb;EACA,OAAO;GACL,OAAO;GACP,WAAW;EACb;EACA,WAAW,EACT,UAAU,KACZ;EACA,OAAO,CAAC;CACV;CACA,UAAU,EACR,MAAM;EACJ,IAAI,CAAC;EAEL,IAAI;GACF,SAAS;IACP,WAAW;IACX,cAAc;GAChB;GACA,MAAM;IACJ,WAAW;IACX,WAAW;IACX,WAAW,EACT,WAAW,kBACb;GACF;GACA,OAAO,EACL,WAAW,kBACb;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC"}
1
+ {"version":3,"file":"Listbox.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Listbox.recipe.ts"],"sourcesContent":["import { listboxAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst listboxSlotRecipe = defineSlotRecipe({\n className: 'listbox',\n slots: listboxAnatomy.keys(),\n base: {\n root: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n content: {\n display: 'flex',\n flexDirection: 'column',\n maxHeight: rem(200),\n outline: 'none',\n overflowY: 'auto',\n paddingBlockEnd: '16',\n },\n item: {\n alignItems: 'center',\n color: 'text/body',\n cursor: 'pointer',\n display: 'flex',\n gap: '12',\n minHeight: '40',\n paddingBlock: '8',\n paddingInline: '24',\n textAlign: 'start',\n textStyle: 'body/md/regular',\n userSelect: 'none',\n _highlighted: {\n background: 'background/hover',\n },\n _selected: {\n background: 'background/selected',\n color: 'text/primary',\n textStyle: 'body/md/semibold',\n _highlighted: {\n background: 'background/selected-hover',\n },\n },\n _disabled: {\n color: 'text/disabled',\n cursor: 'not-allowed',\n _highlighted: {\n background: 'transparent',\n },\n },\n },\n itemText: {\n flex: '1',\n minWidth: 0,\n truncate: true,\n },\n itemIndicator: {\n color: 'icon/interactive',\n display: 'flex',\n flexShrink: 0,\n },\n itemGroup: {},\n // A group's label is a `BitkitGroupHeading`, which brings its own styles.\n itemGroupLabel: {},\n empty: {\n color: 'text/secondary',\n paddingBlock: '8',\n paddingInline: '24',\n textStyle: 'body/md/regular',\n },\n label: {\n color: 'text/primary',\n textStyle: 'comp/input/label',\n },\n valueText: {\n truncate: true,\n },\n input: {},\n },\n variants: {\n size: {\n md: {},\n // The full-screen mobile filter list: taller rows, larger text, unbounded height.\n lg: {\n content: {\n maxHeight: 'none',\n paddingBlock: '8',\n },\n item: {\n minHeight: '48',\n textStyle: 'body/lg/regular',\n _selected: {\n textStyle: 'body/lg/regular',\n },\n },\n empty: {\n textStyle: 'body/lg/regular',\n },\n },\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport default listboxSlotRecipe;\n"],"mappings":";;;;AAKA,IAAM,oBAAoB,iBAAiB;CACzC,WAAW;CACX,OAAO,eAAe,KAAK;CAC3B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,OAAO;EACT;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,WAAW,IAAI,GAAG;GAClB,SAAS;GACT,WAAW;GACX,iBAAiB;EACnB;EACA,MAAM;GACJ,YAAY;GACZ,OAAO;GACP,QAAQ;GACR,SAAS;GACT,KAAK;GACL,WAAW;GACX,cAAc;GACd,eAAe;GACf,WAAW;GACX,WAAW;GACX,YAAY;GACZ,cAAc,EACZ,YAAY,mBACd;GACA,WAAW;IACT,YAAY;IACZ,OAAO;IACP,WAAW;IACX,cAAc,EACZ,YAAY,4BACd;GACF;GACA,WAAW;IACT,OAAO;IACP,QAAQ;IACR,cAAc,EACZ,YAAY,cACd;GACF;EACF;EACA,UAAU;GACR,MAAM;GACN,UAAU;GACV,UAAU;EACZ;EACA,eAAe;GACb,OAAO;GACP,SAAS;GACT,YAAY;EACd;EACA,WAAW,CAAC;EAEZ,gBAAgB,CAAC;EACjB,OAAO;GACL,OAAO;GACP,cAAc;GACd,eAAe;GACf,WAAW;EACb;EACA,OAAO;GACL,OAAO;GACP,WAAW;EACb;EACA,WAAW,EACT,UAAU,KACZ;EACA,OAAO,CAAC;CACV;CACA,UAAU,EACR,MAAM;EACJ,IAAI,CAAC;EAEL,IAAI;GACF,SAAS;IACP,WAAW;IACX,cAAc;GAChB;GACA,MAAM;IACJ,WAAW;IACX,WAAW;IACX,WAAW,EACT,WAAW,kBACb;GACF;GACA,OAAO,EACL,WAAW,kBACb;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC"}
@@ -1181,7 +1181,7 @@ declare const slotRecipes: {
1181
1181
  };
1182
1182
  };
1183
1183
  }>;
1184
- filter: import('@chakra-ui/react').SlotRecipeDefinition<"search" | "content" | "pattern" | "switch" | "icon" | "field" | "root" | "loading" | "items" | "searchInput" | "addSheetBackdrop" | "addSheetPositioner" | "addSheet" | "addMenu" | "addMenuLabel" | "addSheetItem" | "addMenuItem" | "addMenuIcon" | "addSheetItemReason" | "chip" | "chipLabel" | "chipTrigger" | "chipRemove" | "chipIcon" | "chipValue" | "chipChevron" | "fieldLabel" | "fieldControl" | "fieldTrigger" | "fieldRemove" | "fieldIcon" | "fieldValue" | "fieldChevron" | "mobilePanelHeader" | "popoverFooter" | "mobileFooter" | "popoverFooterStart" | "mobilePanelOverline" | "mobilePanelTitle" | "popoverContent" | "calendarFooter" | "mobileSearch" | "mobileSearchInput" | "popoverBody" | "checkboxList" | "popoverSearch" | "listHelperText" | "patternResults" | "patternResultsLabel" | "mobileListCheckbox" | "mobileListCheck" | "switchItem" | "switchItemText" | "filters" | "searchBlock" | "mobileBar" | "mobileTrigger" | "mobileHeader" | "mobileTitle" | "mobileBody", {
1184
+ filter: import('@chakra-ui/react').SlotRecipeDefinition<"search" | "content" | "pattern" | "switch" | "icon" | "field" | "root" | "loading" | "items" | "searchInput" | "addSheetBackdrop" | "addSheetPositioner" | "addSheet" | "addMenu" | "addMenuLabel" | "addSheetItem" | "addMenuItem" | "addMenuIcon" | "addSheetItemReason" | "chip" | "chipLabel" | "chipTrigger" | "chipRemove" | "chipIcon" | "chipValue" | "chipChevron" | "fieldLabel" | "fieldControl" | "fieldTrigger" | "fieldRemove" | "fieldIcon" | "fieldValue" | "fieldChevron" | "mobilePanelHeader" | "popoverFooter" | "mobileFooter" | "popoverFooterStart" | "mobilePanelOverline" | "mobilePanelTitle" | "popoverContent" | "calendarFooter" | "mobileSearch" | "mobileSearchInput" | "popoverBody" | "checkboxList" | "popoverSearch" | "listHelperText" | "mobileListCheckbox" | "mobileListCheck" | "patternResults" | "patternResultsLabel" | "switchItem" | "switchItemText" | "filters" | "searchBlock" | "mobileBar" | "mobileTrigger" | "mobileHeader" | "mobileTitle" | "mobileBody", {
1185
1185
  pageLayout: {
1186
1186
  capped: {
1187
1187
  root: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.475-beta.3012",
4
+ "version": "0.3.475-beta.3014",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",