@inbeat/ui 0.9.4 → 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,19 @@
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
+
10
+ ## [0.10.0](https://github.com/Genoux/ib-toolkit/compare/ui-v0.9.4...ui-v0.10.0) (2026-10-08)
11
+
12
+
13
+ ### Features
14
+
15
+ * **ui:** disable single multi-select options ([#50](https://github.com/Genoux/ib-toolkit/issues/50)) ([5be0d19](https://github.com/Genoux/ib-toolkit/commit/5be0d1918dab26cd08b2f46b7a26067bfe5cc9f4))
16
+
3
17
  ## [0.9.4](https://github.com/Genoux/ib-toolkit/compare/ui-v0.9.3...ui-v0.9.4) (2026-10-08)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inbeat/ui",
3
- "version": "0.9.4",
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.9.4",
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
 
@@ -16,6 +16,7 @@ export type MultiSelectOption = {
16
16
  value: string;
17
17
  label: string;
18
18
  imageUrl?: string | null;
19
+ disabled?: boolean;
19
20
  };
20
21
 
21
22
  function truncateText(value: string, maxLength: number): string {
@@ -49,6 +50,19 @@ export function getMultiSelectLabel({
49
50
  return `${placeholder} (${selectedValues.length})`;
50
51
  }
51
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
+
52
66
  export function MultiSelectOptionList({
53
67
  options,
54
68
  selectedValues,
@@ -60,18 +74,7 @@ export function MultiSelectOptionList({
60
74
  idPrefix = "multi-select-option",
61
75
  searchable,
62
76
  searchPlaceholder = "Search…",
63
- }: {
64
- options: MultiSelectOption[];
65
- selectedValues: string[];
66
- onToggle: (value: string) => void;
67
- disabled?: boolean;
68
- emptyMessage?: string;
69
- isPending?: boolean;
70
- keepOpenOnToggle?: boolean;
71
- idPrefix?: string;
72
- searchable?: boolean;
73
- searchPlaceholder?: string;
74
- }) {
77
+ }: MultiSelectOptionListProps) {
75
78
  const [query, setQuery] = useState("");
76
79
  const visibleOptions = useMemo(() => {
77
80
  const q = query.trim().toLowerCase();
@@ -106,6 +109,7 @@ export function MultiSelectOptionList({
106
109
  {visibleOptions.map((option) => {
107
110
  const checked = selectedValues.includes(option.value);
108
111
  const rowId = `${idPrefix}-${option.value}`;
112
+ const isDisabled = disabled || option.disabled;
109
113
  return (
110
114
  <label
111
115
  key={option.value}
@@ -114,14 +118,14 @@ export function MultiSelectOptionList({
114
118
  className={cn(
115
119
  "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm",
116
120
  "hover:bg-muted/80 has-focus-visible:ring-2 has-focus-visible:ring-ring",
117
- disabled && "pointer-events-none opacity-50",
121
+ isDisabled && "pointer-events-none opacity-50",
118
122
  )}
119
123
  >
120
124
  <Checkbox
121
125
  id={rowId}
122
126
  checked={checked}
123
- disabled={disabled}
124
- onCheckedChange={disabled ? undefined : () => onToggle(option.value)}
127
+ disabled={isDisabled}
128
+ onCheckedChange={isDisabled ? undefined : () => onToggle(option.value)}
125
129
  />
126
130
  {option.imageUrl !== undefined ? (
127
131
  <PersonAvatar imageUrl={option.imageUrl} name={option.label} />
@@ -142,27 +146,24 @@ export function MultiSelectOptionList({
142
146
 
143
147
  export function MultiSelectPopover({
144
148
  placeholder,
145
- selectedValues,
146
- options,
147
149
  onChange,
150
+ renderLabel,
148
151
  triggerClassName = "min-w-36 w-44 max-w-44",
149
152
  contentClassName = "w-72 overflow-hidden",
150
- emptyMessage,
151
- disabled,
152
- idPrefix,
153
- }: {
153
+ ...listProps
154
+ }: Omit<MultiSelectOptionListProps, "onToggle"> & {
154
155
  placeholder: string;
155
- selectedValues: string[];
156
- options: MultiSelectOption[];
157
156
  onChange: (values: string[]) => void;
157
+ renderLabel?: (selectedOptions: MultiSelectOption[]) => ReactNode;
158
158
  triggerClassName?: string;
159
159
  contentClassName?: string;
160
- emptyMessage?: string;
161
- disabled?: boolean;
162
- idPrefix?: string;
163
160
  }) {
161
+ const { options, selectedValues, disabled } = listProps;
164
162
  const isActive = selectedValues.length > 0;
165
- 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 });
166
167
 
167
168
  return (
168
169
  <Popover modal={false}>
@@ -189,12 +190,8 @@ export function MultiSelectPopover({
189
190
  onWheel={(event) => event.stopPropagation()}
190
191
  >
191
192
  <MultiSelectOptionList
192
- options={options}
193
- selectedValues={selectedValues}
193
+ {...listProps}
194
194
  onToggle={(value) => onChange(toggleMultiSelectValue(selectedValues, value))}
195
- disabled={disabled}
196
- emptyMessage={emptyMessage}
197
- idPrefix={idPrefix}
198
195
  />
199
196
  </PopoverContent>
200
197
  </Popover>