@unofficialbox/box-open-elements-react 0.26.0 → 0.27.0
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/README.md +2 -1
- package/dist/combobox.d.ts +44 -0
- package/dist/combobox.js +37 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/text-field.d.ts +6 -0
- package/dist/text-field.js +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -57,7 +57,8 @@ export function SaveAction() {
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
The supported surface also includes
|
|
60
|
+
The supported surface also includes `Combobox` (with structured options and
|
|
61
|
+
field description), typed `TextField` `type`/`reveal`/`autocomplete`, a controlled `Dialog` wrapper and
|
|
61
62
|
`useExplorerSelectionController`, which subscribes React to the existing
|
|
62
63
|
headless selection controller without duplicating its state.
|
|
63
64
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Combobox as ComboboxElement } from "@unofficialbox/box-open-elements/combobox";
|
|
2
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
3
|
+
import type { CustomEventHandler, ValueChangedDetail } from "./events.js";
|
|
4
|
+
export type ComboboxOption = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type ComboboxProps = WebComponentProps & {
|
|
12
|
+
label?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
options?: ComboboxOption[];
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
placement?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
name?: string;
|
|
19
|
+
invalid?: boolean;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
hideLabel?: boolean;
|
|
24
|
+
onValueChanged?: CustomEventHandler<ComboboxElement, ValueChangedDetail>;
|
|
25
|
+
};
|
|
26
|
+
/** React wrapper for the value-bearing `<box-combobox>` form control. */
|
|
27
|
+
export declare const Combobox: import("react").ForwardRefExoticComponent<{
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: import("react").CSSProperties;
|
|
30
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
31
|
+
label?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
options?: ComboboxOption[];
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
placement?: string;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
name?: string;
|
|
38
|
+
invalid?: boolean;
|
|
39
|
+
errorMessage?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
required?: boolean;
|
|
42
|
+
hideLabel?: boolean;
|
|
43
|
+
onValueChanged?: CustomEventHandler<ComboboxElement, ValueChangedDetail>;
|
|
44
|
+
} & import("react").RefAttributes<ComboboxElement>>;
|
package/dist/combobox.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Combobox as ComboboxElement } from "@unofficialbox/box-open-elements/combobox";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
ComboboxElement.register();
|
|
4
|
+
/** React wrapper for the value-bearing `<box-combobox>` form control. */
|
|
5
|
+
export const Combobox = createWebComponent({
|
|
6
|
+
tagName: "box-combobox",
|
|
7
|
+
displayName: "Combobox",
|
|
8
|
+
propertyNames: [
|
|
9
|
+
"label", "value", "options", "placeholder", "placement", "disabled",
|
|
10
|
+
"name", "invalid", "errorMessage", "description", "required", "hideLabel",
|
|
11
|
+
],
|
|
12
|
+
events: [{ propName: "onValueChanged", eventName: "value-changed" }],
|
|
13
|
+
sync: (element, props) => {
|
|
14
|
+
if (props.label !== undefined)
|
|
15
|
+
element.label = props.label;
|
|
16
|
+
if (props.value !== undefined)
|
|
17
|
+
element.value = props.value;
|
|
18
|
+
if (props.options !== undefined)
|
|
19
|
+
element.options = props.options;
|
|
20
|
+
if (props.placeholder !== undefined)
|
|
21
|
+
element.placeholder = props.placeholder;
|
|
22
|
+
if (props.placement !== undefined)
|
|
23
|
+
element.placement = props.placement;
|
|
24
|
+
if (props.name !== undefined)
|
|
25
|
+
element.name = props.name;
|
|
26
|
+
if (props.errorMessage !== undefined)
|
|
27
|
+
element.errorMessage = props.errorMessage;
|
|
28
|
+
if (props.description !== undefined)
|
|
29
|
+
element.description = props.description;
|
|
30
|
+
if (props.required !== undefined)
|
|
31
|
+
element.required = props.required;
|
|
32
|
+
if (props.hideLabel !== undefined)
|
|
33
|
+
element.hideLabel = props.hideLabel;
|
|
34
|
+
element.disabled = Boolean(props.disabled);
|
|
35
|
+
element.invalid = Boolean(props.invalid);
|
|
36
|
+
},
|
|
37
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { Button, type ButtonProps } from "./button.js";
|
|
|
9
9
|
export { Dialog, type DialogProps, type DialogSize } from "./dialog.js";
|
|
10
10
|
export { ExplorerSelectionController, useExplorerSelectionController, type ExplorerSelectionState, } from "./explorer-selection.js";
|
|
11
11
|
export { Select, type SelectOption, type SelectProps } from "./select.js";
|
|
12
|
+
export { Combobox, type ComboboxOption, type ComboboxProps } from "./combobox.js";
|
|
12
13
|
export { TextField, type TextFieldProps } from "./text-field.js";
|
|
13
14
|
export { NumberInput, type NumberInputProps, type NumberInputRef } from "./number-input.js";
|
|
14
15
|
export { Checkbox, type CheckboxProps, type CheckboxRef } from "./checkbox.js";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { Button } from "./button.js";
|
|
|
8
8
|
export { Dialog } from "./dialog.js";
|
|
9
9
|
export { ExplorerSelectionController, useExplorerSelectionController, } from "./explorer-selection.js";
|
|
10
10
|
export { Select } from "./select.js";
|
|
11
|
+
export { Combobox } from "./combobox.js";
|
|
11
12
|
export { TextField } from "./text-field.js";
|
|
12
13
|
export { NumberInput } from "./number-input.js";
|
|
13
14
|
export { Checkbox } from "./checkbox.js";
|
package/dist/text-field.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export type TextFieldProps = WebComponentProps & {
|
|
|
5
5
|
label?: string;
|
|
6
6
|
value?: string;
|
|
7
7
|
placeholder?: string;
|
|
8
|
+
type?: "text" | "password" | "email" | "tel" | "url" | "search" | "number";
|
|
9
|
+
reveal?: boolean;
|
|
10
|
+
autocomplete?: string;
|
|
8
11
|
disabled?: boolean;
|
|
9
12
|
name?: string;
|
|
10
13
|
invalid?: boolean;
|
|
@@ -22,6 +25,9 @@ export declare const TextField: import("react").ForwardRefExoticComponent<{
|
|
|
22
25
|
label?: string;
|
|
23
26
|
value?: string;
|
|
24
27
|
placeholder?: string;
|
|
28
|
+
type?: "text" | "password" | "email" | "tel" | "url" | "search" | "number";
|
|
29
|
+
reveal?: boolean;
|
|
30
|
+
autocomplete?: string;
|
|
25
31
|
disabled?: boolean;
|
|
26
32
|
name?: string;
|
|
27
33
|
invalid?: boolean;
|
package/dist/text-field.js
CHANGED
|
@@ -9,6 +9,7 @@ export const TextField = createWebComponent({
|
|
|
9
9
|
"label",
|
|
10
10
|
"value",
|
|
11
11
|
"placeholder",
|
|
12
|
+
"type", "reveal", "autocomplete",
|
|
12
13
|
"disabled",
|
|
13
14
|
"name",
|
|
14
15
|
"invalid",
|
|
@@ -32,6 +33,12 @@ export const TextField = createWebComponent({
|
|
|
32
33
|
if (props.placeholder !== undefined) {
|
|
33
34
|
element.placeholder = props.placeholder;
|
|
34
35
|
}
|
|
36
|
+
if (props.type !== undefined)
|
|
37
|
+
element.type = props.type;
|
|
38
|
+
if (props.reveal !== undefined)
|
|
39
|
+
element.reveal = props.reveal;
|
|
40
|
+
if (props.autocomplete !== undefined)
|
|
41
|
+
element.autocomplete = props.autocomplete;
|
|
35
42
|
if (props.name !== undefined) {
|
|
36
43
|
element.name = props.name;
|
|
37
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unofficialbox/box-open-elements-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Optional React wrappers for box-open-elements Web Components. Thin adapters — core stays framework-agnostic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://unofficialbox.github.io/box-open-elements",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"node": ">=20.9.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@unofficialbox/box-open-elements": "^0.
|
|
45
|
+
"@unofficialbox/box-open-elements": "^0.27.0",
|
|
46
46
|
"react": "^19.0.0",
|
|
47
47
|
"react-dom": "^19.0.0"
|
|
48
48
|
},
|