@erxes/ui 3.2.25-1 → 3.2.25-2

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.
@@ -18,6 +18,14 @@ export declare const ComboboxContent: React.ForwardRefExoticComponent<Omit<Omit<
18
18
  export declare const ComboboxCheck: React.ForwardRefExoticComponent<Omit<import("@tabler/icons-react").IconProps & React.RefAttributes<import("@tabler/icons-react").Icon>, "ref"> & {
19
19
  checked?: boolean;
20
20
  } & React.RefAttributes<import("@tabler/icons-react").Icon>>;
21
+ export declare const ComboboxChipTrigger: ({ label, children, className, disabled, onClear, clearLabel, }: {
22
+ label?: string;
23
+ children: React.ReactNode;
24
+ className?: string;
25
+ disabled?: boolean;
26
+ onClear?: () => void;
27
+ clearLabel?: string;
28
+ }) => import("react/jsx-runtime").JSX.Element;
21
29
  export declare const ComboboxFetchMore: React.ForwardRefExoticComponent<Omit<Omit<{
22
30
  children?: React.ReactNode;
23
31
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
@@ -53,6 +61,14 @@ export declare const Combobox: {
53
61
  Check: React.ForwardRefExoticComponent<Omit<import("@tabler/icons-react").IconProps & React.RefAttributes<import("@tabler/icons-react").Icon>, "ref"> & {
54
62
  checked?: boolean;
55
63
  } & React.RefAttributes<import("@tabler/icons-react").Icon>>;
64
+ ChipTrigger: ({ label, children, className, disabled, onClear, clearLabel, }: {
65
+ label?: string;
66
+ children: React.ReactNode;
67
+ className?: string;
68
+ disabled?: boolean;
69
+ onClear?: () => void;
70
+ clearLabel?: string;
71
+ }) => import("react/jsx-runtime").JSX.Element;
56
72
  FetchMore: React.ForwardRefExoticComponent<Omit<Omit<{
57
73
  children?: React.ReactNode;
58
74
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erxes/ui",
3
- "version": "3.2.25-1",
3
+ "version": "3.2.25-2",
4
4
  "description": "erxes design system: UI primitives, business modules, hooks and shared frontend state",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Button } from './button';
3
3
  import { cn } from '../lib/utils';
4
- import { IconCheck, IconChevronDown } from '@tabler/icons-react';
4
+ import { IconCheck, IconChevronDown, IconX } from '@tabler/icons-react';
5
5
  import { Popover } from './popover';
6
6
  import { Command } from './command';
7
7
  import { useInView } from 'react-intersection-observer';
@@ -139,6 +139,72 @@ export const ComboboxCheck = React.forwardRef<
139
139
 
140
140
  ComboboxCheck.displayName = 'ComboboxCheck';
141
141
 
142
+ export const ComboboxChipTrigger = ({
143
+ label,
144
+ children,
145
+ className,
146
+ disabled,
147
+ onClear,
148
+ clearLabel,
149
+ }: {
150
+ label?: string;
151
+ children: React.ReactNode;
152
+ className?: string;
153
+ disabled?: boolean;
154
+ onClear?: () => void;
155
+ clearLabel?: string;
156
+ }) => {
157
+ const trigger = (
158
+ <ComboboxTriggerBase
159
+ className={cn(
160
+ 'group w-fit max-w-sm h-7 rounded p-0 gap-0 overflow-hidden',
161
+ 'data-[state=open]:border-primary/40',
162
+ className,
163
+ )}
164
+ disabled={disabled}
165
+ >
166
+ {label && (
167
+ <span className="flex h-full shrink-0 items-center whitespace-nowrap px-3 text-muted-foreground bg-muted/40 border-r">
168
+ {label}
169
+ </span>
170
+ )}
171
+ <span className="flex min-w-0 items-center gap-1.5 pl-3 pr-2.5 font-medium text-foreground">
172
+ <span className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap [&_svg]:size-4 [&_svg]:shrink-0">
173
+ {children}
174
+ </span>
175
+ {onClear ? (
176
+ <span className="size-5 shrink-0" />
177
+ ) : (
178
+ <IconChevronDown className="size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
179
+ )}
180
+ </span>
181
+ </ComboboxTriggerBase>
182
+ );
183
+
184
+ if (!onClear) {
185
+ return trigger;
186
+ }
187
+
188
+ return (
189
+ <div className="relative w-fit max-w-sm">
190
+ {trigger}
191
+ <Button
192
+ variant="ghost"
193
+ size="icon"
194
+ aria-label={clearLabel}
195
+ title={clearLabel}
196
+ className="absolute right-2 top-1/2 size-5 -translate-y-1/2 p-0 text-muted-foreground"
197
+ onClick={(e) => {
198
+ e.stopPropagation();
199
+ onClear();
200
+ }}
201
+ >
202
+ <IconX />
203
+ </Button>
204
+ </div>
205
+ );
206
+ };
207
+
142
208
  export const ComboboxFetchMore = React.forwardRef<
143
209
  React.ElementRef<typeof Command.Item>,
144
210
  React.ComponentPropsWithoutRef<typeof Command.Item> & {
@@ -207,6 +273,7 @@ export const Combobox = {
207
273
  Value: ComboboxValue,
208
274
  Content: ComboboxContent,
209
275
  Check: ComboboxCheck,
276
+ ChipTrigger: ComboboxChipTrigger,
210
277
  FetchMore: ComboboxFetchMore,
211
278
  Empty: ComboboxEmpty,
212
279
  };