@unofficialbox/box-open-elements-react 0.20.0 → 0.22.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/dist/alert.d.ts +33 -0
- package/dist/alert.js +21 -0
- package/dist/card.d.ts +18 -0
- package/dist/card.js +15 -0
- package/dist/checkbox.d.ts +41 -0
- package/dist/checkbox.js +31 -0
- package/dist/code-block.d.ts +27 -0
- package/dist/code-block.js +17 -0
- package/dist/drawer.d.ts +39 -0
- package/dist/drawer.js +23 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/number-input.d.ts +47 -0
- package/dist/number-input.js +37 -0
- package/dist/tabs.d.ts +29 -0
- package/dist/tabs.js +19 -0
- package/dist/toast.d.ts +39 -0
- package/dist/toast.js +23 -0
- package/package.json +7 -2
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Alert as AlertRef } from "@unofficialbox/box-open-elements/alert";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { AlertRef };
|
|
6
|
+
export type AlertProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
heading?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
tone?: string;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
onOpenChanged?: CustomEventHandler<AlertRef, {
|
|
14
|
+
open: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
onDismiss?: CustomEventHandler<AlertRef, unknown>;
|
|
17
|
+
};
|
|
18
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
19
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<{
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: import("react").CSSProperties;
|
|
22
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
heading?: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
tone?: string;
|
|
28
|
+
open?: boolean;
|
|
29
|
+
onOpenChanged?: CustomEventHandler<AlertRef, {
|
|
30
|
+
open: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
onDismiss?: CustomEventHandler<AlertRef, unknown>;
|
|
33
|
+
} & import("react").RefAttributes<AlertRef>>;
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Alert as AlertRef } from "@unofficialbox/box-open-elements/alert";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Alert = createWebComponent({
|
|
5
|
+
tagName: AlertRef.tagName,
|
|
6
|
+
displayName: "Alert",
|
|
7
|
+
propertyNames: ["heading", "message", "description", "tone", "open"],
|
|
8
|
+
events: [{ propName: "onOpenChanged", eventName: "open-changed" }, { propName: "onDismiss", eventName: "dismiss" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.heading !== undefined)
|
|
11
|
+
element.heading = props.heading;
|
|
12
|
+
if (props.message !== undefined)
|
|
13
|
+
element.message = props.message;
|
|
14
|
+
if (props.description !== undefined)
|
|
15
|
+
element.description = props.description;
|
|
16
|
+
if (props.tone !== undefined)
|
|
17
|
+
element.tone = props.tone;
|
|
18
|
+
if (props.open !== undefined)
|
|
19
|
+
element.open = props.open;
|
|
20
|
+
},
|
|
21
|
+
});
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Card as CardRef } from "@unofficialbox/box-open-elements/card";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
export type { CardRef };
|
|
5
|
+
export type CardProps = WebComponentProps & {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
heading?: string;
|
|
8
|
+
eyebrow?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
11
|
+
export declare const Card: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: import("react").CSSProperties;
|
|
14
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
heading?: string;
|
|
17
|
+
eyebrow?: string;
|
|
18
|
+
} & import("react").RefAttributes<CardRef>>;
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Card as CardRef } from "@unofficialbox/box-open-elements/card";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Card = createWebComponent({
|
|
5
|
+
tagName: CardRef.tagName,
|
|
6
|
+
displayName: "Card",
|
|
7
|
+
propertyNames: ["heading", "eyebrow"],
|
|
8
|
+
events: [],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.heading !== undefined)
|
|
11
|
+
element.heading = props.heading;
|
|
12
|
+
if (props.eyebrow !== undefined)
|
|
13
|
+
element.eyebrow = props.eyebrow;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Checkbox as CheckboxRef } from "@unofficialbox/box-open-elements/checkbox";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { CheckboxRef };
|
|
6
|
+
export type CheckboxProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
indeterminate?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
value?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
description?: string;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
onCheckedChanged?: CustomEventHandler<CheckboxRef, {
|
|
19
|
+
checked: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
23
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: import("react").CSSProperties;
|
|
26
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
label?: string;
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
indeterminate?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
value?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
description?: string;
|
|
36
|
+
invalid?: boolean;
|
|
37
|
+
errorMessage?: string;
|
|
38
|
+
onCheckedChanged?: CustomEventHandler<CheckboxRef, {
|
|
39
|
+
checked: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
} & import("react").RefAttributes<CheckboxRef>>;
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Checkbox as CheckboxRef } from "@unofficialbox/box-open-elements/checkbox";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Checkbox = createWebComponent({
|
|
5
|
+
tagName: CheckboxRef.tagName,
|
|
6
|
+
displayName: "Checkbox",
|
|
7
|
+
propertyNames: ["label", "checked", "indeterminate", "disabled", "value", "name", "required", "description", "invalid", "errorMessage"],
|
|
8
|
+
events: [{ propName: "onCheckedChanged", eventName: "checked-changed" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.label !== undefined)
|
|
11
|
+
element.label = props.label;
|
|
12
|
+
if (props.checked !== undefined)
|
|
13
|
+
element.checked = props.checked;
|
|
14
|
+
if (props.indeterminate !== undefined)
|
|
15
|
+
element.indeterminate = props.indeterminate;
|
|
16
|
+
if (props.disabled !== undefined)
|
|
17
|
+
element.disabled = props.disabled;
|
|
18
|
+
if (props.value !== undefined)
|
|
19
|
+
element.value = props.value;
|
|
20
|
+
if (props.name !== undefined)
|
|
21
|
+
element.name = props.name;
|
|
22
|
+
if (props.required !== undefined)
|
|
23
|
+
element.required = props.required;
|
|
24
|
+
if (props.description !== undefined)
|
|
25
|
+
element.description = props.description;
|
|
26
|
+
if (props.invalid !== undefined)
|
|
27
|
+
element.invalid = props.invalid;
|
|
28
|
+
if (props.errorMessage !== undefined)
|
|
29
|
+
element.errorMessage = props.errorMessage;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { CodeBlock as CodeBlockRef } from "@unofficialbox/box-open-elements/code-block";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { CodeBlockRef };
|
|
6
|
+
export type CodeBlockProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
code?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
copyLabel?: string;
|
|
11
|
+
onCodeCopied?: CustomEventHandler<CodeBlockRef, {
|
|
12
|
+
copied: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
16
|
+
export declare const CodeBlock: import("react").ForwardRefExoticComponent<{
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: import("react").CSSProperties;
|
|
19
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
code?: string;
|
|
22
|
+
language?: string;
|
|
23
|
+
copyLabel?: string;
|
|
24
|
+
onCodeCopied?: CustomEventHandler<CodeBlockRef, {
|
|
25
|
+
copied: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
} & import("react").RefAttributes<CodeBlockRef>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CodeBlock as CodeBlockRef } from "@unofficialbox/box-open-elements/code-block";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const CodeBlock = createWebComponent({
|
|
5
|
+
tagName: CodeBlockRef.tagName,
|
|
6
|
+
displayName: "CodeBlock",
|
|
7
|
+
propertyNames: ["code", "language", "copyLabel"],
|
|
8
|
+
events: [{ propName: "onCodeCopied", eventName: "code-copied" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.code !== undefined)
|
|
11
|
+
element.code = props.code;
|
|
12
|
+
if (props.language !== undefined)
|
|
13
|
+
element.language = props.language;
|
|
14
|
+
if (props.copyLabel !== undefined)
|
|
15
|
+
element.copyLabel = props.copyLabel;
|
|
16
|
+
},
|
|
17
|
+
});
|
package/dist/drawer.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Drawer as DrawerRef } from "@unofficialbox/box-open-elements/drawer";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { DrawerRef };
|
|
6
|
+
export type DrawerProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
heading?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
position?: string;
|
|
12
|
+
size?: string;
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
onOpenChanged?: CustomEventHandler<DrawerRef, {
|
|
15
|
+
open: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
onDismiss?: CustomEventHandler<DrawerRef, {
|
|
18
|
+
source: "close-button" | "backdrop" | "escape";
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
22
|
+
export declare const Drawer: import("react").ForwardRefExoticComponent<{
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: import("react").CSSProperties;
|
|
25
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
heading?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
open?: boolean;
|
|
30
|
+
position?: string;
|
|
31
|
+
size?: string;
|
|
32
|
+
busy?: boolean;
|
|
33
|
+
onOpenChanged?: CustomEventHandler<DrawerRef, {
|
|
34
|
+
open: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
onDismiss?: CustomEventHandler<DrawerRef, {
|
|
37
|
+
source: "close-button" | "backdrop" | "escape";
|
|
38
|
+
}>;
|
|
39
|
+
} & import("react").RefAttributes<DrawerRef>>;
|
package/dist/drawer.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Drawer as DrawerRef } from "@unofficialbox/box-open-elements/drawer";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Drawer = createWebComponent({
|
|
5
|
+
tagName: DrawerRef.tagName,
|
|
6
|
+
displayName: "Drawer",
|
|
7
|
+
propertyNames: ["heading", "description", "open", "position", "size", "busy"],
|
|
8
|
+
events: [{ propName: "onOpenChanged", eventName: "open-changed" }, { propName: "onDismiss", eventName: "dismiss" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.heading !== undefined)
|
|
11
|
+
element.heading = props.heading;
|
|
12
|
+
if (props.description !== undefined)
|
|
13
|
+
element.description = props.description;
|
|
14
|
+
if (props.open !== undefined)
|
|
15
|
+
element.open = props.open;
|
|
16
|
+
if (props.position !== undefined)
|
|
17
|
+
element.position = props.position;
|
|
18
|
+
if (props.size !== undefined)
|
|
19
|
+
element.size = props.size;
|
|
20
|
+
if (props.busy !== undefined)
|
|
21
|
+
element.busy = props.busy;
|
|
22
|
+
},
|
|
23
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -10,3 +10,11 @@ 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
12
|
export { TextField, type TextFieldProps } from "./text-field.js";
|
|
13
|
+
export { NumberInput, type NumberInputProps, type NumberInputRef } from "./number-input.js";
|
|
14
|
+
export { Checkbox, type CheckboxProps, type CheckboxRef } from "./checkbox.js";
|
|
15
|
+
export { Tabs, type TabsProps, type TabsRef } from "./tabs.js";
|
|
16
|
+
export { Card, type CardProps, type CardRef } from "./card.js";
|
|
17
|
+
export { Alert, type AlertProps, type AlertRef } from "./alert.js";
|
|
18
|
+
export { Toast, type ToastProps, type ToastRef } from "./toast.js";
|
|
19
|
+
export { Drawer, type DrawerProps, type DrawerRef } from "./drawer.js";
|
|
20
|
+
export { CodeBlock, type CodeBlockProps, type CodeBlockRef } from "./code-block.js";
|
package/dist/index.js
CHANGED
|
@@ -9,3 +9,11 @@ export { Dialog } from "./dialog.js";
|
|
|
9
9
|
export { ExplorerSelectionController, useExplorerSelectionController, } from "./explorer-selection.js";
|
|
10
10
|
export { Select } from "./select.js";
|
|
11
11
|
export { TextField } from "./text-field.js";
|
|
12
|
+
export { NumberInput } from "./number-input.js";
|
|
13
|
+
export { Checkbox } from "./checkbox.js";
|
|
14
|
+
export { Tabs } from "./tabs.js";
|
|
15
|
+
export { Card } from "./card.js";
|
|
16
|
+
export { Alert } from "./alert.js";
|
|
17
|
+
export { Toast } from "./toast.js";
|
|
18
|
+
export { Drawer } from "./drawer.js";
|
|
19
|
+
export { CodeBlock } from "./code-block.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { NumberInput as NumberInputRef } from "@unofficialbox/box-open-elements/number-input";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { NumberInputRef };
|
|
6
|
+
export type NumberInputProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
value?: number;
|
|
10
|
+
min?: number | null;
|
|
11
|
+
max?: number | null;
|
|
12
|
+
step?: number;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
name?: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
hideLabel?: boolean;
|
|
18
|
+
description?: string;
|
|
19
|
+
invalid?: boolean;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
onValueChanged?: CustomEventHandler<NumberInputRef, {
|
|
22
|
+
value: number;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
26
|
+
export declare const NumberInput: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: import("react").CSSProperties;
|
|
29
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
label?: string;
|
|
32
|
+
value?: number;
|
|
33
|
+
min?: number | null;
|
|
34
|
+
max?: number | null;
|
|
35
|
+
step?: number;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
hideLabel?: boolean;
|
|
41
|
+
description?: string;
|
|
42
|
+
invalid?: boolean;
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
onValueChanged?: CustomEventHandler<NumberInputRef, {
|
|
45
|
+
value: number;
|
|
46
|
+
}>;
|
|
47
|
+
} & import("react").RefAttributes<NumberInputRef>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NumberInput as NumberInputRef } from "@unofficialbox/box-open-elements/number-input";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const NumberInput = createWebComponent({
|
|
5
|
+
tagName: NumberInputRef.tagName,
|
|
6
|
+
displayName: "NumberInput",
|
|
7
|
+
propertyNames: ["label", "value", "min", "max", "step", "placeholder", "disabled", "name", "required", "hideLabel", "description", "invalid", "errorMessage"],
|
|
8
|
+
events: [{ propName: "onValueChanged", eventName: "value-changed" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.label !== undefined)
|
|
11
|
+
element.label = props.label;
|
|
12
|
+
if (props.value !== undefined)
|
|
13
|
+
element.value = props.value;
|
|
14
|
+
if (props.min !== undefined)
|
|
15
|
+
element.min = props.min;
|
|
16
|
+
if (props.max !== undefined)
|
|
17
|
+
element.max = props.max;
|
|
18
|
+
if (props.step !== undefined)
|
|
19
|
+
element.step = props.step;
|
|
20
|
+
if (props.placeholder !== undefined)
|
|
21
|
+
element.placeholder = props.placeholder;
|
|
22
|
+
if (props.disabled !== undefined)
|
|
23
|
+
element.disabled = props.disabled;
|
|
24
|
+
if (props.name !== undefined)
|
|
25
|
+
element.name = props.name;
|
|
26
|
+
if (props.required !== undefined)
|
|
27
|
+
element.required = props.required;
|
|
28
|
+
if (props.hideLabel !== undefined)
|
|
29
|
+
element.hideLabel = props.hideLabel;
|
|
30
|
+
if (props.description !== undefined)
|
|
31
|
+
element.description = props.description;
|
|
32
|
+
if (props.invalid !== undefined)
|
|
33
|
+
element.invalid = props.invalid;
|
|
34
|
+
if (props.errorMessage !== undefined)
|
|
35
|
+
element.errorMessage = props.errorMessage;
|
|
36
|
+
},
|
|
37
|
+
});
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Tabs as TabsRef } from "@unofficialbox/box-open-elements/tabs";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { TabsRef };
|
|
6
|
+
export type TabsProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
layout?: "attached" | "separated";
|
|
11
|
+
options?: TabsRef["options"];
|
|
12
|
+
onValueChanged?: CustomEventHandler<TabsRef, {
|
|
13
|
+
value: string;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
17
|
+
export declare const Tabs: import("react").ForwardRefExoticComponent<{
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: import("react").CSSProperties;
|
|
20
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
label?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
layout?: "attached" | "separated";
|
|
25
|
+
options?: TabsRef["options"];
|
|
26
|
+
onValueChanged?: CustomEventHandler<TabsRef, {
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
} & import("react").RefAttributes<TabsRef>>;
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tabs as TabsRef } from "@unofficialbox/box-open-elements/tabs";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Tabs = createWebComponent({
|
|
5
|
+
tagName: TabsRef.tagName,
|
|
6
|
+
displayName: "Tabs",
|
|
7
|
+
propertyNames: ["label", "value", "layout", "options"],
|
|
8
|
+
events: [{ propName: "onValueChanged", eventName: "value-changed" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.label !== undefined)
|
|
11
|
+
element.label = props.label;
|
|
12
|
+
if (props.value !== undefined)
|
|
13
|
+
element.value = props.value;
|
|
14
|
+
if (props.layout !== undefined)
|
|
15
|
+
element.layout = props.layout;
|
|
16
|
+
if (props.options !== undefined)
|
|
17
|
+
element.options = props.options;
|
|
18
|
+
},
|
|
19
|
+
});
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Toast as ToastRef } from "@unofficialbox/box-open-elements/toast";
|
|
3
|
+
import { type WebComponentProps } from "./create-web-component.js";
|
|
4
|
+
import type { CustomEventHandler } from "./events.js";
|
|
5
|
+
export type { ToastRef };
|
|
6
|
+
export type ToastProps = WebComponentProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
heading?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
tone?: string;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
mode?: ToastRef["mode"];
|
|
13
|
+
duration?: number;
|
|
14
|
+
onOpenChanged?: CustomEventHandler<ToastRef, {
|
|
15
|
+
open: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
onDismiss?: CustomEventHandler<ToastRef, {
|
|
18
|
+
source: "timeout" | "close-button";
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
22
|
+
export declare const Toast: import("react").ForwardRefExoticComponent<{
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: import("react").CSSProperties;
|
|
25
|
+
} & Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "children" | "onCancel"> & {
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
heading?: string;
|
|
28
|
+
message?: string;
|
|
29
|
+
tone?: string;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
mode?: ToastRef["mode"];
|
|
32
|
+
duration?: number;
|
|
33
|
+
onOpenChanged?: CustomEventHandler<ToastRef, {
|
|
34
|
+
open: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
onDismiss?: CustomEventHandler<ToastRef, {
|
|
37
|
+
source: "timeout" | "close-button";
|
|
38
|
+
}>;
|
|
39
|
+
} & import("react").RefAttributes<ToastRef>>;
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Toast as ToastRef } from "@unofficialbox/box-open-elements/toast";
|
|
2
|
+
import { createWebComponent } from "./create-web-component.js";
|
|
3
|
+
/** Omitted props preserve imperative state; supplied props are synchronized. */
|
|
4
|
+
export const Toast = createWebComponent({
|
|
5
|
+
tagName: ToastRef.tagName,
|
|
6
|
+
displayName: "Toast",
|
|
7
|
+
propertyNames: ["heading", "message", "tone", "open", "mode", "duration"],
|
|
8
|
+
events: [{ propName: "onOpenChanged", eventName: "open-changed" }, { propName: "onDismiss", eventName: "dismiss" }],
|
|
9
|
+
sync: (element, props) => {
|
|
10
|
+
if (props.heading !== undefined)
|
|
11
|
+
element.heading = props.heading;
|
|
12
|
+
if (props.message !== undefined)
|
|
13
|
+
element.message = props.message;
|
|
14
|
+
if (props.tone !== undefined)
|
|
15
|
+
element.tone = props.tone;
|
|
16
|
+
if (props.open !== undefined)
|
|
17
|
+
element.open = props.open;
|
|
18
|
+
if (props.mode !== undefined)
|
|
19
|
+
element.mode = props.mode;
|
|
20
|
+
if (props.duration !== undefined)
|
|
21
|
+
element.duration = props.duration;
|
|
22
|
+
},
|
|
23
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unofficialbox/box-open-elements-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|
|
@@ -19,9 +19,14 @@
|
|
|
19
19
|
"box"
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
22
23
|
"main": "dist/index.js",
|
|
23
24
|
"types": "dist/index.d.ts",
|
|
24
25
|
"exports": {
|
|
26
|
+
"./*": {
|
|
27
|
+
"types": "./dist/*.d.ts",
|
|
28
|
+
"import": "./dist/*.js"
|
|
29
|
+
},
|
|
25
30
|
".": {
|
|
26
31
|
"types": "./dist/index.d.ts",
|
|
27
32
|
"import": "./dist/index.js"
|
|
@@ -37,7 +42,7 @@
|
|
|
37
42
|
"node": ">=20.9.0"
|
|
38
43
|
},
|
|
39
44
|
"peerDependencies": {
|
|
40
|
-
"@unofficialbox/box-open-elements": "^0.
|
|
45
|
+
"@unofficialbox/box-open-elements": "^0.22.0",
|
|
41
46
|
"react": "^19.0.0",
|
|
42
47
|
"react-dom": "^19.0.0"
|
|
43
48
|
},
|