@scaleflex/ui-tw 0.0.153 → 0.0.155
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/combobox/combobox.component.js +4 -8
- package/combobox/combobox.types.d.ts +0 -1
- package/command/command.component.d.ts +2 -2
- package/command/command.component.js +21 -25
- package/command/command.utils.d.ts +0 -2
- package/command/command.utils.js +0 -5
- package/dropdown-menu/dropdown-menu.component.d.ts +1 -1
- package/dropdown-menu/dropdown-menu.component.js +10 -4
- package/dropdown-menu/dropdown-menu.constants.d.ts +3 -3
- package/dropdown-menu/dropdown-menu.constants.js +1 -1
- package/input-tags/input-tags.component.js +4 -10
- package/package.json +2 -2
- package/truncated-text/index.d.ts +2 -0
- package/truncated-text/index.js +1 -0
- package/truncated-text/truncated-text.component.d.ts +4 -0
- package/truncated-text/truncated-text.component.js +40 -0
- package/truncated-text/truncated-text.constants.d.ts +1 -0
- package/truncated-text/truncated-text.constants.js +1 -0
- package/truncated-text/truncated-text.types.d.ts +7 -0
- package/truncated-text/truncated-text.types.js +1 -0
- package/truncated-text/truncated-text.utils.d.ts +1 -0
- package/truncated-text/truncated-text.utils.js +4 -0
- package/utils/copy-to-clipboard.js +23 -22
|
@@ -264,8 +264,7 @@ export function ComboboxContent(_ref4) {
|
|
|
264
264
|
selectedValue: selectedValue,
|
|
265
265
|
onSelect: function onSelect() {
|
|
266
266
|
return _onSelect(value);
|
|
267
|
-
}
|
|
268
|
-
labelTooltip: resolvedOptionLabel && typeof resolvedLabel === 'string' ? resolvedLabel : undefined
|
|
267
|
+
}
|
|
269
268
|
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel);
|
|
270
269
|
}), showGroupSeparator && groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
|
|
271
270
|
}
|
|
@@ -285,8 +284,7 @@ export function ComboboxContent(_ref4) {
|
|
|
285
284
|
selectedValue: selectedValue,
|
|
286
285
|
onSelect: function onSelect() {
|
|
287
286
|
return _onSelect(option.value);
|
|
288
|
-
}
|
|
289
|
-
labelTooltip: resolvedOptionLabel && typeof resolvedLabel === 'string' ? resolvedLabel : undefined
|
|
287
|
+
}
|
|
290
288
|
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel));
|
|
291
289
|
}), !fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
292
290
|
actions: actions
|
|
@@ -361,8 +359,7 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
361
359
|
selectedValue: selectedValue,
|
|
362
360
|
onSelect: function onSelect() {
|
|
363
361
|
return _onSelect2(value);
|
|
364
|
-
}
|
|
365
|
-
labelTooltip: resolvedOptionLabel && typeof resolvedLabel === 'string' ? resolvedLabel : undefined
|
|
362
|
+
}
|
|
366
363
|
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel);
|
|
367
364
|
}), showGroupSeparator && groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
|
|
368
365
|
}
|
|
@@ -381,8 +378,7 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
381
378
|
selectedValue: selectedValue,
|
|
382
379
|
onSelect: function onSelect() {
|
|
383
380
|
return _onSelect2(option.value);
|
|
384
|
-
}
|
|
385
|
-
labelTooltip: resolvedOptionLabel && typeof resolvedLabel === 'string' ? resolvedLabel : undefined
|
|
381
|
+
}
|
|
386
382
|
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel));
|
|
387
383
|
}), !fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
388
384
|
actions: actions
|
|
@@ -71,7 +71,6 @@ export interface CommandItemProps extends ComponentProps<typeof CommandPrimitive
|
|
|
71
71
|
multiple?: boolean;
|
|
72
72
|
iconClassName?: string;
|
|
73
73
|
textClassName?: string;
|
|
74
|
-
labelTooltip?: string;
|
|
75
74
|
}
|
|
76
75
|
export interface CommandUserItemProps extends Omit<CommandItemProps, 'icon' | 'children' | 'tooltip' | 'disabledTooltip'> {
|
|
77
76
|
name: ReactElement | string | (() => ReactElement);
|
|
@@ -14,8 +14,8 @@ declare function CommandList({ className, ...props }: ComponentProps<typeof Comm
|
|
|
14
14
|
declare function CommandEmpty({ className, ...rest }: ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
15
15
|
declare function CommandGroup({ className, size, ...props }: CommandGroupProps): React.JSX.Element;
|
|
16
16
|
declare function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
17
|
-
declare function CommandItem({ className, size, isGroup, icon, tooltip, children, selectedValue, multiple, value, shortcut, disabledTooltip, disabled, iconClassName, textClassName,
|
|
17
|
+
declare function CommandItem({ className, size, isGroup, icon, tooltip, children, selectedValue, multiple, value, shortcut, disabledTooltip, disabled, iconClassName, textClassName, ...props }: CommandItemProps): React.JSX.Element;
|
|
18
18
|
declare function CommandUserItem({ className, size, isGroup, name, email, profileUrl, selectedValue, multiple, value, disabled, textClassName, ...props }: CommandUserItemProps): React.JSX.Element;
|
|
19
|
-
declare function CommandCheckboxItem({ className, textClassName, size, isGroup, children, selectedValue, value, icon, disabled, tooltip, disabledTooltip,
|
|
19
|
+
declare function CommandCheckboxItem({ className, textClassName, size, isGroup, children, selectedValue, value, icon, disabled, tooltip, disabledTooltip, ...props }: CommandItemProps): React.JSX.Element;
|
|
20
20
|
declare function CommandShortcut({ className, ...props }: ComponentProps<'span'>): React.JSX.Element;
|
|
21
21
|
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandCheckboxItem, CommandShortcut, CommandSeparator, CommandClear, CommandUserItem, };
|
|
@@ -9,9 +9,9 @@ var _excluded = ["className"],
|
|
|
9
9
|
_excluded6 = ["className"],
|
|
10
10
|
_excluded7 = ["className", "size"],
|
|
11
11
|
_excluded8 = ["className"],
|
|
12
|
-
_excluded9 = ["className", "size", "isGroup", "icon", "tooltip", "children", "selectedValue", "multiple", "value", "shortcut", "disabledTooltip", "disabled", "iconClassName", "textClassName"
|
|
12
|
+
_excluded9 = ["className", "size", "isGroup", "icon", "tooltip", "children", "selectedValue", "multiple", "value", "shortcut", "disabledTooltip", "disabled", "iconClassName", "textClassName"],
|
|
13
13
|
_excluded10 = ["className", "size", "isGroup", "name", "email", "profileUrl", "selectedValue", "multiple", "value", "disabled", "textClassName"],
|
|
14
|
-
_excluded11 = ["className", "textClassName", "size", "isGroup", "children", "selectedValue", "value", "icon", "disabled", "tooltip", "disabledTooltip"
|
|
14
|
+
_excluded11 = ["className", "textClassName", "size", "isGroup", "children", "selectedValue", "value", "icon", "disabled", "tooltip", "disabledTooltip"],
|
|
15
15
|
_excluded12 = ["className"];
|
|
16
16
|
import { ButtonVariant, buttonVariants } from '@scaleflex/ui-tw/button';
|
|
17
17
|
import { getIconSizeInRem } from '@scaleflex/ui-tw/button/button.utils';
|
|
@@ -22,7 +22,7 @@ import { crossSizeOptions } from '@scaleflex/ui-tw/search/search.constants';
|
|
|
22
22
|
import { SelectIcon } from '@scaleflex/ui-tw/select/components/select-icon';
|
|
23
23
|
import { selectItemVariants, selectTriggerVariants } from '@scaleflex/ui-tw/select/select.component';
|
|
24
24
|
import { getOptionInGroupPaddingLeft } from '@scaleflex/ui-tw/select/select.utils';
|
|
25
|
-
import {
|
|
25
|
+
import { TruncatedText } from '@scaleflex/ui-tw/truncated-text';
|
|
26
26
|
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
27
27
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
28
28
|
import { cva } from 'class-variance-authority';
|
|
@@ -30,7 +30,7 @@ import { Command as CommandPrimitive, useCommandState } from 'cmdk';
|
|
|
30
30
|
import { CheckIcon, SearchIcon, UserCircle2Icon, XIcon } from 'lucide-react';
|
|
31
31
|
import React from 'react';
|
|
32
32
|
import { useCallback } from 'react';
|
|
33
|
-
import { selectCommandHeadingOptions
|
|
33
|
+
import { selectCommandHeadingOptions } from './command.utils';
|
|
34
34
|
function Command(_ref) {
|
|
35
35
|
var className = _ref.className,
|
|
36
36
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -192,11 +192,9 @@ function CommandItem(_ref9) {
|
|
|
192
192
|
disabled = _ref9.disabled,
|
|
193
193
|
iconClassName = _ref9.iconClassName,
|
|
194
194
|
textClassName = _ref9.textClassName,
|
|
195
|
-
labelTooltip = _ref9.labelTooltip,
|
|
196
195
|
props = _objectWithoutProperties(_ref9, _excluded9);
|
|
197
196
|
var selected = value && (multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value) : value === selectedValue);
|
|
198
197
|
var resolvedShortcut = typeof shortcut === 'function' ? shortcut() : shortcut;
|
|
199
|
-
var resolvedLabelTooltip = truncateLabelTooltip(labelTooltip !== null && labelTooltip !== void 0 ? labelTooltip : typeof children === 'string' ? children : undefined);
|
|
200
198
|
return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
|
|
201
199
|
"data-slot": "command-item",
|
|
202
200
|
className: cn('relative flex w-full cursor-pointer items-center justify-between gap-2 outline-hidden select-none', '*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2', 'data-[selected=true]:bg-secondary data-[selected=true]:text-foreground', '!opacity-100 data-[disabled=true]:cursor-not-allowed', "[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", selectItemVariants({
|
|
@@ -212,11 +210,11 @@ function CommandItem(_ref9) {
|
|
|
212
210
|
className: cn('text-muted-foreground hover:text-primary shrink-0', selected && 'text-primary', disabled && 'opacity-50', iconClassName)
|
|
213
211
|
}), /*#__PURE__*/React.createElement("div", {
|
|
214
212
|
className: "flex items-center gap-1 overflow-hidden"
|
|
215
|
-
}, /*#__PURE__*/React.createElement(
|
|
216
|
-
|
|
217
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
218
|
-
className: cn('
|
|
219
|
-
}, children)
|
|
213
|
+
}, typeof children === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
214
|
+
className: cn(textClassName, disabled && 'opacity-50')
|
|
215
|
+
}, children) : /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: cn('overflow-hidden text-left', textClassName, disabled && 'opacity-50')
|
|
217
|
+
}, children), (tooltip || disabledTooltip) && /*#__PURE__*/React.createElement("div", {
|
|
220
218
|
className: "flex shrink-0 items-center"
|
|
221
219
|
}, /*#__PURE__*/React.createElement(LabelIcon, {
|
|
222
220
|
size: size,
|
|
@@ -265,15 +263,15 @@ function CommandUserItem(_ref10) {
|
|
|
265
263
|
className: "size-8"
|
|
266
264
|
})), /*#__PURE__*/React.createElement("div", {
|
|
267
265
|
className: "max-w-10/12"
|
|
268
|
-
}, /*#__PURE__*/React.createElement(
|
|
269
|
-
|
|
270
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
266
|
+
}, typeof resolvedName === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
267
|
+
className: cn('text-sm', textClassName)
|
|
268
|
+
}, resolvedName) : /*#__PURE__*/React.createElement("div", {
|
|
271
269
|
className: cn('w-full overflow-hidden text-sm text-ellipsis whitespace-nowrap', textClassName)
|
|
272
|
-
}, resolvedName)
|
|
273
|
-
|
|
274
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
270
|
+
}, resolvedName), typeof resolvedEmail === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
271
|
+
className: cn('text-secondary-foreground text-xs', textClassName)
|
|
272
|
+
}, resolvedEmail) : /*#__PURE__*/React.createElement("div", {
|
|
275
273
|
className: cn('text-secondary-foreground w-full overflow-hidden text-xs text-ellipsis whitespace-nowrap', textClassName)
|
|
276
|
-
}, resolvedEmail)))
|
|
274
|
+
}, resolvedEmail))), /*#__PURE__*/React.createElement("span", {
|
|
277
275
|
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
278
276
|
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
279
277
|
className: cn('text-primary ml-auto h-4 w-4', selected ? 'opacity-100' : 'opacity-0')
|
|
@@ -291,10 +289,8 @@ function CommandCheckboxItem(_ref11) {
|
|
|
291
289
|
disabled = _ref11.disabled,
|
|
292
290
|
tooltip = _ref11.tooltip,
|
|
293
291
|
disabledTooltip = _ref11.disabledTooltip,
|
|
294
|
-
labelTooltip = _ref11.labelTooltip,
|
|
295
292
|
props = _objectWithoutProperties(_ref11, _excluded11);
|
|
296
293
|
var selected = value && (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value));
|
|
297
|
-
var resolvedLabelTooltip = truncateLabelTooltip(labelTooltip !== null && labelTooltip !== void 0 ? labelTooltip : typeof children === 'string' ? children : undefined);
|
|
298
294
|
return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
|
|
299
295
|
"data-slot": "command-checkbox-item",
|
|
300
296
|
className: cn('relative flex w-full cursor-pointer items-center gap-3 outline-hidden select-none', 'data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground', '!opacity-100 data-[disabled=true]:cursor-not-allowed', selectItemVariants({
|
|
@@ -313,11 +309,11 @@ function CommandCheckboxItem(_ref11) {
|
|
|
313
309
|
size: size,
|
|
314
310
|
icon: icon,
|
|
315
311
|
className: cn('text-muted-foreground hover:text-primary !mr-1 shrink-0', selected && 'text-primary', disabled && 'opacity-50')
|
|
316
|
-
}), /*#__PURE__*/React.createElement(
|
|
317
|
-
|
|
318
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
319
|
-
className: cn('
|
|
320
|
-
}, children)
|
|
312
|
+
}), typeof children === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
313
|
+
className: cn(textClassName, disabled && 'opacity-50')
|
|
314
|
+
}, children) : /*#__PURE__*/React.createElement("div", {
|
|
315
|
+
className: cn('overflow-hidden text-left', textClassName, disabled && 'opacity-50')
|
|
316
|
+
}, children), (tooltip || disabledTooltip) && /*#__PURE__*/React.createElement("div", {
|
|
321
317
|
className: "flex shrink-0 items-center"
|
|
322
318
|
}, /*#__PURE__*/React.createElement(LabelIcon, {
|
|
323
319
|
size: size,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export declare const LABEL_TOOLTIP_MAX_LENGTH = 250;
|
|
2
|
-
export declare function truncateLabelTooltip(labelTooltip: string | undefined): string | undefined;
|
|
3
1
|
export declare const selectCommandHeadingOptions: {
|
|
4
2
|
readonly sm: "[&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:min-h-8 [&_[cmdk-group-heading]]:text-xs";
|
|
5
3
|
readonly md: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-10 [&_[cmdk-group-heading]]:text-sm";
|
package/command/command.utils.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
-
export var LABEL_TOOLTIP_MAX_LENGTH = 250;
|
|
4
|
-
export function truncateLabelTooltip(labelTooltip) {
|
|
5
|
-
if (!labelTooltip) return undefined;
|
|
6
|
-
return labelTooltip.length > LABEL_TOOLTIP_MAX_LENGTH ? "".concat(labelTooltip.slice(0, LABEL_TOOLTIP_MAX_LENGTH), "\u2026") : labelTooltip;
|
|
7
|
-
}
|
|
8
3
|
export var selectCommandHeadingOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, '[&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:min-h-8 [&_[cmdk-group-heading]]:text-xs'), FormSize.Md, '[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-10 [&_[cmdk-group-heading]]:text-sm'), FormSize.Lg, '[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-12 [&_[cmdk-group-heading]]:text-base');
|
|
@@ -7,7 +7,7 @@ declare function DropdownMenuPortal({ ...props }: ComponentProps<typeof Dropdown
|
|
|
7
7
|
declare function DropdownMenuTrigger({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React.JSX.Element;
|
|
8
8
|
declare function DropdownMenuContent({ className, sideOffset, collisionPadding, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
|
|
9
9
|
declare function DropdownMenuGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
10
|
-
declare function DropdownMenuItem({ className, inset, variant, size, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
10
|
+
declare function DropdownMenuItem({ className, inset, variant, size, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
11
11
|
inset?: boolean;
|
|
12
12
|
variant?: 'default' | 'destructive';
|
|
13
13
|
size?: DropdownMenuItemSize;
|
|
@@ -3,7 +3,7 @@ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructurin
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _excluded = ["className", "sideOffset", "collisionPadding"],
|
|
6
|
-
_excluded2 = ["className", "inset", "variant", "size"],
|
|
6
|
+
_excluded2 = ["className", "inset", "variant", "size", "children"],
|
|
7
7
|
_excluded3 = ["className", "children", "checked", "size", "closeOnSelect", "onSelect"],
|
|
8
8
|
_excluded4 = ["className", "children", "size"],
|
|
9
9
|
_excluded5 = ["className", "size"],
|
|
@@ -16,6 +16,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
|
16
16
|
import { Slot } from '@radix-ui/react-slot';
|
|
17
17
|
import { DropdownMenuItemSize, dropdownMenuButtonTriggerOptions, dropdownMenuCheckboxItemSizeOptions, dropdownMenuIconSizeOptions, dropdownMenuItemIconSizeOptions, dropdownMenuItemIndicatorSizeOptions, dropdownMenuItemSizeOptions, dropdownMenuRadioItemSizeOptions, dropdownMenuShortcutSizeOptions } from '@scaleflex/ui-tw/dropdown-menu/dropdown-menu.constants';
|
|
18
18
|
import { focusRingClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
|
|
19
|
+
import { TruncatedText } from '@scaleflex/ui-tw/truncated-text';
|
|
19
20
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
20
21
|
import { cva } from 'class-variance-authority';
|
|
21
22
|
import { CheckIcon, ChevronDownIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
@@ -131,23 +132,28 @@ function DropdownMenuGroup(_ref5) {
|
|
|
131
132
|
}, props));
|
|
132
133
|
}
|
|
133
134
|
function DropdownMenuItem(_ref6) {
|
|
135
|
+
var _React$Children$map;
|
|
134
136
|
var className = _ref6.className,
|
|
135
137
|
inset = _ref6.inset,
|
|
136
138
|
_ref6$variant = _ref6.variant,
|
|
137
139
|
variant = _ref6$variant === void 0 ? 'default' : _ref6$variant,
|
|
138
140
|
_ref6$size = _ref6.size,
|
|
139
141
|
size = _ref6$size === void 0 ? DropdownMenuItemSize.Sm : _ref6$size,
|
|
142
|
+
children = _ref6.children,
|
|
140
143
|
props = _objectWithoutProperties(_ref6, _excluded2);
|
|
144
|
+
var processedChildren = (_React$Children$map = React.Children.map(children, function (child) {
|
|
145
|
+
return typeof child === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, null, child) : child;
|
|
146
|
+
})) !== null && _React$Children$map !== void 0 ? _React$Children$map : children;
|
|
141
147
|
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, _extends({
|
|
142
148
|
"data-slot": "dropdown-menu-item",
|
|
143
149
|
"data-inset": inset,
|
|
144
150
|
"data-variant": variant,
|
|
145
|
-
className: cn('relative flex cursor-pointer items-center gap-2 rounded-sm outline-hidden select-none', dropdownMenuItemVariants({
|
|
151
|
+
className: cn('relative flex cursor-pointer items-center gap-2 overflow-hidden rounded-sm outline-hidden select-none', dropdownMenuItemVariants({
|
|
146
152
|
size: size
|
|
147
153
|
}), 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive', 'focus:bg-secondary data-[disabled]:pointer-events-none data-[disabled]:opacity-50', "[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0", dropdownMenuIconVariants({
|
|
148
154
|
size: size
|
|
149
155
|
}), className)
|
|
150
|
-
}, props));
|
|
156
|
+
}, props), processedChildren);
|
|
151
157
|
}
|
|
152
158
|
function DropdownMenuCheckboxItem(_ref7) {
|
|
153
159
|
var className = _ref7.className,
|
|
@@ -234,7 +240,7 @@ function DropdownMenuShortcut(_ref12) {
|
|
|
234
240
|
props = _objectWithoutProperties(_ref12, _excluded7);
|
|
235
241
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
236
242
|
"data-slot": "dropdown-menu-shortcut",
|
|
237
|
-
className: cn('text-muted-foreground
|
|
243
|
+
className: cn('text-muted-foreground ml-auto shrink-0 tracking-widest', dropdownMenuShortcutVariants({
|
|
238
244
|
size: size
|
|
239
245
|
}), className)
|
|
240
246
|
}, props));
|
|
@@ -34,9 +34,9 @@ export declare const dropdownMenuItemIconSizeOptions: {
|
|
|
34
34
|
readonly lg: "size-5";
|
|
35
35
|
};
|
|
36
36
|
export declare const dropdownMenuShortcutSizeOptions: {
|
|
37
|
-
readonly sm: "
|
|
38
|
-
readonly md: "
|
|
39
|
-
readonly lg: "
|
|
37
|
+
readonly sm: "text-xs";
|
|
38
|
+
readonly md: "text-xs";
|
|
39
|
+
readonly lg: "text-xs";
|
|
40
40
|
};
|
|
41
41
|
export declare const dropdownMenuIconSizeOptions: {
|
|
42
42
|
readonly sm: "[&_svg:not([class*='size-'])]:size-3.5";
|
|
@@ -10,5 +10,5 @@ export var dropdownMenuRadioItemSizeOptions = _defineProperty(_defineProperty(_d
|
|
|
10
10
|
export var dropdownMenuButtonTriggerOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'px-3 py-1.5 gap-1 text-sm'), DropdownMenuItemSize.Md, 'px-4 py-2 gap-2 text-base'), DropdownMenuItemSize.Lg, 'px-5 py-2.5 gap-2 text-lg');
|
|
11
11
|
export var dropdownMenuItemIndicatorSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'right-2 size-3.5'), DropdownMenuItemSize.Md, 'right-3 size-4'), DropdownMenuItemSize.Lg, 'right-3 size-5');
|
|
12
12
|
export var dropdownMenuItemIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'size-3.5'), DropdownMenuItemSize.Md, 'size-4'), DropdownMenuItemSize.Lg, 'size-5');
|
|
13
|
-
export var dropdownMenuShortcutSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, '
|
|
13
|
+
export var dropdownMenuShortcutSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, 'text-xs'), DropdownMenuItemSize.Md, 'text-xs'), DropdownMenuItemSize.Lg, 'text-xs');
|
|
14
14
|
export var dropdownMenuIconSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, DropdownMenuItemSize.Sm, "[&_svg:not([class*='size-'])]:size-3.5"), DropdownMenuItemSize.Md, "[&_svg:not([class*='size-'])]:size-4.5"), DropdownMenuItemSize.Lg, "[&_svg:not([class*='size-'])]:size-5");
|
|
@@ -203,11 +203,8 @@ export function InputTags(_ref) {
|
|
|
203
203
|
onSelect: function onSelect() {
|
|
204
204
|
return handleAddTag(tag);
|
|
205
205
|
},
|
|
206
|
-
isGroup: true
|
|
207
|
-
|
|
208
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
209
|
-
className: "block w-full truncate overflow-hidden text-ellipsis whitespace-nowrap"
|
|
210
|
-
}, tag.label));
|
|
206
|
+
isGroup: true
|
|
207
|
+
}, tag.label);
|
|
211
208
|
})), filteredAll.length > 0 && /*#__PURE__*/React.createElement(CommandGroup, {
|
|
212
209
|
size: size,
|
|
213
210
|
heading: "All Tags"
|
|
@@ -218,11 +215,8 @@ export function InputTags(_ref) {
|
|
|
218
215
|
onSelect: function onSelect() {
|
|
219
216
|
return handleAddTag(tag);
|
|
220
217
|
},
|
|
221
|
-
isGroup: true
|
|
222
|
-
|
|
223
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
224
|
-
className: "block w-full truncate overflow-hidden text-ellipsis whitespace-nowrap"
|
|
225
|
-
}, tag.label));
|
|
218
|
+
isGroup: true
|
|
219
|
+
}, tag.label);
|
|
226
220
|
})), !canCreate && filteredSuggested.length === 0 && filteredAll.length === 0 && /*#__PURE__*/React.createElement(CommandEmpty, null, "No results found."), canCreate && /*#__PURE__*/React.createElement(CommandItem, {
|
|
227
221
|
size: size,
|
|
228
222
|
onSelect: function onSelect() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.155",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@radix-ui/react-switch": "^1.0.1",
|
|
30
30
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
31
31
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
32
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
32
|
+
"@scaleflex/icons-tw": "^0.0.155",
|
|
33
33
|
"@tanstack/react-table": "^8.21.3",
|
|
34
34
|
"@types/lodash.merge": "^4.6.9",
|
|
35
35
|
"class-variance-authority": "^0.7.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TruncatedText } from './truncated-text.component';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { WithTooltip } from '@scaleflex/ui-tw/tooltip';
|
|
3
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
4
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { truncateTooltip } from './truncated-text.utils';
|
|
6
|
+
function TruncatedText(_ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
className = _ref.className,
|
|
9
|
+
_ref$tooltipSide = _ref.tooltipSide,
|
|
10
|
+
tooltipSide = _ref$tooltipSide === void 0 ? 'top' : _ref$tooltipSide;
|
|
11
|
+
var textRef = useRef(null);
|
|
12
|
+
var _useState = useState(false),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
isTruncated = _useState2[0],
|
|
15
|
+
setIsTruncated = _useState2[1];
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
var checkTruncation = function checkTruncation() {
|
|
18
|
+
var element = textRef.current;
|
|
19
|
+
if (element) {
|
|
20
|
+
setIsTruncated(element.scrollWidth > element.clientWidth);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
checkTruncation();
|
|
24
|
+
var resizeObserver = new ResizeObserver(checkTruncation);
|
|
25
|
+
if (textRef.current) {
|
|
26
|
+
resizeObserver.observe(textRef.current);
|
|
27
|
+
}
|
|
28
|
+
return function () {
|
|
29
|
+
return resizeObserver.disconnect();
|
|
30
|
+
};
|
|
31
|
+
}, [children]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(WithTooltip, {
|
|
33
|
+
side: tooltipSide,
|
|
34
|
+
content: isTruncated ? truncateTooltip(children) : undefined
|
|
35
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
ref: textRef,
|
|
37
|
+
className: cn('block min-w-0 truncate', className)
|
|
38
|
+
}, children));
|
|
39
|
+
}
|
|
40
|
+
export { TruncatedText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TOOLTIP_MAX_LENGTH = 250;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var TOOLTIP_MAX_LENGTH = 250;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export interface TruncatedTextProps {
|
|
4
|
+
children: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
tooltipSide?: ComponentProps<typeof TooltipPrimitive.Content>['side'];
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function truncateTooltip(text: string): string;
|
|
@@ -14,52 +14,53 @@ export function copyToClipboard(_x) {
|
|
|
14
14
|
}
|
|
15
15
|
function _copyToClipboard() {
|
|
16
16
|
_copyToClipboard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
17
|
-
var _navigator$clipboard;
|
|
18
|
-
var textarea;
|
|
17
|
+
var _self, _navigator$clipboard;
|
|
18
|
+
var isSecureContext, textarea;
|
|
19
19
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
isSecureContext = typeof window !== 'undefined' ? window.isSecureContext : !!((_self = self) !== null && _self !== void 0 && _self.isSecureContext);
|
|
23
|
+
if (!(isSecureContext && typeof navigator !== 'undefined' && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText)) {
|
|
24
|
+
_context.next = 10;
|
|
24
25
|
break;
|
|
25
26
|
}
|
|
26
|
-
_context.prev =
|
|
27
|
-
_context.next =
|
|
27
|
+
_context.prev = 2;
|
|
28
|
+
_context.next = 5;
|
|
28
29
|
return navigator.clipboard.writeText(text);
|
|
29
|
-
case
|
|
30
|
+
case 5:
|
|
30
31
|
return _context.abrupt("return", true);
|
|
31
|
-
case
|
|
32
|
-
_context.prev =
|
|
33
|
-
_context.t0 = _context["catch"](
|
|
34
|
-
case
|
|
32
|
+
case 8:
|
|
33
|
+
_context.prev = 8;
|
|
34
|
+
_context.t0 = _context["catch"](2);
|
|
35
|
+
case 10:
|
|
35
36
|
if (!(typeof document === 'undefined')) {
|
|
36
|
-
_context.next =
|
|
37
|
+
_context.next = 12;
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
return _context.abrupt("return", false);
|
|
40
|
-
case
|
|
41
|
+
case 12:
|
|
41
42
|
// Fallback for iframes, HTTP contexts, older browsers
|
|
42
43
|
textarea = document.createElement('textarea');
|
|
43
44
|
textarea.value = text;
|
|
44
45
|
textarea.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';
|
|
45
46
|
document.body.appendChild(textarea);
|
|
46
|
-
_context.prev =
|
|
47
|
+
_context.prev = 16;
|
|
47
48
|
textarea.focus();
|
|
48
49
|
textarea.select();
|
|
49
50
|
return _context.abrupt("return", document.execCommand('copy'));
|
|
50
|
-
case
|
|
51
|
-
_context.prev =
|
|
52
|
-
_context.t1 = _context["catch"](
|
|
51
|
+
case 22:
|
|
52
|
+
_context.prev = 22;
|
|
53
|
+
_context.t1 = _context["catch"](16);
|
|
53
54
|
return _context.abrupt("return", false);
|
|
54
|
-
case
|
|
55
|
-
_context.prev =
|
|
55
|
+
case 25:
|
|
56
|
+
_context.prev = 25;
|
|
56
57
|
document.body.removeChild(textarea);
|
|
57
|
-
return _context.finish(
|
|
58
|
-
case
|
|
58
|
+
return _context.finish(25);
|
|
59
|
+
case 28:
|
|
59
60
|
case "end":
|
|
60
61
|
return _context.stop();
|
|
61
62
|
}
|
|
62
|
-
}, _callee, null, [[
|
|
63
|
+
}, _callee, null, [[2, 8], [16, 22, 25, 28]]);
|
|
63
64
|
}));
|
|
64
65
|
return _copyToClipboard.apply(this, arguments);
|
|
65
66
|
}
|