@unofficialbox/box-open-elements-react 0.26.0 → 0.28.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/button.d.ts +2 -0
- package/dist/button.js +3 -1
- package/dist/combobox.d.ts +44 -0
- package/dist/combobox.js +37 -0
- package/dist/dialog.d.ts +6 -0
- package/dist/dialog.js +7 -1
- package/dist/drawer.d.ts +2 -0
- package/dist/drawer.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/text-field.d.ts +8 -0
- package/dist/text-field.js +9 -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
|
|
package/dist/button.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { NativeEventHandler } from "./events.js";
|
|
|
4
4
|
export type ButtonProps = Omit<WebComponentProps, "onClick"> & {
|
|
5
5
|
/** Button label text (maps to the `label` property / attribute). */
|
|
6
6
|
label?: string;
|
|
7
|
+
accessibleLabel?: string;
|
|
7
8
|
/** Visual tone: `primary` (default), `neutral`, `danger`. */
|
|
8
9
|
tone?: string;
|
|
9
10
|
/** Control size: `small`, `medium` (default), `large`. */
|
|
@@ -31,6 +32,7 @@ export type ButtonProps = Omit<WebComponentProps, "onClick"> & {
|
|
|
31
32
|
export declare const Button: import("react").ForwardRefExoticComponent<Omit<WebComponentProps, "onClick"> & {
|
|
32
33
|
/** Button label text (maps to the `label` property / attribute). */
|
|
33
34
|
label?: string;
|
|
35
|
+
accessibleLabel?: string;
|
|
34
36
|
/** Visual tone: `primary` (default), `neutral`, `danger`. */
|
|
35
37
|
tone?: string;
|
|
36
38
|
/** Control size: `small`, `medium` (default), `large`. */
|
package/dist/button.js
CHANGED
|
@@ -15,12 +15,14 @@ ButtonElement.register();
|
|
|
15
15
|
export const Button = createWebComponent({
|
|
16
16
|
tagName: "box-button",
|
|
17
17
|
displayName: "Button",
|
|
18
|
-
propertyNames: ["label", "tone", "size", "disabled"],
|
|
18
|
+
propertyNames: ["label", "accessibleLabel", "tone", "size", "disabled"],
|
|
19
19
|
events: [{ propName: "onClick", eventName: "click" }],
|
|
20
20
|
sync: (element, props) => {
|
|
21
21
|
if (props.label !== undefined) {
|
|
22
22
|
element.label = props.label;
|
|
23
23
|
}
|
|
24
|
+
if (props.accessibleLabel !== undefined)
|
|
25
|
+
element.accessibleLabel = props.accessibleLabel;
|
|
24
26
|
if (props.tone !== undefined) {
|
|
25
27
|
element.tone = props.tone;
|
|
26
28
|
}
|
|
@@ -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/dialog.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export type DialogProps = WebComponentProps & {
|
|
|
9
9
|
heading?: string;
|
|
10
10
|
description?: string;
|
|
11
11
|
confirmLabel?: string;
|
|
12
|
+
confirmDisabled?: boolean;
|
|
13
|
+
confirmBusy?: boolean;
|
|
14
|
+
confirmBusyLabel?: string;
|
|
12
15
|
size?: DialogSize;
|
|
13
16
|
onOpenChanged?: CustomEventHandler<DialogElement, {
|
|
14
17
|
open: boolean;
|
|
@@ -26,6 +29,9 @@ export declare const Dialog: import("react").ForwardRefExoticComponent<{
|
|
|
26
29
|
heading?: string;
|
|
27
30
|
description?: string;
|
|
28
31
|
confirmLabel?: string;
|
|
32
|
+
confirmDisabled?: boolean;
|
|
33
|
+
confirmBusy?: boolean;
|
|
34
|
+
confirmBusyLabel?: string;
|
|
29
35
|
size?: DialogSize;
|
|
30
36
|
onOpenChanged?: CustomEventHandler<DialogElement, {
|
|
31
37
|
open: boolean;
|
package/dist/dialog.js
CHANGED
|
@@ -5,7 +5,7 @@ DialogElement.register();
|
|
|
5
5
|
export const Dialog = createWebComponent({
|
|
6
6
|
tagName: "box-dialog",
|
|
7
7
|
displayName: "Dialog",
|
|
8
|
-
propertyNames: ["open", "heading", "description", "confirmLabel", "size"],
|
|
8
|
+
propertyNames: ["open", "heading", "description", "confirmLabel", "confirmDisabled", "confirmBusy", "confirmBusyLabel", "size"],
|
|
9
9
|
events: [
|
|
10
10
|
{ propName: "onOpenChanged", eventName: "open-changed" },
|
|
11
11
|
{ propName: "onConfirm", eventName: "confirm" },
|
|
@@ -21,6 +21,12 @@ export const Dialog = createWebComponent({
|
|
|
21
21
|
if (props.confirmLabel !== undefined) {
|
|
22
22
|
element.confirmLabel = props.confirmLabel;
|
|
23
23
|
}
|
|
24
|
+
if (props.confirmDisabled !== undefined)
|
|
25
|
+
element.confirmDisabled = props.confirmDisabled;
|
|
26
|
+
if (props.confirmBusy !== undefined)
|
|
27
|
+
element.confirmBusy = props.confirmBusy;
|
|
28
|
+
if (props.confirmBusyLabel !== undefined)
|
|
29
|
+
element.confirmBusyLabel = props.confirmBusyLabel;
|
|
24
30
|
if (props.size !== undefined) {
|
|
25
31
|
element.size = props.size;
|
|
26
32
|
}
|
package/dist/drawer.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type DrawerProps = WebComponentProps & {
|
|
|
11
11
|
position?: string;
|
|
12
12
|
size?: string;
|
|
13
13
|
busy?: boolean;
|
|
14
|
+
hideCloseButton?: boolean;
|
|
14
15
|
onOpenChanged?: CustomEventHandler<DrawerRef, {
|
|
15
16
|
open: boolean;
|
|
16
17
|
}>;
|
|
@@ -30,6 +31,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<{
|
|
|
30
31
|
position?: string;
|
|
31
32
|
size?: string;
|
|
32
33
|
busy?: boolean;
|
|
34
|
+
hideCloseButton?: boolean;
|
|
33
35
|
onOpenChanged?: CustomEventHandler<DrawerRef, {
|
|
34
36
|
open: boolean;
|
|
35
37
|
}>;
|
package/dist/drawer.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createWebComponent } from "./create-web-component.js";
|
|
|
4
4
|
export const Drawer = createWebComponent({
|
|
5
5
|
tagName: DrawerRef.tagName,
|
|
6
6
|
displayName: "Drawer",
|
|
7
|
-
propertyNames: ["heading", "description", "open", "position", "size", "busy"],
|
|
7
|
+
propertyNames: ["heading", "description", "open", "position", "size", "busy", "hideCloseButton"],
|
|
8
8
|
events: [{ propName: "onOpenChanged", eventName: "open-changed" }, { propName: "onDismiss", eventName: "dismiss" }],
|
|
9
9
|
sync: (element, props) => {
|
|
10
10
|
if (props.heading !== undefined)
|
|
@@ -19,5 +19,7 @@ export const Drawer = createWebComponent({
|
|
|
19
19
|
element.size = props.size;
|
|
20
20
|
if (props.busy !== undefined)
|
|
21
21
|
element.busy = props.busy;
|
|
22
|
+
if (props.hideCloseButton !== undefined)
|
|
23
|
+
element.hideCloseButton = props.hideCloseButton;
|
|
22
24
|
},
|
|
23
25
|
});
|
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,10 @@ 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
|
+
revealLabel?: string;
|
|
11
|
+
autocomplete?: string;
|
|
8
12
|
disabled?: boolean;
|
|
9
13
|
name?: string;
|
|
10
14
|
invalid?: boolean;
|
|
@@ -22,6 +26,10 @@ export declare const TextField: import("react").ForwardRefExoticComponent<{
|
|
|
22
26
|
label?: string;
|
|
23
27
|
value?: string;
|
|
24
28
|
placeholder?: string;
|
|
29
|
+
type?: "text" | "password" | "email" | "tel" | "url" | "search" | "number";
|
|
30
|
+
reveal?: boolean;
|
|
31
|
+
revealLabel?: string;
|
|
32
|
+
autocomplete?: string;
|
|
25
33
|
disabled?: boolean;
|
|
26
34
|
name?: string;
|
|
27
35
|
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", "revealLabel", "autocomplete",
|
|
12
13
|
"disabled",
|
|
13
14
|
"name",
|
|
14
15
|
"invalid",
|
|
@@ -32,6 +33,14 @@ 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.revealLabel !== undefined)
|
|
41
|
+
element.revealLabel = props.revealLabel;
|
|
42
|
+
if (props.autocomplete !== undefined)
|
|
43
|
+
element.autocomplete = props.autocomplete;
|
|
35
44
|
if (props.name !== undefined) {
|
|
36
45
|
element.name = props.name;
|
|
37
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unofficialbox/box-open-elements-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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.28.0",
|
|
46
46
|
"react": "^19.0.0",
|
|
47
47
|
"react-dom": "^19.0.0"
|
|
48
48
|
},
|