@scaleflex/ui-tw 0.0.55 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/combobox/combobox-multi-inline/combobox-multi-inline.component.d.ts +1 -1
- package/combobox/combobox-multi-inline/combobox-multi-inline.component.js +6 -2
- package/combobox/combobox-multi-tag/combobox-multi-tag.component.d.ts +1 -1
- package/combobox/combobox-multi-tag/combobox-multi-tag.component.js +6 -2
- package/combobox/combobox-single/combobox-single.component.d.ts +1 -1
- package/combobox/combobox-single/combobox-single.component.js +6 -2
- package/combobox/combobox.component.d.ts +3 -2
- package/combobox/combobox.component.js +63 -43
- package/combobox/combobox.types.d.ts +7 -0
- package/package.json +2 -2
- package/select/components/selector.d.ts +1 -1
- package/select/components/selector.js +5 -1
- package/select/select.types.d.ts +2 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComboboxMultiInlineProps } from '../combobox.types';
|
|
3
|
-
export declare function ComboboxMultiInline({ options, value, onChange, placeholder, className, disabled, size, readOnly, showClear, popoverClassName, onBlur, showGroupSeparator, defaultOpen, popoverContentProps, formItemId, searchPlaceholder, ...rest }: ComboboxMultiInlineProps): React.JSX.Element;
|
|
3
|
+
export declare function ComboboxMultiInline({ options, value, onChange, placeholder, className, disabled, size, readOnly, showClear, popoverClassName, onBlur, showGroupSeparator, defaultOpen, popoverContentProps, formItemId, searchPlaceholder, actions, fixedActions, ...rest }: ComboboxMultiInlineProps): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "size", "readOnly", "showClear", "popoverClassName", "onBlur", "showGroupSeparator", "defaultOpen", "popoverContentProps", "formItemId", "searchPlaceholder"];
|
|
4
|
+
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "size", "readOnly", "showClear", "popoverClassName", "onBlur", "showGroupSeparator", "defaultOpen", "popoverContentProps", "formItemId", "searchPlaceholder", "actions", "fixedActions"];
|
|
5
5
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
6
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -36,6 +36,8 @@ export function ComboboxMultiInline(_ref) {
|
|
|
36
36
|
popoverContentProps = _ref.popoverContentProps,
|
|
37
37
|
formItemId = _ref.formItemId,
|
|
38
38
|
searchPlaceholder = _ref.searchPlaceholder,
|
|
39
|
+
actions = _ref.actions,
|
|
40
|
+
fixedActions = _ref.fixedActions,
|
|
39
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
42
|
var _useState = useState(defaultOpen),
|
|
41
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -141,6 +143,8 @@ export function ComboboxMultiInline(_ref) {
|
|
|
141
143
|
onSelect: toggleValue,
|
|
142
144
|
size: size,
|
|
143
145
|
multiple: true,
|
|
144
|
-
popoverContentProps: popoverContentProps
|
|
146
|
+
popoverContentProps: popoverContentProps,
|
|
147
|
+
actions: actions,
|
|
148
|
+
fixedActions: fixedActions
|
|
145
149
|
}));
|
|
146
150
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ComboboxMultiTagProps } from '../combobox.types';
|
|
3
|
-
export declare function ComboboxMultiTag({ options, value, onChange, placeholder, className, disabled, size, readOnly, popoverClassName, onBlur, showGroupSeparator, defaultOpen, searchPlaceholder, popoverContentProps, ...rest }: ComboboxMultiTagProps): React.JSX.Element;
|
|
3
|
+
export declare function ComboboxMultiTag({ options, value, onChange, placeholder, className, disabled, size, readOnly, popoverClassName, onBlur, showGroupSeparator, defaultOpen, searchPlaceholder, popoverContentProps, actions, fixedActions, ...rest }: ComboboxMultiTagProps): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "size", "readOnly", "popoverClassName", "onBlur", "showGroupSeparator", "defaultOpen", "searchPlaceholder", "popoverContentProps"];
|
|
4
|
+
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "size", "readOnly", "popoverClassName", "onBlur", "showGroupSeparator", "defaultOpen", "searchPlaceholder", "popoverContentProps", "actions", "fixedActions"];
|
|
5
5
|
import { ButtonVariant, buttonVariants } from '@scaleflex/ui-tw/button';
|
|
6
6
|
import { buttonBaseClassNames } from '@scaleflex/ui-tw/button/button.constants';
|
|
7
7
|
import { createClearHandlers } from '@scaleflex/ui-tw/combobox/combobox.utils';
|
|
@@ -38,6 +38,8 @@ export function ComboboxMultiTag(_ref) {
|
|
|
38
38
|
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
39
39
|
searchPlaceholder = _ref.searchPlaceholder,
|
|
40
40
|
popoverContentProps = _ref.popoverContentProps,
|
|
41
|
+
actions = _ref.actions,
|
|
42
|
+
fixedActions = _ref.fixedActions,
|
|
41
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
44
|
var _getToolbarSizes = getToolbarSizes(size),
|
|
43
45
|
buttonSize = _getToolbarSizes.buttonSize;
|
|
@@ -137,6 +139,8 @@ export function ComboboxMultiTag(_ref) {
|
|
|
137
139
|
className: popoverClassName,
|
|
138
140
|
searchPlaceholder: searchPlaceholder,
|
|
139
141
|
showGroupSeparator: showGroupSeparator,
|
|
140
|
-
popoverContentProps: popoverContentProps
|
|
142
|
+
popoverContentProps: popoverContentProps,
|
|
143
|
+
actions: actions,
|
|
144
|
+
fixedActions: fixedActions
|
|
141
145
|
}));
|
|
142
146
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ComboboxSingleProps } from '../combobox.types';
|
|
3
|
-
export declare function ComboboxSingle({ options, value, onChange, placeholder, className, disabled, popoverClassName, size, readOnly, showClear, formItemId, onBlur, showGroupSeparator, defaultOpen, popoverContentProps, searchPlaceholder, ...rest }: ComboboxSingleProps): React.JSX.Element;
|
|
3
|
+
export declare function ComboboxSingle({ options, value, onChange, placeholder, className, disabled, popoverClassName, size, readOnly, showClear, formItemId, onBlur, showGroupSeparator, defaultOpen, popoverContentProps, searchPlaceholder, actions, fixedActions, ...rest }: ComboboxSingleProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "popoverClassName", "size", "readOnly", "showClear", "formItemId", "onBlur", "showGroupSeparator", "defaultOpen", "popoverContentProps", "searchPlaceholder"];
|
|
3
|
+
var _excluded = ["options", "value", "onChange", "placeholder", "className", "disabled", "popoverClassName", "size", "readOnly", "showClear", "formItemId", "onBlur", "showGroupSeparator", "defaultOpen", "popoverContentProps", "searchPlaceholder", "actions", "fixedActions"];
|
|
4
4
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
5
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -35,6 +35,8 @@ export function ComboboxSingle(_ref) {
|
|
|
35
35
|
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
36
36
|
popoverContentProps = _ref.popoverContentProps,
|
|
37
37
|
searchPlaceholder = _ref.searchPlaceholder,
|
|
38
|
+
actions = _ref.actions,
|
|
39
|
+
fixedActions = _ref.fixedActions,
|
|
38
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
41
|
var _useState = useState(defaultOpen),
|
|
40
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -102,6 +104,8 @@ export function ComboboxSingle(_ref) {
|
|
|
102
104
|
onSelect: onSelect,
|
|
103
105
|
size: size,
|
|
104
106
|
showGroupSeparator: showGroupSeparator,
|
|
105
|
-
popoverContentProps: popoverContentProps
|
|
107
|
+
popoverContentProps: popoverContentProps,
|
|
108
|
+
actions: actions,
|
|
109
|
+
fixedActions: fixedActions
|
|
106
110
|
}));
|
|
107
111
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { ComboboxContentProps, ComboboxTriggerProps } from './combobox.types';
|
|
2
|
+
import type { ComboboxContentProps, ComboboxTriggerProps, SelectActionsProps } from './combobox.types';
|
|
3
|
+
export declare function SelectActions({ actions }: SelectActionsProps): React.JSX.Element | null;
|
|
3
4
|
export declare function ComboboxTrigger({ children, open, disabled, readOnly, size, className, selected, showClear, onClearAll, formItemId, ...rest }: ComboboxTriggerProps): React.JSX.Element;
|
|
4
|
-
export declare function ComboboxContent({ options, value: selectedValue, onSelect, size, multiple, className, showGroupSeparator, popoverContentProps, searchPlaceholder, noGroupSelection, }: ComboboxContentProps): React.JSX.Element;
|
|
5
|
+
export declare function ComboboxContent({ options, value: selectedValue, onSelect, size, multiple, className, showGroupSeparator, popoverContentProps, searchPlaceholder, noGroupSelection, actions, fixedActions, }: ComboboxContentProps): React.JSX.Element;
|
|
@@ -17,6 +17,7 @@ import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
|
17
17
|
import { cva } from 'class-variance-authority';
|
|
18
18
|
import { ChevronsUpDownIcon, XIcon } from 'lucide-react';
|
|
19
19
|
import * as React from 'react';
|
|
20
|
+
import { Fragment } from 'react';
|
|
20
21
|
import { iconSizeInTriggerOptions, verticalSeparatorNextToChevronOptions } from './combobox.constants';
|
|
21
22
|
import { createClearHandlers } from './combobox.utils';
|
|
22
23
|
var selectLabelVariants = cva('', {
|
|
@@ -27,23 +28,34 @@ var selectLabelVariants = cva('', {
|
|
|
27
28
|
size: FormSize.Md
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
export function
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
export function SelectActions(_ref) {
|
|
32
|
+
var actions = _ref.actions;
|
|
33
|
+
if (!actions || actions.length === 0) return null;
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectSeparator, null), /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "space-y-2 px-4 py-3"
|
|
36
|
+
}, actions.map(function (action, idx) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
38
|
+
key: idx
|
|
39
|
+
}, action);
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
export function ComboboxTrigger(_ref2) {
|
|
43
|
+
var children = _ref2.children,
|
|
44
|
+
open = _ref2.open,
|
|
45
|
+
_ref2$disabled = _ref2.disabled,
|
|
46
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
47
|
+
_ref2$readOnly = _ref2.readOnly,
|
|
48
|
+
readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
|
|
49
|
+
_ref2$size = _ref2.size,
|
|
50
|
+
size = _ref2$size === void 0 ? FormSize.Md : _ref2$size,
|
|
51
|
+
className = _ref2.className,
|
|
52
|
+
_ref2$selected = _ref2.selected,
|
|
53
|
+
selected = _ref2$selected === void 0 ? false : _ref2$selected,
|
|
54
|
+
_ref2$showClear = _ref2.showClear,
|
|
55
|
+
showClear = _ref2$showClear === void 0 ? false : _ref2$showClear,
|
|
56
|
+
onClearAll = _ref2.onClearAll,
|
|
57
|
+
formItemId = _ref2.formItemId,
|
|
58
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
47
59
|
var _getToolbarSizes = getToolbarSizes(size),
|
|
48
60
|
iconSize = _getToolbarSizes.iconSize;
|
|
49
61
|
var _createClearHandlers = createClearHandlers(onClearAll),
|
|
@@ -59,7 +71,7 @@ export function ComboboxTrigger(_ref) {
|
|
|
59
71
|
disabled: disabled,
|
|
60
72
|
className: cn.apply(void 0, _toConsumableArray(getBaseSelectClassNames()).concat(_toConsumableArray(getBaseInputClasses()), [selectTriggerVariants({
|
|
61
73
|
size: size
|
|
62
|
-
}), !selected && 'text-muted-foreground/80 hover:border-secondary-foreground/50', readOnly && selectReadOnlyClassNames, className])),
|
|
74
|
+
}), !selected && 'text-muted-foreground/80 hover:border-secondary-foreground/50', readOnly && selectReadOnlyClassNames, className, 'min-w-0'])),
|
|
63
75
|
onClick: handleOnTriggerClick,
|
|
64
76
|
onKeyDown: handleOnTriggerKeyDown
|
|
65
77
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -86,22 +98,25 @@ export function ComboboxTrigger(_ref) {
|
|
|
86
98
|
className: cn('ml-1 shrink-0 opacity-50', iconSizeInTriggerOptions[size])
|
|
87
99
|
}))));
|
|
88
100
|
}
|
|
89
|
-
export function ComboboxContent(
|
|
90
|
-
var options =
|
|
91
|
-
selectedValue =
|
|
92
|
-
_onSelect =
|
|
93
|
-
|
|
94
|
-
size =
|
|
95
|
-
|
|
96
|
-
multiple =
|
|
97
|
-
className =
|
|
98
|
-
|
|
99
|
-
showGroupSeparator =
|
|
100
|
-
popoverContentProps =
|
|
101
|
-
|
|
102
|
-
searchPlaceholder =
|
|
103
|
-
|
|
104
|
-
noGroupSelection =
|
|
101
|
+
export function ComboboxContent(_ref3) {
|
|
102
|
+
var options = _ref3.options,
|
|
103
|
+
selectedValue = _ref3.value,
|
|
104
|
+
_onSelect = _ref3.onSelect,
|
|
105
|
+
_ref3$size = _ref3.size,
|
|
106
|
+
size = _ref3$size === void 0 ? 'md' : _ref3$size,
|
|
107
|
+
_ref3$multiple = _ref3.multiple,
|
|
108
|
+
multiple = _ref3$multiple === void 0 ? false : _ref3$multiple,
|
|
109
|
+
className = _ref3.className,
|
|
110
|
+
_ref3$showGroupSepara = _ref3.showGroupSeparator,
|
|
111
|
+
showGroupSeparator = _ref3$showGroupSepara === void 0 ? false : _ref3$showGroupSepara,
|
|
112
|
+
popoverContentProps = _ref3.popoverContentProps,
|
|
113
|
+
_ref3$searchPlacehold = _ref3.searchPlaceholder,
|
|
114
|
+
searchPlaceholder = _ref3$searchPlacehold === void 0 ? 'Search...' : _ref3$searchPlacehold,
|
|
115
|
+
_ref3$noGroupSelectio = _ref3.noGroupSelection,
|
|
116
|
+
noGroupSelection = _ref3$noGroupSelectio === void 0 ? false : _ref3$noGroupSelectio,
|
|
117
|
+
actions = _ref3.actions,
|
|
118
|
+
_ref3$fixedActions = _ref3.fixedActions,
|
|
119
|
+
fixedActions = _ref3$fixedActions === void 0 ? false : _ref3$fixedActions;
|
|
105
120
|
return /*#__PURE__*/React.createElement(PopoverContent, _extends({
|
|
106
121
|
className: cn('p-0', className)
|
|
107
122
|
}, popoverContentProps), /*#__PURE__*/React.createElement(Command, null, /*#__PURE__*/React.createElement(CommandInput, {
|
|
@@ -131,14 +146,14 @@ export function ComboboxContent(_ref2) {
|
|
|
131
146
|
className: cn('text-secondary-foreground', selectLabelVariants({
|
|
132
147
|
size: size
|
|
133
148
|
}))
|
|
134
|
-
}, option.label), option.options.map(function (
|
|
135
|
-
var label =
|
|
136
|
-
optionLabel =
|
|
137
|
-
value =
|
|
138
|
-
disabled =
|
|
139
|
-
icon =
|
|
140
|
-
tooltip =
|
|
141
|
-
disabledTooltip =
|
|
149
|
+
}, option.label), option.options.map(function (_ref4) {
|
|
150
|
+
var label = _ref4.label,
|
|
151
|
+
optionLabel = _ref4.optionLabel,
|
|
152
|
+
value = _ref4.value,
|
|
153
|
+
disabled = _ref4.disabled,
|
|
154
|
+
icon = _ref4.icon,
|
|
155
|
+
tooltip = _ref4.tooltip,
|
|
156
|
+
disabledTooltip = _ref4.disabledTooltip;
|
|
142
157
|
var isGroupSelected = !noGroupSelection && multiple && option.value && Array.isArray(selectedValue) && selectedValue.includes(option.value);
|
|
143
158
|
return /*#__PURE__*/React.createElement(CommandItem, {
|
|
144
159
|
size: size,
|
|
@@ -167,10 +182,15 @@ export function ComboboxContent(_ref2) {
|
|
|
167
182
|
icon: option.icon,
|
|
168
183
|
value: option.value,
|
|
169
184
|
tooltip: option.tooltip,
|
|
185
|
+
disabledTooltip: option.disabledTooltip,
|
|
170
186
|
selectedValue: selectedValue,
|
|
171
187
|
onSelect: function onSelect() {
|
|
172
188
|
return _onSelect(option.value);
|
|
173
189
|
}
|
|
174
190
|
}, (_option$optionLabel = option.optionLabel) !== null && _option$optionLabel !== void 0 ? _option$optionLabel : option.label));
|
|
175
|
-
})
|
|
191
|
+
}), !fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
192
|
+
actions: actions
|
|
193
|
+
})), fixedActions && /*#__PURE__*/React.createElement(SelectActions, {
|
|
194
|
+
actions: actions
|
|
195
|
+
})));
|
|
176
196
|
}
|
|
@@ -4,6 +4,9 @@ import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
|
4
4
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
5
5
|
import type { ComponentProps, KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
6
6
|
export type ClearEvent = MouseEvent | KeyboardEvent;
|
|
7
|
+
export type SelectActionsProps = {
|
|
8
|
+
actions?: ReactNode[];
|
|
9
|
+
};
|
|
7
10
|
export type ComboboxTriggerProps = {
|
|
8
11
|
children: ReactNode;
|
|
9
12
|
open: boolean;
|
|
@@ -30,6 +33,8 @@ export type ComboboxContentProps = {
|
|
|
30
33
|
searchPlaceholder?: string;
|
|
31
34
|
popoverContentProps?: ComponentProps<typeof PopoverPrimitive.Content>;
|
|
32
35
|
noGroupSelection?: boolean;
|
|
36
|
+
actions?: ReactNode[];
|
|
37
|
+
fixedActions?: boolean;
|
|
33
38
|
};
|
|
34
39
|
export interface CommandInputProps extends Omit<ComponentProps<typeof CommandPrimitive.Input>, 'size'> {
|
|
35
40
|
size?: FormSizeType;
|
|
@@ -61,6 +66,8 @@ interface ComboboxCommonProps {
|
|
|
61
66
|
showGroupSeparator?: boolean;
|
|
62
67
|
searchPlaceholder?: string;
|
|
63
68
|
popoverContentProps?: ComponentProps<typeof PopoverPrimitive.Content>;
|
|
69
|
+
actions?: ReactNode[];
|
|
70
|
+
fixedActions?: boolean;
|
|
64
71
|
}
|
|
65
72
|
export interface ComboboxSingleProps extends ComboboxCommonProps {
|
|
66
73
|
value: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@radix-ui/react-slot": "^1.1.2",
|
|
24
24
|
"@radix-ui/react-switch": "^1.0.1",
|
|
25
25
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
26
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
26
|
+
"@scaleflex/icons-tw": "^0.0.58",
|
|
27
27
|
"@tanstack/react-table": "^8.21.3",
|
|
28
28
|
"@types/lodash.merge": "^4.6.9",
|
|
29
29
|
"class-variance-authority": "^0.7.1",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectorProps } from '../select.types';
|
|
3
|
-
export declare function Selector({ value, onChange, placeholder, disabled, readOnly, size, className, icon, options, showGroupSeparator, formItemId, popoverClassName, selectorContentProps, defaultOpen, triggerProps, ...rest }: SelectorProps): React.JSX.Element;
|
|
3
|
+
export declare function Selector({ value, onChange, placeholder, disabled, readOnly, size, className, icon, options, showGroupSeparator, formItemId, popoverClassName, selectorContentProps, defaultOpen, triggerProps, actions, ...rest }: SelectorProps): React.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["value", "onChange", "placeholder", "disabled", "readOnly", "size", "className", "icon", "options", "showGroupSeparator", "formItemId", "popoverClassName", "selectorContentProps", "defaultOpen", "triggerProps"];
|
|
3
|
+
var _excluded = ["value", "onChange", "placeholder", "disabled", "readOnly", "size", "className", "icon", "options", "showGroupSeparator", "formItemId", "popoverClassName", "selectorContentProps", "defaultOpen", "triggerProps", "actions"];
|
|
4
4
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
5
5
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
import { SelectActions } from '@scaleflex/ui-tw/combobox/combobox.component';
|
|
7
8
|
import { isOptionGroup } from '@scaleflex/ui-tw/form';
|
|
8
9
|
import { selectLabelSizeOptions } from '@scaleflex/ui-tw/select/select.constants';
|
|
9
10
|
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
@@ -36,6 +37,7 @@ export function Selector(_ref) {
|
|
|
36
37
|
selectorContentProps = _ref.selectorContentProps,
|
|
37
38
|
defaultOpen = _ref.defaultOpen,
|
|
38
39
|
triggerProps = _ref.triggerProps,
|
|
40
|
+
actions = _ref.actions,
|
|
39
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
42
|
var getLabelByValue = function getLabelByValue(val) {
|
|
41
43
|
var _iterator = _createForOfIteratorHelper(options),
|
|
@@ -125,5 +127,7 @@ export function Selector(_ref) {
|
|
|
125
127
|
tooltip: option.tooltip,
|
|
126
128
|
disabledTooltip: option.disabledTooltip
|
|
127
129
|
}, (_option$optionLabel = option.optionLabel) !== null && _option$optionLabel !== void 0 ? _option$optionLabel : option.label));
|
|
130
|
+
}), /*#__PURE__*/React.createElement(SelectActions, {
|
|
131
|
+
actions: actions
|
|
128
132
|
})));
|
|
129
133
|
}
|
package/select/select.types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
2
2
|
import { SelectOption } from '@scaleflex/ui-tw/form';
|
|
3
3
|
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
4
|
-
import type { ComponentProps, ReactElement } from 'react';
|
|
4
|
+
import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
5
5
|
export interface SelectProps extends ComponentProps<typeof SelectPrimitive.Root> {
|
|
6
6
|
}
|
|
7
7
|
export interface SelectTriggerProps extends ComponentProps<typeof SelectPrimitive.Trigger> {
|
|
@@ -39,4 +39,5 @@ export interface SelectorProps extends SelectProps {
|
|
|
39
39
|
selectorContentProps?: ComponentProps<typeof SelectPrimitive.Content>;
|
|
40
40
|
'aria-invalid'?: boolean;
|
|
41
41
|
triggerProps?: Omit<ComponentProps<typeof SelectPrimitive.Trigger>, 'aria-invalid'>;
|
|
42
|
+
actions?: ReactNode[];
|
|
42
43
|
}
|