basefn 1.2.0 → 1.4.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/src/Basefn.res +50 -0
- package/src/Basefn.res.mjs +40 -0
- package/src/Basefn__Utils.res.mjs +1 -1
- package/src/components/Basefn__AlertDialog.css +119 -0
- package/src/components/Basefn__AlertDialog.res +80 -0
- package/src/components/Basefn__AlertDialog.res.mjs +106 -0
- package/src/components/Basefn__AppLayout.css +10 -0
- package/src/components/Basefn__AspectRatio.css +16 -0
- package/src/components/Basefn__AspectRatio.res +26 -0
- package/src/components/Basefn__AspectRatio.res.mjs +33 -0
- package/src/components/Basefn__ButtonGroup.css +58 -0
- package/src/components/Basefn__ButtonGroup.res +33 -0
- package/src/components/Basefn__ButtonGroup.res.mjs +38 -0
- package/src/components/Basefn__Card.css +15 -0
- package/src/components/Basefn__ContextMenu.css +78 -0
- package/src/components/Basefn__ContextMenu.res +98 -0
- package/src/components/Basefn__ContextMenu.res.mjs +93 -0
- package/src/components/Basefn__Drawer.css +31 -0
- package/src/components/Basefn__Dropdown.res +3 -1
- package/src/components/Basefn__Dropdown.res.mjs +22 -43
- package/src/components/Basefn__HoverCard.css +93 -0
- package/src/components/Basefn__HoverCard.res +99 -0
- package/src/components/Basefn__HoverCard.res.mjs +109 -0
- package/src/components/Basefn__Modal.css +38 -0
- package/src/components/Basefn__Popover.css +98 -0
- package/src/components/Basefn__Popover.res +95 -0
- package/src/components/Basefn__Popover.res.mjs +107 -0
- package/src/components/Basefn__ScrollArea.css +76 -0
- package/src/components/Basefn__ScrollArea.res +60 -0
- package/src/components/Basefn__ScrollArea.res.mjs +63 -0
- package/src/components/Basefn__Skeleton.css +83 -0
- package/src/components/Basefn__Skeleton.res +55 -0
- package/src/components/Basefn__Skeleton.res.mjs +62 -0
- package/src/components/Basefn__Stepper.css +36 -0
- package/src/components/Basefn__Tabs.css +18 -0
- package/src/components/Basefn__Toggle.css +87 -0
- package/src/components/Basefn__Toggle.res +65 -0
- package/src/components/Basefn__Toggle.res.mjs +71 -0
- package/src/components/Basefn__ToggleGroup.css +110 -0
- package/src/components/Basefn__ToggleGroup.res +106 -0
- package/src/components/Basefn__ToggleGroup.res.mjs +89 -0
- package/src/components/Basefn__Topbar.css +44 -3
- package/src/components/Basefn__Topbar.res +1 -13
- package/src/components/Basefn__Topbar.res.mjs +1 -11
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Xote from "xote/src/Xote.res.mjs";
|
|
4
|
+
import * as Xote__JSX from "xote/src/Xote__JSX.res.mjs";
|
|
5
|
+
|
|
6
|
+
import './Basefn__ToggleGroup.css'
|
|
7
|
+
;
|
|
8
|
+
|
|
9
|
+
function variantToString(variant) {
|
|
10
|
+
if (variant === "Default") {
|
|
11
|
+
return "default";
|
|
12
|
+
} else {
|
|
13
|
+
return "outline";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function sizeToString(size) {
|
|
18
|
+
switch (size) {
|
|
19
|
+
case "Sm" :
|
|
20
|
+
return "sm";
|
|
21
|
+
case "Md" :
|
|
22
|
+
return "md";
|
|
23
|
+
case "Lg" :
|
|
24
|
+
return "lg";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Basefn__ToggleGroup(props) {
|
|
29
|
+
let className = props.className;
|
|
30
|
+
let __size = props.size;
|
|
31
|
+
let __variant = props.variant;
|
|
32
|
+
let onValueChange = props.onValueChange;
|
|
33
|
+
let value = props.value;
|
|
34
|
+
let __type_ = props.type_;
|
|
35
|
+
let type_ = __type_ !== undefined ? __type_ : "Single";
|
|
36
|
+
let variant = __variant !== undefined ? __variant : "Default";
|
|
37
|
+
let size = __size !== undefined ? __size : "Md";
|
|
38
|
+
let getGroupClassName = () => {
|
|
39
|
+
let customClass = className !== undefined ? " " + className : "";
|
|
40
|
+
return "basefn-toggle-group" + customClass;
|
|
41
|
+
};
|
|
42
|
+
let getItemClassName = (itemValue, itemDisabled) => Xote.Computed.make(() => {
|
|
43
|
+
let variantClass = " basefn-toggle-group__item--" + variantToString(variant);
|
|
44
|
+
let sizeClass = " basefn-toggle-group__item--" + sizeToString(size);
|
|
45
|
+
let currentValues = Xote.Signal.get(value);
|
|
46
|
+
let pressedClass = currentValues.includes(itemValue) ? " basefn-toggle-group__item--pressed" : "";
|
|
47
|
+
let disabledClass = itemDisabled ? " basefn-toggle-group__item--disabled" : "";
|
|
48
|
+
return "basefn-toggle-group__item" + variantClass + sizeClass + pressedClass + disabledClass;
|
|
49
|
+
}, undefined);
|
|
50
|
+
return Xote__JSX.Elements.jsx("div", {
|
|
51
|
+
class: getGroupClassName(),
|
|
52
|
+
role: "group",
|
|
53
|
+
children: Xote.Component.fragment(props.items.map(item => {
|
|
54
|
+
let d = item.disabled;
|
|
55
|
+
let isDisabled = d !== undefined ? d : false;
|
|
56
|
+
return Xote__JSX.Elements.jsxKeyed("button", {
|
|
57
|
+
class: getItemClassName(item.value, isDisabled),
|
|
58
|
+
disabled: isDisabled,
|
|
59
|
+
onClick: param => {
|
|
60
|
+
let itemValue = item.value;
|
|
61
|
+
if (isDisabled) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let currentValues = Xote.Signal.get(value);
|
|
65
|
+
let newValues;
|
|
66
|
+
newValues = type_ === "Single" ? (
|
|
67
|
+
currentValues.includes(itemValue) ? [] : [itemValue]
|
|
68
|
+
) : (
|
|
69
|
+
currentValues.includes(itemValue) ? currentValues.filter(v => v !== itemValue) : currentValues.concat([itemValue])
|
|
70
|
+
);
|
|
71
|
+
Xote.Signal.set(value, newValues);
|
|
72
|
+
if (onValueChange !== undefined) {
|
|
73
|
+
return onValueChange(newValues);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: Xote.Component.text(item.label)
|
|
77
|
+
}, item.value, undefined);
|
|
78
|
+
}))
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let make = Basefn__ToggleGroup;
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
variantToString,
|
|
86
|
+
sizeToString,
|
|
87
|
+
make,
|
|
88
|
+
}
|
|
89
|
+
/* Not a pure module */
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
border-bottom: 1px solid var(--basefn-border-primary);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.basefn-topbar--scrolling {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
18
|
.basefn-topbar__left {
|
|
22
19
|
display: flex;
|
|
23
20
|
align-items: center;
|
|
@@ -128,3 +125,47 @@
|
|
|
128
125
|
height: 72px;
|
|
129
126
|
padding: 1rem 2rem;
|
|
130
127
|
}
|
|
128
|
+
|
|
129
|
+
/* Mobile responsiveness */
|
|
130
|
+
@media (max-width: 768px) {
|
|
131
|
+
.basefn-topbar {
|
|
132
|
+
padding: 0.5rem 1rem;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.basefn-topbar--sm {
|
|
136
|
+
padding: 0.5rem 0.75rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.basefn-topbar--md {
|
|
140
|
+
padding: 0.5rem 1rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.basefn-topbar--lg {
|
|
144
|
+
padding: 0.5rem 1rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.basefn-topbar__logo {
|
|
148
|
+
font-size: 1.1rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.basefn-topbar__nav {
|
|
152
|
+
gap: 0.125rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.basefn-topbar__nav-item {
|
|
156
|
+
font-size: 0.8125rem;
|
|
157
|
+
padding: 0.375rem 0.625rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.basefn-topbar__center {
|
|
161
|
+
gap: 0.5rem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.basefn-topbar__right {
|
|
165
|
+
gap: 0.5rem;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.basefn-topbar__actions {
|
|
169
|
+
gap: 0.5rem;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -28,19 +28,7 @@ let make = (
|
|
|
28
28
|
~onMenuClick: option<unit => unit>=?,
|
|
29
29
|
~size: size=Md,
|
|
30
30
|
) => {
|
|
31
|
-
let
|
|
32
|
-
let class = Computed.make(() => {
|
|
33
|
-
let sizeClass = " basefn-topbar--" ++ sizeToString(size)
|
|
34
|
-
let scrollingClass = Signal.get(scrolling) ? " basefn-topbar--scrolling" : ""
|
|
35
|
-
"basefn-topbar" ++ sizeClass ++ scrollingClass
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
let _ = Effect.run(() => {
|
|
39
|
-
Basefn__Dom.addEventListener("scroll", () => {
|
|
40
|
-
let scrollY = %raw("window.scrollY")
|
|
41
|
-
Signal.set(scrolling, scrollY >= 64)
|
|
42
|
-
})
|
|
43
|
-
})
|
|
31
|
+
let class = "basefn-topbar basefn-topbar--" ++ sizeToString(size)
|
|
44
32
|
|
|
45
33
|
<header class>
|
|
46
34
|
<div class="basefn-topbar__left">
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Xote from "xote/src/Xote.res.mjs";
|
|
4
4
|
import * as Xote__JSX from "xote/src/Xote__JSX.res.mjs";
|
|
5
|
-
import * as Basefn__Dom from "../Basefn__Dom.res.mjs";
|
|
6
5
|
|
|
7
6
|
import './Basefn__Topbar.css'
|
|
8
7
|
;
|
|
@@ -27,16 +26,7 @@ function Basefn__Topbar(props) {
|
|
|
27
26
|
let navItems = props.navItems;
|
|
28
27
|
let logo = props.logo;
|
|
29
28
|
let size = __size !== undefined ? __size : "Md";
|
|
30
|
-
let
|
|
31
|
-
let $$class = Xote.Computed.make(() => {
|
|
32
|
-
let sizeClass = " basefn-topbar--" + sizeToString(size);
|
|
33
|
-
let scrollingClass = Xote.Signal.get(scrolling) ? " basefn-topbar--scrolling" : "";
|
|
34
|
-
return "basefn-topbar" + sizeClass + scrollingClass;
|
|
35
|
-
}, undefined);
|
|
36
|
-
Xote.Effect.run(() => Basefn__Dom.addEventListener("scroll", () => {
|
|
37
|
-
let scrollY = window.scrollY;
|
|
38
|
-
Xote.Signal.set(scrolling, scrollY >= 64);
|
|
39
|
-
}), undefined);
|
|
29
|
+
let $$class = "basefn-topbar basefn-topbar--" + sizeToString(size);
|
|
40
30
|
return Xote__JSX.Elements.jsxs("header", {
|
|
41
31
|
class: $$class,
|
|
42
32
|
children: Xote__JSX.array([
|