@inbeat/ui 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.10.0...ui-v0.11.0) (2026-10-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * **ui:** custom trigger label and full list props on multi-select ([#52](https://github.com/Genoux/ib-toolkit/issues/52)) ([072c6bd](https://github.com/Genoux/ib-toolkit/commit/072c6bdf10201136e15379c699a804cc0b4e15e6))
9
+
3
10
  ## [0.10.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.9.4...ui-v0.10.0) (2026-10-08)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inbeat/ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "inBeat design tokens and primitives (Radix + Tailwind v4), shipped as source",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -64,7 +64,7 @@
64
64
  "@base-ui/react": "^1.2.0",
65
65
  "@fontsource-variable/geist": "^5.3.0",
66
66
  "@fontsource-variable/geist-mono": "^5.3.0",
67
- "@inbeat/config": "^0.10.0",
67
+ "@inbeat/config": "^0.11.0",
68
68
  "@storybook/addon-a11y": "^10.6.0",
69
69
  "@storybook/addon-docs": "^10.6.0",
70
70
  "@storybook/addon-themes": "^10.6.0",
@@ -6,7 +6,7 @@ import { SearchInput } from "./search-input";
6
6
  import { selectTriggerClassName } from "./select";
7
7
  import { Spinner } from "./spinner";
8
8
  import { ChevronDownIcon } from "lucide-react";
9
- import { useMemo, useState } from "react";
9
+ import { type ReactNode, useMemo, useState } from "react";
10
10
  import { cn } from "../lib/utils";
11
11
  import { PersonAvatar } from "./person-identity";
12
12
 
@@ -50,6 +50,19 @@ export function getMultiSelectLabel({
50
50
  return `${placeholder} (${selectedValues.length})`;
51
51
  }
52
52
 
53
+ export type MultiSelectOptionListProps = {
54
+ options: MultiSelectOption[];
55
+ selectedValues: string[];
56
+ onToggle: (value: string) => void;
57
+ disabled?: boolean;
58
+ emptyMessage?: string;
59
+ isPending?: boolean;
60
+ keepOpenOnToggle?: boolean;
61
+ idPrefix?: string;
62
+ searchable?: boolean;
63
+ searchPlaceholder?: string;
64
+ };
65
+
53
66
  export function MultiSelectOptionList({
54
67
  options,
55
68
  selectedValues,
@@ -61,18 +74,7 @@ export function MultiSelectOptionList({
61
74
  idPrefix = "multi-select-option",
62
75
  searchable,
63
76
  searchPlaceholder = "Search…",
64
- }: {
65
- options: MultiSelectOption[];
66
- selectedValues: string[];
67
- onToggle: (value: string) => void;
68
- disabled?: boolean;
69
- emptyMessage?: string;
70
- isPending?: boolean;
71
- keepOpenOnToggle?: boolean;
72
- idPrefix?: string;
73
- searchable?: boolean;
74
- searchPlaceholder?: string;
75
- }) {
77
+ }: MultiSelectOptionListProps) {
76
78
  const [query, setQuery] = useState("");
77
79
  const visibleOptions = useMemo(() => {
78
80
  const q = query.trim().toLowerCase();
@@ -144,27 +146,24 @@ export function MultiSelectOptionList({
144
146
 
145
147
  export function MultiSelectPopover({
146
148
  placeholder,
147
- selectedValues,
148
- options,
149
149
  onChange,
150
+ renderLabel,
150
151
  triggerClassName = "min-w-36 w-44 max-w-44",
151
152
  contentClassName = "w-72 overflow-hidden",
152
- emptyMessage,
153
- disabled,
154
- idPrefix,
155
- }: {
153
+ ...listProps
154
+ }: Omit<MultiSelectOptionListProps, "onToggle"> & {
156
155
  placeholder: string;
157
- selectedValues: string[];
158
- options: MultiSelectOption[];
159
156
  onChange: (values: string[]) => void;
157
+ renderLabel?: (selectedOptions: MultiSelectOption[]) => ReactNode;
160
158
  triggerClassName?: string;
161
159
  contentClassName?: string;
162
- emptyMessage?: string;
163
- disabled?: boolean;
164
- idPrefix?: string;
165
160
  }) {
161
+ const { options, selectedValues, disabled } = listProps;
166
162
  const isActive = selectedValues.length > 0;
167
- const triggerLabel = getMultiSelectLabel({ placeholder, selectedValues, options });
163
+ const triggerLabel =
164
+ isActive && renderLabel
165
+ ? renderLabel(options.filter((option) => selectedValues.includes(option.value)))
166
+ : getMultiSelectLabel({ placeholder, selectedValues, options });
168
167
 
169
168
  return (
170
169
  <Popover modal={false}>
@@ -191,12 +190,8 @@ export function MultiSelectPopover({
191
190
  onWheel={(event) => event.stopPropagation()}
192
191
  >
193
192
  <MultiSelectOptionList
194
- options={options}
195
- selectedValues={selectedValues}
193
+ {...listProps}
196
194
  onToggle={(value) => onChange(toggleMultiSelectValue(selectedValues, value))}
197
- disabled={disabled}
198
- emptyMessage={emptyMessage}
199
- idPrefix={idPrefix}
200
195
  />
201
196
  </PopoverContent>
202
197
  </Popover>