basefn 1.10.0 → 1.11.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/package.json +3 -3
- package/rescript.json +1 -1
- package/src/Basefn__Responsive.res.mjs +5 -5
- package/src/Basefn__Utils.res.mjs +2 -2
- package/src/Demo.res +59 -59
- package/src/Demo.res.mjs +630 -628
- package/src/Example.res +3 -3
- package/src/Example.res.mjs +48 -47
- package/src/components/Basefn__Accordion.res +5 -5
- package/src/components/Basefn__Accordion.res.mjs +25 -26
- package/src/components/Basefn__Alert.res +4 -4
- package/src/components/Basefn__Alert.res.mjs +20 -18
- package/src/components/Basefn__AlertDialog.res +5 -5
- package/src/components/Basefn__AlertDialog.res.mjs +23 -21
- package/src/components/Basefn__AppLayout.res +3 -3
- package/src/components/Basefn__AppLayout.res.mjs +25 -24
- package/src/components/Basefn__AspectRatio.res +1 -1
- package/src/components/Basefn__AspectRatio.res.mjs +2 -2
- package/src/components/Basefn__Avatar.res.mjs +3 -3
- package/src/components/Basefn__Badge.res +1 -1
- package/src/components/Basefn__Badge.res.mjs +2 -2
- package/src/components/Basefn__Breadcrumb.res +5 -5
- package/src/components/Basefn__Breadcrumb.res.mjs +14 -14
- package/src/components/Basefn__Button.res +1 -1
- package/src/components/Basefn__Button.res.mjs +10 -9
- package/src/components/Basefn__ButtonGroup.res +1 -1
- package/src/components/Basefn__ButtonGroup.res.mjs +2 -2
- package/src/components/Basefn__Card.res +3 -3
- package/src/components/Basefn__Card.res.mjs +11 -11
- package/src/components/Basefn__Checkbox.res +1 -1
- package/src/components/Basefn__Checkbox.res.mjs +7 -7
- package/src/components/Basefn__ContextMenu.res +4 -4
- package/src/components/Basefn__ContextMenu.res.mjs +22 -20
- package/src/components/Basefn__Drawer.res +5 -5
- package/src/components/Basefn__Drawer.res.mjs +22 -20
- package/src/components/Basefn__Dropdown.res +4 -4
- package/src/components/Basefn__Dropdown.res.mjs +20 -18
- package/src/components/Basefn__Grid.res.mjs +15 -14
- package/src/components/Basefn__HoverCard.res +3 -3
- package/src/components/Basefn__HoverCard.res.mjs +14 -12
- package/src/components/Basefn__Icon.res.mjs +8 -7
- package/src/components/Basefn__Input.res.mjs +4 -4
- package/src/components/Basefn__Kbd.res +2 -2
- package/src/components/Basefn__Kbd.res.mjs +5 -5
- package/src/components/Basefn__Label.res +1 -1
- package/src/components/Basefn__Label.res.mjs +4 -4
- package/src/components/Basefn__Modal.res +5 -5
- package/src/components/Basefn__Modal.res.mjs +20 -18
- package/src/components/Basefn__Popover.res +3 -3
- package/src/components/Basefn__Popover.res.mjs +15 -13
- package/src/components/Basefn__Progress.res +2 -2
- package/src/components/Basefn__Progress.res.mjs +16 -14
- package/src/components/Basefn__Radio.res +1 -1
- package/src/components/Basefn__Radio.res.mjs +7 -7
- package/src/components/Basefn__Resizable.res +49 -20
- package/src/components/Basefn__Resizable.res.mjs +66 -36
- package/src/components/Basefn__ScrollArea.res +1 -1
- package/src/components/Basefn__ScrollArea.res.mjs +2 -2
- package/src/components/Basefn__Select.res +2 -2
- package/src/components/Basefn__Select.res.mjs +7 -6
- package/src/components/Basefn__Separator.res +1 -1
- package/src/components/Basefn__Separator.res.mjs +9 -9
- package/src/components/Basefn__Sidebar.res +7 -7
- package/src/components/Basefn__Sidebar.res.mjs +28 -24
- package/src/components/Basefn__Skeleton.res.mjs +2 -2
- package/src/components/Basefn__Slider.res +4 -4
- package/src/components/Basefn__Slider.res.mjs +21 -20
- package/src/components/Basefn__Spinner.res +1 -1
- package/src/components/Basefn__Spinner.res.mjs +8 -8
- package/src/components/Basefn__Spotlight.res +14 -14
- package/src/components/Basefn__Spotlight.res.mjs +69 -65
- package/src/components/Basefn__Stepper.res +6 -6
- package/src/components/Basefn__Stepper.res.mjs +20 -24
- package/src/components/Basefn__Switch.res +1 -1
- package/src/components/Basefn__Switch.res.mjs +16 -14
- package/src/components/Basefn__Tabs.res +4 -4
- package/src/components/Basefn__Tabs.res.mjs +19 -17
- package/src/components/Basefn__Textarea.res.mjs +4 -4
- package/src/components/Basefn__ThemeToggle.res +1 -1
- package/src/components/Basefn__ThemeToggle.res.mjs +13 -10
- package/src/components/Basefn__Timeline.res +6 -6
- package/src/components/Basefn__Timeline.res.mjs +21 -21
- package/src/components/Basefn__Toast.res +4 -4
- package/src/components/Basefn__Toast.res.mjs +23 -20
- package/src/components/Basefn__Toggle.res +1 -1
- package/src/components/Basefn__Toggle.res.mjs +8 -7
- package/src/components/Basefn__ToggleGroup.res +2 -2
- package/src/components/Basefn__ToggleGroup.res.mjs +12 -10
- package/src/components/Basefn__Tooltip.res +3 -3
- package/src/components/Basefn__Tooltip.res.mjs +14 -12
- package/src/components/Basefn__Topbar.res +7 -7
- package/src/components/Basefn__Topbar.res.mjs +22 -22
- package/src/components/Basefn__Typography.res +2 -2
- package/src/components/Basefn__Typography.res.mjs +13 -13
- package/src/styles/Basefn__Theme.res.mjs +5 -5
package/src/Example.res
CHANGED
|
@@ -55,7 +55,7 @@ module ExampleForm = {
|
|
|
55
55
|
])
|
|
56
56
|
|
|
57
57
|
<div style="max-width: 50rem; margin: auto;">
|
|
58
|
-
<h1> {
|
|
58
|
+
<h1> {Node.text("Contact Form Example")} </h1>
|
|
59
59
|
|
|
60
60
|
<div style="margin-bottom: 1rem;">
|
|
61
61
|
<Label text="Name" required={true} />
|
|
@@ -99,7 +99,7 @@ module ExampleForm = {
|
|
|
99
99
|
|
|
100
100
|
<div style="display: flex; gap: 1rem;">
|
|
101
101
|
<Button onClick={handleSubmit} variant={Button.Primary} disabled={Reactive(isSubmitting)}>
|
|
102
|
-
{
|
|
102
|
+
{Node.signalText(() => Signal.get(isSubmitting) ? "Submitting..." : "Submit")}
|
|
103
103
|
</Button>
|
|
104
104
|
<Button label={Static("Cancel")} variant={Button.Ghost} />
|
|
105
105
|
</div>
|
|
@@ -108,4 +108,4 @@ module ExampleForm = {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Mount the example form
|
|
111
|
-
|
|
111
|
+
Node.mountById(<ExampleForm />, "root")
|
package/src/Example.res.mjs
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Xote from "xote/src/Xote.res.mjs";
|
|
4
3
|
import * as Basefn from "./Basefn.res.mjs";
|
|
5
|
-
import * as
|
|
4
|
+
import * as Node$Xote from "xote/src/Node.res.mjs";
|
|
5
|
+
import * as Signal$Xote from "xote/src/Signal.res.mjs";
|
|
6
|
+
import * as XoteJSX$Xote from "xote/src/XoteJSX.res.mjs";
|
|
6
7
|
|
|
7
8
|
function Example$ExampleForm(props) {
|
|
8
|
-
let name = Xote.
|
|
9
|
-
let email = Xote.
|
|
10
|
-
let message = Xote.
|
|
11
|
-
let agreeToTerms = Xote.
|
|
12
|
-
let selectedOption = Xote.
|
|
13
|
-
let isSubmitting = Xote.
|
|
9
|
+
let name = Signal$Xote.make("", undefined, undefined);
|
|
10
|
+
let email = Signal$Xote.make("", undefined, undefined);
|
|
11
|
+
let message = Signal$Xote.make("", undefined, undefined);
|
|
12
|
+
let agreeToTerms = Signal$Xote.make(false, undefined, undefined);
|
|
13
|
+
let selectedOption = Signal$Xote.make("option1", undefined, undefined);
|
|
14
|
+
let isSubmitting = Signal$Xote.make(false, undefined, undefined);
|
|
14
15
|
let handleNameChange = evt => {
|
|
15
16
|
let target = evt.target;
|
|
16
|
-
Xote.
|
|
17
|
+
Signal$Xote.set(name, target.value);
|
|
17
18
|
};
|
|
18
19
|
let handleEmailChange = evt => {
|
|
19
20
|
let target = evt.target;
|
|
20
|
-
Xote.
|
|
21
|
+
Signal$Xote.set(email, target.value);
|
|
21
22
|
};
|
|
22
23
|
let handleMessageChange = evt => {
|
|
23
24
|
let target = evt.target;
|
|
24
|
-
Xote.
|
|
25
|
+
Signal$Xote.set(message, target.value);
|
|
25
26
|
};
|
|
26
|
-
let handleCheckboxChange = _evt => Xote.
|
|
27
|
+
let handleCheckboxChange = _evt => Signal$Xote.update(agreeToTerms, prev => !prev);
|
|
27
28
|
let handleSubmit = _evt => {
|
|
28
|
-
Xote.
|
|
29
|
+
Signal$Xote.set(isSubmitting, true);
|
|
29
30
|
console.log("Submitting form...");
|
|
30
|
-
console.log(`Name: ` + Xote.
|
|
31
|
-
console.log(`Email: ` + Xote.
|
|
32
|
-
console.log(`Message: ` + Xote.
|
|
31
|
+
console.log(`Name: ` + Signal$Xote.get(name));
|
|
32
|
+
console.log(`Email: ` + Signal$Xote.get(email));
|
|
33
|
+
console.log(`Message: ` + Signal$Xote.get(message));
|
|
33
34
|
setTimeout(() => {
|
|
34
|
-
Xote.
|
|
35
|
+
Signal$Xote.set(isSubmitting, false);
|
|
35
36
|
}, 1000);
|
|
36
37
|
};
|
|
37
|
-
let selectOptions = Xote.
|
|
38
|
+
let selectOptions = Signal$Xote.make([
|
|
38
39
|
{
|
|
39
40
|
value: "option1",
|
|
40
41
|
label: "Option 1"
|
|
@@ -48,20 +49,20 @@ function Example$ExampleForm(props) {
|
|
|
48
49
|
label: "Option 3"
|
|
49
50
|
}
|
|
50
51
|
], undefined, undefined);
|
|
51
|
-
return
|
|
52
|
+
return XoteJSX$Xote.Elements.jsxs("div", {
|
|
52
53
|
style: "max-width: 50rem; margin: auto;",
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
children: Xote.
|
|
54
|
+
children: XoteJSX$Xote.array([
|
|
55
|
+
XoteJSX$Xote.Elements.jsx("h1", {
|
|
56
|
+
children: Node$Xote.text("Contact Form Example")
|
|
56
57
|
}),
|
|
57
|
-
|
|
58
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
58
59
|
style: "margin-bottom: 1rem;",
|
|
59
|
-
children:
|
|
60
|
-
|
|
60
|
+
children: XoteJSX$Xote.array([
|
|
61
|
+
XoteJSX$Xote.jsx(Basefn.Label.make, {
|
|
61
62
|
text: "Name",
|
|
62
63
|
required: true
|
|
63
64
|
}),
|
|
64
|
-
|
|
65
|
+
XoteJSX$Xote.jsx(Basefn.Input.make, {
|
|
65
66
|
value: {
|
|
66
67
|
TAG: "Reactive",
|
|
67
68
|
_0: name
|
|
@@ -72,14 +73,14 @@ function Example$ExampleForm(props) {
|
|
|
72
73
|
})
|
|
73
74
|
])
|
|
74
75
|
}),
|
|
75
|
-
|
|
76
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
76
77
|
style: "margin-bottom: 1rem;",
|
|
77
|
-
children:
|
|
78
|
-
|
|
78
|
+
children: XoteJSX$Xote.array([
|
|
79
|
+
XoteJSX$Xote.jsx(Basefn.Label.make, {
|
|
79
80
|
text: "Email",
|
|
80
81
|
required: true
|
|
81
82
|
}),
|
|
82
|
-
|
|
83
|
+
XoteJSX$Xote.jsx(Basefn.Input.make, {
|
|
83
84
|
value: {
|
|
84
85
|
TAG: "Reactive",
|
|
85
86
|
_0: email
|
|
@@ -90,27 +91,27 @@ function Example$ExampleForm(props) {
|
|
|
90
91
|
})
|
|
91
92
|
])
|
|
92
93
|
}),
|
|
93
|
-
|
|
94
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
94
95
|
style: "margin-bottom: 1rem;",
|
|
95
|
-
children:
|
|
96
|
-
|
|
96
|
+
children: XoteJSX$Xote.array([
|
|
97
|
+
XoteJSX$Xote.jsx(Basefn.Label.make, {
|
|
97
98
|
text: "Choose an option",
|
|
98
99
|
required: false
|
|
99
100
|
}),
|
|
100
|
-
|
|
101
|
+
XoteJSX$Xote.jsx(Basefn.Select.make, {
|
|
101
102
|
value: selectedOption,
|
|
102
103
|
options: selectOptions
|
|
103
104
|
})
|
|
104
105
|
])
|
|
105
106
|
}),
|
|
106
|
-
|
|
107
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
107
108
|
style: "margin-bottom: 1rem;",
|
|
108
|
-
children:
|
|
109
|
-
|
|
109
|
+
children: XoteJSX$Xote.array([
|
|
110
|
+
XoteJSX$Xote.jsx(Basefn.Label.make, {
|
|
110
111
|
text: "Message",
|
|
111
112
|
required: false
|
|
112
113
|
}),
|
|
113
|
-
|
|
114
|
+
XoteJSX$Xote.jsx(Basefn.Textarea.make, {
|
|
114
115
|
value: {
|
|
115
116
|
TAG: "Reactive",
|
|
116
117
|
_0: message
|
|
@@ -120,20 +121,20 @@ function Example$ExampleForm(props) {
|
|
|
120
121
|
})
|
|
121
122
|
])
|
|
122
123
|
}),
|
|
123
|
-
|
|
124
|
+
XoteJSX$Xote.Elements.jsx("div", {
|
|
124
125
|
style: "margin-bottom: 1rem;",
|
|
125
|
-
children:
|
|
126
|
+
children: XoteJSX$Xote.jsx(Basefn.Checkbox.make, {
|
|
126
127
|
checked: agreeToTerms,
|
|
127
128
|
onChange: handleCheckboxChange,
|
|
128
129
|
label: "I agree to the terms and conditions"
|
|
129
130
|
})
|
|
130
131
|
}),
|
|
131
|
-
|
|
132
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
132
133
|
style: "display: flex; gap: 1rem;",
|
|
133
|
-
children:
|
|
134
|
-
|
|
135
|
-
children: Xote.
|
|
136
|
-
if (Xote.
|
|
134
|
+
children: XoteJSX$Xote.array([
|
|
135
|
+
XoteJSX$Xote.jsx(Basefn.Button.make, {
|
|
136
|
+
children: Node$Xote.signalText(() => {
|
|
137
|
+
if (Signal$Xote.get(isSubmitting)) {
|
|
137
138
|
return "Submitting...";
|
|
138
139
|
} else {
|
|
139
140
|
return "Submit";
|
|
@@ -146,7 +147,7 @@ function Example$ExampleForm(props) {
|
|
|
146
147
|
onClick: handleSubmit,
|
|
147
148
|
variant: "Primary"
|
|
148
149
|
}),
|
|
149
|
-
|
|
150
|
+
XoteJSX$Xote.jsx(Basefn.Button.make, {
|
|
150
151
|
label: {
|
|
151
152
|
TAG: "Static",
|
|
152
153
|
_0: "Cancel"
|
|
@@ -163,7 +164,7 @@ let ExampleForm = {
|
|
|
163
164
|
make: Example$ExampleForm
|
|
164
165
|
};
|
|
165
166
|
|
|
166
|
-
Xote.
|
|
167
|
+
Node$Xote.mountById(XoteJSX$Xote.jsx(Example$ExampleForm, {}), "root");
|
|
167
168
|
|
|
168
169
|
export {
|
|
169
170
|
ExampleForm,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module Signal = Xote.Signal
|
|
4
4
|
module Computed = Xote.Computed
|
|
5
|
-
module
|
|
5
|
+
module Node = Xote.Node
|
|
6
6
|
|
|
7
7
|
type accordionItem = {
|
|
8
8
|
value: string,
|
|
9
9
|
title: string,
|
|
10
|
-
content:
|
|
10
|
+
content: Node.node,
|
|
11
11
|
disabled?: bool,
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -52,7 +52,7 @@ let make = (
|
|
|
52
52
|
onClick={_ => toggleItem(item.value, item.disabled)}
|
|
53
53
|
disabled={item.disabled->Option.getOr(false)}
|
|
54
54
|
>
|
|
55
|
-
<span> {
|
|
55
|
+
<span> {Node.text(item.title)} </span>
|
|
56
56
|
<span
|
|
57
57
|
class={Computed.make(() => {
|
|
58
58
|
let baseClass = "basefn-accordion__icon"
|
|
@@ -60,7 +60,7 @@ let make = (
|
|
|
60
60
|
baseClass ++ openClass
|
|
61
61
|
})}
|
|
62
62
|
>
|
|
63
|
-
{
|
|
63
|
+
{Node.text("\u25bc")}
|
|
64
64
|
</span>
|
|
65
65
|
</button>
|
|
66
66
|
<div
|
|
@@ -76,6 +76,6 @@ let make = (
|
|
|
76
76
|
</div>
|
|
77
77
|
</div>
|
|
78
78
|
})
|
|
79
|
-
->
|
|
79
|
+
->Node.fragment}
|
|
80
80
|
</div>
|
|
81
81
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Xote from "xote/src/
|
|
4
|
-
import * as
|
|
3
|
+
import * as Node$Xote from "xote/src/Node.res.mjs";
|
|
4
|
+
import * as Signal$Xote from "xote/src/Signal.res.mjs";
|
|
5
5
|
import * as Core__Option from "@rescript/core/src/Core__Option.res.mjs";
|
|
6
|
+
import * as XoteJSX$Xote from "xote/src/XoteJSX.res.mjs";
|
|
7
|
+
import * as Computed$Xote from "xote/src/Computed.res.mjs";
|
|
6
8
|
|
|
7
9
|
import './Basefn__Accordion.css'
|
|
8
10
|
;
|
|
@@ -10,18 +12,15 @@ import './Basefn__Accordion.css'
|
|
|
10
12
|
function Basefn__Accordion(props) {
|
|
11
13
|
let __multiple = props.multiple;
|
|
12
14
|
let multiple = __multiple !== undefined ? __multiple : false;
|
|
13
|
-
let openItems = Xote.
|
|
14
|
-
return
|
|
15
|
+
let openItems = Signal$Xote.make(Core__Option.getOr(props.defaultOpen, []), undefined, undefined);
|
|
16
|
+
return XoteJSX$Xote.Elements.jsx("div", {
|
|
15
17
|
class: "basefn-accordion",
|
|
16
|
-
children: Xote.
|
|
17
|
-
let itemIsOpen = Xote.
|
|
18
|
-
|
|
19
|
-
return Xote.Signal.get(openItems).includes(value);
|
|
20
|
-
}, undefined);
|
|
21
|
-
return Xote__JSX.Elements.jsxsKeyed("div", {
|
|
18
|
+
children: Node$Xote.fragment(props.items.map(item => {
|
|
19
|
+
let itemIsOpen = Computed$Xote.make(() => Signal$Xote.get(openItems).includes(item.value), undefined);
|
|
20
|
+
return XoteJSX$Xote.Elements.jsxsKeyed("div", {
|
|
22
21
|
class: "basefn-accordion__item",
|
|
23
|
-
children:
|
|
24
|
-
|
|
22
|
+
children: XoteJSX$Xote.array([
|
|
23
|
+
XoteJSX$Xote.Elements.jsxs("button", {
|
|
25
24
|
class: "basefn-accordion__trigger",
|
|
26
25
|
disabled: Core__Option.getOr(item.disabled, false),
|
|
27
26
|
onClick: param => {
|
|
@@ -30,7 +29,7 @@ function Basefn__Accordion(props) {
|
|
|
30
29
|
if (disabled !== undefined && disabled) {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
|
-
Xote.
|
|
32
|
+
Signal$Xote.update(openItems, current => {
|
|
34
33
|
if (current.includes(value)) {
|
|
35
34
|
return current.filter(item => item !== value);
|
|
36
35
|
} else if (multiple) {
|
|
@@ -40,25 +39,25 @@ function Basefn__Accordion(props) {
|
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
41
|
},
|
|
43
|
-
children:
|
|
44
|
-
|
|
45
|
-
children: Xote.
|
|
42
|
+
children: XoteJSX$Xote.array([
|
|
43
|
+
XoteJSX$Xote.Elements.jsx("span", {
|
|
44
|
+
children: Node$Xote.text(item.title)
|
|
46
45
|
}),
|
|
47
|
-
|
|
48
|
-
class: Xote.
|
|
49
|
-
let openClass = Xote.
|
|
46
|
+
XoteJSX$Xote.Elements.jsx("span", {
|
|
47
|
+
class: Computed$Xote.make(() => {
|
|
48
|
+
let openClass = Signal$Xote.get(itemIsOpen) ? " basefn-accordion__icon--open" : "";
|
|
50
49
|
return "basefn-accordion__icon" + openClass;
|
|
51
50
|
}, undefined),
|
|
52
|
-
children: Xote.
|
|
51
|
+
children: Node$Xote.text("\u25bc")
|
|
53
52
|
})
|
|
54
53
|
])
|
|
55
54
|
}),
|
|
56
|
-
|
|
57
|
-
class: Xote.
|
|
58
|
-
let stateClass = Xote.
|
|
55
|
+
XoteJSX$Xote.Elements.jsx("div", {
|
|
56
|
+
class: Computed$Xote.make(() => {
|
|
57
|
+
let stateClass = Signal$Xote.get(itemIsOpen) ? " basefn-accordion__content--expanded" : " basefn-accordion__content--collapsed";
|
|
59
58
|
return "basefn-accordion__content" + stateClass;
|
|
60
59
|
}, undefined),
|
|
61
|
-
children:
|
|
60
|
+
children: XoteJSX$Xote.Elements.jsx("div", {
|
|
62
61
|
class: "basefn-accordion__content-inner",
|
|
63
62
|
children: item.content
|
|
64
63
|
})
|
|
@@ -73,14 +72,14 @@ let Signal;
|
|
|
73
72
|
|
|
74
73
|
let Computed;
|
|
75
74
|
|
|
76
|
-
let
|
|
75
|
+
let Node;
|
|
77
76
|
|
|
78
77
|
let make = Basefn__Accordion;
|
|
79
78
|
|
|
80
79
|
export {
|
|
81
80
|
Signal,
|
|
82
81
|
Computed,
|
|
83
|
-
|
|
82
|
+
Node,
|
|
84
83
|
make,
|
|
85
84
|
}
|
|
86
85
|
/* Not a pure module */
|
|
@@ -44,16 +44,16 @@ let make = (
|
|
|
44
44
|
<div class="basefn-alert__content">
|
|
45
45
|
{switch title {
|
|
46
46
|
| Some(titleText) =>
|
|
47
|
-
<div class="basefn-alert__title"> {
|
|
47
|
+
<div class="basefn-alert__title"> {Node.text(titleText)} </div>
|
|
48
48
|
| None => <> </>
|
|
49
49
|
}}
|
|
50
50
|
<div class="basefn-alert__message">
|
|
51
|
-
{
|
|
51
|
+
{Node.signalText(() => Signal.get(message))}
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
54
54
|
{dismissible
|
|
55
55
|
? <button class="basefn-alert__dismiss" onClick={_ => handleDismiss()}>
|
|
56
|
-
{
|
|
56
|
+
{Node.text("\u00d7")}
|
|
57
57
|
</button>
|
|
58
58
|
: <> </>}
|
|
59
59
|
</div>,
|
|
@@ -64,5 +64,5 @@ let make = (
|
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
// Use signalFragment to reactively render the content
|
|
67
|
-
|
|
67
|
+
Node.signalFragment(content)
|
|
68
68
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Xote from "xote/src/
|
|
4
|
-
import * as
|
|
3
|
+
import * as Node$Xote from "xote/src/Node.res.mjs";
|
|
4
|
+
import * as Signal$Xote from "xote/src/Signal.res.mjs";
|
|
5
|
+
import * as XoteJSX$Xote from "xote/src/XoteJSX.res.mjs";
|
|
6
|
+
import * as Computed$Xote from "xote/src/Computed.res.mjs";
|
|
5
7
|
|
|
6
8
|
import './Basefn__Alert.css'
|
|
7
9
|
;
|
|
@@ -27,9 +29,9 @@ function Basefn__Alert(props) {
|
|
|
27
29
|
let title = props.title;
|
|
28
30
|
let variant = __variant !== undefined ? __variant : "Info";
|
|
29
31
|
let dismissible = __dismissible !== undefined ? __dismissible : false;
|
|
30
|
-
let isVisible = Xote.
|
|
32
|
+
let isVisible = Signal$Xote.make(true, undefined, undefined);
|
|
31
33
|
let handleDismiss = () => {
|
|
32
|
-
Xote.
|
|
34
|
+
Signal$Xote.set(isVisible, false);
|
|
33
35
|
if (onDismiss !== undefined) {
|
|
34
36
|
return onDismiss();
|
|
35
37
|
}
|
|
@@ -38,29 +40,29 @@ function Basefn__Alert(props) {
|
|
|
38
40
|
let variantClass = "basefn-alert--" + variantToString(variant);
|
|
39
41
|
return "basefn-alert " + variantClass;
|
|
40
42
|
};
|
|
41
|
-
return Xote.
|
|
42
|
-
if (Xote.
|
|
43
|
-
return [
|
|
43
|
+
return Node$Xote.signalFragment(Computed$Xote.make(() => {
|
|
44
|
+
if (Signal$Xote.get(isVisible)) {
|
|
45
|
+
return [XoteJSX$Xote.Elements.jsxs("div", {
|
|
44
46
|
class: getClassName(),
|
|
45
|
-
children:
|
|
46
|
-
|
|
47
|
+
children: XoteJSX$Xote.array([
|
|
48
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
47
49
|
class: "basefn-alert__content",
|
|
48
|
-
children:
|
|
49
|
-
title !== undefined ?
|
|
50
|
+
children: XoteJSX$Xote.array([
|
|
51
|
+
title !== undefined ? XoteJSX$Xote.Elements.jsx("div", {
|
|
50
52
|
class: "basefn-alert__title",
|
|
51
|
-
children: Xote.
|
|
52
|
-
}) :
|
|
53
|
-
|
|
53
|
+
children: Node$Xote.text(title)
|
|
54
|
+
}) : XoteJSX$Xote.jsx(XoteJSX$Xote.jsxFragment, {}),
|
|
55
|
+
XoteJSX$Xote.Elements.jsx("div", {
|
|
54
56
|
class: "basefn-alert__message",
|
|
55
|
-
children: Xote.
|
|
57
|
+
children: Node$Xote.signalText(() => Signal$Xote.get(message))
|
|
56
58
|
})
|
|
57
59
|
])
|
|
58
60
|
}),
|
|
59
|
-
dismissible ?
|
|
61
|
+
dismissible ? XoteJSX$Xote.Elements.jsx("button", {
|
|
60
62
|
class: "basefn-alert__dismiss",
|
|
61
63
|
onClick: param => handleDismiss(),
|
|
62
|
-
children: Xote.
|
|
63
|
-
}) :
|
|
64
|
+
children: Node$Xote.text("\u00d7")
|
|
65
|
+
}) : XoteJSX$Xote.jsx(XoteJSX$Xote.jsxFragment, {})
|
|
64
66
|
])
|
|
65
67
|
})];
|
|
66
68
|
} else {
|
|
@@ -55,17 +55,17 @@ let make = (
|
|
|
55
55
|
<div class="basefn-alert-dialog-backdrop" onClick={handleBackdropClick}>
|
|
56
56
|
<div class="basefn-alert-dialog" role="alertdialog">
|
|
57
57
|
<div class="basefn-alert-dialog__header">
|
|
58
|
-
<h2 class="basefn-alert-dialog__title"> {
|
|
58
|
+
<h2 class="basefn-alert-dialog__title"> {Node.text(title)} </h2>
|
|
59
59
|
</div>
|
|
60
60
|
<div class="basefn-alert-dialog__body">
|
|
61
|
-
<p class="basefn-alert-dialog__description"> {
|
|
61
|
+
<p class="basefn-alert-dialog__description"> {Node.text(description)} </p>
|
|
62
62
|
</div>
|
|
63
63
|
<div class="basefn-alert-dialog__footer">
|
|
64
64
|
<button class="basefn-alert-dialog__cancel" onClick={handleCancel}>
|
|
65
|
-
{
|
|
65
|
+
{Node.text(cancelLabel)}
|
|
66
66
|
</button>
|
|
67
67
|
<button class={getConfirmButtonClass()} onClick={handleConfirm}>
|
|
68
|
-
{
|
|
68
|
+
{Node.text(confirmLabel)}
|
|
69
69
|
</button>
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
@@ -76,5 +76,5 @@ let make = (
|
|
|
76
76
|
}
|
|
77
77
|
})
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Node.signalFragment(content)
|
|
80
80
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Xote from "xote/src/
|
|
4
|
-
import * as
|
|
3
|
+
import * as Node$Xote from "xote/src/Node.res.mjs";
|
|
4
|
+
import * as Signal$Xote from "xote/src/Signal.res.mjs";
|
|
5
|
+
import * as XoteJSX$Xote from "xote/src/XoteJSX.res.mjs";
|
|
6
|
+
import * as Computed$Xote from "xote/src/Computed.res.mjs";
|
|
5
7
|
|
|
6
8
|
import './Basefn__AlertDialog.css'
|
|
7
9
|
;
|
|
@@ -39,52 +41,52 @@ function Basefn__AlertDialog(props) {
|
|
|
39
41
|
}
|
|
40
42
|
};
|
|
41
43
|
let handleCancel = param => {
|
|
42
|
-
Xote.
|
|
44
|
+
Signal$Xote.set(isOpen, false);
|
|
43
45
|
onCancel();
|
|
44
46
|
};
|
|
45
47
|
let handleConfirm = param => {
|
|
46
|
-
Xote.
|
|
48
|
+
Signal$Xote.set(isOpen, false);
|
|
47
49
|
onConfirm();
|
|
48
50
|
};
|
|
49
51
|
let getConfirmButtonClass = () => {
|
|
50
52
|
let variantClass = " basefn-alert-dialog__confirm--" + variantToString(variant);
|
|
51
53
|
return "basefn-alert-dialog__confirm" + variantClass;
|
|
52
54
|
};
|
|
53
|
-
return Xote.
|
|
54
|
-
if (Xote.
|
|
55
|
-
return [
|
|
55
|
+
return Node$Xote.signalFragment(Computed$Xote.make(() => {
|
|
56
|
+
if (Signal$Xote.get(isOpen)) {
|
|
57
|
+
return [XoteJSX$Xote.Elements.jsx("div", {
|
|
56
58
|
class: "basefn-alert-dialog-backdrop",
|
|
57
59
|
onClick: handleBackdropClick,
|
|
58
|
-
children:
|
|
60
|
+
children: XoteJSX$Xote.Elements.jsxs("div", {
|
|
59
61
|
class: "basefn-alert-dialog",
|
|
60
62
|
role: "alertdialog",
|
|
61
|
-
children:
|
|
62
|
-
|
|
63
|
+
children: XoteJSX$Xote.array([
|
|
64
|
+
XoteJSX$Xote.Elements.jsx("div", {
|
|
63
65
|
class: "basefn-alert-dialog__header",
|
|
64
|
-
children:
|
|
66
|
+
children: XoteJSX$Xote.Elements.jsx("h2", {
|
|
65
67
|
class: "basefn-alert-dialog__title",
|
|
66
|
-
children: Xote.
|
|
68
|
+
children: Node$Xote.text(title)
|
|
67
69
|
})
|
|
68
70
|
}),
|
|
69
|
-
|
|
71
|
+
XoteJSX$Xote.Elements.jsx("div", {
|
|
70
72
|
class: "basefn-alert-dialog__body",
|
|
71
|
-
children:
|
|
73
|
+
children: XoteJSX$Xote.Elements.jsx("p", {
|
|
72
74
|
class: "basefn-alert-dialog__description",
|
|
73
|
-
children: Xote.
|
|
75
|
+
children: Node$Xote.text(description)
|
|
74
76
|
})
|
|
75
77
|
}),
|
|
76
|
-
|
|
78
|
+
XoteJSX$Xote.Elements.jsxs("div", {
|
|
77
79
|
class: "basefn-alert-dialog__footer",
|
|
78
|
-
children:
|
|
79
|
-
|
|
80
|
+
children: XoteJSX$Xote.array([
|
|
81
|
+
XoteJSX$Xote.Elements.jsx("button", {
|
|
80
82
|
class: "basefn-alert-dialog__cancel",
|
|
81
83
|
onClick: handleCancel,
|
|
82
|
-
children: Xote.
|
|
84
|
+
children: Node$Xote.text(cancelLabel)
|
|
83
85
|
}),
|
|
84
|
-
|
|
86
|
+
XoteJSX$Xote.Elements.jsx("button", {
|
|
85
87
|
class: getConfirmButtonClass(),
|
|
86
88
|
onClick: handleConfirm,
|
|
87
|
-
children: Xote.
|
|
89
|
+
children: Node$Xote.text(confirmLabel)
|
|
88
90
|
})
|
|
89
91
|
])
|
|
90
92
|
})
|
|
@@ -7,9 +7,9 @@ type topbarPosition = Inline | AboveAll
|
|
|
7
7
|
|
|
8
8
|
@jsx.component
|
|
9
9
|
let make = (
|
|
10
|
-
~sidebar: option<
|
|
11
|
-
~topbar: option<
|
|
12
|
-
~children:
|
|
10
|
+
~sidebar: option<Node.node>=?,
|
|
11
|
+
~topbar: option<Node.node>=?,
|
|
12
|
+
~children: Node.node,
|
|
13
13
|
~contentWidth: contentWidth=FullWidth,
|
|
14
14
|
~noPadding: bool=false,
|
|
15
15
|
~sidebarSize: option<string>=?, // "sm" | "md" | "lg"
|