@bitrise/bitkit-v2 0.3.478-beta.3036 → 0.3.479

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.
Files changed (111) hide show
  1. package/dist/components/BitkitCalendar/BitkitCalendar.d.ts +0 -12
  2. package/dist/components/BitkitCalendar/BitkitCalendar.js +1 -7
  3. package/dist/components/BitkitCalendar/BitkitCalendar.js.map +1 -1
  4. package/dist/components/BitkitCalendar/components/CalendarContent.d.ts +1 -5
  5. package/dist/components/BitkitCalendar/components/CalendarContent.js +43 -60
  6. package/dist/components/BitkitCalendar/components/CalendarContent.js.map +1 -1
  7. package/dist/components/BitkitCalendar/components/CalendarMonth.d.ts +2 -4
  8. package/dist/components/BitkitCalendar/components/CalendarMonth.js +5 -15
  9. package/dist/components/BitkitCalendar/components/CalendarMonth.js.map +1 -1
  10. package/dist/components/BitkitCalendar/components/CalendarMonthSelect.d.ts +1 -2
  11. package/dist/components/BitkitCalendar/components/CalendarMonthSelect.js +2 -3
  12. package/dist/components/BitkitCalendar/components/CalendarMonthSelect.js.map +1 -1
  13. package/dist/components/BitkitCalendar/components/CalendarNextTrigger.d.ts +1 -3
  14. package/dist/components/BitkitCalendar/components/CalendarNextTrigger.js +3 -3
  15. package/dist/components/BitkitCalendar/components/CalendarNextTrigger.js.map +1 -1
  16. package/dist/components/BitkitCalendar/components/CalendarPrevTrigger.d.ts +1 -3
  17. package/dist/components/BitkitCalendar/components/CalendarPrevTrigger.js +3 -3
  18. package/dist/components/BitkitCalendar/components/CalendarPrevTrigger.js.map +1 -1
  19. package/dist/components/BitkitCalendar/components/CalendarSelect.d.ts +0 -1
  20. package/dist/components/BitkitCalendar/components/CalendarSelect.js +3 -5
  21. package/dist/components/BitkitCalendar/components/CalendarSelect.js.map +1 -1
  22. package/dist/components/BitkitCalendar/components/CalendarTrigger.js +0 -1
  23. package/dist/components/BitkitCalendar/components/CalendarTrigger.js.map +1 -1
  24. package/dist/components/BitkitCalendar/components/CalendarYearSelect.d.ts +1 -2
  25. package/dist/components/BitkitCalendar/components/CalendarYearSelect.js +2 -3
  26. package/dist/components/BitkitCalendar/components/CalendarYearSelect.js.map +1 -1
  27. package/dist/components/BitkitDatePicker/BitkitDatePicker.d.ts +0 -2
  28. package/dist/components/BitkitDatePicker/BitkitDatePicker.js +1 -2
  29. package/dist/components/BitkitDatePicker/BitkitDatePicker.js.map +1 -1
  30. package/dist/components/BitkitLabelTooltip/BitkitLabelTooltip.d.ts +3 -4
  31. package/dist/components/BitkitLabelTooltip/BitkitLabelTooltip.js +2 -3
  32. package/dist/components/BitkitLabelTooltip/BitkitLabelTooltip.js.map +1 -1
  33. package/dist/components/BitkitMarkdown/BitkitMarkdown.js +1 -1
  34. package/dist/components/BitkitNoteCard/BitkitNoteCard.js +1 -1
  35. package/dist/components/BitkitPageHeader/BitkitPageHeader.d.ts +14 -0
  36. package/dist/components/BitkitPageHeader/BitkitPageHeader.js +62 -36
  37. package/dist/components/BitkitPageHeader/BitkitPageHeader.js.map +1 -1
  38. package/dist/components/BitkitPageSidebar/BitkitPageSidebar.d.ts +24 -0
  39. package/dist/components/BitkitPageSidebar/BitkitPageSidebar.js +74 -6
  40. package/dist/components/BitkitPageSidebar/BitkitPageSidebar.js.map +1 -1
  41. package/dist/components/BitkitSelect/BitkitSelect.js +1 -0
  42. package/dist/components/BitkitSelect/BitkitSelect.js.map +1 -1
  43. package/dist/components/index.d.ts +1 -7
  44. package/dist/main.js +7 -8
  45. package/dist/theme/slot-recipes/DatePicker.recipe.d.ts +0 -15
  46. package/dist/theme/slot-recipes/DatePicker.recipe.js +22 -72
  47. package/dist/theme/slot-recipes/DatePicker.recipe.js.map +1 -1
  48. package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +0 -85
  49. package/dist/theme/slot-recipes/DatePickerSelect.recipe.js +10 -35
  50. package/dist/theme/slot-recipes/DatePickerSelect.recipe.js.map +1 -1
  51. package/dist/theme/slot-recipes/Menu.recipe.js +1 -6
  52. package/dist/theme/slot-recipes/Menu.recipe.js.map +1 -1
  53. package/dist/theme/slot-recipes/PageHeader.recipe.d.ts +23 -1
  54. package/dist/theme/slot-recipes/PageHeader.recipe.js +63 -0
  55. package/dist/theme/slot-recipes/PageHeader.recipe.js.map +1 -1
  56. package/dist/theme/slot-recipes/PageSidebar.recipe.d.ts +49 -1
  57. package/dist/theme/slot-recipes/PageSidebar.recipe.js +93 -0
  58. package/dist/theme/slot-recipes/PageSidebar.recipe.js.map +1 -1
  59. package/dist/theme/slot-recipes/Tag.recipe.d.ts +1 -1
  60. package/dist/theme/slot-recipes/index.d.ts +59 -160
  61. package/dist/theme/slot-recipes/index.js +0 -4
  62. package/dist/theme/slot-recipes/index.js.map +1 -1
  63. package/dist/utilities/BitkitPortalContext.js +2 -3
  64. package/dist/utilities/BitkitPortalContext.js.map +1 -1
  65. package/docs/v1-to-v2-migration-guide.md +1 -48
  66. package/package.json +1 -1
  67. package/dist/components/BitkitFilter/BitkitFilter.context.d.ts +0 -65
  68. package/dist/components/BitkitFilter/BitkitFilter.context.js +0 -82
  69. package/dist/components/BitkitFilter/BitkitFilter.context.js.map +0 -1
  70. package/dist/components/BitkitFilter/BitkitFilter.d.ts +0 -55
  71. package/dist/components/BitkitFilter/BitkitFilter.js +0 -247
  72. package/dist/components/BitkitFilter/BitkitFilter.js.map +0 -1
  73. package/dist/components/BitkitFilter/BitkitFilter.utils.d.ts +0 -18
  74. package/dist/components/BitkitFilter/BitkitFilter.utils.js +0 -42
  75. package/dist/components/BitkitFilter/BitkitFilter.utils.js.map +0 -1
  76. package/dist/components/BitkitFilter/BitkitFilterAdd.d.ts +0 -18
  77. package/dist/components/BitkitFilter/BitkitFilterAdd.js +0 -200
  78. package/dist/components/BitkitFilter/BitkitFilterAdd.js.map +0 -1
  79. package/dist/components/BitkitFilter/BitkitFilterDateRange.d.ts +0 -26
  80. package/dist/components/BitkitFilter/BitkitFilterDateRange.js +0 -118
  81. package/dist/components/BitkitFilter/BitkitFilterDateRange.js.map +0 -1
  82. package/dist/components/BitkitFilter/BitkitFilterSearch.d.ts +0 -23
  83. package/dist/components/BitkitFilter/BitkitFilterSearch.js +0 -72
  84. package/dist/components/BitkitFilter/BitkitFilterSearch.js.map +0 -1
  85. package/dist/components/BitkitFilter/BitkitFilterSelect.d.ts +0 -61
  86. package/dist/components/BitkitFilter/BitkitFilterSelect.js +0 -149
  87. package/dist/components/BitkitFilter/BitkitFilterSelect.js.map +0 -1
  88. package/dist/components/BitkitFilter/BitkitFilterSwitch.d.ts +0 -28
  89. package/dist/components/BitkitFilter/BitkitFilterSwitch.js +0 -87
  90. package/dist/components/BitkitFilter/BitkitFilterSwitch.js.map +0 -1
  91. package/dist/components/BitkitFilter/components/FilterChip.d.ts +0 -23
  92. package/dist/components/BitkitFilter/components/FilterChip.js +0 -66
  93. package/dist/components/BitkitFilter/components/FilterChip.js.map +0 -1
  94. package/dist/components/BitkitFilter/components/FilterField.d.ts +0 -15
  95. package/dist/components/BitkitFilter/components/FilterField.js +0 -60
  96. package/dist/components/BitkitFilter/components/FilterField.js.map +0 -1
  97. package/dist/components/BitkitFilter/components/FilterPanel.d.ts +0 -42
  98. package/dist/components/BitkitFilter/components/FilterPanel.js +0 -126
  99. package/dist/components/BitkitFilter/components/FilterPanel.js.map +0 -1
  100. package/dist/components/BitkitFilter/components/FilterSearchInput.d.ts +0 -15
  101. package/dist/components/BitkitFilter/components/FilterSearchInput.js +0 -41
  102. package/dist/components/BitkitFilter/components/FilterSearchInput.js.map +0 -1
  103. package/dist/components/BitkitFilter/components/FilterSelectForm.d.ts +0 -45
  104. package/dist/components/BitkitFilter/components/FilterSelectForm.js +0 -324
  105. package/dist/components/BitkitFilter/components/FilterSelectForm.js.map +0 -1
  106. package/dist/theme/slot-recipes/Filter.recipe.d.ts +0 -37
  107. package/dist/theme/slot-recipes/Filter.recipe.js +0 -649
  108. package/dist/theme/slot-recipes/Filter.recipe.js.map +0 -1
  109. package/dist/theme/slot-recipes/Listbox.recipe.d.ts +0 -22
  110. package/dist/theme/slot-recipes/Listbox.recipe.js +0 -92
  111. package/dist/theme/slot-recipes/Listbox.recipe.js.map +0 -1
