@scaleflex/ui-tw 0.0.152 → 0.0.154
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/button/button.types.d.ts +4 -4
- package/button/components/end-icon.js +3 -0
- package/button/components/start-icon.js +12 -6
- package/color-picker/color-picker.component.js +6 -3
- package/color-picker/color-picker.types.d.ts +4 -4
- package/combobox/combobox-multi-checkbox/combobox-multi-checkbox.component.js +8 -4
- package/combobox/combobox-multi-inline/combobox-multi-inline.component.js +6 -3
- package/combobox/combobox-multi-tag/combobox-multi-tag.component.js +1 -1
- package/combobox/combobox-single/combobox-single.component.js +3 -3
- package/combobox/combobox-users/combobox-users.component.js +9 -8
- package/combobox/combobox.component.js +22 -14
- package/combobox/combobox.types.d.ts +8 -8
- package/command/command.component.js +23 -12
- package/command/command.utils.d.ts +2 -2
- package/command/command.utils.js +1 -1
- package/dialog/dialog.component.d.ts +1 -1
- package/dialog/dialog.component.js +4 -2
- package/dialog/dialog.types.d.ts +2 -0
- 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/form/components/form-checkbox-field.component.js +4 -2
- package/form/components/form-checkbox-group-field.component.js +7 -5
- package/form/components/form-field-group.component.js +7 -5
- package/form/components/form-radio-group-field.component.js +7 -5
- package/form/components/form-switch-field.component.js +6 -4
- package/form/form.types.d.ts +24 -24
- package/input-tags/input-tags.component.js +16 -19
- package/label/components/label-icon.js +8 -3
- package/label/label.types.d.ts +4 -4
- package/package.json +2 -2
- package/select/components/select-icon.js +3 -0
- package/select/components/selector.js +13 -9
- package/select/select.types.d.ts +5 -5
- package/textarea/components/textarea-with-actions.js +7 -5
- package/textarea/textarea.types.d.ts +2 -2
- package/tooltip/tooltip.component.js +3 -2
- package/tooltip/tooltip.types.d.ts +1 -1
- 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/button/button.types.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ export type ButtonSizeType = (typeof ButtonSize)[keyof typeof ButtonSize];
|
|
|
6
6
|
export type ButtonVariantType = (typeof ButtonVariant)[keyof typeof ButtonVariant];
|
|
7
7
|
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
asChild?: boolean;
|
|
9
|
-
startIcon?: ReactElement;
|
|
10
|
-
endIcon?: ReactElement;
|
|
9
|
+
startIcon?: ReactElement | (() => ReactElement);
|
|
10
|
+
endIcon?: ReactElement | (() => ReactElement);
|
|
11
11
|
loading?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export interface EndIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
15
|
-
icon?: ReactElement;
|
|
15
|
+
icon?: ReactElement | (() => ReactElement);
|
|
16
16
|
}
|
|
17
17
|
export interface StartIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
18
|
-
icon?: ReactElement;
|
|
18
|
+
icon?: ReactElement | (() => ReactElement);
|
|
19
19
|
loading?: boolean;
|
|
20
20
|
}
|
|
@@ -18,6 +18,9 @@ var EndIcon = function EndIcon(props) {
|
|
|
18
18
|
variant = props.variant,
|
|
19
19
|
rest = _objectWithoutProperties(props, _excluded);
|
|
20
20
|
if (!icon) return null;
|
|
21
|
+
if (typeof icon === 'function') {
|
|
22
|
+
return icon();
|
|
23
|
+
}
|
|
21
24
|
return /*#__PURE__*/cloneElement(icon, _objectSpread({
|
|
22
25
|
className: endIconVariants({
|
|
23
26
|
size: size,
|
|
@@ -22,15 +22,21 @@ var StartIcon = function StartIcon(props) {
|
|
|
22
22
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
23
23
|
rest = _objectWithoutProperties(props, _excluded);
|
|
24
24
|
if (!icon) return null;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (loading) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
27
|
+
className: cn(startIconVariants({
|
|
28
|
+
size: size
|
|
29
|
+
}), 'animate-spin')
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (typeof icon === 'function') {
|
|
33
|
+
return icon();
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/cloneElement(icon, _objectSpread({
|
|
30
36
|
className: startIconVariants({
|
|
31
37
|
variant: variant,
|
|
32
38
|
size: size
|
|
33
39
|
})
|
|
34
|
-
}, rest))
|
|
40
|
+
}, rest));
|
|
35
41
|
};
|
|
36
42
|
export { StartIcon, startIconVariants };
|
|
@@ -27,6 +27,9 @@ function ColorPicker(_ref) {
|
|
|
27
27
|
_ref$displayAsInput = _ref.displayAsInput,
|
|
28
28
|
displayAsInput = _ref$displayAsInput === void 0 ? false : _ref$displayAsInput,
|
|
29
29
|
overlayClassName = _ref.overlayClassName;
|
|
30
|
+
var resolvedTitle = typeof title === 'function' ? title() : title;
|
|
31
|
+
var resolvedCancelLabel = typeof cancelLabel === 'function' ? cancelLabel() : cancelLabel;
|
|
32
|
+
var resolvedSelectLabel = typeof selectLabel === 'function' ? selectLabel() : selectLabel;
|
|
30
33
|
var _useState = useState(value),
|
|
31
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
35
|
tempValue = _useState2[0],
|
|
@@ -77,7 +80,7 @@ function ColorPicker(_ref) {
|
|
|
77
80
|
variant: "centered",
|
|
78
81
|
className: cn('w-[316px]', className),
|
|
79
82
|
overlayClassName: overlayClassName
|
|
80
|
-
}, /*#__PURE__*/React.createElement(DialogHeader, null, /*#__PURE__*/React.createElement(DialogIcon, null, /*#__PURE__*/React.createElement(PaletteIcon, null)), /*#__PURE__*/React.createElement(DialogTitle, null,
|
|
83
|
+
}, /*#__PURE__*/React.createElement(DialogHeader, null, /*#__PURE__*/React.createElement(DialogIcon, null, /*#__PURE__*/React.createElement(PaletteIcon, null)), /*#__PURE__*/React.createElement(DialogTitle, null, resolvedTitle || 'Pick color')), /*#__PURE__*/React.createElement(DialogBody, {
|
|
81
84
|
className: "space-y-4"
|
|
82
85
|
}, /*#__PURE__*/React.createElement(HexColorPicker, {
|
|
83
86
|
color: tempValue,
|
|
@@ -107,11 +110,11 @@ function ColorPicker(_ref) {
|
|
|
107
110
|
variant: "outline",
|
|
108
111
|
className: "flex-1",
|
|
109
112
|
onClick: handleCancel
|
|
110
|
-
},
|
|
113
|
+
}, resolvedCancelLabel || 'Cancel')), /*#__PURE__*/React.createElement(DialogTrigger, {
|
|
111
114
|
asChild: true
|
|
112
115
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
113
116
|
className: "flex-1",
|
|
114
117
|
onClick: handleSelect
|
|
115
|
-
},
|
|
118
|
+
}, resolvedSelectLabel || 'Select')))));
|
|
116
119
|
}
|
|
117
120
|
export { ColorPicker };
|
|
@@ -7,12 +7,12 @@ export type ColorPickerProps = {
|
|
|
7
7
|
inputTriggerProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
8
8
|
className?: string;
|
|
9
9
|
overlayClassName?: string;
|
|
10
|
-
title?: string | ReactElement;
|
|
11
|
-
cancelLabel?: string | ReactElement;
|
|
12
|
-
selectLabel?: string | ReactElement;
|
|
10
|
+
title?: string | ReactElement | (() => ReactElement);
|
|
11
|
+
cancelLabel?: string | ReactElement | (() => ReactElement);
|
|
12
|
+
selectLabel?: string | ReactElement | (() => ReactElement);
|
|
13
13
|
inputClassName?: string;
|
|
14
14
|
children?: ReactNode;
|
|
15
|
-
placeholder?:
|
|
15
|
+
placeholder?: string;
|
|
16
16
|
presetColors?: string[];
|
|
17
17
|
displayAsInput?: boolean;
|
|
18
18
|
};
|
|
@@ -45,6 +45,7 @@ export function ComboboxMultiCheckbox(_ref) {
|
|
|
45
45
|
_ref$displayCount = _ref.displayCount,
|
|
46
46
|
displayCount = _ref$displayCount === void 0 ? false : _ref$displayCount,
|
|
47
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
var resolvedLabel = typeof label === 'function' ? label() : label;
|
|
48
49
|
var _useState = useState(defaultOpen),
|
|
49
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
51
|
open = _useState2[0],
|
|
@@ -58,7 +59,8 @@ export function ComboboxMultiCheckbox(_ref) {
|
|
|
58
59
|
var option = _step.value;
|
|
59
60
|
if (isOptionGroup(option)) {
|
|
60
61
|
if (option.value && selectedValue.includes(option.value)) {
|
|
61
|
-
|
|
62
|
+
var l = typeof option.label === 'function' ? option.label() : option.label;
|
|
63
|
+
labels.push(l);
|
|
62
64
|
}
|
|
63
65
|
var _iterator2 = _createForOfIteratorHelper(option.options),
|
|
64
66
|
_step2;
|
|
@@ -66,7 +68,8 @@ export function ComboboxMultiCheckbox(_ref) {
|
|
|
66
68
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
67
69
|
var sub = _step2.value;
|
|
68
70
|
if (selectedValue.includes(sub.value)) {
|
|
69
|
-
|
|
71
|
+
var _l = typeof sub.label === 'function' ? sub.label() : sub.label;
|
|
72
|
+
labels.push(_l);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
} catch (err) {
|
|
@@ -76,7 +79,8 @@ export function ComboboxMultiCheckbox(_ref) {
|
|
|
76
79
|
}
|
|
77
80
|
} else {
|
|
78
81
|
if (selectedValue.includes(option.value)) {
|
|
79
|
-
|
|
82
|
+
var _l2 = typeof option.label === 'function' ? option.label() : option.label;
|
|
83
|
+
labels.push(_l2);
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -173,7 +177,7 @@ export function ComboboxMultiCheckbox(_ref) {
|
|
|
173
177
|
}, /*#__PURE__*/React.createElement(ComboboxCheckboxTrigger, {
|
|
174
178
|
open: open,
|
|
175
179
|
icon: icon,
|
|
176
|
-
label:
|
|
180
|
+
label: resolvedLabel,
|
|
177
181
|
disabled: disabled,
|
|
178
182
|
className: className,
|
|
179
183
|
size: size,
|
|
@@ -53,7 +53,8 @@ export function ComboboxMultiInline(_ref) {
|
|
|
53
53
|
var option = _step.value;
|
|
54
54
|
if (isOptionGroup(option)) {
|
|
55
55
|
if (option.value && value.includes(option.value)) {
|
|
56
|
-
|
|
56
|
+
var label = typeof option.label === 'function' ? option.label() : option.label;
|
|
57
|
+
labels.push(label);
|
|
57
58
|
}
|
|
58
59
|
var _iterator2 = _createForOfIteratorHelper(option.options),
|
|
59
60
|
_step2;
|
|
@@ -61,7 +62,8 @@ export function ComboboxMultiInline(_ref) {
|
|
|
61
62
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
62
63
|
var sub = _step2.value;
|
|
63
64
|
if (value.includes(sub.value)) {
|
|
64
|
-
|
|
65
|
+
var _label = typeof sub.label === 'function' ? sub.label() : sub.label;
|
|
66
|
+
labels.push(_label);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
} catch (err) {
|
|
@@ -71,7 +73,8 @@ export function ComboboxMultiInline(_ref) {
|
|
|
71
73
|
}
|
|
72
74
|
} else {
|
|
73
75
|
if (value.includes(option.value)) {
|
|
74
|
-
|
|
76
|
+
var _label2 = typeof option.label === 'function' ? option.label() : option.label;
|
|
77
|
+
labels.push(_label2);
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
@@ -114,7 +114,7 @@ export function ComboboxMultiTag(_ref) {
|
|
|
114
114
|
isTriggerOnBlur: true
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
}, option.label);
|
|
117
|
+
}, typeof option.label === 'function' ? option.label() : option.label);
|
|
118
118
|
})), isSelected ? /*#__PURE__*/React.createElement("div", {
|
|
119
119
|
className: "flex w-full items-center justify-between p-1.5"
|
|
120
120
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -50,13 +50,13 @@ export function ComboboxSingle(_ref) {
|
|
|
50
50
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
51
|
var option = _step.value;
|
|
52
52
|
if (isOptionGroup(option)) {
|
|
53
|
-
if (option.value === value) return option.label;
|
|
53
|
+
if (option.value === value) return typeof option.label === 'function' ? option.label() : option.label;
|
|
54
54
|
var found = option.options.find(function (o) {
|
|
55
55
|
return o.value === value;
|
|
56
56
|
});
|
|
57
|
-
if (found) return found.label;
|
|
57
|
+
if (found) return typeof found.label === 'function' ? found.label() : found.label;
|
|
58
58
|
} else if (option.value === value) {
|
|
59
|
-
return option.label;
|
|
59
|
+
return typeof option.label === 'function' ? option.label() : option.label;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
} catch (err) {
|
|
@@ -152,7 +152,7 @@ export function ComboboxUsers(_ref) {
|
|
|
152
152
|
alt: "profile image"
|
|
153
153
|
}) : /*#__PURE__*/React.createElement(UserCircle2Icon, {
|
|
154
154
|
className: "text-muted-foreground size-5"
|
|
155
|
-
}), /*#__PURE__*/React.createElement("span", null, option.email)));
|
|
155
|
+
}), /*#__PURE__*/React.createElement("span", null, typeof option.email === 'function' ? option.email() : option.email)));
|
|
156
156
|
})), isSelected ? /*#__PURE__*/React.createElement("div", {
|
|
157
157
|
className: "flex w-full items-center justify-between p-1.5"
|
|
158
158
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -181,9 +181,10 @@ export function ComboboxUsers(_ref) {
|
|
|
181
181
|
className: "border-0 border-none"
|
|
182
182
|
}), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, null, "No results found."), options === null || options === void 0 ? void 0 : options.map(function (option, groupIndex) {
|
|
183
183
|
if (isUserOptionGroup(option)) {
|
|
184
|
+
var resolvedGroupLabel = typeof option.label === 'function' ? option.label() : option.label;
|
|
184
185
|
return /*#__PURE__*/React.createElement(CommandGroup, {
|
|
185
186
|
key: groupIndex,
|
|
186
|
-
heading: !option.value ?
|
|
187
|
+
heading: !option.value ? resolvedGroupLabel : undefined,
|
|
187
188
|
size: size
|
|
188
189
|
}, option.value && /*#__PURE__*/React.createElement(CommandItem, {
|
|
189
190
|
size: size,
|
|
@@ -202,26 +203,26 @@ export function ComboboxUsers(_ref) {
|
|
|
202
203
|
className: cn('text-secondary-foreground', selectLabelVariants({
|
|
203
204
|
size: size
|
|
204
205
|
}))
|
|
205
|
-
},
|
|
206
|
+
}, resolvedGroupLabel), option.options.map(function (_ref3) {
|
|
206
207
|
var name = _ref3.name,
|
|
207
208
|
email = _ref3.email,
|
|
208
209
|
profileUrl = _ref3.profileUrl,
|
|
209
|
-
|
|
210
|
+
subValue = _ref3.value,
|
|
210
211
|
disabled = _ref3.disabled;
|
|
211
|
-
var isGroupSelected = option.value &&
|
|
212
|
+
var isGroupSelected = option.value && value.includes(option.value);
|
|
212
213
|
return /*#__PURE__*/React.createElement(CommandUserItem, {
|
|
213
214
|
size: size,
|
|
214
215
|
multiple: true,
|
|
215
216
|
disabled: disabled || !!isGroupSelected,
|
|
216
|
-
key:
|
|
217
|
+
key: subValue,
|
|
217
218
|
name: name,
|
|
218
219
|
email: email,
|
|
219
220
|
profileUrl: profileUrl,
|
|
220
|
-
value:
|
|
221
|
+
value: subValue,
|
|
221
222
|
isGroup: !!option.label,
|
|
222
223
|
selectedValue: value,
|
|
223
224
|
onSelect: function onSelect() {
|
|
224
|
-
return toggleValue(
|
|
225
|
+
return toggleValue(subValue);
|
|
225
226
|
}
|
|
226
227
|
});
|
|
227
228
|
}), showGroupSeparator && groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
|
|
@@ -196,7 +196,7 @@ export function ComboboxContent(_ref4) {
|
|
|
196
196
|
selectedValue = _ref4.value,
|
|
197
197
|
_onSelect = _ref4.onSelect,
|
|
198
198
|
_ref4$size = _ref4.size,
|
|
199
|
-
size = _ref4$size === void 0 ?
|
|
199
|
+
size = _ref4$size === void 0 ? FormSize.Md : _ref4$size,
|
|
200
200
|
_ref4$multiple = _ref4.multiple,
|
|
201
201
|
multiple = _ref4$multiple === void 0 ? false : _ref4$multiple,
|
|
202
202
|
className = _ref4.className,
|
|
@@ -217,11 +217,11 @@ export function ComboboxContent(_ref4) {
|
|
|
217
217
|
placeholder: searchPlaceholder,
|
|
218
218
|
className: "border-0 border-none"
|
|
219
219
|
}), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, null, "No results found."), options === null || options === void 0 ? void 0 : options.map(function (option, groupIndex) {
|
|
220
|
-
var _option$optionLabel;
|
|
221
220
|
if (isOptionGroup(option)) {
|
|
221
|
+
var resolvedGroupLabel = typeof option.label === 'function' ? option.label() : option.label;
|
|
222
222
|
return /*#__PURE__*/React.createElement(CommandGroup, {
|
|
223
223
|
key: groupIndex,
|
|
224
|
-
heading: !option.value || noGroupSelection ?
|
|
224
|
+
heading: !option.value || noGroupSelection ? resolvedGroupLabel : undefined,
|
|
225
225
|
size: size
|
|
226
226
|
}, !noGroupSelection && option.value && /*#__PURE__*/React.createElement(CommandItem, {
|
|
227
227
|
size: size,
|
|
@@ -240,7 +240,7 @@ export function ComboboxContent(_ref4) {
|
|
|
240
240
|
className: cn('text-secondary-foreground', selectLabelVariants({
|
|
241
241
|
size: size
|
|
242
242
|
}))
|
|
243
|
-
},
|
|
243
|
+
}, resolvedGroupLabel), option.options.map(function (_ref5) {
|
|
244
244
|
var label = _ref5.label,
|
|
245
245
|
optionLabel = _ref5.optionLabel,
|
|
246
246
|
value = _ref5.value,
|
|
@@ -248,6 +248,8 @@ export function ComboboxContent(_ref4) {
|
|
|
248
248
|
icon = _ref5.icon,
|
|
249
249
|
tooltip = _ref5.tooltip,
|
|
250
250
|
disabledTooltip = _ref5.disabledTooltip;
|
|
251
|
+
var resolvedLabel = typeof label === 'function' ? label() : label;
|
|
252
|
+
var resolvedOptionLabel = typeof optionLabel === 'function' ? optionLabel() : optionLabel;
|
|
251
253
|
var isGroupSelected = !noGroupSelection && multiple && option.value && Array.isArray(selectedValue) && selectedValue.includes(option.value);
|
|
252
254
|
return /*#__PURE__*/React.createElement(CommandItem, {
|
|
253
255
|
size: size,
|
|
@@ -258,14 +260,16 @@ export function ComboboxContent(_ref4) {
|
|
|
258
260
|
value: value,
|
|
259
261
|
tooltip: tooltip,
|
|
260
262
|
disabledTooltip: disabledTooltip,
|
|
261
|
-
isGroup: !!
|
|
263
|
+
isGroup: !!resolvedGroupLabel,
|
|
262
264
|
selectedValue: selectedValue,
|
|
263
265
|
onSelect: function onSelect() {
|
|
264
266
|
return _onSelect(value);
|
|
265
267
|
}
|
|
266
|
-
},
|
|
268
|
+
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel);
|
|
267
269
|
}), showGroupSeparator && groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
|
|
268
270
|
}
|
|
271
|
+
var resolvedLabel = typeof option.label === 'function' ? option.label() : option.label;
|
|
272
|
+
var resolvedOptionLabel = typeof option.optionLabel === 'function' ? option.optionLabel() : option.optionLabel;
|
|
269
273
|
return /*#__PURE__*/React.createElement(CommandGroup, {
|
|
270
274
|
key: groupIndex
|
|
271
275
|
}, /*#__PURE__*/React.createElement(CommandItem, {
|
|
@@ -281,7 +285,7 @@ export function ComboboxContent(_ref4) {
|
|
|
281
285
|
onSelect: function onSelect() {
|
|
282
286
|
return _onSelect(option.value);
|
|
283
287
|
}
|
|
284
|
-
},
|
|
288
|
+
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel));
|
|
285
289
|
}), !fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
286
290
|
actions: actions
|
|
287
291
|
})), fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
@@ -293,7 +297,7 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
293
297
|
selectedValue = _ref6.value,
|
|
294
298
|
_onSelect2 = _ref6.onSelect,
|
|
295
299
|
_ref6$size = _ref6.size,
|
|
296
|
-
size = _ref6$size === void 0 ?
|
|
300
|
+
size = _ref6$size === void 0 ? FormSize.Md : _ref6$size,
|
|
297
301
|
className = _ref6.className,
|
|
298
302
|
_ref6$showGroupSepara = _ref6.showGroupSeparator,
|
|
299
303
|
showGroupSeparator = _ref6$showGroupSepara === void 0 ? false : _ref6$showGroupSepara,
|
|
@@ -310,11 +314,11 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
310
314
|
placeholder: searchPlaceholder,
|
|
311
315
|
className: "border-0 border-none"
|
|
312
316
|
}), /*#__PURE__*/React.createElement(CommandList, null, /*#__PURE__*/React.createElement(CommandEmpty, null, "No results found."), options === null || options === void 0 ? void 0 : options.map(function (option, groupIndex) {
|
|
313
|
-
var _option$optionLabel2;
|
|
314
317
|
if (isOptionGroup(option)) {
|
|
318
|
+
var resolvedGroupLabel = typeof option.label === 'function' ? option.label() : option.label;
|
|
315
319
|
return /*#__PURE__*/React.createElement(CommandGroup, {
|
|
316
320
|
key: groupIndex,
|
|
317
|
-
heading: !option.value ?
|
|
321
|
+
heading: !option.value ? resolvedGroupLabel : undefined,
|
|
318
322
|
size: size
|
|
319
323
|
}, option.value && /*#__PURE__*/React.createElement(CommandCheckboxItem, {
|
|
320
324
|
size: size,
|
|
@@ -332,7 +336,7 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
332
336
|
className: cn('text-secondary-foreground', selectLabelVariants({
|
|
333
337
|
size: size
|
|
334
338
|
}))
|
|
335
|
-
},
|
|
339
|
+
}, resolvedGroupLabel), option.options.map(function (_ref7) {
|
|
336
340
|
var label = _ref7.label,
|
|
337
341
|
optionLabel = _ref7.optionLabel,
|
|
338
342
|
value = _ref7.value,
|
|
@@ -340,6 +344,8 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
340
344
|
icon = _ref7.icon,
|
|
341
345
|
tooltip = _ref7.tooltip,
|
|
342
346
|
disabledTooltip = _ref7.disabledTooltip;
|
|
347
|
+
var resolvedLabel = typeof label === 'function' ? label() : label;
|
|
348
|
+
var resolvedOptionLabel = typeof optionLabel === 'function' ? optionLabel() : optionLabel;
|
|
343
349
|
var isGroupSelected = option.value && Array.isArray(selectedValue) && selectedValue.includes(option.value);
|
|
344
350
|
return /*#__PURE__*/React.createElement(CommandCheckboxItem, {
|
|
345
351
|
size: size,
|
|
@@ -349,14 +355,16 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
349
355
|
value: value,
|
|
350
356
|
tooltip: tooltip,
|
|
351
357
|
disabledTooltip: disabledTooltip,
|
|
352
|
-
isGroup: !!
|
|
358
|
+
isGroup: !!resolvedGroupLabel,
|
|
353
359
|
selectedValue: selectedValue,
|
|
354
360
|
onSelect: function onSelect() {
|
|
355
361
|
return _onSelect2(value);
|
|
356
362
|
}
|
|
357
|
-
},
|
|
363
|
+
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel);
|
|
358
364
|
}), showGroupSeparator && groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
|
|
359
365
|
}
|
|
366
|
+
var resolvedLabel = typeof option.label === 'function' ? option.label() : option.label;
|
|
367
|
+
var resolvedOptionLabel = typeof option.optionLabel === 'function' ? option.optionLabel() : option.optionLabel;
|
|
360
368
|
return /*#__PURE__*/React.createElement(CommandGroup, {
|
|
361
369
|
key: groupIndex
|
|
362
370
|
}, /*#__PURE__*/React.createElement(CommandCheckboxItem, {
|
|
@@ -371,7 +379,7 @@ export function ComboboxCheckboxContent(_ref6) {
|
|
|
371
379
|
onSelect: function onSelect() {
|
|
372
380
|
return _onSelect2(option.value);
|
|
373
381
|
}
|
|
374
|
-
},
|
|
382
|
+
}, resolvedOptionLabel !== null && resolvedOptionLabel !== void 0 ? resolvedOptionLabel : resolvedLabel));
|
|
375
383
|
}), !fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
376
384
|
actions: actions
|
|
377
385
|
})), fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
@@ -25,7 +25,7 @@ export type ComboboxTriggerProps = {
|
|
|
25
25
|
export type ComboboxCheckboxTriggerProps = ComboboxTriggerProps & {
|
|
26
26
|
optionsLength: number;
|
|
27
27
|
selectedLength: number;
|
|
28
|
-
label?: ReactNode
|
|
28
|
+
label?: ReactNode;
|
|
29
29
|
displayCount?: boolean;
|
|
30
30
|
icon?: ElementType;
|
|
31
31
|
iconClassName?: string;
|
|
@@ -61,20 +61,20 @@ export interface CommandGroupProps extends ComponentProps<typeof CommandPrimitiv
|
|
|
61
61
|
size?: FormSizeType;
|
|
62
62
|
}
|
|
63
63
|
export interface CommandItemProps extends ComponentProps<typeof CommandPrimitive.Item> {
|
|
64
|
-
icon?: ReactElement;
|
|
64
|
+
icon?: ReactElement | (() => ReactElement);
|
|
65
65
|
size?: FormSizeType;
|
|
66
|
-
tooltip?: ReactElement | string;
|
|
67
|
-
disabledTooltip?: ReactElement | string;
|
|
66
|
+
tooltip?: ReactElement | string | (() => ReactElement);
|
|
67
|
+
disabledTooltip?: ReactElement | string | (() => ReactElement);
|
|
68
68
|
isGroup?: boolean;
|
|
69
|
-
shortcut?: ReactElement | string;
|
|
69
|
+
shortcut?: ReactElement | string | (() => ReactElement);
|
|
70
70
|
selectedValue?: string | string[];
|
|
71
71
|
multiple?: boolean;
|
|
72
72
|
iconClassName?: string;
|
|
73
73
|
textClassName?: string;
|
|
74
74
|
}
|
|
75
75
|
export interface CommandUserItemProps extends Omit<CommandItemProps, 'icon' | 'children' | 'tooltip' | 'disabledTooltip'> {
|
|
76
|
-
name: ReactElement | string;
|
|
77
|
-
email: ReactElement | string;
|
|
76
|
+
name: ReactElement | string | (() => ReactElement);
|
|
77
|
+
email: ReactElement | string | (() => ReactElement);
|
|
78
78
|
profileUrl?: string;
|
|
79
79
|
}
|
|
80
80
|
interface ComboboxCommonProps {
|
|
@@ -110,7 +110,7 @@ export interface ComboboxMultiInlineProps extends ComboboxCommonProps {
|
|
|
110
110
|
export interface ComboboxMultiCheckboxProps extends ComboboxCommonProps {
|
|
111
111
|
value: string[];
|
|
112
112
|
onChange: (value: string[]) => void;
|
|
113
|
-
label?: ReactElement | string;
|
|
113
|
+
label?: ReactElement | string | (() => ReactElement);
|
|
114
114
|
displayCount?: boolean;
|
|
115
115
|
iconClassName?: string;
|
|
116
116
|
icon?: ElementType;
|
|
@@ -22,11 +22,11 @@ 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 { TruncatedText } from '@scaleflex/ui-tw/truncated-text';
|
|
25
26
|
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
26
27
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
27
28
|
import { cva } from 'class-variance-authority';
|
|
28
|
-
import { Command as CommandPrimitive } from 'cmdk';
|
|
29
|
-
import { useCommandState } from 'cmdk';
|
|
29
|
+
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';
|
|
@@ -194,6 +194,7 @@ function CommandItem(_ref9) {
|
|
|
194
194
|
textClassName = _ref9.textClassName,
|
|
195
195
|
props = _objectWithoutProperties(_ref9, _excluded9);
|
|
196
196
|
var selected = value && (multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value) : value === selectedValue);
|
|
197
|
+
var resolvedShortcut = typeof shortcut === 'function' ? shortcut() : shortcut;
|
|
197
198
|
return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
|
|
198
199
|
"data-slot": "command-item",
|
|
199
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({
|
|
@@ -209,16 +210,18 @@ function CommandItem(_ref9) {
|
|
|
209
210
|
className: cn('text-muted-foreground hover:text-primary shrink-0', selected && 'text-primary', disabled && 'opacity-50', iconClassName)
|
|
210
211
|
}), /*#__PURE__*/React.createElement("div", {
|
|
211
212
|
className: "flex items-center gap-1 overflow-hidden"
|
|
212
|
-
}, /*#__PURE__*/React.createElement(
|
|
213
|
-
className: cn(
|
|
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')
|
|
214
217
|
}, children), (tooltip || disabledTooltip) && /*#__PURE__*/React.createElement("div", {
|
|
215
218
|
className: "flex shrink-0 items-center"
|
|
216
219
|
}, /*#__PURE__*/React.createElement(LabelIcon, {
|
|
217
220
|
size: size,
|
|
218
221
|
tooltip: disabled ? disabledTooltip : tooltip
|
|
219
|
-
})))),
|
|
222
|
+
})))), resolvedShortcut && /*#__PURE__*/React.createElement(CommandShortcut, {
|
|
220
223
|
className: cn(disabled && 'opacity-50')
|
|
221
|
-
},
|
|
224
|
+
}, resolvedShortcut), /*#__PURE__*/React.createElement("span", {
|
|
222
225
|
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
223
226
|
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
224
227
|
className: cn('text-primary ml-auto h-4 w-4', selected ? 'opacity-100' : 'opacity-0')
|
|
@@ -238,6 +241,8 @@ function CommandUserItem(_ref10) {
|
|
|
238
241
|
textClassName = _ref10.textClassName,
|
|
239
242
|
props = _objectWithoutProperties(_ref10, _excluded10);
|
|
240
243
|
var selected = value && (multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value) : value === selectedValue);
|
|
244
|
+
var resolvedName = typeof name === 'function' ? name() : name;
|
|
245
|
+
var resolvedEmail = typeof email === 'function' ? email() : email;
|
|
241
246
|
return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
|
|
242
247
|
"data-slot": "command-item",
|
|
243
248
|
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-accent data-[selected=true]:text-accent-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({
|
|
@@ -258,11 +263,15 @@ function CommandUserItem(_ref10) {
|
|
|
258
263
|
className: "size-8"
|
|
259
264
|
})), /*#__PURE__*/React.createElement("div", {
|
|
260
265
|
className: "max-w-10/12"
|
|
261
|
-
}, /*#__PURE__*/React.createElement(
|
|
266
|
+
}, typeof resolvedName === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
267
|
+
className: cn('text-sm', textClassName)
|
|
268
|
+
}, resolvedName) : /*#__PURE__*/React.createElement("div", {
|
|
262
269
|
className: cn('w-full overflow-hidden text-sm text-ellipsis whitespace-nowrap', textClassName)
|
|
263
|
-
},
|
|
270
|
+
}, resolvedName), typeof resolvedEmail === 'string' ? /*#__PURE__*/React.createElement(TruncatedText, {
|
|
271
|
+
className: cn('text-secondary-foreground text-xs', textClassName)
|
|
272
|
+
}, resolvedEmail) : /*#__PURE__*/React.createElement("div", {
|
|
264
273
|
className: cn('text-secondary-foreground w-full overflow-hidden text-xs text-ellipsis whitespace-nowrap', textClassName)
|
|
265
|
-
},
|
|
274
|
+
}, resolvedEmail))), /*#__PURE__*/React.createElement("span", {
|
|
266
275
|
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
267
276
|
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
268
277
|
className: cn('text-primary ml-auto h-4 w-4', selected ? 'opacity-100' : 'opacity-0')
|
|
@@ -284,7 +293,7 @@ function CommandCheckboxItem(_ref11) {
|
|
|
284
293
|
var selected = value && (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value));
|
|
285
294
|
return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
|
|
286
295
|
"data-slot": "command-checkbox-item",
|
|
287
|
-
className: cn('relative flex w-full cursor-pointer items-center gap-3 outline-
|
|
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({
|
|
288
297
|
size: size
|
|
289
298
|
}), isGroup && getOptionInGroupPaddingLeft(size), className),
|
|
290
299
|
disabled: disabled
|
|
@@ -300,8 +309,10 @@ function CommandCheckboxItem(_ref11) {
|
|
|
300
309
|
size: size,
|
|
301
310
|
icon: icon,
|
|
302
311
|
className: cn('text-muted-foreground hover:text-primary !mr-1 shrink-0', selected && 'text-primary', disabled && 'opacity-50')
|
|
303
|
-
}), /*#__PURE__*/React.createElement(
|
|
304
|
-
className: cn(
|
|
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')
|
|
305
316
|
}, children), (tooltip || disabledTooltip) && /*#__PURE__*/React.createElement("div", {
|
|
306
317
|
className: "flex shrink-0 items-center"
|
|
307
318
|
}, /*#__PURE__*/React.createElement(LabelIcon, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const selectCommandHeadingOptions: {
|
|
2
2
|
readonly sm: "[&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:min-h-8 [&_[cmdk-group-heading]]:text-xs";
|
|
3
|
-
readonly md: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-10 [&_[cmdk-group-heading]]:text-sm
|
|
4
|
-
readonly lg: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-12 [&_[cmdk-group-heading]]:text-base
|
|
3
|
+
readonly md: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-10 [&_[cmdk-group-heading]]:text-sm";
|
|
4
|
+
readonly lg: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:min-h-12 [&_[cmdk-group-heading]]:text-base";
|
|
5
5
|
};
|
package/command/command.utils.js
CHANGED
|
@@ -1,3 +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 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
|
|
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');
|
|
@@ -6,7 +6,7 @@ declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogPrimiti
|
|
|
6
6
|
declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
|
|
7
7
|
declare function DialogClose({ ...props }: ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
8
8
|
declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
|
|
9
|
-
declare function DialogContent({ className, children, overlayClassName, variant, headerSize, maxWidth, ...props }: DialogContentProps): React.JSX.Element;
|
|
9
|
+
declare function DialogContent({ className, children, overlayClassName, variant, headerSize, maxWidth, hideCloseButton, ...props }: DialogContentProps): React.JSX.Element;
|
|
10
10
|
declare function DialogHeader({ className, size, ...props }: DialogHeaderProps): React.JSX.Element;
|
|
11
11
|
declare function DialogTitle({ className, size, align, ...props }: DialogTitleProps): React.JSX.Element;
|
|
12
12
|
declare function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
|
|
@@ -2,7 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
var _excluded = ["className"],
|
|
5
|
-
_excluded2 = ["className", "children", "overlayClassName", "variant", "headerSize", "maxWidth"],
|
|
5
|
+
_excluded2 = ["className", "children", "overlayClassName", "variant", "headerSize", "maxWidth", "hideCloseButton"],
|
|
6
6
|
_excluded3 = ["className", "size"],
|
|
7
7
|
_excluded4 = ["className", "size", "align"],
|
|
8
8
|
_excluded5 = ["className"],
|
|
@@ -81,6 +81,8 @@ function DialogContent(_ref6) {
|
|
|
81
81
|
_ref6$headerSize = _ref6.headerSize,
|
|
82
82
|
headerSize = _ref6$headerSize === void 0 ? 'md' : _ref6$headerSize,
|
|
83
83
|
maxWidth = _ref6.maxWidth,
|
|
84
|
+
_ref6$hideCloseButton = _ref6.hideCloseButton,
|
|
85
|
+
hideCloseButton = _ref6$hideCloseButton === void 0 ? false : _ref6$hideCloseButton,
|
|
84
86
|
props = _objectWithoutProperties(_ref6, _excluded2);
|
|
85
87
|
var resolvedMaxWidth = maxWidth === 'none' ? undefined : maxWidth !== null && maxWidth !== void 0 ? maxWidth : variant === 'centered' ? 'md' : '4xl';
|
|
86
88
|
var isCentered = variant === 'centered';
|
|
@@ -98,7 +100,7 @@ function DialogContent(_ref6) {
|
|
|
98
100
|
className: cn('bg-background text-foreground border-border fixed top-[50%] left-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] rounded-lg border shadow-lg duration-200', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', resolvedMaxWidth && dialogContentWidthVariants({
|
|
99
101
|
maxWidth: resolvedMaxWidth
|
|
100
102
|
}), className)
|
|
101
|
-
}, props), children, /*#__PURE__*/React.createElement(DialogPrimitive.Close, {
|
|
103
|
+
}, props), children, !hideCloseButton && /*#__PURE__*/React.createElement(DialogPrimitive.Close, {
|
|
102
104
|
"data-state": "open",
|
|
103
105
|
asChild: true,
|
|
104
106
|
className: cn('text-muted-foreground/70 hover:text-muted-foreground absolute right-3 cursor-pointer rounded-xs transition-opacity disabled:pointer-events-none', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", isCentered ? 'top-3' : dialogCloseButtonPositionVariants({
|
package/dialog/dialog.types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface DialogContentProps extends ComponentProps<typeof DialogPrimitiv
|
|
|
10
10
|
headerSize?: DialogHeaderSize;
|
|
11
11
|
/** Preset max-width. Pass `'none'` to skip the preset and use className for custom width. */
|
|
12
12
|
maxWidth?: DialogContentWidth;
|
|
13
|
+
/** Hide the built-in close (X) button. */
|
|
14
|
+
hideCloseButton?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export interface DialogHeaderProps extends ComponentProps<'div'> {
|
|
15
17
|
size?: DialogHeaderSize;
|
|
@@ -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;
|