basefn 1.0.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 +104 -0
- package/package.json +82 -0
- package/rescript.json +32 -0
- package/src/Basefn.css +14 -0
- package/src/Basefn.res +105 -0
- package/src/Basefn.res.mjs +114 -0
- package/src/Basefn__Dom.res +9 -0
- package/src/Basefn__Dom.res.mjs +24 -0
- package/src/Basefn__Utils.res +15 -0
- package/src/Basefn__Utils.res.mjs +32 -0
- package/src/Demo.res +1417 -0
- package/src/Demo.res.mjs +2328 -0
- package/src/Eita.res.mjs +105 -0
- package/src/Eita__Accordion.res.mjs +77 -0
- package/src/Eita__Alert.res.mjs +81 -0
- package/src/Eita__AppLayout.res.mjs +100 -0
- package/src/Eita__Avatar.res.mjs +40 -0
- package/src/Eita__Badge.res.mjs +65 -0
- package/src/Eita__Breadcrumb.res.mjs +53 -0
- package/src/Eita__Button.res.mjs +47 -0
- package/src/Eita__Card.res.mjs +60 -0
- package/src/Eita__Checkbox.res.mjs +36 -0
- package/src/Eita__Dom.res.mjs +16 -0
- package/src/Eita__Drawer.res.mjs +112 -0
- package/src/Eita__Dropdown.res.mjs +96 -0
- package/src/Eita__Grid.res.mjs +24 -0
- package/src/Eita__Input.res.mjs +54 -0
- package/src/Eita__Kbd.res.mjs +42 -0
- package/src/Eita__Label.res.mjs +24 -0
- package/src/Eita__Modal.res.mjs +93 -0
- package/src/Eita__Progress.res.mjs +101 -0
- package/src/Eita__Radio.res.mjs +38 -0
- package/src/Eita__Select.res.mjs +40 -0
- package/src/Eita__Separator.res.mjs +70 -0
- package/src/Eita__Sidebar.res.mjs +103 -0
- package/src/Eita__Slider.res.mjs +89 -0
- package/src/Eita__Spinner.res.mjs +69 -0
- package/src/Eita__Stepper.res.mjs +114 -0
- package/src/Eita__Switch.res.mjs +84 -0
- package/src/Eita__Tabs.res.mjs +57 -0
- package/src/Eita__Textarea.res.mjs +39 -0
- package/src/Eita__Timeline.res.mjs +86 -0
- package/src/Eita__Toast.res.mjs +112 -0
- package/src/Eita__Tooltip.res.mjs +60 -0
- package/src/Eita__Topbar.res.mjs +96 -0
- package/src/Eita__Typography.res.mjs +183 -0
- package/src/Eita__Utils.res.mjs +32 -0
- package/src/Example.res +111 -0
- package/src/Example.res.mjs +176 -0
- package/src/components/Basefn__Accordion.css +70 -0
- package/src/components/Basefn__Accordion.res +79 -0
- package/src/components/Basefn__Accordion.res.mjs +77 -0
- package/src/components/Basefn__Alert.css +79 -0
- package/src/components/Basefn__Alert.res +68 -0
- package/src/components/Basefn__Alert.res.mjs +78 -0
- package/src/components/Basefn__AppLayout.css +100 -0
- package/src/components/Basefn__AppLayout.res +74 -0
- package/src/components/Basefn__AppLayout.res.mjs +100 -0
- package/src/components/Basefn__Avatar.css +25 -0
- package/src/components/Basefn__Avatar.res +23 -0
- package/src/components/Basefn__Avatar.res.mjs +40 -0
- package/src/components/Basefn__Badge.css +71 -0
- package/src/components/Basefn__Badge.res +43 -0
- package/src/components/Basefn__Badge.res.mjs +65 -0
- package/src/components/Basefn__Breadcrumb.css +36 -0
- package/src/components/Basefn__Breadcrumb.res +45 -0
- package/src/components/Basefn__Breadcrumb.res.mjs +53 -0
- package/src/components/Basefn__Button.css +83 -0
- package/src/components/Basefn__Button.res +32 -0
- package/src/components/Basefn__Button.res.mjs +54 -0
- package/src/components/Basefn__Card.css +50 -0
- package/src/components/Basefn__Card.res +45 -0
- package/src/components/Basefn__Card.res.mjs +60 -0
- package/src/components/Basefn__Checkbox.css +72 -0
- package/src/components/Basefn__Checkbox.res +25 -0
- package/src/components/Basefn__Checkbox.res.mjs +36 -0
- package/src/components/Basefn__Drawer.css +168 -0
- package/src/components/Basefn__Drawer.res +86 -0
- package/src/components/Basefn__Drawer.res.mjs +112 -0
- package/src/components/Basefn__Dropdown.css +76 -0
- package/src/components/Basefn__Dropdown.res +85 -0
- package/src/components/Basefn__Dropdown.res.mjs +96 -0
- package/src/components/Basefn__Grid.css +11 -0
- package/src/components/Basefn__Grid.res +296 -0
- package/src/components/Basefn__Grid.res.mjs +263 -0
- package/src/components/Basefn__Icon.css +12 -0
- package/src/components/Basefn__Icon.res +196 -0
- package/src/components/Basefn__Icon.res.mjs +183 -0
- package/src/components/Basefn__Input.css +44 -0
- package/src/components/Basefn__Input.res +48 -0
- package/src/components/Basefn__Input.res.mjs +63 -0
- package/src/components/Basefn__Kbd.css +65 -0
- package/src/components/Basefn__Kbd.res +27 -0
- package/src/components/Basefn__Kbd.res.mjs +42 -0
- package/src/components/Basefn__Label.css +22 -0
- package/src/components/Basefn__Label.res +18 -0
- package/src/components/Basefn__Label.res.mjs +24 -0
- package/src/components/Basefn__Modal.css +100 -0
- package/src/components/Basefn__Modal.res +74 -0
- package/src/components/Basefn__Modal.res.mjs +93 -0
- package/src/components/Basefn__Progress.css +69 -0
- package/src/components/Basefn__Progress.res +88 -0
- package/src/components/Basefn__Progress.res.mjs +101 -0
- package/src/components/Basefn__Radio.css +72 -0
- package/src/components/Basefn__Radio.res +35 -0
- package/src/components/Basefn__Radio.res.mjs +38 -0
- package/src/components/Basefn__Select.css +44 -0
- package/src/components/Basefn__Select.res +33 -0
- package/src/components/Basefn__Select.res.mjs +40 -0
- package/src/components/Basefn__Separator.css +85 -0
- package/src/components/Basefn__Separator.res +45 -0
- package/src/components/Basefn__Separator.res.mjs +70 -0
- package/src/components/Basefn__Sidebar.css +141 -0
- package/src/components/Basefn__Sidebar.res +95 -0
- package/src/components/Basefn__Sidebar.res.mjs +107 -0
- package/src/components/Basefn__Slider.css +97 -0
- package/src/components/Basefn__Slider.res +68 -0
- package/src/components/Basefn__Slider.res.mjs +89 -0
- package/src/components/Basefn__Spinner.css +63 -0
- package/src/components/Basefn__Spinner.res +44 -0
- package/src/components/Basefn__Spinner.res.mjs +69 -0
- package/src/components/Basefn__Stepper.css +141 -0
- package/src/components/Basefn__Stepper.res +86 -0
- package/src/components/Basefn__Stepper.res.mjs +114 -0
- package/src/components/Basefn__Switch.css +80 -0
- package/src/components/Basefn__Switch.res +62 -0
- package/src/components/Basefn__Switch.res.mjs +84 -0
- package/src/components/Basefn__Tabs.css +54 -0
- package/src/components/Basefn__Tabs.res +73 -0
- package/src/components/Basefn__Tabs.res.mjs +57 -0
- package/src/components/Basefn__Textarea.css +41 -0
- package/src/components/Basefn__Textarea.res +28 -0
- package/src/components/Basefn__Textarea.res.mjs +41 -0
- package/src/components/Basefn__ThemeToggle.css +5 -0
- package/src/components/Basefn__ThemeToggle.res +29 -0
- package/src/components/Basefn__ThemeToggle.res.mjs +49 -0
- package/src/components/Basefn__Timeline.css +144 -0
- package/src/components/Basefn__Timeline.res +70 -0
- package/src/components/Basefn__Timeline.res.mjs +86 -0
- package/src/components/Basefn__Toast.css +100 -0
- package/src/components/Basefn__Toast.res +92 -0
- package/src/components/Basefn__Toast.res.mjs +112 -0
- package/src/components/Basefn__Tooltip.css +84 -0
- package/src/components/Basefn__Tooltip.res +42 -0
- package/src/components/Basefn__Tooltip.res.mjs +60 -0
- package/src/components/Basefn__Topbar.css +130 -0
- package/src/components/Basefn__Topbar.res +92 -0
- package/src/components/Basefn__Topbar.res.mjs +91 -0
- package/src/components/Basefn__Typography.css +120 -0
- package/src/components/Basefn__Typography.res +96 -0
- package/src/components/Basefn__Typography.res.mjs +175 -0
- package/src/styles/Basefn__Theme.res +63 -0
- package/src/styles/Basefn__Theme.res.mjs +65 -0
- package/src/styles/variables.css +199 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@import '../styles/variables.css';
|
|
2
|
+
|
|
3
|
+
.basefn-button {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
font-family: var(--basefn-font-family);
|
|
8
|
+
font-size: var(--basefn-font-size-sm);
|
|
9
|
+
font-weight: var(--basefn-font-weight-medium);
|
|
10
|
+
line-height: var(--basefn-line-height-tight);
|
|
11
|
+
height: var(--basefn-button-height);
|
|
12
|
+
padding: 0 var(--basefn-button-padding-x);
|
|
13
|
+
border: var(--basefn-border-width) solid transparent;
|
|
14
|
+
border-radius: var(--basefn-radius-lg);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: all var(--basefn-transition-fast);
|
|
17
|
+
outline: none;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
user-select: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.basefn-button:focus-visible {
|
|
24
|
+
outline: var(--basefn-focus-ring-width) solid var(--basefn-focus-ring-color);
|
|
25
|
+
outline-offset: var(--basefn-focus-ring-offset);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Primary Variant */
|
|
29
|
+
.basefn-button--primary {
|
|
30
|
+
background-color: var(--basefn-color-primary);
|
|
31
|
+
color: white;
|
|
32
|
+
border-color: var(--basefn-color-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.basefn-button--primary:hover:not(:disabled) {
|
|
36
|
+
background-color: var(--basefn-color-primary-hover);
|
|
37
|
+
border-color: var(--basefn-color-primary-hover);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.basefn-button--primary:active:not(:disabled) {
|
|
41
|
+
background-color: var(--basefn-color-primary-active);
|
|
42
|
+
border-color: var(--basefn-color-primary-active);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Secondary Variant */
|
|
46
|
+
.basefn-button--secondary {
|
|
47
|
+
background-color: var(--basefn-color-secondary);
|
|
48
|
+
color: white;
|
|
49
|
+
border-color: var(--basefn-color-secondary);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.basefn-button--secondary:hover:not(:disabled) {
|
|
53
|
+
background-color: var(--basefn-color-secondary-hover);
|
|
54
|
+
border-color: var(--basefn-color-secondary-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.basefn-button--secondary:active:not(:disabled) {
|
|
58
|
+
background-color: var(--basefn-color-secondary-active);
|
|
59
|
+
border-color: var(--basefn-color-secondary-active);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Ghost Variant */
|
|
63
|
+
.basefn-button--ghost {
|
|
64
|
+
background-color: transparent;
|
|
65
|
+
border-color: transparent;
|
|
66
|
+
border: 0;
|
|
67
|
+
padding: 0;
|
|
68
|
+
color: var(--basefn-text-tertiary);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.basefn-button--ghost:hover:not(:disabled) {
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.basefn-button--ghost:active:not(:disabled) {
|
|
75
|
+
background-color: var(--basefn-color-neutral-100);
|
|
76
|
+
border-color: var(--basefn-color-neutral-500);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Disabled State */
|
|
80
|
+
.basefn-button:disabled {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
open Xote
|
|
2
|
+
|
|
3
|
+
%%raw(`import './Basefn__Button.css'`)
|
|
4
|
+
|
|
5
|
+
type variant = Primary | Secondary | Ghost
|
|
6
|
+
|
|
7
|
+
let variantToString = (variant: variant) => {
|
|
8
|
+
switch variant {
|
|
9
|
+
| Primary => "primary"
|
|
10
|
+
| Secondary => "secondary"
|
|
11
|
+
| Ghost => "ghost"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@jsx.component
|
|
16
|
+
let make = (
|
|
17
|
+
~children=Xote__JSX.null(),
|
|
18
|
+
~class=ReactiveProp.static(""),
|
|
19
|
+
~disabled=ReactiveProp.static(false),
|
|
20
|
+
~label=ReactiveProp.static(""),
|
|
21
|
+
~onClick=evt => {
|
|
22
|
+
Basefn__Dom.preventDefault(evt)
|
|
23
|
+
},
|
|
24
|
+
~variant: variant=Primary,
|
|
25
|
+
) => {
|
|
26
|
+
let class = Computed.make(() => {
|
|
27
|
+
let variantClass = "basefn-button--" ++ variantToString(variant)
|
|
28
|
+
"basefn-button " ++ variantClass ++ " " ++ class->ReactiveProp.get
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
<button class disabled onClick> {children} </button>
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
import * as Basefn__Dom from "../Basefn__Dom.res.mjs";
|
|
6
|
+
|
|
7
|
+
import './Basefn__Button.css'
|
|
8
|
+
;
|
|
9
|
+
|
|
10
|
+
function variantToString(variant) {
|
|
11
|
+
switch (variant) {
|
|
12
|
+
case "Primary" :
|
|
13
|
+
return "primary";
|
|
14
|
+
case "Secondary" :
|
|
15
|
+
return "secondary";
|
|
16
|
+
case "Ghost" :
|
|
17
|
+
return "ghost";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Basefn__Button(props) {
|
|
22
|
+
let __variant = props.variant;
|
|
23
|
+
let __onClick = props.onClick;
|
|
24
|
+
let __label = props.label;
|
|
25
|
+
let __disabled = props.disabled;
|
|
26
|
+
let __class = props.class;
|
|
27
|
+
let __children = props.children;
|
|
28
|
+
let children = __children !== undefined ? __children : Xote__JSX.$$null();
|
|
29
|
+
let $$class = __class !== undefined ? __class : Xote.ReactiveProp.$$static("");
|
|
30
|
+
let disabled = __disabled !== undefined ? __disabled : Xote.ReactiveProp.$$static(false);
|
|
31
|
+
if (__label === undefined) {
|
|
32
|
+
Xote.ReactiveProp.$$static("");
|
|
33
|
+
}
|
|
34
|
+
let onClick = __onClick !== undefined ? __onClick : Basefn__Dom.preventDefault;
|
|
35
|
+
let variant = __variant !== undefined ? __variant : "Primary";
|
|
36
|
+
let $$class$1 = Xote.Computed.make(() => {
|
|
37
|
+
let variantClass = "basefn-button--" + variantToString(variant);
|
|
38
|
+
return "basefn-button " + variantClass + " " + Xote.ReactiveProp.get($$class);
|
|
39
|
+
}, undefined);
|
|
40
|
+
return Xote__JSX.Elements.jsx("button", {
|
|
41
|
+
class: $$class$1,
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
onClick: onClick,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let make = Basefn__Button;
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
variantToString,
|
|
52
|
+
make,
|
|
53
|
+
}
|
|
54
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import '../styles/variables.css';
|
|
2
|
+
|
|
3
|
+
.basefn-card {
|
|
4
|
+
border-radius: var(--basefn-radius-xl);
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
transition: all 0.2s;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.basefn-card__header {
|
|
10
|
+
padding: 1rem 1.5rem;
|
|
11
|
+
border-bottom: 1px solid var(--basefn-border-primary);
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-size: 1.125rem;
|
|
14
|
+
color: var(--basefn-text-primary);
|
|
15
|
+
background-color: var(--basefn-bg-secondary);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.basefn-card__body {
|
|
19
|
+
padding: 1.5rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.basefn-card__footer {
|
|
23
|
+
padding: 1rem 1.5rem;
|
|
24
|
+
border-top: 1px solid var(--basefn-border-primary);
|
|
25
|
+
font-size: 0.875rem;
|
|
26
|
+
color: var(--basefn-text-tertiary);
|
|
27
|
+
background-color: var(--basefn-bg-secondary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Variants */
|
|
31
|
+
.basefn-card--default {
|
|
32
|
+
background-color: var(--basefn-bg-primary);
|
|
33
|
+
border: 1px solid var(--basefn-border-primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.basefn-card--outlined {
|
|
37
|
+
background-color: var(--basefn-bg-primary);
|
|
38
|
+
border: 2px solid var(--basefn-border-secondary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.basefn-card--elevated {
|
|
42
|
+
background-color: var(--basefn-surface-elevated);
|
|
43
|
+
border: 1px solid var(--basefn-border-primary);
|
|
44
|
+
box-shadow: var(--basefn-shadow-md);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.basefn-card--elevated:hover {
|
|
48
|
+
box-shadow: var(--basefn-shadow-lg);
|
|
49
|
+
transform: translateY(-2px);
|
|
50
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
%%raw(`import './Basefn__Card.css'`)
|
|
2
|
+
|
|
3
|
+
open Xote
|
|
4
|
+
|
|
5
|
+
type variant = Default | Outlined | Elevated
|
|
6
|
+
|
|
7
|
+
let variantToString = (variant: variant) => {
|
|
8
|
+
switch variant {
|
|
9
|
+
| Default => "default"
|
|
10
|
+
| Outlined => "outlined"
|
|
11
|
+
| Elevated => "elevated"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@jsx.component
|
|
16
|
+
let make = (
|
|
17
|
+
~children: Xote__JSX.element,
|
|
18
|
+
~variant: variant=Default,
|
|
19
|
+
~header: option<string>=?,
|
|
20
|
+
~footer: option<string>=?,
|
|
21
|
+
~style: string="",
|
|
22
|
+
~className: string="",
|
|
23
|
+
) => {
|
|
24
|
+
let getClassName = () => {
|
|
25
|
+
let variantClass = "basefn-card--" ++ variantToString(variant)
|
|
26
|
+
let customClass = if className !== "" {
|
|
27
|
+
" " ++ className
|
|
28
|
+
} else {
|
|
29
|
+
""
|
|
30
|
+
}
|
|
31
|
+
"basefn-card " ++ variantClass ++ customClass
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
<div class={getClassName()} style>
|
|
35
|
+
{switch header {
|
|
36
|
+
| Some(text) => <div class="basefn-card__header"> {Component.text(text)} </div>
|
|
37
|
+
| None => <empty />
|
|
38
|
+
}}
|
|
39
|
+
<div class="basefn-card__body"> {children} </div>
|
|
40
|
+
{switch footer {
|
|
41
|
+
| Some(text) => <div class="basefn-card__footer"> {Component.text(text)} </div>
|
|
42
|
+
| None => <empty />
|
|
43
|
+
}}
|
|
44
|
+
</div>
|
|
45
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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__Card.css'
|
|
7
|
+
;
|
|
8
|
+
|
|
9
|
+
function variantToString(variant) {
|
|
10
|
+
switch (variant) {
|
|
11
|
+
case "Default" :
|
|
12
|
+
return "default";
|
|
13
|
+
case "Outlined" :
|
|
14
|
+
return "outlined";
|
|
15
|
+
case "Elevated" :
|
|
16
|
+
return "elevated";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Basefn__Card(props) {
|
|
21
|
+
let __className = props.className;
|
|
22
|
+
let __style = props.style;
|
|
23
|
+
let footer = props.footer;
|
|
24
|
+
let header = props.header;
|
|
25
|
+
let __variant = props.variant;
|
|
26
|
+
let variant = __variant !== undefined ? __variant : "Default";
|
|
27
|
+
let style = __style !== undefined ? __style : "";
|
|
28
|
+
let className = __className !== undefined ? __className : "";
|
|
29
|
+
let getClassName = () => {
|
|
30
|
+
let variantClass = "basefn-card--" + variantToString(variant);
|
|
31
|
+
let customClass = className !== "" ? " " + className : "";
|
|
32
|
+
return "basefn-card " + variantClass + customClass;
|
|
33
|
+
};
|
|
34
|
+
return Xote__JSX.Elements.jsxs("div", {
|
|
35
|
+
class: getClassName(),
|
|
36
|
+
style: style,
|
|
37
|
+
children: Xote__JSX.array([
|
|
38
|
+
header !== undefined ? Xote__JSX.Elements.jsx("div", {
|
|
39
|
+
class: "basefn-card__header",
|
|
40
|
+
children: Xote.Component.text(header)
|
|
41
|
+
}) : Xote__JSX.Elements.jsx("empty", {}),
|
|
42
|
+
Xote__JSX.Elements.jsx("div", {
|
|
43
|
+
class: "basefn-card__body",
|
|
44
|
+
children: props.children
|
|
45
|
+
}),
|
|
46
|
+
footer !== undefined ? Xote__JSX.Elements.jsx("div", {
|
|
47
|
+
class: "basefn-card__footer",
|
|
48
|
+
children: Xote.Component.text(footer)
|
|
49
|
+
}) : Xote__JSX.Elements.jsx("empty", {})
|
|
50
|
+
])
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let make = Basefn__Card;
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
variantToString,
|
|
58
|
+
make,
|
|
59
|
+
}
|
|
60
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@import '../styles/variables.css';
|
|
2
|
+
|
|
3
|
+
.basefn-checkbox-wrapper {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--basefn-spacing-sm);
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
user-select: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.basefn-checkbox-wrapper--disabled {
|
|
12
|
+
cursor: not-allowed;
|
|
13
|
+
opacity: 0.6;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.basefn-checkbox-input {
|
|
17
|
+
appearance: none;
|
|
18
|
+
width: 1.125rem;
|
|
19
|
+
height: 1.125rem;
|
|
20
|
+
border: var(--basefn-border-width-thick) solid var(--basefn-form-input-border);
|
|
21
|
+
border-radius: var(--basefn-radius-sm);
|
|
22
|
+
background-color: var(--basefn-form-input-bg);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
position: relative;
|
|
25
|
+
transition: all var(--basefn-transition-fast);
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.basefn-checkbox-input:focus-visible {
|
|
30
|
+
outline: var(--basefn-focus-ring-width) solid var(--basefn-focus-ring-color);
|
|
31
|
+
outline-offset: var(--basefn-focus-ring-offset);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.basefn-checkbox-input:checked {
|
|
35
|
+
background-color: var(--basefn-color-primary);
|
|
36
|
+
border-color: var(--basefn-color-primary);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.basefn-checkbox-input:checked::after {
|
|
40
|
+
content: '';
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 50%;
|
|
43
|
+
top: 50%;
|
|
44
|
+
transform: translate(-50%, -50%) rotate(45deg);
|
|
45
|
+
width: 0.25rem;
|
|
46
|
+
height: 0.5rem;
|
|
47
|
+
border: solid white;
|
|
48
|
+
border-width: 0 2px 2px 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.basefn-checkbox-input:disabled {
|
|
52
|
+
background-color: var(--basefn-form-input-disabled-bg);
|
|
53
|
+
border-color: var(--basefn-form-input-disabled-border);
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.basefn-checkbox-input:disabled:checked {
|
|
58
|
+
background-color: var(--basefn-color-neutral-400);
|
|
59
|
+
border-color: var(--basefn-color-neutral-400);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.basefn-checkbox-label {
|
|
63
|
+
font-family: var(--basefn-font-family);
|
|
64
|
+
font-size: var(--basefn-font-size-base);
|
|
65
|
+
font-weight: var(--basefn-font-weight-normal);
|
|
66
|
+
color: var(--basefn-color-neutral-700);
|
|
67
|
+
line-height: var(--basefn-line-height-normal);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.basefn-checkbox-wrapper--disabled .basefn-checkbox-label {
|
|
71
|
+
color: var(--basefn-form-input-disabled-text);
|
|
72
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
%%raw(`import './Basefn__Checkbox.css'`)
|
|
2
|
+
|
|
3
|
+
open Xote
|
|
4
|
+
|
|
5
|
+
@jsx.component
|
|
6
|
+
let make = (
|
|
7
|
+
~checked: Signal.t<bool>,
|
|
8
|
+
~onChange: option<Dom.event => unit>=?,
|
|
9
|
+
~label: string,
|
|
10
|
+
~disabled: bool=false,
|
|
11
|
+
) => {
|
|
12
|
+
let getWrapperClassName = () => {
|
|
13
|
+
let base = "basefn-checkbox-wrapper"
|
|
14
|
+
if disabled {
|
|
15
|
+
base ++ " basefn-checkbox-wrapper--disabled"
|
|
16
|
+
} else {
|
|
17
|
+
base
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
<label class={getWrapperClassName()}>
|
|
22
|
+
<input type_="checkbox" class="basefn-checkbox-input" checked={checked} disabled ?onChange />
|
|
23
|
+
<span class="basefn-checkbox-label"> {Component.text(label)} </span>
|
|
24
|
+
</label>
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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__Checkbox.css'
|
|
7
|
+
;
|
|
8
|
+
|
|
9
|
+
function Basefn__Checkbox(props) {
|
|
10
|
+
let __disabled = props.disabled;
|
|
11
|
+
let disabled = __disabled !== undefined ? __disabled : false;
|
|
12
|
+
let base = "basefn-checkbox-wrapper";
|
|
13
|
+
return Xote__JSX.Elements.jsxs("label", {
|
|
14
|
+
class: disabled ? base + " basefn-checkbox-wrapper--disabled" : base,
|
|
15
|
+
children: Xote__JSX.array([
|
|
16
|
+
Xote__JSX.Elements.jsx("input", {
|
|
17
|
+
class: "basefn-checkbox-input",
|
|
18
|
+
type: "checkbox",
|
|
19
|
+
disabled: disabled,
|
|
20
|
+
checked: props.checked,
|
|
21
|
+
onChange: props.onChange
|
|
22
|
+
}),
|
|
23
|
+
Xote__JSX.Elements.jsx("span", {
|
|
24
|
+
class: "basefn-checkbox-label",
|
|
25
|
+
children: Xote.Component.text(props.label)
|
|
26
|
+
})
|
|
27
|
+
])
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let make = Basefn__Checkbox;
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
make,
|
|
35
|
+
}
|
|
36
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
.basefn-drawer-backdrop {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
5
|
+
z-index: 1000;
|
|
6
|
+
animation: basefn-drawer-fade-in 0.3s ease-out;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.basefn-drawer {
|
|
10
|
+
position: fixed;
|
|
11
|
+
background: white;
|
|
12
|
+
z-index: 1001;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.basefn-drawer--left {
|
|
19
|
+
left: 0;
|
|
20
|
+
top: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
width: 320px;
|
|
23
|
+
animation: basefn-drawer-slide-in-left 0.3s ease-out;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.basefn-drawer--right {
|
|
27
|
+
right: 0;
|
|
28
|
+
top: 0;
|
|
29
|
+
bottom: 0;
|
|
30
|
+
width: 320px;
|
|
31
|
+
animation: basefn-drawer-slide-in-right 0.3s ease-out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.basefn-drawer--top {
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
height: 320px;
|
|
39
|
+
animation: basefn-drawer-slide-in-top 0.3s ease-out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.basefn-drawer--bottom {
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
right: 0;
|
|
46
|
+
height: 320px;
|
|
47
|
+
animation: basefn-drawer-slide-in-bottom 0.3s ease-out;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Size variants */
|
|
51
|
+
.basefn-drawer--sm.basefn-drawer--left,
|
|
52
|
+
.basefn-drawer--sm.basefn-drawer--right {
|
|
53
|
+
width: 240px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.basefn-drawer--md.basefn-drawer--left,
|
|
57
|
+
.basefn-drawer--md.basefn-drawer--right {
|
|
58
|
+
width: 320px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.basefn-drawer--lg.basefn-drawer--left,
|
|
62
|
+
.basefn-drawer--lg.basefn-drawer--right {
|
|
63
|
+
width: 480px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.basefn-drawer--sm.basefn-drawer--top,
|
|
67
|
+
.basefn-drawer--sm.basefn-drawer--bottom {
|
|
68
|
+
height: 240px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.basefn-drawer--md.basefn-drawer--top,
|
|
72
|
+
.basefn-drawer--md.basefn-drawer--bottom {
|
|
73
|
+
height: 320px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.basefn-drawer--lg.basefn-drawer--top,
|
|
77
|
+
.basefn-drawer--lg.basefn-drawer--bottom {
|
|
78
|
+
height: 480px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.basefn-drawer__header {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
padding: 1.5rem;
|
|
86
|
+
border-bottom: 1px solid #e5e7eb;
|
|
87
|
+
flex-shrink: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.basefn-drawer__title {
|
|
91
|
+
font-size: 1.25rem;
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
color: #1f2937;
|
|
94
|
+
margin: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.basefn-drawer__close {
|
|
98
|
+
background: none;
|
|
99
|
+
border: none;
|
|
100
|
+
font-size: 1.5rem;
|
|
101
|
+
color: #6b7280;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
padding: 0.25rem;
|
|
104
|
+
line-height: 1;
|
|
105
|
+
transition: color 0.2s;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.basefn-drawer__close:hover {
|
|
109
|
+
color: #1f2937;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.basefn-drawer__body {
|
|
113
|
+
flex: 1;
|
|
114
|
+
padding: 1.5rem;
|
|
115
|
+
overflow-y: auto;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.basefn-drawer__footer {
|
|
119
|
+
padding: 1.5rem;
|
|
120
|
+
border-top: 1px solid #e5e7eb;
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Animations */
|
|
125
|
+
@keyframes basefn-drawer-fade-in {
|
|
126
|
+
from {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
}
|
|
129
|
+
to {
|
|
130
|
+
opacity: 1;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@keyframes basefn-drawer-slide-in-left {
|
|
135
|
+
from {
|
|
136
|
+
transform: translateX(-100%);
|
|
137
|
+
}
|
|
138
|
+
to {
|
|
139
|
+
transform: translateX(0);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@keyframes basefn-drawer-slide-in-right {
|
|
144
|
+
from {
|
|
145
|
+
transform: translateX(100%);
|
|
146
|
+
}
|
|
147
|
+
to {
|
|
148
|
+
transform: translateX(0);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes basefn-drawer-slide-in-top {
|
|
153
|
+
from {
|
|
154
|
+
transform: translateY(-100%);
|
|
155
|
+
}
|
|
156
|
+
to {
|
|
157
|
+
transform: translateY(0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@keyframes basefn-drawer-slide-in-bottom {
|
|
162
|
+
from {
|
|
163
|
+
transform: translateY(100%);
|
|
164
|
+
}
|
|
165
|
+
to {
|
|
166
|
+
transform: translateY(0);
|
|
167
|
+
}
|
|
168
|
+
}
|