@@ -1,126 +0,0 @@
1
- import IconArrowLeft from "../../../icons/IconArrowLeft.js";
2
- import { usePortalContext } from "../../../utilities/BitkitPortalContext.js";
3
- import BitkitBadge from "../../BitkitBadge/BitkitBadge.js";
4
- import BitkitControlButton from "../../BitkitControlButton/BitkitControlButton.js";
5
- import BitkitButton from "../../BitkitButton/BitkitButton.js";
6
- import { useFilterContext } from "../BitkitFilter.context.js";
7
- import { Box } from "@chakra-ui/react/box";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- import { Portal } from "@chakra-ui/react/portal";
10
- import { Text } from "@chakra-ui/react/text";
11
- import { Drawer } from "@chakra-ui/react/drawer";
12
- import { Popover } from "@chakra-ui/react/popover";
13
- //#region lib/components/BitkitFilter/components/FilterPanel.tsx
14
- /**
15
- * Where a filter edits its value: an anchored popover on desktop, a full-screen view stacked over the
16
- * filters dialog on mobile. The content unmounts on close, so the draft state of the form inside
17
- * starts over from the applied value each time it opens.
18
- */
19
- var FilterPanel = (props) => {
20
- const { children, finalFocusEl, getAnchorElement, onOpenChange: onOpenChangeProp, open, trigger } = props;
21
- const { isDisabled, isMobile, styles } = useFilterContext();
22
- const onOpenChange = (isOpen) => {
23
- if (!isOpen || !isDisabled) onOpenChangeProp(isOpen);
24
- };
25
- const { disablePortal } = usePortalContext();
26
- if (isMobile) return /* @__PURE__ */ jsxs(Fragment, { children: [trigger, /* @__PURE__ */ jsx(Drawer.Root, {
27
- finalFocusEl,
28
- lazyMount: true,
29
- onOpenChange: ({ open: isOpen }) => onOpenChange(isOpen),
30
- open,
31
- unmountOnExit: true,
32
- children: /* @__PURE__ */ jsx(Portal, {
33
- disabled: disablePortal,
34
- children: /* @__PURE__ */ jsx(Drawer.Positioner, { children: /* @__PURE__ */ jsx(Drawer.Content, { children }) })
35
- })
36
- })] });
37
- return /* @__PURE__ */ jsxs(Popover.Root, {
38
- finalFocusEl,
39
- lazyMount: true,
40
- onOpenChange: ({ open: isOpen }) => onOpenChange(isOpen),
41
- open,
42
- positioning: {
43
- getAnchorElement,
44
- gutter: 8,
45
- placement: "bottom-start"
46
- },
47
- unmountOnExit: true,
48
- children: [trigger, /* @__PURE__ */ jsx(Portal, {
49
- disabled: disablePortal,
50
- children: /* @__PURE__ */ jsx(Popover.Positioner, { children: /* @__PURE__ */ jsx(Popover.Content, {
51
- css: styles.popoverContent,
52
- children
53
- }) })
54
- })]
55
- });
56
- };
57
- var FilterPanelHeader = ({ count, title }) => {
58
- const { isMobile, styles } = useFilterContext();
59
- if (isMobile) return /* @__PURE__ */ jsxs(Box, {
60
- css: styles.mobilePanelHeader,
61
- children: [/* @__PURE__ */ jsx(Drawer.CloseTrigger, {
62
- asChild: true,
63
- unstyled: true,
64
- children: /* @__PURE__ */ jsx(BitkitControlButton, {
65
- icon: IconArrowLeft,
66
- label: "Back"
67
- })
68
- }), /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
69
- css: styles.mobilePanelOverline,
70
- children: "Filter"
71
- }), /* @__PURE__ */ jsx(Drawer.Title, {
72
- css: styles.mobilePanelTitle,
73
- unstyled: true,
74
- children: title
75
- })] })]
76
- });
77
- return /* @__PURE__ */ jsxs(Popover.Header, { children: [/* @__PURE__ */ jsx(Popover.Title, { children: title }), count !== void 0 && /* @__PURE__ */ jsx(BitkitBadge, { children: count })] });
78
- };
79
- var FilterPanelFooter = ({ applyLabel, isApplyDisabled, onApply, onCancel, start }) => {
80
- const { isMobile, styles } = useFilterContext();
81
- const applyState = isApplyDisabled ? "disabled" : void 0;
82
- if (isMobile) return /* @__PURE__ */ jsx(Drawer.Footer, { children: /* @__PURE__ */ jsxs(Box, {
83
- css: styles.mobileFooter,
84
- children: [!!start && /* @__PURE__ */ jsx(BitkitButton, {
85
- onClick: start.onClick,
86
- size: "md",
87
- variant: "secondary",
88
- children: start.label
89
- }), /* @__PURE__ */ jsx(BitkitButton, {
90
- onClick: onApply,
91
- size: "md",
92
- state: applyState,
93
- children: applyLabel ?? "Apply"
94
- })]
95
- }) });
96
- return /* @__PURE__ */ jsxs(Box, {
97
- css: styles.popoverFooter,
98
- children: [
99
- /* @__PURE__ */ jsx(Box, {
100
- css: styles.popoverFooterStart,
101
- children: !!start && /* @__PURE__ */ jsx(BitkitButton, {
102
- onClick: start.onClick,
103
- size: "sm",
104
- variant: "tertiary",
105
- children: start.label
106
- })
107
- }),
108
- !!onCancel && /* @__PURE__ */ jsx(BitkitButton, {
109
- onClick: onCancel,
110
- size: "sm",
111
- variant: "secondary",
112
- children: "Cancel"
113
- }),
114
- /* @__PURE__ */ jsx(BitkitButton, {
115
- onClick: onApply,
116
- size: "sm",
117
- state: applyState,
118
- children: "Apply"
119
- })
120
- ]
121
- });
122
- };
123
- //#endregion
124
- export { FilterPanelFooter, FilterPanelHeader, FilterPanel as default };
125
-
126
- //# sourceMappingURL=FilterPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FilterPanel.js","names":["_Fragment"],"sources":["../../../../lib/components/BitkitFilter/components/FilterPanel.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Drawer } from '@chakra-ui/react/drawer';\nimport { Popover } from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ReactNode } from 'react';\n\nimport { IconArrowLeft } from '../../../icons';\nimport { usePortalContext } from '../../../utilities/BitkitPortalContext';\nimport BitkitBadge from '../../BitkitBadge/BitkitBadge';\nimport BitkitButton from '../../BitkitButton/BitkitButton';\nimport BitkitControlButton from '../../BitkitControlButton/BitkitControlButton';\nimport { useFilterContext } from '../BitkitFilter.context';\n\nexport interface FilterPanelProps {\n children: ReactNode;\n /** Where focus goes on close, for a panel without a trigger to return it to. */\n finalFocusEl?: () => HTMLElement | null;\n /** Anchors the desktop popover to an element it has no trigger for — the \"Add filter\" button. */\n getAnchorElement?: () => HTMLElement | null;\n onOpenChange: (open: boolean) => void;\n open: boolean;\n /**\n * What opens the panel: on desktop a `FilterChip`, which renders the popover's trigger; on mobile a\n * `FilterField`, which opens it through its own `onClick`.\n */\n trigger?: ReactNode;\n}\n\n/**\n * Where a filter edits its value: an anchored popover on desktop, a full-screen view stacked over the\n * filters dialog on mobile. The content unmounts on close, so the draft state of the form inside\n * starts over from the applied value each time it opens.\n */\nconst FilterPanel = (props: FilterPanelProps) => {\n const { children, finalFocusEl, getAnchorElement, onOpenChange: onOpenChangeProp, open, trigger } = props;\n const { isDisabled, isMobile, styles } = useFilterContext();\n // While the page loads the triggers are only `aria-disabled`, so opening is refused here.\n const onOpenChange = (isOpen: boolean) => {\n if (!isOpen || !isDisabled) onOpenChangeProp(isOpen);\n };\n const { disablePortal } = usePortalContext();\n\n if (isMobile) {\n return (\n <>\n {trigger}\n <Drawer.Root\n finalFocusEl={finalFocusEl}\n lazyMount\n onOpenChange={({ open: isOpen }) => onOpenChange(isOpen)}\n open={open}\n unmountOnExit\n >\n <Portal disabled={disablePortal}>\n <Drawer.Positioner>\n <Drawer.Content>{children}</Drawer.Content>\n </Drawer.Positioner>\n </Portal>\n </Drawer.Root>\n </>\n );\n }\n\n return (\n <Popover.Root\n finalFocusEl={finalFocusEl}\n lazyMount\n onOpenChange={({ open: isOpen }) => onOpenChange(isOpen)}\n open={open}\n positioning={{\n getAnchorElement,\n gutter: 8,\n placement: 'bottom-start',\n }}\n unmountOnExit\n >\n {trigger}\n <Portal disabled={disablePortal}>\n <Popover.Positioner>\n <Popover.Content css={styles.popoverContent}>{children}</Popover.Content>\n </Popover.Positioner>\n </Portal>\n </Popover.Root>\n );\n};\n\nexport interface FilterPanelHeaderProps {\n /** Desktop only: a multi-select's selection count, shown as a badge next to the title. */\n count?: number;\n title: string;\n}\n\nexport const FilterPanelHeader = ({ count, title }: FilterPanelHeaderProps) => {\n const { isMobile, styles } = useFilterContext();\n\n if (isMobile) {\n return (\n <Box css={styles.mobilePanelHeader}>\n <Drawer.CloseTrigger asChild unstyled>\n <BitkitControlButton icon={IconArrowLeft} label=\"Back\" />\n </Drawer.CloseTrigger>\n <Box>\n <Text css={styles.mobilePanelOverline}>Filter</Text>\n <Drawer.Title css={styles.mobilePanelTitle} unstyled>\n {title}\n </Drawer.Title>\n </Box>\n </Box>\n );\n }\n\n return (\n <Popover.Header>\n <Popover.Title>{title}</Popover.Title>\n {count !== undefined && <BitkitBadge>{count}</BitkitBadge>}\n </Popover.Header>\n );\n};\n\nexport interface FilterPanelFooterProps {\n /** Mobile only: the Apply button's label, e.g. \"Apply (2)\". */\n applyLabel?: string;\n isApplyDisabled: boolean;\n onApply: () => void;\n /** Desktop only: adds a \"Cancel\" button. On mobile the header's back button cancels. */\n onCancel?: () => void;\n /** The action before Apply: \"Clear\", or the wildcard-mode switch. */\n start?: { label: string; onClick: () => void };\n}\n\nexport const FilterPanelFooter = ({\n applyLabel,\n isApplyDisabled,\n onApply,\n onCancel,\n start,\n}: FilterPanelFooterProps) => {\n const { isMobile, styles } = useFilterContext();\n const applyState = isApplyDisabled ? 'disabled' : undefined;\n\n if (isMobile) {\n return (\n <Drawer.Footer>\n <Box css={styles.mobileFooter}>\n {!!start && (\n <BitkitButton onClick={start.onClick} size=\"md\" variant=\"secondary\">\n {start.label}\n </BitkitButton>\n )}\n <BitkitButton onClick={onApply} size=\"md\" state={applyState}>\n {applyLabel ?? 'Apply'}\n </BitkitButton>\n </Box>\n </Drawer.Footer>\n );\n }\n\n return (\n <Box css={styles.popoverFooter}>\n <Box css={styles.popoverFooterStart}>\n {!!start && (\n <BitkitButton onClick={start.onClick} size=\"sm\" variant=\"tertiary\">\n {start.label}\n </BitkitButton>\n )}\n </Box>\n {!!onCancel && (\n <BitkitButton onClick={onCancel} size=\"sm\" variant=\"secondary\">\n Cancel\n </BitkitButton>\n )}\n <BitkitButton onClick={onApply} size=\"sm\" state={applyState}>\n Apply\n </BitkitButton>\n </Box>\n );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/C,CAAA;EACX;;AAET"}
@@ -1,15 +0,0 @@
1
- import { BoxProps } from '@chakra-ui/react/box';
2
- import { ReactElement } from 'react';
3
- export interface FilterSearchInputProps extends Omit<BoxProps, 'children' | 'defaultValue' | 'onChange'> {
4
- /** Extra hint read out with the field, e.g. what the search matches. */
5
- description?: string;
6
- label: string;
7
- onValueChange: (value: string) => void;
8
- placeholder: string;
9
- /** Wraps the input, e.g. in a tooltip. */
10
- renderInput?: (input: ReactElement) => ReactElement;
11
- value: string;
12
- }
13
- /** The borderless search field of the bar — and, on mobile, of each filter's view too. */
14
- declare const FilterSearchInput: import('react').ForwardRefExoticComponent<FilterSearchInputProps & import('react').RefAttributes<HTMLInputElement>>;
15
- export default FilterSearchInput;
@@ -1,41 +0,0 @@
1
- import IconMagnifier from "../../../icons/IconMagnifier.js";
2
- import BitkitCloseButton from "../../BitkitCloseButton/BitkitCloseButton.js";
3
- import { useFilterContext } from "../BitkitFilter.context.js";
4
- import { Box } from "@chakra-ui/react/box";
5
- import { chakra } from "@chakra-ui/react/styled-system";
6
- import { forwardRef } from "react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- //#region lib/components/BitkitFilter/components/FilterSearchInput.tsx
9
- /** The borderless search field of the bar — and, on mobile, of each filter's view too. */
10
- var FilterSearchInput = forwardRef((props, ref) => {
11
- const { css, description, label, onValueChange, placeholder, renderInput = (input) => input, value, ...rest } = props;
12
- const { isMobile, styles } = useFilterContext();
13
- return /* @__PURE__ */ jsxs(Box, {
14
- css: [isMobile ? styles.mobileSearch : styles.search, css],
15
- ...rest,
16
- children: [
17
- /* @__PURE__ */ jsx(IconMagnifier, { size: isMobile ? "24" : "16" }),
18
- renderInput(/* @__PURE__ */ jsx(chakra.input, {
19
- "aria-description": description,
20
- "aria-label": label,
21
- css: isMobile ? styles.mobileSearchInput : styles.searchInput,
22
- onChange: (event) => onValueChange(event.target.value),
23
- placeholder,
24
- ref,
25
- type: "search",
26
- value
27
- })),
28
- !!value && /* @__PURE__ */ jsx(BitkitCloseButton, {
29
- "aria-label": "Clear search",
30
- colorVariant: "neutral",
31
- onClick: () => onValueChange(""),
32
- size: "sm"
33
- })
34
- ]
35
- });
36
- });
37
- FilterSearchInput.displayName = "FilterSearchInput";
38
- //#endregion
39
- export { FilterSearchInput as default };
40
-
41
- //# sourceMappingURL=FilterSearchInput.js.map
@@ -1 +0,0 @@
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 <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 {!!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;GACE,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;GACC,CAAC,CAAC,SACD,oBAAC,mBAAD;IACE,cAAW;IACX,cAAa;IACb,eAAe,cAAc,EAAE;IAC/B,MAAK;GACN,CAAA;EAEA;;AAET,CAAC;AAED,kBAAkB,cAAc"}
@@ -1,45 +0,0 @@
1
- import { BitkitIconComponent } from '../../../icons';
2
- import { BitkitColorToken } from '../../../theme/themeUtils';
3
- export interface BitkitFilterSelectItem {
4
- /**
5
- * Lists the option under this heading, with the others of the same group. Only the open list shows
6
- * it: the chip shows the label alone, so the label has to make sense without its group.
7
- */
8
- group?: string;
9
- icon?: BitkitIconComponent;
10
- /** Colors the icon, e.g. a status: `icon/positive` for "Passed". */
11
- iconColor?: BitkitColorToken<'icon'>;
12
- label: string;
13
- /** Unique across all groups. */
14
- value: string;
15
- }
16
- /** The list renders at most this many options; search narrows down the rest. */
17
- export declare const MAX_VISIBLE_ITEMS = 100;
18
- export interface FilterSelectFormProps {
19
- /** The filter holds a value: the footer offers "Clear" instead of the wildcard-mode switch. */
20
- isEditing: boolean;
21
- /** Keeps `items` in their own order instead of listing the applied ones first — for a switch's fixed options. */
22
- isOrderFixed?: boolean;
23
- /** A value is always applied: no "Clear" in the footer. */
24
- isRequired?: boolean;
25
- items: BitkitFilterSelectItem[];
26
- label: string;
27
- loading?: boolean;
28
- loadingLabel?: string;
29
- multiple?: boolean;
30
- onApply: (value: string[]) => void;
31
- onCancel: () => void;
32
- onSearchChange?: (searchText: string) => void;
33
- pattern?: boolean;
34
- pluralLabel: string;
35
- searchPlaceholder?: string;
36
- /**
37
- * The applied selection with its labels. Without a search, any of it missing from `items` — e.g.
38
- * left behind by a server search — is listed first, so it can still be unchecked.
39
- */
40
- selectedItems?: BitkitFilterSelectItem[];
41
- value: string[];
42
- }
43
- /** The body of a select filter's panel: search, the option list or wildcard pattern, and the footer. */
44
- declare const FilterSelectForm: (props: FilterSelectFormProps) => import('react').JSX.Element;
45
- export default FilterSelectForm;
@@ -1,324 +0,0 @@
1
- import IconCheck from "../../../icons/IconCheck.js";
2
- import BitkitGroupHeading from "../../BitkitGroupHeading/BitkitGroupHeading.js";
3
- import BitkitCheckbox from "../../BitkitCheckbox/BitkitCheckbox.js";
4
- import BitkitCheckboxGroup from "../../BitkitCheckboxGroup/BitkitCheckboxGroup.js";
5
- import { compilePattern, isEqualFilterValue, isPattern, toRunningText } from "../BitkitFilter.utils.js";
6
- import { useFilterContext } from "../BitkitFilter.context.js";
7
- import { FilterPanelFooter, FilterPanelHeader } from "./FilterPanel.js";
8
- import FilterSearchInput from "./FilterSearchInput.js";
9
- import BitkitInlineLoading from "../../BitkitInlineLoading/BitkitInlineLoading.js";
10
- import BitkitList_default from "../../BitkitList/BitkitList.js";
11
- import BitkitTextInput from "../../BitkitTextInput/BitkitTextInput.js";
12
- import BitkitSearchInput from "../../BitkitSearchInput/BitkitSearchInput.js";
13
- import { Box } from "@chakra-ui/react/box";
14
- import { useSlotRecipe } from "@chakra-ui/react/styled-system";
15
- import { Fragment, useEffect, useId, useMemo, useRef, useState } from "react";
16
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
17
- import { Text } from "@chakra-ui/react/text";
18
- import { createListCollection } from "@chakra-ui/react/collection";
19
- import { HStack } from "@chakra-ui/react/stack";
20
- import { Listbox } from "@chakra-ui/react/listbox";
21
- //#region lib/components/BitkitFilter/components/FilterSelectForm.tsx
22
- /**
23
- * Gathers the options by `group`, so the list (and its keyboard order) runs group by group. The groups
24
- * keep their order in `items`, with the ungrouped options (an empty-named group) first; within a
25
- * group the options keep their order in `options`, e.g. the applied ones first.
26
- */
27
- var groupItems = (options, items) => {
28
- const groups = /* @__PURE__ */ new Map([["", []]]);
29
- [...items, ...options].forEach((item) => {
30
- if (!groups.has(item.group ?? "")) groups.set(item.group ?? "", []);
31
- });
32
- options.forEach((option) => groups.get(option.group ?? "")?.push(option));
33
- return [...groups].filter(([, groupOptions]) => groupOptions.length);
34
- };
35
- /** Below this many options the list is short enough to scan, so there is no search input. */
36
- var SEARCH_THRESHOLD = 5;
37
- /** The body of a select filter's panel: search, the option list or wildcard pattern, and the footer. */
38
- var FilterSelectForm = (props) => {
39
- const { isEditing, isOrderFixed, isRequired, items, label, loading, loadingLabel = "Loading...", multiple, onApply, onCancel, onSearchChange, pattern, pluralLabel, searchPlaceholder = "Search for options", selectedItems = [], value } = props;
40
- const { isMobile, styles } = useFilterContext();
41
- const [draft, setDraft] = useState(value);
42
- const [mode, setMode] = useState(pattern && value[0] && isPattern(value[0]) ? "pattern" : "list");
43
- const [searchText, setSearchText] = useState("");
44
- const [hasLoaded, setHasLoaded] = useState(!loading);
45
- if (!loading && !hasLoaded) setHasLoaded(true);
46
- const onSearchTextChange = (text) => {
47
- setSearchText(text);
48
- onSearchChange?.(text);
49
- };
50
- const matchingItems = useMemo(() => {
51
- if (!searchText) {
52
- if (isOrderFixed) return items;
53
- return [...value.flatMap((selected) => {
54
- return items.find((option) => option.value === selected) ?? selectedItems.find((option) => option.value === selected) ?? [];
55
- }), ...items.filter((item) => !value.includes(item.value))];
56
- }
57
- if (onSearchChange) return items;
58
- const query = searchText.toLowerCase();
59
- return items.filter((item) => item.label.toLowerCase().includes(query));
60
- }, [
61
- isOrderFixed,
62
- items,
63
- onSearchChange,
64
- searchText,
65
- selectedItems,
66
- value
67
- ]);
68
- const visibleGroups = useMemo(() => groupItems(matchingItems.slice(0, 100), items), [items, matchingItems]);
69
- const visibleItems = visibleGroups.flatMap(([, groupItems]) => groupItems);
70
- const isInitialLoading = !!loading && !hasLoaded;
71
- const showSearch = !isInitialLoading && (!!onSearchChange || items.length > SEARCH_THRESHOLD);
72
- const searchLabel = `Search ${toRunningText(pluralLabel)}`;
73
- const showLimitHelper = matchingItems.length > 100;
74
- const patternValue = draft[0] ?? "";
75
- const isApplyDisabled = isEqualFilterValue(draft, value) || mode === "pattern" && !(patternValue && isPattern(patternValue)) || !!isRequired && !draft.length;
76
- const bodyRef = useRef(null);
77
- const hasSwitchedMode = useRef(false);
78
- useEffect(() => {
79
- if (!hasSwitchedMode.current) return;
80
- bodyRef.current?.querySelector("input:not([type=hidden]), [role=listbox], input[type=checkbox]")?.focus();
81
- }, [mode]);
82
- let start;
83
- if (isEditing && !isRequired) start = {
84
- label: multiple && isMobile ? "Clear all" : "Clear",
85
- onClick: () => onApply([])
86
- };
87
- else if (pattern && !isEditing) start = {
88
- label: mode === "list" ? "Use wildcard pattern" : "Select from list",
89
- onClick: () => {
90
- hasSwitchedMode.current = true;
91
- setMode(mode === "list" ? "pattern" : "list");
92
- setDraft([]);
93
- }
94
- };
95
- let list;
96
- if (loading) list = /* @__PURE__ */ jsx(BitkitInlineLoading, {
97
- css: styles.loading,
98
- label: loadingLabel,
99
- size: isMobile ? "lg" : "md"
100
- });
101
- else if (!visibleItems.length) list = /* @__PURE__ */ jsx(Text, {
102
- css: styles.loading,
103
- color: "text/secondary",
104
- textStyle: isMobile ? "body/lg/regular" : "body/md/regular",
105
- children: searchText ? "No result. Refine your search term." : "No options available."
106
- });
107
- else if (multiple && !isMobile) list = /* @__PURE__ */ jsxs(Box, {
108
- css: styles.checkboxList,
109
- children: [/* @__PURE__ */ jsx(BitkitCheckboxGroup, {
110
- "aria-label": label,
111
- onValueChange: setDraft,
112
- size: "md",
113
- value: draft,
114
- children: visibleGroups.map(([group, groupItems]) => {
115
- const checkboxes = groupItems.map((item) => /* @__PURE__ */ jsx(BitkitCheckbox, {
116
- labelText: item.icon ? /* @__PURE__ */ jsxs(HStack, {
117
- gap: "4",
118
- children: [/* @__PURE__ */ jsx(item.icon, {
119
- color: item.iconColor,
120
- size: "16"
121
- }), item.label]
122
- }) : item.label,
123
- value: item.value
124
- }, item.value));
125
- return group ? /* @__PURE__ */ jsx(CheckboxOptionGroup, {
126
- label: group,
127
- children: checkboxes
128
- }, group) : /* @__PURE__ */ jsx(Fragment, { children: checkboxes }, group);
129
- })
130
- }), showLimitHelper && /* @__PURE__ */ jsx(LimitHelper, { marginBlockStart: "16" })]
131
- });
132
- else list = /* @__PURE__ */ jsx(FilterListbox, {
133
- groups: visibleGroups,
134
- items: visibleItems,
135
- label,
136
- multiple,
137
- onValueChange: setDraft,
138
- showLimitHelper,
139
- value: draft
140
- });
141
- let search = null;
142
- if (showSearch && isMobile) search = /* @__PURE__ */ jsx(FilterSearchInput, {
143
- label: searchLabel,
144
- onValueChange: onSearchTextChange,
145
- placeholder: searchPlaceholder,
146
- value: searchText
147
- });
148
- else if (showSearch) search = /* @__PURE__ */ jsx(Box, {
149
- css: styles.popoverSearch,
150
- children: /* @__PURE__ */ jsx(BitkitSearchInput, {
151
- label: searchLabel,
152
- onChange: onSearchTextChange,
153
- placeholder: searchPlaceholder,
154
- size: "md",
155
- value: searchText
156
- })
157
- });
158
- const body = /* @__PURE__ */ jsx(Box, {
159
- css: styles.popoverBody,
160
- ref: bodyRef,
161
- children: mode === "pattern" ? /* @__PURE__ */ jsx(FilterPatternBody, {
162
- items,
163
- onValueChange: setDraft,
164
- pluralLabel,
165
- value: patternValue
166
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [search, list] })
167
- });
168
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
169
- /* @__PURE__ */ jsx(FilterPanelHeader, {
170
- count: multiple && mode === "list" ? draft.length : void 0,
171
- title: multiple ? pluralLabel : label
172
- }),
173
- isMobile ? /* @__PURE__ */ jsx(Box, {
174
- flex: "1",
175
- overflowY: "auto",
176
- children: body
177
- }) : body,
178
- !isInitialLoading && /* @__PURE__ */ jsx(FilterPanelFooter, {
179
- applyLabel: multiple && mode === "list" && draft.length ? `Apply (${draft.length})` : void 0,
180
- isApplyDisabled,
181
- onApply: () => onApply(mode === "pattern" ? [patternValue] : draft),
182
- onCancel,
183
- start
184
- })
185
- ] });
186
- };
187
- /** A named group of the desktop checkboxes, so a screen reader tells which group an option is in. */
188
- var CheckboxOptionGroup = ({ children, label }) => {
189
- const headingId = useId();
190
- return /* @__PURE__ */ jsxs(Box, {
191
- "aria-labelledby": headingId,
192
- role: "group",
193
- children: [/* @__PURE__ */ jsx(BitkitGroupHeading, {
194
- id: headingId,
195
- label,
196
- paddingBlockStart: "12",
197
- paddingInline: "4"
198
- }), children]
199
- });
200
- };
201
- var LimitHelper = ({ marginBlockStart }) => {
202
- const { styles } = useFilterContext();
203
- return /* @__PURE__ */ jsxs(Text, {
204
- css: styles.listHelperText,
205
- marginBlockStart,
206
- children: [
207
- "Showing the first ",
208
- 100,
209
- " options. Search to find more."
210
- ]
211
- });
212
- };
213
- /**
214
- * The option list for a single select, and on mobile for a multiple one too — there the rows are
215
- * full-width and highlighted when selected, with a checkbox drawn in front.
216
- */
217
- var FilterListbox = (props) => {
218
- const { groups, items, label, multiple, onValueChange, showLimitHelper, value } = props;
219
- const { isMobile, styles } = useFilterContext();
220
- const collection = useMemo(() => createListCollection({ items }), [items]);
221
- const checkboxStyles = useSlotRecipe({ key: "checkbox" })({ size: "lg" });
222
- const checkIndicator = /* @__PURE__ */ jsx(Listbox.ItemIndicator, { children: /* @__PURE__ */ jsx(IconCheck, { size: "16" }) });
223
- const renderItem = (item) => {
224
- const state = value.includes(item.value) ? "checked" : "unchecked";
225
- const check = multiple ? /* @__PURE__ */ jsx(Box, {
226
- "aria-hidden": true,
227
- css: [checkboxStyles.control, styles.mobileListCheckbox],
228
- "data-state": state,
229
- children: /* @__PURE__ */ jsx(IconCheck, {})
230
- }) : /* @__PURE__ */ jsx(Box, {
231
- "aria-hidden": true,
232
- css: styles.mobileListCheck,
233
- "data-state": state,
234
- children: /* @__PURE__ */ jsx(IconCheck, { size: "16" })
235
- });
236
- return /* @__PURE__ */ jsxs(Listbox.Item, {
237
- item,
238
- children: [
239
- isMobile && check,
240
- !!item.icon && /* @__PURE__ */ jsx(item.icon, {
241
- color: item.iconColor,
242
- size: isMobile ? "24" : "16"
243
- }),
244
- /* @__PURE__ */ jsx(Listbox.ItemText, { children: item.label }),
245
- !isMobile && checkIndicator
246
- ]
247
- }, item.value);
248
- };
249
- return /* @__PURE__ */ jsxs(Listbox.Root, {
250
- collection,
251
- onValueChange: (details) => onValueChange(details.value),
252
- selectionMode: multiple ? "multiple" : "single",
253
- size: isMobile ? "lg" : "md",
254
- value,
255
- children: [/* @__PURE__ */ jsx(Listbox.Label, {
256
- srOnly: true,
257
- children: label
258
- }), /* @__PURE__ */ jsxs(Listbox.Content, { children: [groups.map(([group, groupItems]) => group ? /* @__PURE__ */ jsxs(Listbox.ItemGroup, { children: [/* @__PURE__ */ jsx(Listbox.ItemGroupLabel, {
259
- asChild: true,
260
- children: /* @__PURE__ */ jsx(BitkitGroupHeading, {
261
- label: group,
262
- paddingBlockStart: "12",
263
- paddingInline: "24"
264
- })
265
- }), groupItems.map(renderItem)] }, group) : groupItems.map(renderItem)), showLimitHelper && /* @__PURE__ */ jsx(Box, {
266
- paddingBlockStart: "8",
267
- paddingInline: "24",
268
- children: /* @__PURE__ */ jsx(LimitHelper, {})
269
- })] })]
270
- });
271
- };
272
- var FilterPatternBody = ({ items, onValueChange, pluralLabel, value }) => {
273
- const { isMobile, styles } = useFilterContext();
274
- const noun = toRunningText(pluralLabel);
275
- const matches = useMemo(() => {
276
- if (!isPattern(value)) return null;
277
- const regExp = compilePattern(value);
278
- return items.filter((item) => !isPattern(item.label) && regExp.test(item.label));
279
- }, [items, value]);
280
- let results;
281
- if (!matches) results = /* @__PURE__ */ jsxs(Text, {
282
- color: "text/secondary",
283
- textStyle: "body/md/regular",
284
- children: [
285
- "Enter a pattern with the wildcard ‘*’ to view ",
286
- noun,
287
- " with matching names."
288
- ]
289
- });
290
- else if (!matches.length) results = /* @__PURE__ */ jsxs(Text, {
291
- color: "text/tertiary",
292
- textStyle: "body/md/regular",
293
- children: [
294
- "(no matching ",
295
- noun,
296
- ")"
297
- ]
298
- });
299
- else results = /* @__PURE__ */ jsx(BitkitList_default, {
300
- size: "md",
301
- children: matches.map((item) => /* @__PURE__ */ jsx(BitkitList_default.Item, { children: item.label }, item.value))
302
- });
303
- return /* @__PURE__ */ jsxs(Box, {
304
- css: styles.pattern,
305
- children: [/* @__PURE__ */ jsx(BitkitTextInput, {
306
- helperText: "Allowed wildcard character: *",
307
- label: "Wildcard pattern",
308
- onValueChange: (text) => onValueChange(text ? [text] : []),
309
- placeholder: "(e.g. *main*, release-*)",
310
- size: isMobile ? "lg" : "md",
311
- value
312
- }), /* @__PURE__ */ jsxs(Box, {
313
- css: styles.patternResults,
314
- children: [/* @__PURE__ */ jsxs(Text, {
315
- css: styles.patternResultsLabel,
316
- children: ["Matching results", matches?.length ? ` (${matches.length})` : ""]
317
- }), results]
318
- })]
319
- });
320
- };
321
- //#endregion
322
- export { FilterSelectForm as default };
323
-
324
- //# sourceMappingURL=FilterSelectForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FilterSelectForm.js","names":["_Fragment","BitkitList"],"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, type ReactNode, useEffect, useId, 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 /**\n * Lists the option under this heading, with the others of the same group. Only the open list shows\n * it: the chip shows the label alone, so the label has to make sense without its group.\n */\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 /** Unique across all groups. */\n value: string;\n}\n\n/**\n * Gathers the options by `group`, so the list (and its keyboard order) runs group by group. The groups\n * keep their order in `items`, with the ungrouped options (an empty-named group) first; within a\n * group the options keep their order in `options`, e.g. the applied ones first.\n */\nconst groupItems = (options: BitkitFilterSelectItem[], items: BitkitFilterSelectItem[]) => {\n const groups = new Map<string, BitkitFilterSelectItem[]>([['', []]]);\n [...items, ...options].forEach((item) => {\n if (!groups.has(item.group ?? '')) groups.set(item.group ?? '', []);\n });\n options.forEach((option) => groups.get(option.group ?? '')?.push(option));\n return [...groups].filter(([, groupOptions]) => groupOptions.length);\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(\n () => groupItems(matchingItems.slice(0, MAX_VISIBLE_ITEMS), items),\n [items, matchingItems],\n );\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 const checkboxes = 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 return group ? (\n <CheckboxOptionGroup key={group} label={group}>\n {checkboxes}\n </CheckboxOptionGroup>\n ) : (\n <Fragment key={group}>{checkboxes}</Fragment>\n );\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\n/** A named group of the desktop checkboxes, so a screen reader tells which group an option is in. */\nconst CheckboxOptionGroup = ({ children, label }: { children: ReactNode; label: string }) => {\n const headingId = useId();\n\n return (\n <Box aria-labelledby={headingId} role=\"group\">\n {/* The list pads 20; the heading lines up 24 from the popover's edge, like the listbox's. */}\n <BitkitGroupHeading id={headingId} label={label} paddingBlockStart=\"12\" paddingInline=\"4\" />\n {children}\n </Box>\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 {/* Ungrouped options sit straight in the list: a group around them would have no name. */}\n {groups.map(([group, groupItems]) =>\n group ? (\n <Listbox.ItemGroup key={group}>\n <Listbox.ItemGroupLabel asChild>\n <BitkitGroupHeading label={group} paddingBlockStart=\"12\" paddingInline=\"24\" />\n </Listbox.ItemGroupLabel>\n {groupItems.map(renderItem)}\n </Listbox.ItemGroup>\n ) : (\n groupItems.map(renderItem)\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAM,cAAc,SAAmC,UAAoC;CACzF,MAAM,yBAAS,IAAI,IAAsC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnE,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,SAAS,SAAS;EACvC,IAAI,CAAC,OAAO,IAAI,KAAK,SAAS,EAAE,GAAG,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC;CACpE,CAAC;CACD,QAAQ,SAAS,WAAW,OAAO,IAAI,OAAO,SAAS,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC;CACx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