@adaptabletools/adaptable 23.0.0-canary.2 → 23.0.0-canary.4
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/index.css +68 -73
- package/package.json +1 -1
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +0 -4
- package/src/AdaptableOptions/FilterOptions.d.ts +0 -7
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -3
- package/src/AdaptableState/Common/AdaptableForm.d.ts +18 -1
- package/src/AdaptableState/Common/AdaptableForm.js +31 -0
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +1 -1
- package/src/AdaptableState/Common/CellDataChangedInfo.d.ts +3 -2
- package/src/AdaptableState/Common/Enums.d.ts +0 -5
- package/src/AdaptableState/Common/Enums.js +0 -6
- package/src/Api/EventApi.d.ts +1 -1
- package/src/Api/Events/ReportScheduleRan.d.ts +4 -0
- package/src/Api/Implementation/LayoutHelpers.js +12 -0
- package/src/Api/Internal/EventInternalApi.js +2 -1
- package/src/Strategy/CalculatedColumnModule.js +3 -1
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +1 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +7 -0
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.d.ts +4 -0
- package/src/Utilities/Services/CalculatedColumnSyntheticChange.js +115 -0
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +1 -0
- package/src/View/AdaptablePopover/index.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/SettingsSection.js +8 -16
- package/src/View/Components/Buttons/ButtonInfo.d.ts +1 -1
- package/src/View/Components/Buttons/ButtonInfo.js +4 -3
- package/src/View/Components/ColumnFilter/AdaptableColumnFilter.js +1 -1
- package/src/View/Components/ColumnFilter/ColumnFilter.js +15 -5
- package/src/View/Components/ColumnFilter/ColumnFilterWindow.js +1 -1
- package/src/View/Components/ColumnFilter/FloatingFilter.js +58 -60
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
- package/src/View/Components/Forms/AdaptableFormControlTextClear.js +2 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +2 -2
- package/src/View/Components/Selectors/ColumnSelector.js +5 -0
- package/src/View/Components/ValueSelector/index.js +1 -1
- package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +3 -1
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +3 -8
- package/src/View/GridFilter/GridFilterViewPanel.js +1 -1
- package/src/View/Layout/LayoutViewPanel.js +23 -21
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +3 -3
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/RowSelectionSection.js +1 -1
- package/src/View/Layout/Wizard/sections/SettingsSection.js +1 -1
- package/src/View/License/LicenseWatermark.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardScopeSection.js +1 -1
- package/src/View/Wizard/OnePageWizards.js +1 -1
- package/src/View/renderWithAdaptableContext.js +2 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +0 -1
- package/src/agGrid/AdaptableAgGrid.js +3 -18
- package/src/agGrid/AgGridColumnAdapter.js +1 -4
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +11 -6
- package/src/components/Card/index.js +1 -1
- package/src/components/Combobox/VirtualizedList.js +5 -5
- package/src/components/Combobox/comboboxUtils.d.ts +4 -1
- package/src/components/Combobox/comboboxUtils.js +2 -0
- package/src/components/Combobox/index.d.ts +1 -0
- package/src/components/Combobox/index.js +38 -12
- package/src/components/Datepicker/index.js +2 -2
- package/src/components/Dialog/index.js +1 -1
- package/src/components/DragAndDropContext/TabList.js +1 -1
- package/src/components/Dropdown/Arrows.js +0 -1
- package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
- package/src/components/ExpressionEditor/index.js +1 -1
- package/src/components/Input/index.js +1 -1
- package/src/components/NewDropdownButton/index.d.ts +1 -0
- package/src/components/NewDropdownButton/index.js +2 -2
- package/src/components/NewSelect/index.d.ts +2 -0
- package/src/components/NewSelect/index.js +10 -7
- package/src/components/Panel/index.js +1 -1
- package/src/components/SimpleButton/index.js +1 -1
- package/src/components/Tabs/index.js +1 -1
- package/src/components/Tree/TreeDropdown/index.js +6 -14
- package/src/components/ui/button.d.ts +5 -2
- package/src/components/ui/button.js +5 -4
- package/src/components/ui/combobox.d.ts +16 -16
- package/src/components/ui/combobox.js +37 -37
- package/src/components/ui/input-group.d.ts +10 -9
- package/src/components/ui/input-group.js +13 -12
- package/src/components/ui/input.d.ts +2 -2
- package/src/components/ui/input.js +5 -4
- package/src/components/ui/popover.d.ts +5 -5
- package/src/components/ui/popover.js +7 -7
- package/src/components/ui/select.d.ts +7 -6
- package/src/components/ui/select.js +13 -12
- package/src/components/ui/textarea.d.ts +2 -2
- package/src/components/ui/textarea.js +4 -3
- package/src/components/ui/tooltip.d.ts +6 -5
- package/src/components/ui/tooltip.js +8 -7
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +5 -1
- package/src/lib/utils.d.ts +20 -0
- package/src/lib/utils.js +45 -0
- package/src/metamodel/adaptable.metamodel.d.ts +7 -19
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade23.d.ts +2 -3
- package/src/migration/VersionUpgrade23.js +4 -16
- package/src/types.d.ts +0 -1
- package/themes/dark.css +7 -17
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/AdaptableState/Common/FilterActionOnDataChange.d.ts +0 -17
- package/src/AdaptableState/Common/FilterActionOnDataChange.js +0 -4
- package/src/View/AdaptableComputedCSSVarsContext.d.ts +0 -12
- package/src/View/AdaptableComputedCSSVarsContext.js +0 -29
- package/src/components/Select/CSSNumericVariableWatch.d.ts +0 -11
- package/src/components/Select/CSSNumericVariableWatch.js +0 -45
|
@@ -249,12 +249,12 @@ export const Datepicker = React.forwardRef((props, ref) => {
|
|
|
249
249
|
width: style?.width,
|
|
250
250
|
maxWidth: style?.maxWidth,
|
|
251
251
|
border: style?.border,
|
|
252
|
-
}, tabIndex: -1, className: cn('ab-Datepicker twa:flex twa:flex-row', 'twa:bg-
|
|
252
|
+
}, tabIndex: -1, className: cn('ab-Datepicker twa:flex twa:flex-row twa:shadow-none', 'twa:bg-input-background', targetOwn.focusWithinOutline, open && 'twa:border-ring twa:ring-3 twa:ring-ring/50', className), children: [_jsx(AdaptableDateInlineInput, { ref: ref, "data-slot": "input-group-control", value: inputValue, placeholder: placeholder ?? '', onChange: (v) => {
|
|
253
253
|
const date = new Date(v);
|
|
254
254
|
if (isValid(date)) {
|
|
255
255
|
updateValue(date);
|
|
256
256
|
}
|
|
257
|
-
}, className: "twa:h-auto twa:min-w-0 twa:outline-none twa:min-h-auto twa:py-0 twa:flex-1 twa:rounded-none twa:border-0 twa:bg-transparent twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:dark:bg-transparent", style: style, disabled: disabled }), _jsxs(InputGroupAddon, { align: "inline-end", children: [inputValue ? clearButton : null, calendarButton] })] }) }), _jsx(PopoverContent, { className: "twa:w-auto twa:p-0", align: "start", sideOffset:
|
|
257
|
+
}, className: "twa:h-auto twa:min-w-0 twa:outline-none twa:min-h-auto twa:py-0 twa:flex-1 twa:rounded-none twa:border-0 twa:bg-transparent twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:dark:bg-transparent", style: style, disabled: disabled }), _jsxs(InputGroupAddon, { align: "inline-end", children: [inputValue ? clearButton : null, calendarButton] })] }) }), _jsx(PopoverContent, { className: "twa:w-auto twa:p-0", align: "start", sideOffset: 8, children: _jsx("div", { ref: popupRefCallback, tabIndex: -1, role: "region", "aria-label": "Calendar", className: cn('twa:relative twa:isolate twa:overflow-visible twa:outline-none twa:rounded-standard', targetOwn.focusWithinOutline), onKeyDown: () => {
|
|
258
258
|
// console.log('onKeyDown', e.key);
|
|
259
259
|
// return;
|
|
260
260
|
// if (e.key === 'Tab') {
|
|
@@ -106,7 +106,7 @@ export const Dialog = React.forwardRef((props, dialogRef) => {
|
|
|
106
106
|
if (boxProps && boxProps.onClick) {
|
|
107
107
|
boxProps.onClick(e);
|
|
108
108
|
}
|
|
109
|
-
}, onKeyDown: onKeyDown, className: clsx('twa:relative', 'twa:bg-
|
|
109
|
+
}, onKeyDown: onKeyDown, className: clsx('twa:relative', 'twa:bg-background', 'twa:text-foreground', 'twa:fill-foreground', 'twa:rounded-standard', 'twa:flex twa:flex-col', targetOwn.focusOutline, targetOwn.focusWithinOutline, baseClassName, modal ? `${baseClassName}--modal` : `${baseClassName}--not-modal`, className), ref: boxRef, children: [children, closeButton] }));
|
|
110
110
|
const content = fixed ? (_jsx("div", { onClick: setPreventDismissFlag, className: clsx(`${baseClassName}-fixed-wrapper`, 'twa:fixed twa:inset-0', 'twa:m-auto', 'twa:flex twa:items-center twa:justify-center'), children: box })) : (box);
|
|
111
111
|
if (windowModal) {
|
|
112
112
|
return _jsx(WindowModal, { ...windowModalProps, children: content });
|
|
@@ -37,7 +37,7 @@ export function TabItem({ tab, tabId, tabIndex, tabs, onTabsChange, onRemove, on
|
|
|
37
37
|
!context.permittedActions.deleteTab) {
|
|
38
38
|
showHeader = false;
|
|
39
39
|
}
|
|
40
|
-
return (_jsxs("div", { ...restDomProps, className: clsx('twa:bg-
|
|
40
|
+
return (_jsxs("div", { ...restDomProps, className: clsx('twa:bg-background', 'twa:select-none', 'ab-ModuleSelector__TabItem twa:min-w-32', restDomProps.className), "data-name": "dashboard-tab", children: [showHeader ? (_jsxs("div", { className: "ab-ModuleSelector__TabItem__header", children: [_jsx("div", { ...(!isDragDisabled ? { onPointerDown } : {}), style: context.permittedActions.dragAndDropTab ? {} : { display: 'none' }, children: _jsx(Icon, { name: "drag" }) }), context.permittedActions.editTabName ? (_jsx("input", { className: "ab-ModuleSelector__TabItem__header-input", type: "text", disabled: disabled, value: tab.Name, onChange: (event) => {
|
|
41
41
|
onChangeTabName(event.target.value);
|
|
42
42
|
} })) : (tab.Name), context.permittedActions.deleteTab && (_jsx(SimpleButton, { disabled: disabled, icon: "delete", variant: "text", onClick: onRemove }))] })) : null, _jsx(ToolbarList, { disabled: disabled, toolbars: tab.Items, tabIndex: tabIndex, tabs: tabs, onTabsChange: onTabsChange, onRemove: onRemoveToolbar })] }));
|
|
43
43
|
} }));
|
|
@@ -116,7 +116,7 @@ const FunctionsDropdown = ({ expressionFunctions, baseClassName }) => {
|
|
|
116
116
|
* - mouse leaves
|
|
117
117
|
* - a function is inserted
|
|
118
118
|
*/
|
|
119
|
-
return (_jsx(OverlayTrigger, { ref: dropdownRef, showEvent: "mouseenter", hideEvent: "mouseleave", targetOffset: 5, render: () => (_jsxs(Flex, { className: `${baseClassName}__dropdown-functions-list-wrapper twa:max-w-[60vw] twa:shadow-md twa:bg-
|
|
119
|
+
return (_jsx(OverlayTrigger, { ref: dropdownRef, showEvent: "mouseenter", hideEvent: "mouseleave", targetOffset: 5, render: () => (_jsxs(Flex, { className: `${baseClassName}__dropdown-functions-list-wrapper twa:max-w-[60vw] twa:shadow-md twa:bg-background twa:text-foreground twa:text-3 twa:rounded-standard twa:p-3`, flexDirection: "column", onMouseLeave: () => hidePopup(), children: [_jsx(Flex, { className: "twa:md:gap-3 twa:gap-2 twa:pb-2 twa:md:justify-between twa:justify-start twa:flex-wrap twa:border-b twa:border-primarydark/30 twa:mb-2", children: categoryOptions.map((option, index) => {
|
|
120
120
|
return (_jsx(Radio, { onFocus: (event) => {
|
|
121
121
|
event.preventDefault();
|
|
122
122
|
event.stopPropagation();
|
|
@@ -76,7 +76,7 @@ export function ExpressionEditor(props) {
|
|
|
76
76
|
}
|
|
77
77
|
}, children: _jsxs(Flex, { className: "twa:flex-1 twa:text-2", flexDirection: "row", "data-name": "expression-editor", style: { minHeight: 0 }, children: [_jsxs(Flex, { className: "twa:flex-1 twa:pr-2 twa:overflow-auto twa:min-h-0", "data-name": "expression-builder", flexDirection: "column", children: [editorInput, StringExtensions.IsNotNullOrEmpty(expressionText?.trim()) && (_jsx(ExpressionFunctionDocumentation, { expressionFunction: selectedFunction })),
|
|
78
78
|
/* displayed for advanced queries (observable&Aggregation) to give the users a starting point */
|
|
79
|
-
StringExtensions.IsNullOrEmpty(expressionText?.trim()) && renderQueryHints(type), showDocumentationLinks && (_jsxs(HelpBlock, { "data-name": "query-documentation", className: "twa:my-2 twa:p-2 twa:text-3", children: [_jsx(ButtonInfo, { className: "twa:mr-2", onClick: () => window.open(queryDocumentationLink, '_blank') }), "See documentation for more details and examples"] })), _jsx(Box, { className: "twa:flex-1" }), showNamedQueryStuff && saveAsNamedQueryElement] }), _jsx(Box, { className: `${baseClassName}__sidebar twa:pb-2 twa:px-2 twa:overflow-auto twa:h-full twa:w-[280px]`, "data-name": "expression-sidebar", children: _jsx(Box, { className: "twa:h-full twa:p-2 twa:rounded-standard twa:shadow-md twa:bg-
|
|
79
|
+
StringExtensions.IsNullOrEmpty(expressionText?.trim()) && renderQueryHints(type), showDocumentationLinks && (_jsxs(HelpBlock, { "data-name": "query-documentation", className: "twa:my-2 twa:p-2 twa:text-3", children: [_jsx(ButtonInfo, { className: "twa:mr-2", onClick: () => window.open(queryDocumentationLink, '_blank') }), "See documentation for more details and examples"] })), _jsx(Box, { className: "twa:flex-1" }), showNamedQueryStuff && saveAsNamedQueryElement] }), _jsx(Box, { className: `${baseClassName}__sidebar twa:pb-2 twa:px-2 twa:overflow-auto twa:h-full twa:w-[280px]`, "data-name": "expression-sidebar", children: _jsx(Box, { className: "twa:h-full twa:p-2 twa:rounded-standard twa:shadow-md twa:bg-background twa:text-foreground", children: _jsxs(Tabs, { className: "twa:h-full", children: [_jsx(Tabs.Tab, { value: "column", children: "Columns" }), _jsx(Tabs.Tab, { value: "field", children: "Fields" }), _jsx(Tabs.Tab, { value: "named-query", children: "Named Queries" }), _jsx(Tabs.Content, { className: "twa:flex-1 twa:h-full", children: _jsx(DataTableEditor, { type: "column", dataFormatter: (value) => `[${value}]`, fields: queryableColumns.map((column) => ({
|
|
80
80
|
label: column.friendlyName,
|
|
81
81
|
value: column.columnId,
|
|
82
82
|
dataType: column.dataType,
|
|
@@ -14,7 +14,7 @@ const Input = React.forwardRef((props, ref) => {
|
|
|
14
14
|
type = 'text';
|
|
15
15
|
}
|
|
16
16
|
return (_jsx(Box, { as: as ?? 'input', ref: ref, ...inputProps, type: type, disabled: disabled, className: cn(baseClassName, 'twa:min-h-input', 'twa:rounded-input', targetOwn.focusOutline, type ? `${baseClassName}--type-${type}` : '', disabled ? `${baseClassName}--disabled` : '', {
|
|
17
|
-
'twa:bg-
|
|
17
|
+
'twa:bg-input-background': !disabled,
|
|
18
18
|
'twa:bg-(--ab-cmp-input--disabled__background)': disabled,
|
|
19
19
|
}, className) }));
|
|
20
20
|
});
|
|
@@ -22,5 +22,6 @@ export type NewDropdownButtonProps = {
|
|
|
22
22
|
align?: 'start' | 'center' | 'end';
|
|
23
23
|
'data-name'?: string;
|
|
24
24
|
tone?: SimpleButtonProps['tone'];
|
|
25
|
+
showDivider?: boolean;
|
|
25
26
|
};
|
|
26
27
|
export declare const NewDropdownButton: React.ForwardRefExoticComponent<NewDropdownButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -6,11 +6,11 @@ import { cn } from '../../lib/utils';
|
|
|
6
6
|
import { ChevronDownIcon } from 'lucide-react';
|
|
7
7
|
import SimpleButton from '../SimpleButton';
|
|
8
8
|
export const NewDropdownButton = React.forwardRef((props, ref) => {
|
|
9
|
-
const { items, children, className, disabled, tooltip, variant = 'text', accessLevel, side = 'bottom', align = 'start', 'data-name': dataName, tone = 'neutral', } = props;
|
|
9
|
+
const { items, children, className, disabled, tooltip, variant = 'text', accessLevel, side = 'bottom', align = 'start', 'data-name': dataName, tone = 'neutral', showDivider = true, } = props;
|
|
10
10
|
const isHidden = accessLevel === 'Hidden';
|
|
11
11
|
const isReadOnly = accessLevel === 'ReadOnly';
|
|
12
12
|
const isDisabled = disabled || isHidden || isReadOnly;
|
|
13
|
-
const trigger = (_jsxs(DropdownMenuTrigger, { render: _jsx(SimpleButton, { ref: ref, tone: tone, variant: variant, disabled: isDisabled, className: cn(className, 'twa:pr-1 twa:active:translate-y-0 twa:flex-row twa:flex-none', variant !== 'text' ? 'twa:gap-1' : 'twa:gap-0.5'), "data-name": dataName }), children: [children, _jsx("div", { className: cn('twa:h-full twa:my-1', variant !== 'text' ? 'twa:border-l twa:border-border' : '') }), _jsx(ChevronDownIcon, { className: "twa:size-3.5 twa:opacity-60 twa:transition-transform twa:duration-200 twa:[[data-popup-open]_&]:rotate-180" })] }));
|
|
13
|
+
const trigger = (_jsxs(DropdownMenuTrigger, { render: _jsx(SimpleButton, { ref: ref, tone: tone, variant: variant, disabled: isDisabled, className: cn(className, 'twa:pr-1 twa:active:translate-y-0 twa:flex-row twa:flex-none', variant !== 'text' ? 'twa:gap-1' : 'twa:gap-0.5'), "data-name": dataName }), children: [children, showDivider && (_jsx("div", { className: cn('twa:h-full twa:my-1', variant !== 'text' ? 'twa:border-l twa:border-border' : '') })), _jsx(ChevronDownIcon, { className: "twa:size-3.5 twa:opacity-60 twa:transition-transform twa:duration-200 twa:[[data-popup-open]_&]:rotate-180" })] }));
|
|
14
14
|
const maxLabelLength = items.reduce((max, item) => Math.max(max, typeof item.label === 'string' ? item.label.length : 0), 0);
|
|
15
15
|
return (_jsxs(DropdownMenu, { children: [tooltip ? _jsx(NewTooltip, { label: tooltip, children: trigger }) : trigger, _jsx(DropdownMenuContent, { side: side, align: align, style: {
|
|
16
16
|
// minWidth: `min(max(${maxLabelLength + 5}ch, calc(var(--ab-base-space) * 32)),80vw)`,
|
|
@@ -9,10 +9,12 @@ type SelectGroupType<T extends SelectItemType> = {
|
|
|
9
9
|
items: T[];
|
|
10
10
|
};
|
|
11
11
|
type NewSelectBaseProps<T extends SelectItemType> = {
|
|
12
|
+
chevronIcon?: React.ReactNode;
|
|
12
13
|
'data-name'?: string;
|
|
13
14
|
open?: boolean;
|
|
14
15
|
onOpenChange?: (open: boolean) => void;
|
|
15
16
|
showClear?: boolean;
|
|
17
|
+
extraWidthChars?: number;
|
|
16
18
|
multiple?: boolean;
|
|
17
19
|
disabled?: boolean;
|
|
18
20
|
value?: T['value'] | T['value'][];
|
|
@@ -30,9 +30,13 @@ const NewSelect = (props) => {
|
|
|
30
30
|
];
|
|
31
31
|
allItems = props.items;
|
|
32
32
|
}
|
|
33
|
-
const maxLabelLength = allItems.reduce((max, item) => Math.max(max, typeof item.label === 'string'
|
|
33
|
+
const maxLabelLength = allItems.reduce((max, item) => Math.max(max, typeof item.label === 'string'
|
|
34
|
+
? item.label.length
|
|
35
|
+
: typeof item.tooltip === 'string'
|
|
36
|
+
? item.tooltip.length
|
|
37
|
+
: 0), 0);
|
|
34
38
|
const contentStyle = {
|
|
35
|
-
width: `max(${maxLabelLength + 3}ch, calc(var(--ab-base-space) * 20), var(--anchor-width))`,
|
|
39
|
+
width: `max(${maxLabelLength + (props.extraWidthChars ?? 3)}ch, calc(var(--ab-base-space) * 20), var(--anchor-width))`,
|
|
36
40
|
};
|
|
37
41
|
const renderValueProp = props.renderValue;
|
|
38
42
|
const renderValueChild = renderValueProp
|
|
@@ -48,13 +52,12 @@ const NewSelect = (props) => {
|
|
|
48
52
|
return item !== undefined ? renderValueProp(item) : undefined;
|
|
49
53
|
}
|
|
50
54
|
: undefined;
|
|
51
|
-
return (_jsxs(Select, { multiple: props.multiple, open: props.open, onOpenChange: props.onOpenChange, isItemEqualToValue: isItemEqualToValue, items: allItems, disabled: props.disabled, value: props.value, onValueChange: props.onValueChange, "aria-label": props.ariaLabel, defaultValue: props.defaultValue, children: [_jsx(SelectTrigger, { size: props.size === 'small' ? 'sm' : 'default', className: cn('twa:max-w-80 ab-Select', props.className), "aria-invalid": isInvalid, "aria-label": props.ariaLabel, "data-name": props['data-name'], children: _jsx(SelectValue, { placeholder: props.placeholder, className: 'twa:truncate twa:block!', children: renderValueChild }) }), _jsx(SelectContent, { alignItemWithTrigger: false, container: props.container, stopMouseDownPropagation: props.stopMouseDownPropagation, style: contentStyle, children: groups.map((group, index) => {
|
|
55
|
+
return (_jsxs(Select, { multiple: props.multiple, open: props.open, onOpenChange: props.onOpenChange, isItemEqualToValue: isItemEqualToValue, items: allItems, disabled: props.disabled, value: props.value, onValueChange: props.onValueChange, "aria-label": props.ariaLabel, defaultValue: props.defaultValue, children: [_jsx(SelectTrigger, { size: props.size === 'small' ? 'sm' : 'default', className: cn('twa:max-w-80 ab-Select', props.className), "aria-invalid": isInvalid, "aria-label": props.ariaLabel, "data-name": props['data-name'], icon: props.chevronIcon, children: _jsx(SelectValue, { placeholder: props.placeholder, className: 'twa:truncate twa:block!', children: renderValueChild }) }), _jsx(SelectContent, { "aria-label": props.ariaLabel ? `${props.ariaLabel} content` : undefined, alignItemWithTrigger: false, container: props.container, stopMouseDownPropagation: props.stopMouseDownPropagation, style: contentStyle, children: groups.map((group, index) => {
|
|
52
56
|
return (_jsxs(React.Fragment, { children: [_jsxs(SelectGroup, { children: [group.label && _jsx(SelectLabel, { children: group.label }), group.items.map((item) => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
: undefined;
|
|
57
|
+
const itemTitle = getItemTitle(item.label, item.value);
|
|
58
|
+
const tooltipText = props.showItemTooltip ? itemTitle : undefined;
|
|
56
59
|
const itemContent = item.label;
|
|
57
|
-
const itemElement = (_jsx(SelectItem, { value: item.value, className: 'ab-Select-Row', disabled: item.disabled, children: itemContent }, item.value));
|
|
60
|
+
const itemElement = (_jsx(SelectItem, { value: item.value, "aria-label": itemTitle || undefined, className: 'ab-Select-Row', disabled: item.disabled, children: itemContent }, item.value));
|
|
58
61
|
if (tooltipText != null) {
|
|
59
62
|
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: itemElement, children: itemContent }), _jsx(TooltipContent, { side: "right", children: tooltipText })] }, item.value));
|
|
60
63
|
}
|
|
@@ -4,7 +4,7 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { Box, Flex } from '../Flex';
|
|
5
5
|
import { twMerge } from '../../twMerge';
|
|
6
6
|
export const baseClassName = 'ab-Panel';
|
|
7
|
-
const DEFAULT_BODY_CLS = 'twa:relative twa:flex-1 twa:p-2 twa:bg-
|
|
7
|
+
const DEFAULT_BODY_CLS = 'twa:relative twa:flex-1 twa:p-2 twa:bg-background twa:text-foreground';
|
|
8
8
|
const Header = ({ children, variant = 'default', className, style, onClick, ...flexProps }) => {
|
|
9
9
|
if (!children) {
|
|
10
10
|
return null;
|
|
@@ -92,7 +92,7 @@ const SimpleButton = React.forwardRef((givenProps, theRef) => {
|
|
|
92
92
|
}, variant === 'text' ? 'twa:bg-transparent' : '', variant === 'ghost'
|
|
93
93
|
? 'twa:hover:bg-muted twa:hover:text-foreground twa:aria-expanded:bg-muted twa:aria-expanded:text-foreground twa:dark:hover:bg-muted/50'
|
|
94
94
|
: '', variant === 'outlined'
|
|
95
|
-
? 'twa:bg-
|
|
95
|
+
? 'twa:bg-background twa:border-input-border twa:border'
|
|
96
96
|
: '', variant === 'raised'
|
|
97
97
|
? {
|
|
98
98
|
'twa:text-text-on-primary twa:shadow-(--ab-cmp-simple-button__box-shadow) twa:hover:not-disabled:shadow-(--ab-cmp-simple-button__hover-box-shadow) twa:transition-(--ab-cmp-simple-button__transition) twa:duration-200 twa:focus:shadow-(--ab-focus__box-shadow)': true,
|
|
@@ -66,7 +66,7 @@ export const Tabs = (props) => {
|
|
|
66
66
|
selectedIndex,
|
|
67
67
|
tabCount: tabs.length,
|
|
68
68
|
setSelectedIndex,
|
|
69
|
-
}, children: _jsxs(Box, { ...boxProps, className: join(boxProps.className, 'ab-Tabs twa:flex twa:flex-col'), "data-selected-index": selectedIndex, children: [_jsxs(Flex, { flexDirection: "row", className: clsx('ab-Tabs__Strip', 'twa:bg-(--ab-cmp-tabs-strip__background)'), children: [_jsx(Box, { className: fillerClassName }), tabs, _jsx(Flex, { className: clsx(fillerClassName, 'twa:flex-1') })] }), _jsx(Box, { ...contentProps, className: `ab-Tabs__Body twa:p-2 twa:flex-1 ${contentProps.className || ''} `, children: currentContent })] }) }));
|
|
69
|
+
}, children: _jsxs(Box, { ...boxProps, className: join(boxProps.className, 'ab-Tabs twa:flex twa:flex-col'), "data-selected-index": selectedIndex, children: [_jsxs(Flex, { flexDirection: "row", className: clsx('ab-Tabs__Strip', 'twa:bg-(--ab-cmp-tabs-strip__background)', 'twa:pt-0.5'), children: [_jsx(Box, { className: fillerClassName }), tabs, _jsx(Flex, { className: clsx(fillerClassName, 'twa:flex-1') })] }), _jsx(Box, { ...contentProps, className: `ab-Tabs__Body twa:p-2 twa:flex-1 ${contentProps.className || ''} `, children: currentContent })] }) }));
|
|
70
70
|
};
|
|
71
71
|
export const Tab = (props) => {
|
|
72
72
|
const { index, autoFocus, keyboardNavigation = true, className: propsClassName, ...boxProps } = props;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { ChevronRightIcon, ChevronDownIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, } from 'lucide-react';
|
|
5
5
|
import { TreeExpandState, TreeSelectionState } from '../../InfiniteTable';
|
|
6
|
-
import { MultiCombobox } from '../../Combobox';
|
|
6
|
+
import { GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME, MultiCombobox, } from '../../Combobox';
|
|
7
7
|
import { ComboboxChip } from '../../ui/combobox';
|
|
8
8
|
import { toDisplayValueDefault, toDisplayValueFromOptionTree } from '../treeUtils';
|
|
9
9
|
import { cn } from '../../../lib/utils';
|
|
@@ -57,15 +57,9 @@ function TreeItemLabel(props) {
|
|
|
57
57
|
// that base-ui's boolean indicator can't.
|
|
58
58
|
const indent = node.depth > 0 ? `calc(${node.depth} * var(--ab-tree-indent-size))` : 0;
|
|
59
59
|
const iconProps = {
|
|
60
|
-
style: {
|
|
61
|
-
// override this explicitly since the parent ComboboxItem
|
|
62
|
-
// sets this on highlighted items, but the color is not appropriate
|
|
63
|
-
//@ts-ignore ignore
|
|
64
|
-
'--ab-color-accent-foreground': 'var(--ab-color-accent)',
|
|
65
|
-
},
|
|
66
60
|
className: 'twa:size-4',
|
|
67
61
|
};
|
|
68
|
-
return (_jsxs(_Fragment, { children: [node.hasChildren ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": isExpanded ? 'Collapse' : 'Expand', "data-name": "expand-collapse-icon", onMouseDown: handleChevronMouseDown, onClick: handleChevronClick, style: { order: -1, marginLeft: indent }, className: cn('twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center twa:rounded', 'twa:cursor-pointer'), children: isExpanded ? _jsx(ChevronDownIcon, { ...iconProps }) : _jsx(ChevronRightIcon, { ...iconProps }) })) : reserveExpandSpace ? (_jsx("span", { "aria-hidden": "true", style: { order: -1, marginLeft: indent }, className: "twa:inline-block twa:size-4 twa:shrink-0" })) : null, _jsx(CheckBox, { checked: selected, checkSquareClassName: clsx(selected === true && 'twa:ring-1 twa:ring-accent-foreground') }), _jsx("span", { className: "twa:truncate twa:min-w-0 twa:flex-1", children: node.label })] }));
|
|
62
|
+
return (_jsxs(_Fragment, { children: [node.hasChildren ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": isExpanded ? 'Collapse' : 'Expand', "data-name": "expand-collapse-icon", onMouseDown: handleChevronMouseDown, onClick: handleChevronClick, style: { order: -1, marginLeft: indent }, className: cn('twa:bg-transparent twa:text-foreground', 'twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center twa:rounded', 'twa:cursor-pointer'), children: isExpanded ? _jsx(ChevronDownIcon, { ...iconProps }) : _jsx(ChevronRightIcon, { ...iconProps }) })) : reserveExpandSpace ? (_jsx("span", { "aria-hidden": "true", style: { order: -1, marginLeft: indent }, className: "twa:inline-block twa:size-4 twa:shrink-0" })) : null, _jsx(CheckBox, { checked: selected, checkSquareClassName: clsx(selected === true && 'twa:ring-1 twa:ring-accent-foreground') }), _jsx("span", { className: "twa:truncate twa:min-w-0 twa:flex-1", children: node.label })] }));
|
|
69
63
|
}
|
|
70
64
|
export function TreeDropdown(props) {
|
|
71
65
|
const { isLoading = false } = props;
|
|
@@ -454,7 +448,7 @@ export function TreeDropdown(props) {
|
|
|
454
448
|
}, onClick: (e) => {
|
|
455
449
|
e.preventDefault();
|
|
456
450
|
toggleExpandAll();
|
|
457
|
-
}, className: cn('ab-NewTreeDropdown-expand-all', 'twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center', 'twa:bg-
|
|
451
|
+
}, className: cn('ab-NewTreeDropdown-expand-all', 'twa:inline-flex twa:shrink-0 twa:items-center twa:justify-center', 'twa:bg-background', 'twa:size-6 twa:rounded-md twa:text-muted-foreground', 'twa:hover:text-foreground twa:hover:bg-ring/50 twa:cursor-pointer'
|
|
458
452
|
// 'twa:-mr-1'
|
|
459
453
|
), children: anyBranchExpanded ? (_jsx(ChevronsDownUpIcon, { className: "twa:size-4" })) : (_jsx(ChevronsUpDownIcon, { className: "twa:size-4" })) }));
|
|
460
454
|
}, [branchNodes.length, anyBranchExpanded, toggleExpandAll]);
|
|
@@ -479,6 +473,8 @@ export function TreeDropdown(props) {
|
|
|
479
473
|
resizable: props.resizable,
|
|
480
474
|
placeholder: props.placeholder,
|
|
481
475
|
showClear: showRemoveChip,
|
|
476
|
+
//@ts-ignore ignore
|
|
477
|
+
'data-name': props['data-name'] ?? 'Select Values',
|
|
482
478
|
renderItemLabel: (defaultLabel) => {
|
|
483
479
|
return defaultLabel;
|
|
484
480
|
},
|
|
@@ -520,10 +516,6 @@ export function GridFilterTreeDropdown(props) {
|
|
|
520
516
|
}
|
|
521
517
|
return (_jsxs("div", { className: "twa:text-ellipsis twa:overflow-hidden twa:whitespace-nowrap twa:flex-1000", "data-slot": "combobox-selected-values", children: [showSelectedCount && selectedLeafPaths.length > 0 && (_jsxs("span", { "data-name": "multiple-values-count", className: "twa:mr-0.5", children: ["(", selectedLeafPaths.length, ")"] })), children] }));
|
|
522
518
|
}, [placeholder, showSelectedCount]);
|
|
523
|
-
const mergedClassName = cn(
|
|
524
|
-
// Match the restyling GridFilterCombobox uses: remove the field border,
|
|
525
|
-
// flatten the shadow and absolutely position so the component fits the
|
|
526
|
-
// grid's floating-filter input box.
|
|
527
|
-
'twa:[.ab-FloatingFilter_&]:border-none twa:[.ab-FloatingFilter_&]:inset-y-0.5 twa:[.ab-FloatingFilter_&]:inset-x-0 twa:[.ab-FloatingFilter_&]:absolute twa:[.ab-FloatingFilter_&]:shadow-none twa:[.ab-FloatingFilter_&]:min-h-auto!', className);
|
|
519
|
+
const mergedClassName = cn(GRID_FILTER_COMBBOX_ADJUSTMENTS_CLASSNAME, className);
|
|
528
520
|
return (_jsx(TreeDropdown, { ...rest, placeholder: placeholder, className: mergedClassName, showClear: rest.showClear ?? false, resizable: rest.resizable ?? true, renderSelectedValues: renderSelectedValues }));
|
|
529
521
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const buttonVariants: (props?: {
|
|
4
4
|
variant?: "link" | "secondary" | "default" | "ghost" | "outline" | "destructive";
|
|
5
5
|
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
7
|
-
declare
|
|
7
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/button").ButtonProps & VariantProps<(props?: {
|
|
8
|
+
variant?: "link" | "secondary" | "default" | "ghost" | "outline" | "destructive";
|
|
9
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
8
11
|
export { Button, buttonVariants };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
3
4
|
import { cva } from 'class-variance-authority';
|
|
4
5
|
import { cn } from '../../lib/utils';
|
|
@@ -6,7 +7,7 @@ const buttonVariants = cva('twa:group/button twa:inline-flex twa:shrink-0 twa:it
|
|
|
6
7
|
variants: {
|
|
7
8
|
variant: {
|
|
8
9
|
default: 'twa:bg-primary twa:text-primary-foreground twa:hover:bg-primary/80',
|
|
9
|
-
outline: 'twa:border-border twa:bg-background twa:shadow-xs twa:hover:bg-muted twa:hover:text-foreground twa:aria-expanded:bg-muted twa:aria-expanded:text-foreground twa:dark:border-input
|
|
10
|
+
outline: 'twa:border-border twa:bg-background twa:shadow-xs twa:hover:bg-muted twa:hover:text-foreground twa:aria-expanded:bg-muted twa:aria-expanded:text-foreground twa:dark:border-input twa:dark:hover:bg-input/50',
|
|
10
11
|
secondary: 'twa:bg-secondary twa:text-secondary-foreground twa:hover:bg-secondary/80 twa:aria-expanded:bg-secondary twa:aria-expanded:text-secondary-foreground',
|
|
11
12
|
ghost: 'twa:bg-transparent twa:hover:bg-muted twa:hover:text-foreground twa:aria-expanded:bg-muted twa:aria-expanded:text-foreground twa:dark:hover:bg-muted/50',
|
|
12
13
|
destructive: 'twa:bg-destructive/10 twa:text-destructive twa:hover:bg-destructive/20 twa:focus-visible:border-destructive/40 twa:focus-visible:ring-destructive/20 twa:dark:bg-destructive/20 twa:dark:hover:bg-destructive/30 twa:dark:focus-visible:ring-destructive/40',
|
|
@@ -28,7 +29,7 @@ const buttonVariants = cva('twa:group/button twa:inline-flex twa:shrink-0 twa:it
|
|
|
28
29
|
size: 'default',
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
function Button({ className, variant = 'default', size = 'default', ...props }) {
|
|
32
|
-
return (_jsx(ButtonPrimitive, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
33
|
-
}
|
|
32
|
+
const Button = React.forwardRef(function Button({ className, variant = 'default', size = 'default', ...props }, ref) {
|
|
33
|
+
return (_jsx(ButtonPrimitive, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
34
|
+
});
|
|
34
35
|
export { Button, buttonVariants };
|
|
@@ -6,32 +6,32 @@ declare const Combobox: typeof ComboboxPrimitive.Root;
|
|
|
6
6
|
declare const RESIZABLE_VIRTUALIZED_LIST_CLASS = "twa:group-data-resizable/combobox-content:max-h-none twa:group-data-resizable/combobox-content:flex-1 twa:group-data-resizable/combobox-content:min-h-0 twa:group-data-resizable/combobox-content:flex twa:group-data-resizable/combobox-content:flex-col";
|
|
7
7
|
declare const RESIZABLE_VIRTUALIZED_SCROLL_CLASS = "twa:group-data-resizable/combobox-content:h-auto twa:group-data-resizable/combobox-content:max-h-none twa:group-data-resizable/combobox-content:flex-1 twa:group-data-resizable/combobox-content:min-h-0";
|
|
8
8
|
declare function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props): React.JSX.Element;
|
|
9
|
-
declare
|
|
10
|
-
export declare
|
|
11
|
-
declare
|
|
9
|
+
declare const ComboboxTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export declare const ComboboxClear: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteClearProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
declare const ComboboxInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteInputProps & {
|
|
12
12
|
isLoading?: boolean;
|
|
13
13
|
showTrigger?: boolean;
|
|
14
14
|
showClear?: boolean;
|
|
15
15
|
/** Ref to the visible `InputGroup` wrapper. Use as the popup anchor so the popup
|
|
16
16
|
* lines up with the perceived combobox box (input + buttons), not just the bare input. */
|
|
17
17
|
groupRef?: React.Ref<HTMLDivElement>;
|
|
18
|
-
}
|
|
18
|
+
}, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
19
19
|
declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, resizable, contentRef, style, ...props }: ComboboxPrimitive.Popup.Props & Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'> & {
|
|
20
20
|
resizable?: boolean;
|
|
21
21
|
contentRef?: (el: HTMLDivElement | null) => void;
|
|
22
22
|
maxLabelLength?: number;
|
|
23
23
|
}): React.JSX.Element;
|
|
24
|
-
declare
|
|
25
|
-
declare
|
|
26
|
-
renderCheckboxIndicator?: boolean | null | ComboboxPrimitive.ItemIndicator.Props[
|
|
27
|
-
}
|
|
28
|
-
declare
|
|
29
|
-
declare
|
|
24
|
+
declare const ComboboxList: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteListProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const ComboboxItem: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxItemProps & {
|
|
26
|
+
renderCheckboxIndicator?: boolean | null | ComboboxPrimitive.ItemIndicator.Props["render"];
|
|
27
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
declare const ComboboxGroup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
declare const ComboboxLabel: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
30
|
declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): React.JSX.Element;
|
|
31
|
-
declare
|
|
32
|
-
declare
|
|
33
|
-
declare
|
|
34
|
-
declare
|
|
31
|
+
declare const ComboboxEmpty: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
declare const ComboboxSeparator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare const ComboboxChips: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const ComboboxChip: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxChipProps & {
|
|
35
35
|
showRemove?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Optional override for the remove action. When provided, a plain button
|
|
@@ -42,7 +42,7 @@ declare function ComboboxChip({ className, children, showRemove, onRemove, ...pr
|
|
|
42
42
|
* the chip's composite list index and would target the wrong value.
|
|
43
43
|
*/
|
|
44
44
|
onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
45
|
-
}
|
|
46
|
-
declare
|
|
45
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
declare const ComboboxChipsInput: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
47
47
|
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement>;
|
|
48
48
|
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, RESIZABLE_VIRTUALIZED_LIST_CLASS, RESIZABLE_VIRTUALIZED_SCROLL_CLASS, };
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
4
4
|
import { cn, POPUP_Z_INDEX } from '../../lib/utils';
|
|
5
5
|
import { Button } from './button';
|
|
6
|
-
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput
|
|
6
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group';
|
|
7
7
|
import { CheckIcon, ChevronDownIcon, XIcon, Loader2Icon } from 'lucide-react';
|
|
8
8
|
import { CheckBox } from '../CheckBox';
|
|
9
9
|
const useFilteredItems = ComboboxPrimitive.useFilteredItems;
|
|
@@ -15,16 +15,16 @@ const RESIZABLE_VIRTUALIZED_SCROLL_CLASS = 'twa:group-data-resizable/combobox-co
|
|
|
15
15
|
function ComboboxValue({ ...props }) {
|
|
16
16
|
return _jsx(ComboboxPrimitive.Value, { "data-slot": "combobox-value", ...props });
|
|
17
17
|
}
|
|
18
|
-
function ComboboxTrigger({ className, children, ...props }) {
|
|
19
|
-
return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", className: cn('twa:[&_svg:not([class*=size-])]:size-4', className), ...props, children: [children, _jsx(ChevronDownIcon, { className: "twa:pointer-events-none twa:size-4 twa:text-muted-foreground" })] }));
|
|
20
|
-
}
|
|
21
|
-
export function ComboboxClear({ className, ...props }) {
|
|
22
|
-
return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs", className: "twa:min-h-auto!" }), className:
|
|
23
|
-
}
|
|
24
|
-
function ComboboxInput({ className, children, disabled = false, isLoading = false, showTrigger = true, showClear = false, groupRef, ...props }) {
|
|
18
|
+
const ComboboxTrigger = React.forwardRef(function ComboboxTrigger({ className, children, ...props }, ref) {
|
|
19
|
+
return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", className: cn('twa:[&_svg:not([class*=size-])]:size-4', className), ref: ref, ...props, children: [children, _jsx(ChevronDownIcon, { className: "twa:pointer-events-none twa:size-4 twa:text-muted-foreground" })] }));
|
|
20
|
+
});
|
|
21
|
+
export const ComboboxClear = React.forwardRef(function ComboboxClear({ className, ...props }, ref) {
|
|
22
|
+
return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs", className: "twa:min-h-auto!" }), className: className, ref: ref, ...props, children: _jsx(XIcon, { className: "twa:pointer-events-none", strokeWidth: 1 }) }));
|
|
23
|
+
});
|
|
24
|
+
const ComboboxInput = React.forwardRef(function ComboboxInput({ className, children, disabled = false, isLoading = false, showTrigger = true, showClear = false, groupRef, ...props }, ref) {
|
|
25
25
|
const { 'aria-label': ariaLabel, ...rest } = props;
|
|
26
|
-
return (_jsxs(InputGroup, { ref: groupRef, className: cn('twa:w-auto', className), "aria-label": ariaLabel, children: [_jsx(ComboboxPrimitive.Input, { render: _jsx(InputGroupInput, { disabled: disabled }), ...rest }), _jsxs(InputGroupAddon, { align: "inline-end", children: [isLoading && (_jsx(Loader2Icon, { className: "twa:size-4 twa:text-muted-foreground twa:animate-spin" })), showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", render: _jsx(ComboboxTrigger, {}), "data-slot": "
|
|
27
|
-
}
|
|
26
|
+
return (_jsxs(InputGroup, { ref: groupRef, className: cn('twa:w-auto', className), "aria-label": ariaLabel, children: [_jsx(ComboboxPrimitive.Input, { ref: ref, render: _jsx(InputGroupInput, { disabled: disabled }), ...rest }), _jsxs(InputGroupAddon, { align: "inline-end", children: [isLoading && (_jsx(Loader2Icon, { className: "twa:size-4 twa:text-muted-foreground twa:animate-spin" })), showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", render: _jsx(ComboboxTrigger, {}), "data-slot": "combobox-toggle", className: "twa:group-has-data-[slot=combobox-clear]/input-group:hidden twa:data-pressed:bg-transparent twa:min-h-auto!", disabled: disabled })), showClear && _jsx(ComboboxClear, { disabled: disabled })] }), children] }));
|
|
27
|
+
});
|
|
28
28
|
function ComboboxContent({ className, side = 'bottom', sideOffset = 6, align = 'start', alignOffset = 0, anchor, resizable = false, contentRef, style, ...props }) {
|
|
29
29
|
const sizeRef = React.useRef(null);
|
|
30
30
|
const popupElRef = React.useRef(null);
|
|
@@ -49,36 +49,36 @@ function ComboboxContent({ className, side = 'bottom', sideOffset = 6, align = '
|
|
|
49
49
|
: undefined;
|
|
50
50
|
return (_jsx(ComboboxPrimitive.Portal, { children: _jsx(ComboboxPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, anchor: anchor, className: `twa:isolate ${POPUP_Z_INDEX}`, children: _jsx(ComboboxPrimitive.Popup, { ref: popupRef, "data-slot": "combobox-content", "data-chips": !!anchor, "data-resizable": resizable || undefined, style: { ...resizableStyle, ...style }, className: cn('twa:group/combobox-content twa:relative twa:origin-(--transform-origin) twa:overflow-hidden twa:rounded-input twa:bg-popover twa:text-popover-foreground twa:shadow-md twa:ring-1 twa:ring-foreground/10 twa:duration-100 twa:data-[side=bottom]:slide-in-from-top-2 twa:data-[side=inline-end]:slide-in-from-left-2 twa:data-[side=inline-start]:slide-in-from-right-2 twa:data-[side=left]:slide-in-from-right-2 twa:data-[side=right]:slide-in-from-left-2 twa:data-[side=top]:slide-in-from-bottom-2 twa:*:data-[slot=input-group]:m-1 twa:*:data-[slot=input-group]:mb-0 twa:*:data-[slot=input-group]:h-8 twa:*:data-[slot=input-group]:border-input/30 twa:*:data-[slot=input-group]:bg-input/30 twa:*:data-[slot=input-group]:shadow-none twa:data-open:animate-in twa:data-open:fade-in-0 twa:data-open:zoom-in-95 twa:data-closed:animate-out twa:data-closed:fade-out-0 twa:data-closed:zoom-out-95', 'twa:max-h-[min(var(--available-height),80vh)]', 'twa:max-w-[min(var(--available-width),80vw)]', 'twa:min-w-[min(calc(var(--anchor-width)+--spacing(7)),var(--available-width),80vw)]', resizable ? 'twa:flex twa:flex-col twa:min-h-24' : 'twa:w-(--anchor-width)', className), ...props }) }) }));
|
|
51
51
|
}
|
|
52
|
-
function ComboboxList({ className, ...props }) {
|
|
53
|
-
return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", className: cn('twa:no-scrollbar twa:max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] twa:scroll-py-1 twa:overflow-y-auto twa:overscroll-contain twa:p-1 twa:data-empty:p-0', RESIZABLE_LIST_CLASS, className), ...props }));
|
|
54
|
-
}
|
|
52
|
+
const ComboboxList = React.forwardRef(function ComboboxList({ className, ...props }, ref) {
|
|
53
|
+
return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", className: cn('twa:no-scrollbar twa:max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] twa:scroll-py-1 twa:overflow-y-auto twa:overscroll-contain twa:p-1 twa:data-empty:p-0', RESIZABLE_LIST_CLASS, className), ref: ref, ...props }));
|
|
54
|
+
});
|
|
55
55
|
const checkboxIndicatorRender = (props, state) => {
|
|
56
56
|
const clsForSquare = state.selected ? 'twa:ring-1 twa:ring-accent-foreground' : '';
|
|
57
57
|
return (_jsx(CheckBox, { checked: state.selected, tabIndex: -1, checkSquareClassName: clsForSquare, className: "twa:p-0 twa:m-0 twa:cursor-pointer" }));
|
|
58
58
|
};
|
|
59
|
-
function ComboboxItem({ className, children, renderCheckboxIndicator, ...props }) {
|
|
60
|
-
return (_jsxs(ComboboxPrimitive.Item, { className: cn('twa:relative twa:flex twa:w-full twa:cursor-default twa:items-center twa:gap-2 twa:rounded-input twa:py-1.5 twa:pl-2 twa:text-sm twa:outline-hidden twa:select-none twa:data-highlighted:bg-accent twa:data-highlighted:text-accent-foreground twa:not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground twa:data-disabled:pointer-events-none twa:data-disabled:opacity-50 twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4', 'twa:cursor-pointer', renderCheckboxIndicator ? 'twa:pr-2' : 'twa:pr-8', className), ...props, "data-slot": "combobox-item", children: [renderCheckboxIndicator ? (_jsx(ComboboxPrimitive.ItemIndicator, { keepMounted: true, render: renderCheckboxIndicator === true ? checkboxIndicatorRender : renderCheckboxIndicator })) : null, children, !renderCheckboxIndicator && (_jsx(ComboboxPrimitive.ItemIndicator, { render: _jsx("span", { className: "twa:pointer-events-none twa:absolute twa:right-2 twa:flex twa:size-4 twa:items-center twa:justify-center" }), children: _jsx(CheckIcon, { className: "twa:pointer-events-none" }) }))] }));
|
|
61
|
-
}
|
|
62
|
-
function ComboboxGroup({ className, ...props }) {
|
|
63
|
-
return (_jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", className: cn(className), ...props }));
|
|
64
|
-
}
|
|
65
|
-
function ComboboxLabel({ className, ...props }) {
|
|
66
|
-
return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", className: cn('twa:px-2 twa:py-1.5 twa:text-xs twa:text-muted-foreground', className), ...props }));
|
|
67
|
-
}
|
|
59
|
+
const ComboboxItem = React.forwardRef(function ComboboxItem({ className, children, renderCheckboxIndicator, ...props }, ref) {
|
|
60
|
+
return (_jsxs(ComboboxPrimitive.Item, { ref: ref, className: cn('twa:relative twa:flex twa:w-full twa:cursor-default twa:items-center twa:gap-2 twa:rounded-input twa:py-1.5 twa:pl-2 twa:text-sm twa:outline-hidden twa:select-none twa:data-highlighted:bg-accent twa:data-highlighted:text-accent-foreground twa:not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground twa:data-disabled:pointer-events-none twa:data-disabled:opacity-50 twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4', 'twa:cursor-pointer', renderCheckboxIndicator ? 'twa:pr-2' : 'twa:pr-8', className), ...props, "data-slot": "combobox-item", children: [renderCheckboxIndicator ? (_jsx(ComboboxPrimitive.ItemIndicator, { keepMounted: true, render: renderCheckboxIndicator === true ? checkboxIndicatorRender : renderCheckboxIndicator })) : null, children, !renderCheckboxIndicator && (_jsx(ComboboxPrimitive.ItemIndicator, { render: _jsx("span", { className: "twa:pointer-events-none twa:absolute twa:right-2 twa:flex twa:size-4 twa:items-center twa:justify-center" }), children: _jsx(CheckIcon, { className: "twa:pointer-events-none" }) }))] }));
|
|
61
|
+
});
|
|
62
|
+
const ComboboxGroup = React.forwardRef(function ComboboxGroup({ className, ...props }, ref) {
|
|
63
|
+
return (_jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", className: cn(className), ref: ref, ...props }));
|
|
64
|
+
});
|
|
65
|
+
const ComboboxLabel = React.forwardRef(function ComboboxLabel({ className, ...props }, ref) {
|
|
66
|
+
return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", className: cn('twa:px-2 twa:py-1.5 twa:text-xs twa:text-muted-foreground', className), ref: ref, ...props }));
|
|
67
|
+
});
|
|
68
68
|
function ComboboxCollection({ ...props }) {
|
|
69
69
|
return _jsx(ComboboxPrimitive.Collection, { "data-slot": "combobox-collection", ...props });
|
|
70
70
|
}
|
|
71
|
-
function ComboboxEmpty({ className, ...props }) {
|
|
72
|
-
return (_jsx(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", className: cn('twa:hidden twa:w-full twa:justify-center twa:py-2 twa:text-center twa:text-sm twa:text-muted-foreground twa:group-data-empty/combobox-content:flex', className), ...props }));
|
|
73
|
-
}
|
|
74
|
-
function ComboboxSeparator({ className, ...props }) {
|
|
75
|
-
return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", className: cn('twa:-mx-1 twa:my-1 twa:h-px twa:bg-border', className), ...props }));
|
|
76
|
-
}
|
|
77
|
-
function ComboboxChips({ className, ...props }) {
|
|
78
|
-
return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", className: cn('twa:focus-within:outline-none', 'twa:flex twa:flex-wrap twa:items-center twa:gap-1.5 twa:rounded-input twa:border twa:border-input twa:bg-input-background twa:bg-clip-padding twa:text-sm twa:shadow-xs twa:transition-[color,box-shadow] twa:focus-within:border-ring twa:focus-within:ring-3 twa:focus-within:ring-ring/50 twa:has-aria-invalid:border-destructive twa:has-aria-invalid:ring-3 twa:has-aria-invalid:ring-destructive/20 twa:has-data-[slot=combobox-chip]:px-1.5 twa:dark:
|
|
79
|
-
}
|
|
80
|
-
function ComboboxChip({ className, children, showRemove = true, onRemove, ...props }) {
|
|
81
|
-
return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", className: cn('twa:flex twa:h-[calc(--spacing(5.5))] twa:w-fit twa:items-center twa:justify-center twa:gap-1 twa:rounded-input twa:bg-muted twa:px-1.5 twa:text-xs twa:font-medium twa:whitespace-nowrap twa:text-input-foreground twa:has-disabled:pointer-events-none twa:has-disabled:cursor-not-allowed twa:has-disabled:opacity-50 twa:has-data-[slot=combobox-chip-remove]:pr-0', className), ...props, children: [children, showRemove &&
|
|
71
|
+
const ComboboxEmpty = React.forwardRef(function ComboboxEmpty({ className, ...props }, ref) {
|
|
72
|
+
return (_jsx(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", className: cn('twa:hidden twa:w-full twa:justify-center twa:py-2 twa:text-center twa:text-sm twa:text-muted-foreground twa:group-data-empty/combobox-content:flex', className), ref: ref, ...props }));
|
|
73
|
+
});
|
|
74
|
+
const ComboboxSeparator = React.forwardRef(function ComboboxSeparator({ className, ...props }, ref) {
|
|
75
|
+
return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", className: cn('twa:-mx-1 twa:my-1 twa:h-px twa:bg-border', className), ref: ref, ...props }));
|
|
76
|
+
});
|
|
77
|
+
const ComboboxChips = React.forwardRef(function ComboboxChips({ className, ...props }, ref) {
|
|
78
|
+
return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", className: cn('twa:focus-within:outline-none', 'twa:flex twa:flex-wrap twa:items-center twa:gap-1.5 twa:rounded-input twa:border twa:border-input twa:bg-input-background twa:bg-clip-padding twa:text-sm twa:shadow-xs twa:transition-[color,box-shadow] twa:focus-within:border-ring twa:focus-within:ring-3 twa:focus-within:ring-ring/50 twa:has-aria-invalid:border-destructive twa:has-aria-invalid:ring-3 twa:has-aria-invalid:ring-destructive/20 twa:has-data-[slot=combobox-chip]:px-1.5 twa:dark:has-aria-invalid:border-destructive/50 twa:dark:has-aria-invalid:ring-destructive/40', 'twa:py-1', 'twa:px-2.5', 'twa:min-h-input', 'twa:[&>input]:max-h-[calc(var(--ab-input-height)-1.5*var(--ab-base-space))]!', className), ref: ref, ...props }));
|
|
79
|
+
});
|
|
80
|
+
const ComboboxChip = React.forwardRef(function ComboboxChip({ className, children, showRemove = true, onRemove, ...props }, ref) {
|
|
81
|
+
return (_jsxs(ComboboxPrimitive.Chip, { ref: ref, "data-slot": "combobox-chip", className: cn('twa:flex twa:h-[calc(--spacing(5.5))] twa:w-fit twa:items-center twa:justify-center twa:gap-1 twa:rounded-input twa:bg-muted twa:px-1.5 twa:text-xs twa:font-medium twa:whitespace-nowrap twa:text-input-foreground twa:has-disabled:pointer-events-none twa:has-disabled:cursor-not-allowed twa:has-disabled:opacity-50 twa:has-data-[slot=combobox-chip-remove]:pr-0', className), ...props, children: [children, showRemove &&
|
|
82
82
|
(onRemove ? (_jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", tabIndex: -1, "data-slot": "combobox-chip-remove", className: "twa:-ml-1 twa:opacity-50 twa:hover:opacity-100", onMouseDown: (e) => {
|
|
83
83
|
// Don't let base-ui's Chip onMouseDown steal focus back to the
|
|
84
84
|
// input before the click fires.
|
|
@@ -90,10 +90,10 @@ function ComboboxChip({ className, children, showRemove = true, onRemove, ...pro
|
|
|
90
90
|
e.stopPropagation();
|
|
91
91
|
onRemove(e);
|
|
92
92
|
}, children: _jsx(XIcon, { className: "twa:pointer-events-none" }) })) : (_jsx(ComboboxPrimitive.ChipRemove, { render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "twa:-ml-1 twa:opacity-50 twa:hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "twa:pointer-events-none" }) })))] }));
|
|
93
|
-
}
|
|
94
|
-
function ComboboxChipsInput({ className, ...props }) {
|
|
95
|
-
return (_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-chip-input", className: cn('twa:placeholder:text-muted-foreground twa:min-w-16 twa:flex-1 twa:px-2.5 twa:outline-none twa:border-none twa:bg-transparent twa:min-h-auto!', className), ...props }));
|
|
96
|
-
}
|
|
93
|
+
});
|
|
94
|
+
const ComboboxChipsInput = React.forwardRef(function ComboboxChipsInput({ className, ...props }, ref) {
|
|
95
|
+
return (_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-chip-input", className: cn('twa:placeholder:text-muted-foreground twa:min-w-16 twa:flex-1 twa:px-2.5 twa:outline-none twa:border-none twa:bg-transparent twa:min-h-auto!', className), ref: ref, ...props }));
|
|
96
|
+
});
|
|
97
97
|
function useComboboxAnchor() {
|
|
98
98
|
return React.useRef(null);
|
|
99
99
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
-
|
|
4
|
-
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
3
|
+
declare const InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
4
|
declare const inputGroupAddonVariants: (props?: {
|
|
6
5
|
align?: "inline-end" | "inline-start" | "block-end" | "block-start";
|
|
7
6
|
} & import("class-variance-authority/dist/types").ClassProp) => string;
|
|
8
7
|
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
9
|
-
declare const
|
|
8
|
+
declare const InputGroupButton: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react").ButtonProps & VariantProps<(props?: {
|
|
9
|
+
variant?: "link" | "secondary" | "default" | "ghost" | "outline" | "destructive";
|
|
10
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg";
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string>, "ref"> & React.RefAttributes<HTMLButtonElement>, "type" | "size"> & VariantProps<(props?: {
|
|
10
12
|
size?: "xs" | "sm" | "icon-xs" | "icon-sm";
|
|
11
|
-
} & import("class-variance-authority/dist/types").ClassProp) => string
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}): React.JSX.Element;
|
|
13
|
+
} & import("class-variance-authority/dist/types").ClassProp) => string> & {
|
|
14
|
+
type?: "button" | "submit" | "reset";
|
|
15
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
15
16
|
declare function InputGroupText({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
16
|
-
declare
|
|
17
|
-
declare
|
|
17
|
+
declare const InputGroupInput: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
declare const InputGroupTextarea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
18
19
|
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { cva } from 'class-variance-authority';
|
|
4
5
|
import { cn } from '../../lib/utils';
|
|
5
6
|
import { Button } from './button';
|
|
6
7
|
import { Input } from './input';
|
|
7
8
|
import { Textarea } from './textarea';
|
|
8
|
-
function InputGroup({ className, ...props }) {
|
|
9
|
-
return (_jsx("div", { "data-slot": "input-group", role: "group", className: cn('twa:group/input-group twa:relative twa:flex twa:h-input twa:w-full twa:min-w-0 twa:items-center twa:rounded-input twa:border twa:border-input twa:shadow-xs twa:transition-[color,box-shadow] twa:outline-none twa:in-data-[slot=combobox-content]:focus-within:border-inherit twa:in-data-[slot=combobox-content]:focus-within:ring-0 twa:has-[[data-slot=input-group-control]:focus-visible]:border-ring twa:has-[[data-slot=input-group-control]:focus-visible]:ring-3 twa:has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 twa:has-[[data-slot][aria-invalid=true]]:border-destructive twa:has-[[data-slot][aria-invalid=true]]:ring-3 twa:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 twa:has-[>[data-align=block-end]]:h-auto twa:has-[>[data-align=block-end]]:flex-col twa:has-[>[data-align=block-start]]:h-auto twa:has-[>[data-align=block-start]]:flex-col twa:has-[>textarea]:h-auto twa:dark:
|
|
10
|
-
}
|
|
9
|
+
const InputGroup = React.forwardRef(function InputGroup({ className, ...props }, ref) {
|
|
10
|
+
return (_jsx("div", { ref: ref, "data-slot": "input-group", role: "group", className: cn('twa:group/input-group twa:relative twa:flex twa:h-input twa:w-full twa:min-w-0 twa:items-center twa:rounded-input twa:border twa:border-input twa:shadow-xs twa:transition-[color,box-shadow] twa:outline-none twa:in-data-[slot=combobox-content]:focus-within:border-inherit twa:in-data-[slot=combobox-content]:focus-within:ring-0 twa:has-[[data-slot=input-group-control]:focus-visible]:border-ring twa:has-[[data-slot=input-group-control]:focus-visible]:ring-3 twa:has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 twa:has-[[data-slot][aria-invalid=true]]:border-destructive twa:has-[[data-slot][aria-invalid=true]]:ring-3 twa:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 twa:has-[>[data-align=block-end]]:h-auto twa:has-[>[data-align=block-end]]:flex-col twa:has-[>[data-align=block-start]]:h-auto twa:has-[>[data-align=block-start]]:flex-col twa:has-[>textarea]:h-auto twa:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 twa:has-[>[data-align=block-end]]:[&>input]:pt-3 twa:has-[>[data-align=block-start]]:[&>input]:pb-3 twa:has-[>[data-align=inline-end]]:[&>input]:pr-1.5 twa:has-[>[data-align=inline-start]]:[&>input]:pl-1.5', className), ...props }));
|
|
11
|
+
});
|
|
11
12
|
const inputGroupAddonVariants = cva('twa:flex twa:h-auto twa:cursor-text twa:items-center twa:justify-center twa:gap-2 twa:py-1.5 twa:text-sm twa:font-medium twa:text-muted-foreground twa:select-none twa:group-data-[disabled=true]/input-group:opacity-50 twa:[&>kbd]:rounded-[calc(var(--ab-border-radius))] twa:[&>svg:not([class*=size-])]:size-4', {
|
|
12
13
|
variants: {
|
|
13
14
|
align: {
|
|
@@ -42,16 +43,16 @@ const inputGroupButtonVariants = cva('twa:flex twa:items-center twa:gap-2 twa:te
|
|
|
42
43
|
size: 'xs',
|
|
43
44
|
},
|
|
44
45
|
});
|
|
45
|
-
function InputGroupButton({ className, type = 'button', variant = 'ghost', size = 'xs', ...props }) {
|
|
46
|
-
return (_jsx(Button, { type: type, "data-size": size, variant: variant, className: cn(inputGroupButtonVariants({ size }), className), ...props }));
|
|
47
|
-
}
|
|
46
|
+
const InputGroupButton = React.forwardRef(function InputGroupButton({ className, type = 'button', variant = 'ghost', size = 'xs', ...props }, ref) {
|
|
47
|
+
return (_jsx(Button, { type: type, "data-size": size, variant: variant, className: cn(inputGroupButtonVariants({ size }), className), ref: ref, ...props }));
|
|
48
|
+
});
|
|
48
49
|
function InputGroupText({ className, ...props }) {
|
|
49
50
|
return (_jsx("span", { className: cn('twa:flex twa:items-center twa:gap-2 twa:text-sm twa:text-muted-foreground twa:[&_svg]:pointer-events-none twa:[&_svg:not([class*=size-])]:size-4', className), ...props }));
|
|
50
51
|
}
|
|
51
|
-
function InputGroupInput({ className, ...props }) {
|
|
52
|
-
return (_jsx(Input, { "data-slot": "input-group-control", className: cn('twa:flex-1 twa:rounded-none twa:border-0 twa:bg-transparent twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:aria-invalid:ring-0 twa:dark:bg-transparent', className), ...props }));
|
|
53
|
-
}
|
|
54
|
-
function InputGroupTextarea({ className, ...props }) {
|
|
55
|
-
return (_jsx(Textarea, { "data-slot": "input-group-control", className: cn('twa:flex-1 twa:resize-none twa:rounded-none twa:border-0 twa:bg-transparent twa:py-2 twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:aria-invalid:ring-0 twa:dark:bg-transparent', className), ...props }));
|
|
56
|
-
}
|
|
52
|
+
const InputGroupInput = React.forwardRef(function InputGroupInput({ className, ...props }, ref) {
|
|
53
|
+
return (_jsx(Input, { "data-slot": "input-group-control", className: cn('twa:flex-1 twa:rounded-none twa:border-0 twa:bg-transparent twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:aria-invalid:ring-0 twa:dark:bg-transparent', className), ref: ref, ...props }));
|
|
54
|
+
});
|
|
55
|
+
const InputGroupTextarea = React.forwardRef(function InputGroupTextarea({ className, ...props }, ref) {
|
|
56
|
+
return (_jsx(Textarea, { "data-slot": "input-group-control", className: cn('twa:flex-1 twa:resize-none twa:rounded-none twa:border-0 twa:bg-transparent twa:py-2 twa:shadow-none twa:ring-0 twa:focus-visible:ring-0 twa:aria-invalid:ring-0 twa:dark:bg-transparent', className), ...props, ref: ref }));
|
|
57
|
+
});
|
|
57
58
|
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|