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,296 @@
|
|
|
1
|
+
%%raw(`import "./Basefn__Grid.css"`)
|
|
2
|
+
|
|
3
|
+
open Xote
|
|
4
|
+
|
|
5
|
+
// Grid template types
|
|
6
|
+
type columns =
|
|
7
|
+
| Count(int) // Simple column count (e.g., 3 columns)
|
|
8
|
+
| Template(string) // Custom template (e.g., "1fr 2fr 1fr")
|
|
9
|
+
| Repeat(int, string) // Repeat pattern (e.g., Repeat(3, "1fr"))
|
|
10
|
+
| AutoFit(string) // Auto-fit with min size (e.g., AutoFit("minmax(200px, 1fr)"))
|
|
11
|
+
| AutoFill(string) // Auto-fill with min size
|
|
12
|
+
|
|
13
|
+
type rows =
|
|
14
|
+
| Count(int)
|
|
15
|
+
| Template(string)
|
|
16
|
+
| Repeat(int, string)
|
|
17
|
+
| Auto // Auto rows
|
|
18
|
+
|
|
19
|
+
// Auto flow direction
|
|
20
|
+
type autoFlow =
|
|
21
|
+
| Row
|
|
22
|
+
| Column
|
|
23
|
+
| RowDense
|
|
24
|
+
| ColumnDense
|
|
25
|
+
|
|
26
|
+
// Alignment options
|
|
27
|
+
type justifyItems =
|
|
28
|
+
| Start
|
|
29
|
+
| End
|
|
30
|
+
| Center
|
|
31
|
+
| Stretch
|
|
32
|
+
|
|
33
|
+
type alignItems =
|
|
34
|
+
| Start
|
|
35
|
+
| End
|
|
36
|
+
| Center
|
|
37
|
+
| Stretch
|
|
38
|
+
| Baseline
|
|
39
|
+
|
|
40
|
+
type justifyContent =
|
|
41
|
+
| Start
|
|
42
|
+
| End
|
|
43
|
+
| Center
|
|
44
|
+
| Stretch
|
|
45
|
+
| SpaceBetween
|
|
46
|
+
| SpaceAround
|
|
47
|
+
| SpaceEvenly
|
|
48
|
+
|
|
49
|
+
type alignContent =
|
|
50
|
+
| Start
|
|
51
|
+
| End
|
|
52
|
+
| Center
|
|
53
|
+
| Stretch
|
|
54
|
+
| SpaceBetween
|
|
55
|
+
| SpaceAround
|
|
56
|
+
| SpaceEvenly
|
|
57
|
+
|
|
58
|
+
// Convert types to CSS values
|
|
59
|
+
let columnsToString = (cols: columns): string => {
|
|
60
|
+
switch cols {
|
|
61
|
+
| Count(n) => "repeat(" ++ Int.toString(n) ++ ", 1fr)"
|
|
62
|
+
| Template(t) => t
|
|
63
|
+
| Repeat(n, pattern) => "repeat(" ++ Int.toString(n) ++ ", " ++ pattern ++ ")"
|
|
64
|
+
| AutoFit(minmax) => "repeat(auto-fit, " ++ minmax ++ ")"
|
|
65
|
+
| AutoFill(minmax) => "repeat(auto-fill, " ++ minmax ++ ")"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let rowsToString = (rows: rows): string => {
|
|
70
|
+
switch rows {
|
|
71
|
+
| Count(n) => "repeat(" ++ Int.toString(n) ++ ", auto)"
|
|
72
|
+
| Template(t) => t
|
|
73
|
+
| Repeat(n, pattern) => "repeat(" ++ Int.toString(n) ++ ", " ++ pattern ++ ")"
|
|
74
|
+
| Auto => "auto"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let autoFlowToString = (flow: autoFlow): string => {
|
|
79
|
+
switch flow {
|
|
80
|
+
| Row => "row"
|
|
81
|
+
| Column => "column"
|
|
82
|
+
| RowDense => "row dense"
|
|
83
|
+
| ColumnDense => "column dense"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let justifyItemsToString = (justify: justifyItems): string => {
|
|
88
|
+
switch justify {
|
|
89
|
+
| Start => "start"
|
|
90
|
+
| End => "end"
|
|
91
|
+
| Center => "center"
|
|
92
|
+
| Stretch => "stretch"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let alignItemsToString = (align: alignItems): string => {
|
|
97
|
+
switch align {
|
|
98
|
+
| Start => "start"
|
|
99
|
+
| End => "end"
|
|
100
|
+
| Center => "center"
|
|
101
|
+
| Stretch => "stretch"
|
|
102
|
+
| Baseline => "baseline"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let justifyContentToString = (justify: justifyContent): string => {
|
|
107
|
+
switch justify {
|
|
108
|
+
| Start => "start"
|
|
109
|
+
| End => "end"
|
|
110
|
+
| Center => "center"
|
|
111
|
+
| Stretch => "stretch"
|
|
112
|
+
| SpaceBetween => "space-between"
|
|
113
|
+
| SpaceAround => "space-around"
|
|
114
|
+
| SpaceEvenly => "space-evenly"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let alignContentToString = (align: alignContent): string => {
|
|
119
|
+
switch align {
|
|
120
|
+
| Start => "start"
|
|
121
|
+
| End => "end"
|
|
122
|
+
| Center => "center"
|
|
123
|
+
| Stretch => "stretch"
|
|
124
|
+
| SpaceBetween => "space-between"
|
|
125
|
+
| SpaceAround => "space-around"
|
|
126
|
+
| SpaceEvenly => "space-evenly"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@jsx.component
|
|
131
|
+
let make = (
|
|
132
|
+
~columns: columns=Count(1),
|
|
133
|
+
~rows: option<rows>=?,
|
|
134
|
+
~gap: option<string>=?,
|
|
135
|
+
~rowGap: option<string>=?,
|
|
136
|
+
~columnGap: option<string>=?,
|
|
137
|
+
~autoFlow: option<autoFlow>=?,
|
|
138
|
+
~justifyItems: option<justifyItems>=?,
|
|
139
|
+
~alignItems: option<alignItems>=?,
|
|
140
|
+
~justifyContent: option<justifyContent>=?,
|
|
141
|
+
~alignContent: option<alignContent>=?,
|
|
142
|
+
~class=ReactiveProp.static(""),
|
|
143
|
+
~style=ReactiveProp.static(""),
|
|
144
|
+
~children,
|
|
145
|
+
) => {
|
|
146
|
+
let className = Computed.make(() => {
|
|
147
|
+
"basefn-grid " ++ class->ReactiveProp.get
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
let gridStyle = Computed.make(() => {
|
|
151
|
+
let styles = []
|
|
152
|
+
|
|
153
|
+
// Template columns (required)
|
|
154
|
+
styles->Array.push("grid-template-columns: " ++ columnsToString(columns))
|
|
155
|
+
|
|
156
|
+
// Template rows (optional)
|
|
157
|
+
switch rows {
|
|
158
|
+
| Some(r) => styles->Array.push("grid-template-rows: " ++ rowsToString(r))
|
|
159
|
+
| None => ()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Gap (can use single gap or separate row/column gaps)
|
|
163
|
+
switch (gap, rowGap, columnGap) {
|
|
164
|
+
| (Some(g), None, None) => styles->Array.push("gap: " ++ g)
|
|
165
|
+
| (None, Some(rg), Some(cg)) => {
|
|
166
|
+
styles->Array.push("row-gap: " ++ rg)
|
|
167
|
+
styles->Array.push("column-gap: " ++ cg)
|
|
168
|
+
}
|
|
169
|
+
| (None, Some(rg), None) => styles->Array.push("row-gap: " ++ rg)
|
|
170
|
+
| (None, None, Some(cg)) => styles->Array.push("column-gap: " ++ cg)
|
|
171
|
+
| _ => () // Default gap from CSS
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Auto flow
|
|
175
|
+
switch autoFlow {
|
|
176
|
+
| Some(flow) => styles->Array.push("grid-auto-flow: " ++ autoFlowToString(flow))
|
|
177
|
+
| None => ()
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Justify items
|
|
181
|
+
switch justifyItems {
|
|
182
|
+
| Some(justify) => styles->Array.push("justify-items: " ++ justifyItemsToString(justify))
|
|
183
|
+
| None => ()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Align items
|
|
187
|
+
switch alignItems {
|
|
188
|
+
| Some(align) => styles->Array.push("align-items: " ++ alignItemsToString(align))
|
|
189
|
+
| None => ()
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Justify content
|
|
193
|
+
switch justifyContent {
|
|
194
|
+
| Some(justify) => styles->Array.push("justify-content: " ++ justifyContentToString(justify))
|
|
195
|
+
| None => ()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Align content
|
|
199
|
+
switch alignContent {
|
|
200
|
+
| Some(align) => styles->Array.push("align-content: " ++ alignContentToString(align))
|
|
201
|
+
| None => ()
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Add custom styles
|
|
205
|
+
let customStyle = style->ReactiveProp.get
|
|
206
|
+
if customStyle !== "" {
|
|
207
|
+
styles->Array.push(customStyle)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
styles->Array.join("; ")
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
<div class={className} style={gridStyle}> {children} </div>
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Grid Item component for children that need custom placement
|
|
217
|
+
module Item = {
|
|
218
|
+
type columnSpan =
|
|
219
|
+
| Span(int)
|
|
220
|
+
| StartEnd(int, int)
|
|
221
|
+
| Auto
|
|
222
|
+
|
|
223
|
+
type rowSpan =
|
|
224
|
+
| Span(int)
|
|
225
|
+
| StartEnd(int, int)
|
|
226
|
+
| Auto
|
|
227
|
+
|
|
228
|
+
let columnSpanToString = (span: columnSpan): string => {
|
|
229
|
+
switch span {
|
|
230
|
+
| Span(n) => "span " ++ Int.toString(n)
|
|
231
|
+
| StartEnd(start, end) => Int.toString(start) ++ " / " ++ Int.toString(end)
|
|
232
|
+
| Auto => "auto"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
let rowSpanToString = (span: rowSpan): string => {
|
|
237
|
+
switch span {
|
|
238
|
+
| Span(n) => "span " ++ Int.toString(n)
|
|
239
|
+
| StartEnd(start, end) => Int.toString(start) ++ " / " ++ Int.toString(end)
|
|
240
|
+
| Auto => "auto"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@jsx.component
|
|
245
|
+
let make = (
|
|
246
|
+
~column: option<columnSpan>=?,
|
|
247
|
+
~row: option<rowSpan>=?,
|
|
248
|
+
~justifySelf: option<justifyItems>=?,
|
|
249
|
+
~alignSelf: option<alignItems>=?,
|
|
250
|
+
~class=ReactiveProp.static(""),
|
|
251
|
+
~style=ReactiveProp.static(""),
|
|
252
|
+
~children,
|
|
253
|
+
) => {
|
|
254
|
+
let className = Computed.make(() => {
|
|
255
|
+
"basefn-grid-item " ++ class->ReactiveProp.get
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
let itemStyle = Computed.make(() => {
|
|
259
|
+
let styles = []
|
|
260
|
+
|
|
261
|
+
// Column placement
|
|
262
|
+
switch column {
|
|
263
|
+
| Some(col) => styles->Array.push("grid-column: " ++ columnSpanToString(col))
|
|
264
|
+
| None => ()
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Row placement
|
|
268
|
+
switch row {
|
|
269
|
+
| Some(r) => styles->Array.push("grid-row: " ++ rowSpanToString(r))
|
|
270
|
+
| None => ()
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Justify self
|
|
274
|
+
switch justifySelf {
|
|
275
|
+
| Some(justify) => styles->Array.push("justify-self: " ++ justifyItemsToString(justify))
|
|
276
|
+
| None => ()
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Align self
|
|
280
|
+
switch alignSelf {
|
|
281
|
+
| Some(align) => styles->Array.push("align-self: " ++ alignItemsToString(align))
|
|
282
|
+
| None => ()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Add custom styles
|
|
286
|
+
let customStyle = style->ReactiveProp.get
|
|
287
|
+
if customStyle !== "" {
|
|
288
|
+
styles->Array.push(customStyle)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
styles->Array.join("; ")
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
<div class={className} style={itemStyle}> {children} </div>
|
|
295
|
+
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
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__Grid.css"
|
|
7
|
+
;
|
|
8
|
+
|
|
9
|
+
function columnsToString(cols) {
|
|
10
|
+
switch (cols.TAG) {
|
|
11
|
+
case "Count" :
|
|
12
|
+
return "repeat(" + cols._0.toString() + ", 1fr)";
|
|
13
|
+
case "Template" :
|
|
14
|
+
return cols._0;
|
|
15
|
+
case "Repeat" :
|
|
16
|
+
return "repeat(" + cols._0.toString() + ", " + cols._1 + ")";
|
|
17
|
+
case "AutoFit" :
|
|
18
|
+
return "repeat(auto-fit, " + cols._0 + ")";
|
|
19
|
+
case "AutoFill" :
|
|
20
|
+
return "repeat(auto-fill, " + cols._0 + ")";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function rowsToString(rows) {
|
|
25
|
+
if (typeof rows !== "object") {
|
|
26
|
+
return "auto";
|
|
27
|
+
}
|
|
28
|
+
switch (rows.TAG) {
|
|
29
|
+
case "Count" :
|
|
30
|
+
return "repeat(" + rows._0.toString() + ", auto)";
|
|
31
|
+
case "Template" :
|
|
32
|
+
return rows._0;
|
|
33
|
+
case "Repeat" :
|
|
34
|
+
return "repeat(" + rows._0.toString() + ", " + rows._1 + ")";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function autoFlowToString(flow) {
|
|
39
|
+
switch (flow) {
|
|
40
|
+
case "Row" :
|
|
41
|
+
return "row";
|
|
42
|
+
case "Column" :
|
|
43
|
+
return "column";
|
|
44
|
+
case "RowDense" :
|
|
45
|
+
return "row dense";
|
|
46
|
+
case "ColumnDense" :
|
|
47
|
+
return "column dense";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function justifyItemsToString(justify) {
|
|
52
|
+
switch (justify) {
|
|
53
|
+
case "Start" :
|
|
54
|
+
return "start";
|
|
55
|
+
case "End" :
|
|
56
|
+
return "end";
|
|
57
|
+
case "Center" :
|
|
58
|
+
return "center";
|
|
59
|
+
case "Stretch" :
|
|
60
|
+
return "stretch";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function alignItemsToString(align) {
|
|
65
|
+
switch (align) {
|
|
66
|
+
case "Start" :
|
|
67
|
+
return "start";
|
|
68
|
+
case "End" :
|
|
69
|
+
return "end";
|
|
70
|
+
case "Center" :
|
|
71
|
+
return "center";
|
|
72
|
+
case "Stretch" :
|
|
73
|
+
return "stretch";
|
|
74
|
+
case "Baseline" :
|
|
75
|
+
return "baseline";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function justifyContentToString(justify) {
|
|
80
|
+
switch (justify) {
|
|
81
|
+
case "Start" :
|
|
82
|
+
return "start";
|
|
83
|
+
case "End" :
|
|
84
|
+
return "end";
|
|
85
|
+
case "Center" :
|
|
86
|
+
return "center";
|
|
87
|
+
case "Stretch" :
|
|
88
|
+
return "stretch";
|
|
89
|
+
case "SpaceBetween" :
|
|
90
|
+
return "space-between";
|
|
91
|
+
case "SpaceAround" :
|
|
92
|
+
return "space-around";
|
|
93
|
+
case "SpaceEvenly" :
|
|
94
|
+
return "space-evenly";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function alignContentToString(align) {
|
|
99
|
+
switch (align) {
|
|
100
|
+
case "Start" :
|
|
101
|
+
return "start";
|
|
102
|
+
case "End" :
|
|
103
|
+
return "end";
|
|
104
|
+
case "Center" :
|
|
105
|
+
return "center";
|
|
106
|
+
case "Stretch" :
|
|
107
|
+
return "stretch";
|
|
108
|
+
case "SpaceBetween" :
|
|
109
|
+
return "space-between";
|
|
110
|
+
case "SpaceAround" :
|
|
111
|
+
return "space-around";
|
|
112
|
+
case "SpaceEvenly" :
|
|
113
|
+
return "space-evenly";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function Basefn__Grid(props) {
|
|
118
|
+
let __style = props.style;
|
|
119
|
+
let __class = props.class;
|
|
120
|
+
let alignContent = props.alignContent;
|
|
121
|
+
let justifyContent = props.justifyContent;
|
|
122
|
+
let alignItems = props.alignItems;
|
|
123
|
+
let justifyItems = props.justifyItems;
|
|
124
|
+
let autoFlow = props.autoFlow;
|
|
125
|
+
let columnGap = props.columnGap;
|
|
126
|
+
let rowGap = props.rowGap;
|
|
127
|
+
let gap = props.gap;
|
|
128
|
+
let rows = props.rows;
|
|
129
|
+
let __columns = props.columns;
|
|
130
|
+
let columns = __columns !== undefined ? __columns : ({
|
|
131
|
+
TAG: "Count",
|
|
132
|
+
_0: 1
|
|
133
|
+
});
|
|
134
|
+
let $$class = __class !== undefined ? __class : Xote.ReactiveProp.$$static("");
|
|
135
|
+
let style = __style !== undefined ? __style : Xote.ReactiveProp.$$static("");
|
|
136
|
+
let className = Xote.Computed.make(() => "basefn-grid " + Xote.ReactiveProp.get($$class), undefined);
|
|
137
|
+
let gridStyle = Xote.Computed.make(() => {
|
|
138
|
+
let styles = [];
|
|
139
|
+
styles.push("grid-template-columns: " + columnsToString(columns));
|
|
140
|
+
if (rows !== undefined) {
|
|
141
|
+
styles.push("grid-template-rows: " + rowsToString(rows));
|
|
142
|
+
}
|
|
143
|
+
if (gap !== undefined) {
|
|
144
|
+
if (rowGap !== undefined || columnGap !== undefined) {
|
|
145
|
+
|
|
146
|
+
} else {
|
|
147
|
+
styles.push("gap: " + gap);
|
|
148
|
+
}
|
|
149
|
+
} else if (rowGap !== undefined) {
|
|
150
|
+
if (columnGap !== undefined) {
|
|
151
|
+
styles.push("row-gap: " + rowGap);
|
|
152
|
+
styles.push("column-gap: " + columnGap);
|
|
153
|
+
} else {
|
|
154
|
+
styles.push("row-gap: " + rowGap);
|
|
155
|
+
}
|
|
156
|
+
} else if (columnGap !== undefined) {
|
|
157
|
+
styles.push("column-gap: " + columnGap);
|
|
158
|
+
}
|
|
159
|
+
if (autoFlow !== undefined) {
|
|
160
|
+
styles.push("grid-auto-flow: " + autoFlowToString(autoFlow));
|
|
161
|
+
}
|
|
162
|
+
if (justifyItems !== undefined) {
|
|
163
|
+
styles.push("justify-items: " + justifyItemsToString(justifyItems));
|
|
164
|
+
}
|
|
165
|
+
if (alignItems !== undefined) {
|
|
166
|
+
styles.push("align-items: " + alignItemsToString(alignItems));
|
|
167
|
+
}
|
|
168
|
+
if (justifyContent !== undefined) {
|
|
169
|
+
styles.push("justify-content: " + justifyContentToString(justifyContent));
|
|
170
|
+
}
|
|
171
|
+
if (alignContent !== undefined) {
|
|
172
|
+
styles.push("align-content: " + alignContentToString(alignContent));
|
|
173
|
+
}
|
|
174
|
+
let customStyle = Xote.ReactiveProp.get(style);
|
|
175
|
+
if (customStyle !== "") {
|
|
176
|
+
styles.push(customStyle);
|
|
177
|
+
}
|
|
178
|
+
return styles.join("; ");
|
|
179
|
+
}, undefined);
|
|
180
|
+
return Xote__JSX.Elements.jsx("div", {
|
|
181
|
+
class: className,
|
|
182
|
+
style: gridStyle,
|
|
183
|
+
children: props.children
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function columnSpanToString(span) {
|
|
188
|
+
if (typeof span !== "object") {
|
|
189
|
+
return "auto";
|
|
190
|
+
} else if (span.TAG === "Span") {
|
|
191
|
+
return "span " + span._0.toString();
|
|
192
|
+
} else {
|
|
193
|
+
return span._0.toString() + " / " + span._1.toString();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function rowSpanToString(span) {
|
|
198
|
+
if (typeof span !== "object") {
|
|
199
|
+
return "auto";
|
|
200
|
+
} else if (span.TAG === "Span") {
|
|
201
|
+
return "span " + span._0.toString();
|
|
202
|
+
} else {
|
|
203
|
+
return span._0.toString() + " / " + span._1.toString();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function Basefn__Grid$Item(props) {
|
|
208
|
+
let __style = props.style;
|
|
209
|
+
let __class = props.class;
|
|
210
|
+
let alignSelf = props.alignSelf;
|
|
211
|
+
let justifySelf = props.justifySelf;
|
|
212
|
+
let row = props.row;
|
|
213
|
+
let column = props.column;
|
|
214
|
+
let $$class = __class !== undefined ? __class : Xote.ReactiveProp.$$static("");
|
|
215
|
+
let style = __style !== undefined ? __style : Xote.ReactiveProp.$$static("");
|
|
216
|
+
let className = Xote.Computed.make(() => "basefn-grid-item " + Xote.ReactiveProp.get($$class), undefined);
|
|
217
|
+
let itemStyle = Xote.Computed.make(() => {
|
|
218
|
+
let styles = [];
|
|
219
|
+
if (column !== undefined) {
|
|
220
|
+
styles.push("grid-column: " + columnSpanToString(column));
|
|
221
|
+
}
|
|
222
|
+
if (row !== undefined) {
|
|
223
|
+
styles.push("grid-row: " + rowSpanToString(row));
|
|
224
|
+
}
|
|
225
|
+
if (justifySelf !== undefined) {
|
|
226
|
+
styles.push("justify-self: " + justifyItemsToString(justifySelf));
|
|
227
|
+
}
|
|
228
|
+
if (alignSelf !== undefined) {
|
|
229
|
+
styles.push("align-self: " + alignItemsToString(alignSelf));
|
|
230
|
+
}
|
|
231
|
+
let customStyle = Xote.ReactiveProp.get(style);
|
|
232
|
+
if (customStyle !== "") {
|
|
233
|
+
styles.push(customStyle);
|
|
234
|
+
}
|
|
235
|
+
return styles.join("; ");
|
|
236
|
+
}, undefined);
|
|
237
|
+
return Xote__JSX.Elements.jsx("div", {
|
|
238
|
+
class: className,
|
|
239
|
+
style: itemStyle,
|
|
240
|
+
children: props.children
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
let Item = {
|
|
245
|
+
columnSpanToString: columnSpanToString,
|
|
246
|
+
rowSpanToString: rowSpanToString,
|
|
247
|
+
make: Basefn__Grid$Item
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
let make = Basefn__Grid;
|
|
251
|
+
|
|
252
|
+
export {
|
|
253
|
+
columnsToString,
|
|
254
|
+
rowsToString,
|
|
255
|
+
autoFlowToString,
|
|
256
|
+
justifyItemsToString,
|
|
257
|
+
alignItemsToString,
|
|
258
|
+
justifyContentToString,
|
|
259
|
+
alignContentToString,
|
|
260
|
+
make,
|
|
261
|
+
Item,
|
|
262
|
+
}
|
|
263
|
+
/* Not a pure module */
|