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.
Files changed (154) hide show
  1. package/README.md +104 -0
  2. package/package.json +82 -0
  3. package/rescript.json +32 -0
  4. package/src/Basefn.css +14 -0
  5. package/src/Basefn.res +105 -0
  6. package/src/Basefn.res.mjs +114 -0
  7. package/src/Basefn__Dom.res +9 -0
  8. package/src/Basefn__Dom.res.mjs +24 -0
  9. package/src/Basefn__Utils.res +15 -0
  10. package/src/Basefn__Utils.res.mjs +32 -0
  11. package/src/Demo.res +1417 -0
  12. package/src/Demo.res.mjs +2328 -0
  13. package/src/Eita.res.mjs +105 -0
  14. package/src/Eita__Accordion.res.mjs +77 -0
  15. package/src/Eita__Alert.res.mjs +81 -0
  16. package/src/Eita__AppLayout.res.mjs +100 -0
  17. package/src/Eita__Avatar.res.mjs +40 -0
  18. package/src/Eita__Badge.res.mjs +65 -0
  19. package/src/Eita__Breadcrumb.res.mjs +53 -0
  20. package/src/Eita__Button.res.mjs +47 -0
  21. package/src/Eita__Card.res.mjs +60 -0
  22. package/src/Eita__Checkbox.res.mjs +36 -0
  23. package/src/Eita__Dom.res.mjs +16 -0
  24. package/src/Eita__Drawer.res.mjs +112 -0
  25. package/src/Eita__Dropdown.res.mjs +96 -0
  26. package/src/Eita__Grid.res.mjs +24 -0
  27. package/src/Eita__Input.res.mjs +54 -0
  28. package/src/Eita__Kbd.res.mjs +42 -0
  29. package/src/Eita__Label.res.mjs +24 -0
  30. package/src/Eita__Modal.res.mjs +93 -0
  31. package/src/Eita__Progress.res.mjs +101 -0
  32. package/src/Eita__Radio.res.mjs +38 -0
  33. package/src/Eita__Select.res.mjs +40 -0
  34. package/src/Eita__Separator.res.mjs +70 -0
  35. package/src/Eita__Sidebar.res.mjs +103 -0
  36. package/src/Eita__Slider.res.mjs +89 -0
  37. package/src/Eita__Spinner.res.mjs +69 -0
  38. package/src/Eita__Stepper.res.mjs +114 -0
  39. package/src/Eita__Switch.res.mjs +84 -0
  40. package/src/Eita__Tabs.res.mjs +57 -0
  41. package/src/Eita__Textarea.res.mjs +39 -0
  42. package/src/Eita__Timeline.res.mjs +86 -0
  43. package/src/Eita__Toast.res.mjs +112 -0
  44. package/src/Eita__Tooltip.res.mjs +60 -0
  45. package/src/Eita__Topbar.res.mjs +96 -0
  46. package/src/Eita__Typography.res.mjs +183 -0
  47. package/src/Eita__Utils.res.mjs +32 -0
  48. package/src/Example.res +111 -0
  49. package/src/Example.res.mjs +176 -0
  50. package/src/components/Basefn__Accordion.css +70 -0
  51. package/src/components/Basefn__Accordion.res +79 -0
  52. package/src/components/Basefn__Accordion.res.mjs +77 -0
  53. package/src/components/Basefn__Alert.css +79 -0
  54. package/src/components/Basefn__Alert.res +68 -0
  55. package/src/components/Basefn__Alert.res.mjs +78 -0
  56. package/src/components/Basefn__AppLayout.css +100 -0
  57. package/src/components/Basefn__AppLayout.res +74 -0
  58. package/src/components/Basefn__AppLayout.res.mjs +100 -0
  59. package/src/components/Basefn__Avatar.css +25 -0
  60. package/src/components/Basefn__Avatar.res +23 -0
  61. package/src/components/Basefn__Avatar.res.mjs +40 -0
  62. package/src/components/Basefn__Badge.css +71 -0
  63. package/src/components/Basefn__Badge.res +43 -0
  64. package/src/components/Basefn__Badge.res.mjs +65 -0
  65. package/src/components/Basefn__Breadcrumb.css +36 -0
  66. package/src/components/Basefn__Breadcrumb.res +45 -0
  67. package/src/components/Basefn__Breadcrumb.res.mjs +53 -0
  68. package/src/components/Basefn__Button.css +83 -0
  69. package/src/components/Basefn__Button.res +32 -0
  70. package/src/components/Basefn__Button.res.mjs +54 -0
  71. package/src/components/Basefn__Card.css +50 -0
  72. package/src/components/Basefn__Card.res +45 -0
  73. package/src/components/Basefn__Card.res.mjs +60 -0
  74. package/src/components/Basefn__Checkbox.css +72 -0
  75. package/src/components/Basefn__Checkbox.res +25 -0
  76. package/src/components/Basefn__Checkbox.res.mjs +36 -0
  77. package/src/components/Basefn__Drawer.css +168 -0
  78. package/src/components/Basefn__Drawer.res +86 -0
  79. package/src/components/Basefn__Drawer.res.mjs +112 -0
  80. package/src/components/Basefn__Dropdown.css +76 -0
  81. package/src/components/Basefn__Dropdown.res +85 -0
  82. package/src/components/Basefn__Dropdown.res.mjs +96 -0
  83. package/src/components/Basefn__Grid.css +11 -0
  84. package/src/components/Basefn__Grid.res +296 -0
  85. package/src/components/Basefn__Grid.res.mjs +263 -0
  86. package/src/components/Basefn__Icon.css +12 -0
  87. package/src/components/Basefn__Icon.res +196 -0
  88. package/src/components/Basefn__Icon.res.mjs +183 -0
  89. package/src/components/Basefn__Input.css +44 -0
  90. package/src/components/Basefn__Input.res +48 -0
  91. package/src/components/Basefn__Input.res.mjs +63 -0
  92. package/src/components/Basefn__Kbd.css +65 -0
  93. package/src/components/Basefn__Kbd.res +27 -0
  94. package/src/components/Basefn__Kbd.res.mjs +42 -0
  95. package/src/components/Basefn__Label.css +22 -0
  96. package/src/components/Basefn__Label.res +18 -0
  97. package/src/components/Basefn__Label.res.mjs +24 -0
  98. package/src/components/Basefn__Modal.css +100 -0
  99. package/src/components/Basefn__Modal.res +74 -0
  100. package/src/components/Basefn__Modal.res.mjs +93 -0
  101. package/src/components/Basefn__Progress.css +69 -0
  102. package/src/components/Basefn__Progress.res +88 -0
  103. package/src/components/Basefn__Progress.res.mjs +101 -0
  104. package/src/components/Basefn__Radio.css +72 -0
  105. package/src/components/Basefn__Radio.res +35 -0
  106. package/src/components/Basefn__Radio.res.mjs +38 -0
  107. package/src/components/Basefn__Select.css +44 -0
  108. package/src/components/Basefn__Select.res +33 -0
  109. package/src/components/Basefn__Select.res.mjs +40 -0
  110. package/src/components/Basefn__Separator.css +85 -0
  111. package/src/components/Basefn__Separator.res +45 -0
  112. package/src/components/Basefn__Separator.res.mjs +70 -0
  113. package/src/components/Basefn__Sidebar.css +141 -0
  114. package/src/components/Basefn__Sidebar.res +95 -0
  115. package/src/components/Basefn__Sidebar.res.mjs +107 -0
  116. package/src/components/Basefn__Slider.css +97 -0
  117. package/src/components/Basefn__Slider.res +68 -0
  118. package/src/components/Basefn__Slider.res.mjs +89 -0
  119. package/src/components/Basefn__Spinner.css +63 -0
  120. package/src/components/Basefn__Spinner.res +44 -0
  121. package/src/components/Basefn__Spinner.res.mjs +69 -0
  122. package/src/components/Basefn__Stepper.css +141 -0
  123. package/src/components/Basefn__Stepper.res +86 -0
  124. package/src/components/Basefn__Stepper.res.mjs +114 -0
  125. package/src/components/Basefn__Switch.css +80 -0
  126. package/src/components/Basefn__Switch.res +62 -0
  127. package/src/components/Basefn__Switch.res.mjs +84 -0
  128. package/src/components/Basefn__Tabs.css +54 -0
  129. package/src/components/Basefn__Tabs.res +73 -0
  130. package/src/components/Basefn__Tabs.res.mjs +57 -0
  131. package/src/components/Basefn__Textarea.css +41 -0
  132. package/src/components/Basefn__Textarea.res +28 -0
  133. package/src/components/Basefn__Textarea.res.mjs +41 -0
  134. package/src/components/Basefn__ThemeToggle.css +5 -0
  135. package/src/components/Basefn__ThemeToggle.res +29 -0
  136. package/src/components/Basefn__ThemeToggle.res.mjs +49 -0
  137. package/src/components/Basefn__Timeline.css +144 -0
  138. package/src/components/Basefn__Timeline.res +70 -0
  139. package/src/components/Basefn__Timeline.res.mjs +86 -0
  140. package/src/components/Basefn__Toast.css +100 -0
  141. package/src/components/Basefn__Toast.res +92 -0
  142. package/src/components/Basefn__Toast.res.mjs +112 -0
  143. package/src/components/Basefn__Tooltip.css +84 -0
  144. package/src/components/Basefn__Tooltip.res +42 -0
  145. package/src/components/Basefn__Tooltip.res.mjs +60 -0
  146. package/src/components/Basefn__Topbar.css +130 -0
  147. package/src/components/Basefn__Topbar.res +92 -0
  148. package/src/components/Basefn__Topbar.res.mjs +91 -0
  149. package/src/components/Basefn__Typography.css +120 -0
  150. package/src/components/Basefn__Typography.res +96 -0
  151. package/src/components/Basefn__Typography.res.mjs +175 -0
  152. package/src/styles/Basefn__Theme.res +63 -0
  153. package/src/styles/Basefn__Theme.res.mjs +65 -0
  154. package/src/styles/variables.css +199 -0
