@trycompai/design-system 1.0.27 → 1.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycompai/design-system",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "Design system for Comp AI - shadcn-style components with Tailwind CSS",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -5,7 +5,6 @@ import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
5
5
  import { Combobox as ComboboxPrimitive } from '@base-ui/react';
6
6
  import { Checkmark, ChevronDown, Search } from '@carbon/icons-react';
7
7
  import * as React from 'react';
8
-
9
8
  // ============================================================================
10
9
  // Types
11
10
  // ============================================================================
@@ -54,6 +53,12 @@ export interface OrganizationSelectorProps {
54
53
  hotkey?: string | null;
55
54
  /** Whether to open as a full-screen modal (like Cmd+K) instead of dropdown */
56
55
  modal?: boolean;
56
+ /** Optional footer content rendered below the list (e.g., create org action) */
57
+ footer?: React.ReactNode;
58
+ /** Optional label for a create action rendered as the final list item */
59
+ createLabel?: string;
60
+ /** Callback when create action is selected */
61
+ onCreate?: () => void;
57
62
  }
58
63
 
59
64
  // ============================================================================
@@ -124,6 +129,9 @@ function OrganizationSelector({
124
129
  maxWidth = '150px',
125
130
  hotkey = 'o',
126
131
  modal = false,
132
+ footer,
133
+ createLabel = 'Create organization',
134
+ onCreate,
127
135
  }: OrganizationSelectorProps) {
128
136
  const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');
129
137
  const [searchQuery, setSearchQuery] = React.useState('');
@@ -295,6 +303,28 @@ function OrganizationSelector({
295
303
  </CommandPrimitive.Group>
296
304
  )}
297
305
  </CommandPrimitive.List>
306
+ {(footer || onCreate) && (
307
+ <div
308
+ data-slot="organization-selector-footer"
309
+ className="border-t border-border p-2"
310
+ >
311
+ {footer ?? (
312
+ <button
313
+ type="button"
314
+ disabled={disabled || loading}
315
+ onClick={() => {
316
+ onCreate?.();
317
+ setSearchQuery('');
318
+ setOpen(false);
319
+ }}
320
+ className="hover:bg-accent hover:text-foreground w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50"
321
+ >
322
+ <span className="mr-1 text-base leading-none">+</span>
323
+ {createLabel}
324
+ </button>
325
+ )}
326
+ </div>
327
+ )}
298
328
  </CommandPrimitive>
299
329
  </DialogPrimitive.Popup>
300
330
  </DialogPrimitive.Portal>
@@ -365,7 +395,7 @@ function OrganizationSelector({
365
395
  key={org.id}
366
396
  data-slot="organization-selector-item"
367
397
  value={org.id}
368
- className="data-highlighted:bg-accent data-highlighted:text-accent-foreground gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
398
+ className="data-highlighted:bg-accent data-highlighted:text-accent-foreground gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50"
369
399
  >
370
400
  <OrganizationItemContent org={org} />
371
401
  <ComboboxPrimitive.ItemIndicator
@@ -379,6 +409,28 @@ function OrganizationSelector({
379
409
  ))
380
410
  )}
381
411
  </ComboboxPrimitive.List>
412
+ {(footer || onCreate) && (
413
+ <div
414
+ data-slot="organization-selector-footer"
415
+ className="border-t border-border p-2"
416
+ >
417
+ {footer ?? (
418
+ <button
419
+ type="button"
420
+ disabled={disabled || loading}
421
+ onClick={() => {
422
+ onCreate?.();
423
+ setSearchQuery('');
424
+ triggerRef.current?.click();
425
+ }}
426
+ className="hover:bg-accent hover:text-foreground w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50"
427
+ >
428
+ <span className="mr-1 text-base leading-none">+</span>
429
+ {createLabel}
430
+ </button>
431
+ )}
432
+ </div>
433
+ )}
382
434
  </ComboboxPrimitive.Popup>
383
435
  </ComboboxPrimitive.Positioner>
384
436
  </ComboboxPrimitive.Portal>