@nubitio/ui 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +19 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1030,8 +1030,9 @@ function SelectionCombobox({ options, value, onChange, label, error, helpText, i
|
|
|
1030
1030
|
}),
|
|
1031
1031
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1032
1032
|
className: "nb-combobox",
|
|
1033
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1033
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComboboxInput, {
|
|
1034
1034
|
...inputProps,
|
|
1035
|
+
openOnClick: !disabled && !readOnly,
|
|
1035
1036
|
ref: inputRef,
|
|
1036
1037
|
id: inputId,
|
|
1037
1038
|
className: `nb-input nb-combobox__input${invalid || error ? " nb-input--invalid" : ""}${inputClassName ? ` ${inputClassName}` : ""}`,
|
|
@@ -1146,6 +1147,23 @@ function SelectionCombobox({ options, value, onChange, label, error, helpText, i
|
|
|
1146
1147
|
]
|
|
1147
1148
|
});
|
|
1148
1149
|
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Editable combobox input that also opens its list on click. React Aria opens
|
|
1152
|
+
* on typing or ArrowDown by default; users expect a click on a dropdown-style
|
|
1153
|
+
* field to show the options. Keyboard behaviour is unchanged (no open on focus).
|
|
1154
|
+
*/
|
|
1155
|
+
const ComboboxInput = (0, react.forwardRef)(function ComboboxInput({ onClick, openOnClick, ...props }, ref) {
|
|
1156
|
+
const state = (0, react.useContext)(react_aria_components.ComboBoxStateContext);
|
|
1157
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Input, {
|
|
1158
|
+
...props,
|
|
1159
|
+
ref,
|
|
1160
|
+
onClick: (event) => {
|
|
1161
|
+
onClick?.(event);
|
|
1162
|
+
if (!openOnClick || event.defaultPrevented || !state || state.isOpen) return;
|
|
1163
|
+
state.open(null, "manual");
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
});
|
|
1149
1167
|
function ComboboxClear({ label, disabled, multiple }) {
|
|
1150
1168
|
const state = (0, react.useContext)(react_aria_components.ComboBoxStateContext);
|
|
1151
1169
|
const hasValue = multiple ? Array.isArray(state?.value) && state.value.length > 0 : !!state?.inputValue;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
1
2
|
import React, { ButtonHTMLAttributes, CSSProperties, FieldsetHTMLAttributes, FormHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ProgressHTMLAttributes, ReactElement, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
2
3
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
3
4
|
//#region packages/ui/Avatar.d.ts
|
|
@@ -1234,8 +1235,8 @@ interface MultiSelectProps extends Omit<ComboboxProps, 'value' | 'onChange'> {
|
|
|
1234
1235
|
selectedLabel?: string;
|
|
1235
1236
|
removeLabel?: (option: ComboboxOption) => string;
|
|
1236
1237
|
}
|
|
1237
|
-
declare const Combobox:
|
|
1238
|
-
declare const MultiSelect:
|
|
1238
|
+
declare const Combobox: React$1.ForwardRefExoticComponent<ComboboxProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1239
|
+
declare const MultiSelect: React$1.ForwardRefExoticComponent<MultiSelectProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1239
1240
|
//#endregion
|
|
1240
1241
|
//#region packages/ui/Tooltip.d.ts
|
|
1241
1242
|
interface TooltipProps {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
1
2
|
import React, { ButtonHTMLAttributes, CSSProperties, FieldsetHTMLAttributes, FormHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ProgressHTMLAttributes, ReactElement, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
2
3
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
3
4
|
//#region packages/ui/Avatar.d.ts
|
|
@@ -1234,8 +1235,8 @@ interface MultiSelectProps extends Omit<ComboboxProps, 'value' | 'onChange'> {
|
|
|
1234
1235
|
selectedLabel?: string;
|
|
1235
1236
|
removeLabel?: (option: ComboboxOption) => string;
|
|
1236
1237
|
}
|
|
1237
|
-
declare const Combobox:
|
|
1238
|
-
declare const MultiSelect:
|
|
1238
|
+
declare const Combobox: React$1.ForwardRefExoticComponent<ComboboxProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1239
|
+
declare const MultiSelect: React$1.ForwardRefExoticComponent<MultiSelectProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1239
1240
|
//#endregion
|
|
1240
1241
|
//#region packages/ui/Tooltip.d.ts
|
|
1241
1242
|
interface TooltipProps {
|
package/dist/index.mjs
CHANGED
|
@@ -1006,8 +1006,9 @@ function SelectionCombobox({ options, value, onChange, label, error, helpText, i
|
|
|
1006
1006
|
}),
|
|
1007
1007
|
/* @__PURE__ */ jsxs("div", {
|
|
1008
1008
|
className: "nb-combobox",
|
|
1009
|
-
children: [/* @__PURE__ */ jsx(
|
|
1009
|
+
children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
1010
1010
|
...inputProps,
|
|
1011
|
+
openOnClick: !disabled && !readOnly,
|
|
1011
1012
|
ref: inputRef,
|
|
1012
1013
|
id: inputId,
|
|
1013
1014
|
className: `nb-input nb-combobox__input${invalid || error ? " nb-input--invalid" : ""}${inputClassName ? ` ${inputClassName}` : ""}`,
|
|
@@ -1122,6 +1123,23 @@ function SelectionCombobox({ options, value, onChange, label, error, helpText, i
|
|
|
1122
1123
|
]
|
|
1123
1124
|
});
|
|
1124
1125
|
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Editable combobox input that also opens its list on click. React Aria opens
|
|
1128
|
+
* on typing or ArrowDown by default; users expect a click on a dropdown-style
|
|
1129
|
+
* field to show the options. Keyboard behaviour is unchanged (no open on focus).
|
|
1130
|
+
*/
|
|
1131
|
+
const ComboboxInput = forwardRef(function ComboboxInput({ onClick, openOnClick, ...props }, ref) {
|
|
1132
|
+
const state = useContext(ComboBoxStateContext);
|
|
1133
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
1134
|
+
...props,
|
|
1135
|
+
ref,
|
|
1136
|
+
onClick: (event) => {
|
|
1137
|
+
onClick?.(event);
|
|
1138
|
+
if (!openOnClick || event.defaultPrevented || !state || state.isOpen) return;
|
|
1139
|
+
state.open(null, "manual");
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1125
1143
|
function ComboboxClear({ label, disabled, multiple }) {
|
|
1126
1144
|
const state = useContext(ComboBoxStateContext);
|
|
1127
1145
|
const hasValue = multiple ? Array.isArray(state?.value) && state.value.length > 0 : !!state?.inputValue;
|