@@ -0,0 +1,112 @@
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 './Eita__Toast.css'
7
+ ;
8
+
9
+ function variantToString(variant) {
10
+ switch (variant) {
11
+ case "Info" :
12
+ return "info";
13
+ case "Success" :
14
+ return "success";
15
+ case "Warning" :
16
+ return "warning";
17
+ case "Error" :
18
+ return "error";
19
+ }
20
+ }
21
+
22
+ function positionToString(position) {
23
+ switch (position) {
24
+ case "TopRight" :
25
+ return "top-right";
26
+ case "TopLeft" :
27
+ return "top-left";
28
+ case "BottomRight" :
29
+ return "bottom-right";
30
+ case "BottomLeft" :
31
+ return "bottom-left";
32
+ }
33
+ }
34
+
35
+ function Eita__Toast(props) {
36
+ let __duration = props.duration;
37
+ let __autoDismiss = props.autoDismiss;
38
+ let onClose = props.onClose;
39
+ let isVisible = props.isVisible;
40
+ let __position = props.position;
41
+ let __variant = props.variant;
42
+ let message = props.message;
43
+ let title = props.title;
44
+ let variant = __variant !== undefined ? __variant : "Info";
45
+ let position = __position !== undefined ? __position : "TopRight";
46
+ let autoDismiss = __autoDismiss !== undefined ? __autoDismiss : true;
47
+ let duration = __duration !== undefined ? __duration : 3000;
48
+ Xote.Effect.run(() => {
49
+ if (!(Xote.Signal.get(isVisible) && autoDismiss)) {
50
+ return;
51
+ }
52
+ let timeoutId = setTimeout(() => {
53
+ Xote.Signal.set(isVisible, false);
54
+ onClose();
55
+ }, duration);
56
+ return () => {
57
+ clearTimeout(timeoutId);
58
+ };
59
+ }, undefined);
60
+ let getToastClass = () => {
61
+ let variantClass = "basefn-toast--" + variantToString(variant);
62
+ return "basefn-toast " + variantClass;
63
+ };
64
+ let getContainerClass = () => {
65
+ let posClass = "basefn-toast-container--" + positionToString(position);
66
+ return "basefn-toast-container " + posClass;
67
+ };
68
+ return Xote.Component.signalFragment(Xote.Computed.make(() => {
69
+ if (Xote.Signal.get(isVisible)) {
70
+ return [Xote__JSX.Elements.jsx("div", {
71
+ class: getContainerClass(),
72
+ children: Xote__JSX.Elements.jsxs("div", {
73
+ class: getToastClass(),
74
+ children: Xote__JSX.array([
75
+ Xote__JSX.Elements.jsxs("div", {
76
+ class: "basefn-toast__content",
77
+ children: Xote__JSX.array([
78
+ title !== undefined ? Xote__JSX.Elements.jsx("div", {
79
+ class: "basefn-toast__title",
80
+ children: Xote.Component.text(title)
81
+ }) : Xote__JSX.jsx(Xote__JSX.jsxFragment, {}),
82
+ Xote__JSX.Elements.jsx("div", {
83
+ class: "basefn-toast__message",
84
+ children: Xote.Component.text(message)
85
+ })
86
+ ])
87
+ }),
88
+ Xote__JSX.Elements.jsx("button", {
89
+ class: "basefn-toast__close",
90
+ onClick: param => {
91
+ Xote.Signal.set(isVisible, false);
92
+ onClose();
93
+ },
94
+ children: Xote.Component.text("\u00d7")
95
+ })
96
+ ])
97
+ })
98
+ })];
99
+ } else {
100
+ return [];
101
+ }
102
+ }, undefined));
103
+ }
104
+
105
+ let make = Eita__Toast;
106
+
107
+ export {
108
+ variantToString,
109
+ positionToString,
110
+ make,
111
+ }
112
+ /* Not a pure module */
@@ -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 './Eita__Tooltip.css'
7
+ ;
8
+
9
+ function positionToString(position) {
10
+ switch (position) {
11
+ case "Top" :
12
+ return "top";
13
+ case "Bottom" :
14
+ return "bottom";
15
+ case "Left" :
16
+ return "left";
17
+ case "Right" :
18
+ return "right";
19
+ }
20
+ }
21
+
22
+ function Eita__Tooltip(props) {
23
+ let __position = props.position;
24
+ let content = props.content;
25
+ let position = __position !== undefined ? __position : "Top";
26
+ let isVisible = Xote.Signal.make(false, undefined, undefined);
27
+ let handleMouseEnter = param => Xote.Signal.set(isVisible, true);
28
+ let handleMouseLeave = param => Xote.Signal.set(isVisible, false);
29
+ let getTooltipClass = () => {
30
+ let posClass = "basefn-tooltip--" + positionToString(position);
31
+ return "basefn-tooltip " + posClass;
32
+ };
33
+ let tooltipContent = Xote.Computed.make(() => {
34
+ if (Xote.Signal.get(isVisible)) {
35
+ return [Xote__JSX.Elements.jsx("div", {
36
+ class: getTooltipClass(),
37
+ children: Xote.Component.text(content)
38
+ })];
39
+ } else {
40
+ return [];
41
+ }
42
+ }, undefined);
43
+ return Xote__JSX.Elements.jsxs("div", {
44
+ class: "basefn-tooltip-wrapper",
45
+ onMouseEnter: handleMouseEnter,
46
+ onMouseLeave: handleMouseLeave,
47
+ children: Xote__JSX.array([
48
+ props.children,
49
+ Xote.Component.signalFragment(tooltipContent)
50
+ ])
51
+ });
52
+ }
53
+
54
+ let make = Eita__Tooltip;
55
+
56
+ export {
57
+ positionToString,
58
+ make,
59
+ }
60
+ /* Not a pure module */
@@ -0,0 +1,96 @@
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 './Eita__Topbar.css'
7
+ ;
8
+
9
+ function themeToString(theme) {
10
+ if (theme === "Light") {
11
+ return "light";
12
+ } else {
13
+ return "dark";
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 Eita__Topbar(props) {
29
+ let __size = props.size;
30
+ let __theme = props.theme;
31
+ let onMenuClick = props.onMenuClick;
32
+ let rightContent = props.rightContent;
33
+ let centerContent = props.centerContent;
34
+ let leftContent = props.leftContent;
35
+ let navItems = props.navItems;
36
+ let logo = props.logo;
37
+ let theme = __theme !== undefined ? __theme : "Light";
38
+ let size = __size !== undefined ? __size : "Md";
39
+ let getTopbarClass = () => {
40
+ let themeClass = theme === "Dark" ? " basefn-topbar--dark" : "";
41
+ let sizeClass = " basefn-topbar--" + sizeToString(size);
42
+ return "basefn-topbar" + themeClass + sizeClass;
43
+ };
44
+ return Xote__JSX.Elements.jsxs("header", {
45
+ class: getTopbarClass(),
46
+ children: Xote__JSX.array([
47
+ Xote__JSX.Elements.jsxs("div", {
48
+ class: "basefn-topbar__left",
49
+ children: Xote__JSX.array([
50
+ onMenuClick !== undefined ? Xote__JSX.Elements.jsx("button", {
51
+ class: "basefn-topbar__menu-button",
52
+ onClick: param => onMenuClick(),
53
+ children: Xote.Component.text("\u2630")
54
+ }) : Xote__JSX.jsx(Xote__JSX.jsxFragment, {}),
55
+ logo !== undefined ? Xote__JSX.Elements.jsx("div", {
56
+ class: "basefn-topbar__logo",
57
+ children: logo
58
+ }) : Xote__JSX.jsx(Xote__JSX.jsxFragment, {}),
59
+ leftContent !== undefined ? leftContent : Xote__JSX.jsx(Xote__JSX.jsxFragment, {})
60
+ ])
61
+ }),
62
+ Xote__JSX.Elements.jsxs("div", {
63
+ class: "basefn-topbar__center",
64
+ children: Xote__JSX.array([
65
+ navItems !== undefined ? Xote__JSX.Elements.jsx("nav", {
66
+ class: "basefn-topbar__nav",
67
+ children: Xote.Component.fragment(navItems.map((item, index) => {
68
+ let className = "basefn-topbar__nav-item" + (
69
+ item.active ? " basefn-topbar__nav-item--active" : ""
70
+ );
71
+ return Xote__JSX.Elements.jsxKeyed("button", {
72
+ class: className,
73
+ onClick: param => item.onClick(),
74
+ children: Xote.Component.text(item.label)
75
+ }, index.toString(), undefined);
76
+ }))
77
+ }) : Xote__JSX.jsx(Xote__JSX.jsxFragment, {}),
78
+ centerContent !== undefined ? centerContent : Xote__JSX.jsx(Xote__JSX.jsxFragment, {})
79
+ ])
80
+ }),
81
+ Xote__JSX.Elements.jsx("div", {
82
+ class: "basefn-topbar__right",
83
+ children: rightContent !== undefined ? rightContent : Xote__JSX.jsx(Xote__JSX.jsxFragment, {})
84
+ })
85
+ ])
86
+ });
87
+ }
88
+
89
+ let make = Eita__Topbar;
90
+
91
+ export {
92
+ themeToString,
93
+ sizeToString,
94
+ make,
95
+ }
96
+ /* Not a pure module */
@@ -0,0 +1,183 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Xote__JSX from "xote/src/Xote__JSX.res.mjs";
4
+
5
+ import './Eita__Typography.css'
6
+ ;
7
+
8
+ function variantToTag(variant) {
9
+ switch (variant) {
10
+ case "H1" :
11
+ return "h1";
12
+ case "H2" :
13
+ return "h2";
14
+ case "H3" :
15
+ return "h3";
16
+ case "H4" :
17
+ return "h4";
18
+ case "H5" :
19
+ return "h5";
20
+ case "H6" :
21
+ return "h6";
22
+ case "Small" :
23
+ return "small";
24
+ case "P" :
25
+ case "Lead" :
26
+ case "Muted" :
27
+ return "p";
28
+ case "Code" :
29
+ return "code";
30
+ case "Unstyled" :
31
+ return "div";
32
+ }
33
+ }
34
+
35
+ function variantToClass(variant) {
36
+ switch (variant) {
37
+ case "H1" :
38
+ return "basefn-typography--h1";
39
+ case "H2" :
40
+ return "basefn-typography--h2";
41
+ case "H3" :
42
+ return "basefn-typography--h3";
43
+ case "H4" :
44
+ return "basefn-typography--h4";
45
+ case "H5" :
46
+ return "basefn-typography--h5";
47
+ case "H6" :
48
+ return "basefn-typography--h6";
49
+ case "P" :
50
+ return "basefn-typography--p";
51
+ case "Small" :
52
+ return "basefn-typography--small";
53
+ case "Lead" :
54
+ return "basefn-typography--lead";
55
+ case "Muted" :
56
+ return "basefn-typography--muted";
57
+ case "Code" :
58
+ return "basefn-typography--code";
59
+ case "Unstyled" :
60
+ return "basefn-typography--unstyled";
61
+ }
62
+ }
63
+
64
+ function alignToString(align) {
65
+ switch (align) {
66
+ case "Left" :
67
+ return "left";
68
+ case "Center" :
69
+ return "center";
70
+ case "Right" :
71
+ return "right";
72
+ case "Justify" :
73
+ return "justify";
74
+ }
75
+ }
76
+
77
+ function Eita__Typography(props) {
78
+ let __class = props.class;
79
+ let align = props.align;
80
+ let __variant = props.variant;
81
+ let text = props.text;
82
+ let variant = __variant !== undefined ? __variant : "P";
83
+ let $$class = __class !== undefined ? __class : "";
84
+ let variantClass = variantToClass(variant);
85
+ let baseClass = "basefn-typography " + variantClass;
86
+ let alignClass = align !== undefined ? " basefn-typography--" + alignToString(align) : "";
87
+ let customClass = $$class !== "" ? " " + $$class : "";
88
+ let $$class$1 = baseClass + alignClass + customClass;
89
+ switch (variant) {
90
+ case "H1" :
91
+ return Xote__JSX.Elements.jsx("h1", {
92
+ class: $$class$1,
93
+ children: {
94
+ TAG: "SignalText",
95
+ _0: text
96
+ }
97
+ });
98
+ case "H2" :
99
+ return Xote__JSX.Elements.jsx("h2", {
100
+ class: $$class$1,
101
+ children: {
102
+ TAG: "SignalText",
103
+ _0: text
104
+ }
105
+ });
106
+ case "H3" :
107
+ return Xote__JSX.Elements.jsx("h3", {
108
+ class: $$class$1,
109
+ children: {
110
+ TAG: "SignalText",
111
+ _0: text
112
+ }
113
+ });
114
+ case "H4" :
115
+ return Xote__JSX.Elements.jsx("h4", {
116
+ class: $$class$1,
117
+ children: {
118
+ TAG: "SignalText",
119
+ _0: text
120
+ }
121
+ });
122
+ case "H5" :
123
+ return Xote__JSX.Elements.jsx("h5", {
124
+ class: $$class$1,
125
+ children: {
126
+ TAG: "SignalText",
127
+ _0: text
128
+ }
129
+ });
130
+ case "H6" :
131
+ return Xote__JSX.Elements.jsx("h6", {
132
+ class: $$class$1,
133
+ children: {
134
+ TAG: "SignalText",
135
+ _0: text
136
+ }
137
+ });
138
+ case "Small" :
139
+ return Xote__JSX.Elements.jsx("small", {
140
+ class: $$class$1,
141
+ children: {
142
+ TAG: "SignalText",
143
+ _0: text
144
+ }
145
+ });
146
+ case "P" :
147
+ case "Lead" :
148
+ case "Muted" :
149
+ return Xote__JSX.Elements.jsx("p", {
150
+ class: $$class$1,
151
+ children: {
152
+ TAG: "SignalText",
153
+ _0: text
154
+ }
155
+ });
156
+ case "Code" :
157
+ return Xote__JSX.Elements.jsx("code", {
158
+ class: $$class$1,
159
+ children: {
160
+ TAG: "SignalText",
161
+ _0: text
162
+ }
163
+ });
164
+ case "Unstyled" :
165
+ return Xote__JSX.Elements.jsx("div", {
166
+ class: $$class$1,
167
+ children: {
168
+ TAG: "SignalText",
169
+ _0: text
170
+ }
171
+ });
172
+ }
173
+ }
174
+
175
+ let make = Eita__Typography;
176
+
177
+ export {
178
+ variantToTag,
179
+ variantToClass,
180
+ alignToString,
181
+ make,
182
+ }
183
+ /* Not a pure module */
@@ -0,0 +1,32 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Signals from "rescript-signals/src/Signals.res.mjs";
4
+
5
+ function getValue(reactive) {
6
+ if (reactive.TAG === "Value") {
7
+ return reactive._0;
8
+ } else {
9
+ return Signals.Signal.get(reactive._0);
10
+ }
11
+ }
12
+
13
+ function makeReactive(value) {
14
+ return {
15
+ TAG: "Value",
16
+ _0: value
17
+ };
18
+ }
19
+
20
+ function makeReactiveFromSignal(signal) {
21
+ return {
22
+ TAG: "SignalValue",
23
+ _0: signal
24
+ };
25
+ }
26
+
27
+ export {
28
+ getValue,
29
+ makeReactive,
30
+ makeReactiveFromSignal,
31
+ }
32
+ /* Signals Not a pure module */
@@ -0,0 +1,111 @@
1
+ // Example usage of basefn-UI components
2
+
3
+ open Basefn
4
+ open Xote
5
+
6
+ module ExampleForm = {
7
+ @jsx.component
8
+ let make = () => {
9
+ // Form state using signals
10
+ let name = Signal.make("")
11
+ let email = Signal.make("")
12
+ let message = Signal.make("")
13
+ let agreeToTerms = Signal.make(false)
14
+ let selectedOption = Signal.make("option1")
15
+ let isSubmitting = Signal.make(false)
16
+
17
+ // Event handlers
18
+ let handleNameChange = evt => {
19
+ let target = Obj.magic(evt)["target"]
20
+ Signal.set(name, target["value"])
21
+ }
22
+
23
+ let handleEmailChange = evt => {
24
+ let target = Obj.magic(evt)["target"]
25
+ Signal.set(email, target["value"])
26
+ }
27
+
28
+ let handleMessageChange = evt => {
29
+ let target = Obj.magic(evt)["target"]
30
+ Signal.set(message, target["value"])
31
+ }
32
+
33
+ let handleCheckboxChange = _evt => {
34
+ Signal.update(agreeToTerms, prev => !prev)
35
+ }
36
+
37
+ let handleSubmit = _evt => {
38
+ Signal.set(isSubmitting, true)
39
+ // Simulate API call
40
+ Console.log("Submitting form...")
41
+ Console.log(`Name: ${Signal.get(name)}`)
42
+ Console.log(`Email: ${Signal.get(email)}`)
43
+ Console.log(`Message: ${Signal.get(message)}`)
44
+
45
+ let _ = setTimeout(() => {
46
+ Signal.set(isSubmitting, false)
47
+ ()
48
+ }, 1000)
49
+ }
50
+
51
+ let selectOptions = Signal.make([
52
+ ({value: "option1", label: "Option 1"}: selectOption),
53
+ ({value: "option2", label: "Option 2"}: selectOption),
54
+ ({value: "option3", label: "Option 3"}: selectOption),
55
+ ])
56
+
57
+ <div style="max-width: 50rem; margin: auto;">
58
+ <h1> {Component.text("Contact Form Example")} </h1>
59
+
60
+ <div style="margin-bottom: 1rem;">
61
+ <Label text="Name" required={true} />
62
+ <Input
63
+ value={Reactive(name)}
64
+ onInput={handleNameChange}
65
+ type_={Input.Text}
66
+ placeholder="Enter your name"
67
+ />
68
+ </div>
69
+
70
+ <div style="margin-bottom: 1rem;">
71
+ <Label text="Email" required={true} />
72
+ <Input
73
+ value={Reactive(email)}
74
+ onInput={handleEmailChange}
75
+ type_={Input.Email}
76
+ placeholder="Enter your email"
77
+ />
78
+ </div>
79
+
80
+ <div style="margin-bottom: 1rem;">
81
+ <Label text="Choose an option" required={false} />
82
+ <Select value={selectedOption} options={selectOptions} />
83
+ </div>
84
+
85
+ <div style="margin-bottom: 1rem;">
86
+ <Label text="Message" required={false} />
87
+ <Textarea
88
+ value={Reactive(message)} onInput={handleMessageChange} placeholder="Enter your message"
89
+ />
90
+ </div>
91
+
92
+ <div style="margin-bottom: 1rem;">
93
+ <Checkbox
94
+ checked={agreeToTerms}
95
+ onChange={handleCheckboxChange}
96
+ label="I agree to the terms and conditions"
97
+ />
98
+ </div>
99
+
100
+ <div style="display: flex; gap: 1rem;">
101
+ <Button onClick={handleSubmit} variant={Button.Primary} disabled={Reactive(isSubmitting)}>
102
+ {Component.textSignal(() => Signal.get(isSubmitting) ? "Submitting..." : "Submit")}
103
+ </Button>
104
+ <Button label={Static("Cancel")} variant={Button.Ghost} />
105
+ </div>
106
+ </div>
107
+ }
108
+ }
109
+
110
+ // Mount the example form
111
+ Component.mountById(<ExampleForm />, "root")