@rbxts/uiblox 0.1.9 → 0.1.11
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 +33 -37
- package/out/theme/components/ThemeWrapper.luau +0 -1
- package/out/ui/packages/button/components/Button.luau +2 -6
- package/out/ui/packages/divider/components/Divider.luau +2 -6
- package/out/ui/packages/icon/components/Icon.luau +2 -6
- package/out/ui/packages/iconButton/components/IconButton.luau +2 -6
- package/out/ui/packages/input/components/Input.luau +8 -24
- package/out/ui/packages/progressBar/components/ProgressBar.luau +10 -30
- package/out/ui/packages/shadow/components/Shadow.luau +2 -7
- package/out/ui/packages/sidebar/components/Sidebar.luau +4 -12
- package/out/ui/packages/toast/components/Toast.luau +4 -14
- package/out/ui/packages/treeView/components/TreeView.luau +8 -24
- package/out/ui/packages/typography/components/Typography.luau +2 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,16 +32,16 @@ that aids UI/UX consistentency.
|
|
|
32
32
|
|
|
33
33
|
How does it do this? Well, there are two main exports from this package:
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
35
|
+
- @rbxts/uiblox -> theme
|
|
36
|
+
- An extensible Theme type + default Dark (default) and Light themes
|
|
37
|
+
- ... Light theme palette is a WIP
|
|
38
|
+
- makeStyles/createStyles utilities to serve up Instance-extended property
|
|
39
|
+
tables that can be applied to your Roact Components
|
|
40
|
+
- ThemeProvider which can wrap your application and uses Rodux to tell
|
|
41
|
+
sub-components which theme to style off of (via makeStyles)
|
|
42
|
+
- Uses Rodux
|
|
43
|
+
- @rbxts/uiblox -> ui
|
|
44
|
+
- Packaged and reusable typed Roact components
|
|
45
45
|
|
|
46
46
|
# How to use
|
|
47
47
|
|
|
@@ -71,13 +71,13 @@ is what we later pass to `Roact.mount()`.
|
|
|
71
71
|
import Roact, { Component } from "@rbxts/roact";
|
|
72
72
|
|
|
73
73
|
class App extends Component {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
render() {
|
|
75
|
+
return (
|
|
76
|
+
<screengui IgnoreGuiInset ZIndexBehavior={Enum.ZIndexBehavior.Global}>
|
|
77
|
+
<AppLayout />
|
|
78
|
+
</screengui>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export default App;
|
|
@@ -100,19 +100,15 @@ import { DarkTheme, ThemeProvider } from "@rbxts/uiblox";
|
|
|
100
100
|
import usePageLayoutStyles from "./PageLayout.styles";
|
|
101
101
|
|
|
102
102
|
class AppLayout extends Component {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</frame>
|
|
113
|
-
</ThemeProvider>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
103
|
+
render() {
|
|
104
|
+
return (
|
|
105
|
+
<ThemeProvider theme={DarkTheme}>
|
|
106
|
+
<frame Size={new UDim2(1, 0, 1, 0)} BackgroundTransparency={1}>
|
|
107
|
+
<MyComponent />
|
|
108
|
+
</frame>
|
|
109
|
+
</ThemeProvider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
export default AppLayout;
|
|
@@ -145,7 +141,7 @@ function MyComponent(props: MyComponentProps) {
|
|
|
145
141
|
const { root, button } = useMyComponentStyles(props);
|
|
146
142
|
|
|
147
143
|
return (
|
|
148
|
-
<frame
|
|
144
|
+
<frame {...root}>
|
|
149
145
|
<Button
|
|
150
146
|
variant="outlined"
|
|
151
147
|
text={title}
|
|
@@ -249,12 +245,12 @@ new AppLoader().Mount();
|
|
|
249
245
|
|
|
250
246
|
# Future work
|
|
251
247
|
|
|
252
|
-
-
|
|
253
|
-
-
|
|
248
|
+
- More UI packages
|
|
249
|
+
- Finish palette for LightTheme
|
|
254
250
|
|
|
255
251
|
# See Also
|
|
256
252
|
|
|
257
|
-
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
253
|
+
- [Storyblox](https://github.com/bjlarouche/storyblox) a UI component explorer for roblox-ts developers
|
|
254
|
+
- <img src=docs/storyblox-preview.png width=40%>
|
|
255
|
+
- Test it out here [Storyblox Pre-Release Experience](https://www.roblox.com/games/9159382473)
|
|
256
|
+
- Similar to [hoarcekat](https://github.com/Kampfkarren/hoarcekat) by Kampfkarren
|
|
@@ -47,12 +47,8 @@ local function Button(props)
|
|
|
47
47
|
local corner = _binding_1.corner
|
|
48
48
|
local stroke = _binding_1.stroke
|
|
49
49
|
local hovering, setHovering = useState(false)
|
|
50
|
-
local _attributes =
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
for _k, _v in root do
|
|
54
|
-
_attributes[_k] = _v
|
|
55
|
-
end
|
|
50
|
+
local _attributes = table.clone(root)
|
|
51
|
+
setmetatable(_attributes, nil)
|
|
56
52
|
for _k, _v in font do
|
|
57
53
|
_attributes[_k] = _v
|
|
58
54
|
end
|
|
@@ -7,12 +7,8 @@ local function Divider(props)
|
|
|
7
7
|
local className = _binding.className
|
|
8
8
|
local _binding_1 = useDividerStyles(props)
|
|
9
9
|
local root = _binding_1.root
|
|
10
|
-
local _attributes =
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
for _k, _v in root do
|
|
14
|
-
_attributes[_k] = _v
|
|
15
|
-
end
|
|
10
|
+
local _attributes = table.clone(root)
|
|
11
|
+
setmetatable(_attributes, nil)
|
|
16
12
|
_attributes.BorderSizePixel = 0
|
|
17
13
|
if className ~= 0 and className == className and className ~= "" and className then
|
|
18
14
|
for _k, _v in className do
|
|
@@ -10,12 +10,8 @@ local function Icon(props)
|
|
|
10
10
|
local className = _binding.className
|
|
11
11
|
local _binding_1 = useIconStyles(props)
|
|
12
12
|
local container = _binding_1.container
|
|
13
|
-
local _attributes =
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
for _k, _v in container do
|
|
17
|
-
_attributes[_k] = _v
|
|
18
|
-
end
|
|
13
|
+
local _attributes = table.clone(container)
|
|
14
|
+
setmetatable(_attributes, nil)
|
|
19
15
|
if className then
|
|
20
16
|
for _k, _v in className do
|
|
21
17
|
_attributes[_k] = _v
|
|
@@ -15,12 +15,8 @@ local function IconButton(props)
|
|
|
15
15
|
local _binding_1 = useIconButtonStyles(props)
|
|
16
16
|
local container = _binding_1.container
|
|
17
17
|
local hovering, setHovering = useState(false)
|
|
18
|
-
local _attributes =
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
for _k, _v in container do
|
|
22
|
-
_attributes[_k] = _v
|
|
23
|
-
end
|
|
18
|
+
local _attributes = table.clone(container)
|
|
19
|
+
setmetatable(_attributes, nil)
|
|
24
20
|
if className then
|
|
25
21
|
for _k, _v in className do
|
|
26
22
|
_attributes[_k] = _v
|
|
@@ -50,29 +50,17 @@ local function Input(props)
|
|
|
50
50
|
_condition = ""
|
|
51
51
|
end
|
|
52
52
|
local input, setInput = useState(_condition)
|
|
53
|
-
local _attributes =
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
for _k, _v in root do
|
|
57
|
-
_attributes[_k] = _v
|
|
58
|
-
end
|
|
53
|
+
local _attributes = table.clone(root)
|
|
54
|
+
setmetatable(_attributes, nil)
|
|
59
55
|
if className then
|
|
60
56
|
for _k, _v in className do
|
|
61
57
|
_attributes[_k] = _v
|
|
62
58
|
end
|
|
63
59
|
end
|
|
64
|
-
local _attributes_1 =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_attributes_1[_k] = _v
|
|
69
|
-
end
|
|
70
|
-
local _attributes_2 = {
|
|
71
|
-
Key = "Field",
|
|
72
|
-
}
|
|
73
|
-
for _k, _v in font do
|
|
74
|
-
_attributes_2[_k] = _v
|
|
75
|
-
end
|
|
60
|
+
local _attributes_1 = table.clone(margin)
|
|
61
|
+
setmetatable(_attributes_1, nil)
|
|
62
|
+
local _attributes_2 = table.clone(font)
|
|
63
|
+
setmetatable(_attributes_2, nil)
|
|
76
64
|
for _k, _v in box do
|
|
77
65
|
_attributes_2[_k] = _v
|
|
78
66
|
end
|
|
@@ -125,12 +113,8 @@ local function Input(props)
|
|
|
125
113
|
})
|
|
126
114
|
local _condition_3 = helperText ~= nil
|
|
127
115
|
if _condition_3 then
|
|
128
|
-
local _attributes_3 =
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
for _k, _v in font do
|
|
132
|
-
_attributes_3[_k] = _v
|
|
133
|
-
end
|
|
116
|
+
local _attributes_3 = table.clone(font)
|
|
117
|
+
setmetatable(_attributes_3, nil)
|
|
134
118
|
for _k, _v in helper do
|
|
135
119
|
_attributes_3[_k] = _v
|
|
136
120
|
end
|
|
@@ -13,51 +13,31 @@ local function ProgressBar(_param)
|
|
|
13
13
|
local inner = _binding.inner
|
|
14
14
|
local fill = _binding.fill
|
|
15
15
|
local corner = _binding.corner
|
|
16
|
-
local _attributes =
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
for _k, _v in container do
|
|
20
|
-
_attributes[_k] = _v
|
|
21
|
-
end
|
|
16
|
+
local _attributes = table.clone(container)
|
|
17
|
+
setmetatable(_attributes, nil)
|
|
22
18
|
if className then
|
|
23
19
|
for _k, _v in className do
|
|
24
20
|
_attributes[_k] = _v
|
|
25
21
|
end
|
|
26
22
|
end
|
|
27
|
-
local _attributes_1 =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_attributes_1[_k] = _v
|
|
32
|
-
end
|
|
33
|
-
local _attributes_2 = {
|
|
34
|
-
Key = "Corner",
|
|
35
|
-
}
|
|
36
|
-
for _k, _v in corner do
|
|
37
|
-
_attributes_2[_k] = _v
|
|
38
|
-
end
|
|
23
|
+
local _attributes_1 = table.clone(outer)
|
|
24
|
+
setmetatable(_attributes_1, nil)
|
|
25
|
+
local _attributes_2 = table.clone(corner)
|
|
26
|
+
setmetatable(_attributes_2, nil)
|
|
39
27
|
local _exp = Roact.jsx("uicorner", _attributes_2)
|
|
40
28
|
local _attributes_3 = table.clone(stroke)
|
|
41
29
|
setmetatable(_attributes_3, nil)
|
|
42
30
|
local _exp_1 = Roact.jsx("uistroke", _attributes_3)
|
|
43
31
|
local _attributes_4 = table.clone(inner)
|
|
44
32
|
setmetatable(_attributes_4, nil)
|
|
45
|
-
local _attributes_5 =
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
for _k, _v in corner do
|
|
49
|
-
_attributes_5[_k] = _v
|
|
50
|
-
end
|
|
33
|
+
local _attributes_5 = table.clone(corner)
|
|
34
|
+
setmetatable(_attributes_5, nil)
|
|
51
35
|
local _exp_2 = Roact.jsx("uicorner", _attributes_5)
|
|
52
36
|
local _attributes_6 = table.clone(fill)
|
|
53
37
|
setmetatable(_attributes_6, nil)
|
|
54
38
|
_attributes_6.Size = UDim2.new(progress / 100, 0, 1, 0)
|
|
55
|
-
local _attributes_7 =
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
for _k, _v in corner do
|
|
59
|
-
_attributes_7[_k] = _v
|
|
60
|
-
end
|
|
39
|
+
local _attributes_7 = table.clone(corner)
|
|
40
|
+
setmetatable(_attributes_7, nil)
|
|
61
41
|
return Roact.jsx("frame", _attributes, Roact.jsx("frame", _attributes_1, _exp, _exp_1, Roact.jsx("frame", _attributes_4, _exp_2, Roact.jsx("frame", _attributes_6, Roact.jsx("uicorner", _attributes_7)))))
|
|
62
42
|
end
|
|
63
43
|
local default = markPureComponent(ProgressBar)
|
|
@@ -42,12 +42,8 @@ local function Shadow()
|
|
|
42
42
|
setZIndex(_condition_1 - 1)
|
|
43
43
|
parent.ClipsDescendants = false
|
|
44
44
|
end, { parent })
|
|
45
|
-
local _attributes =
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
for _k, _v in container do
|
|
49
|
-
_attributes[_k] = _v
|
|
50
|
-
end
|
|
45
|
+
local _attributes = table.clone(container)
|
|
46
|
+
setmetatable(_attributes, nil)
|
|
51
47
|
_attributes.ZIndex = zIndex
|
|
52
48
|
_attributes.Event = {
|
|
53
49
|
AncestryChanged = function(rbx, parent)
|
|
@@ -57,7 +53,6 @@ local function Shadow()
|
|
|
57
53
|
end,
|
|
58
54
|
}
|
|
59
55
|
return Roact.jsx("frame", _attributes, cornerRadius ~= nil and Roact.jsx("uicorner", {
|
|
60
|
-
Key = "Corner",
|
|
61
56
|
CornerRadius = cornerRadius,
|
|
62
57
|
}))
|
|
63
58
|
end
|
|
@@ -9,23 +9,15 @@ local function Sidebar(props)
|
|
|
9
9
|
local _binding_1 = useSidebarStyles(props)
|
|
10
10
|
local root = _binding_1.root
|
|
11
11
|
local container = _binding_1.container
|
|
12
|
-
local _attributes =
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
for _k, _v in root do
|
|
16
|
-
_attributes[_k] = _v
|
|
17
|
-
end
|
|
12
|
+
local _attributes = table.clone(root)
|
|
13
|
+
setmetatable(_attributes, nil)
|
|
18
14
|
if className ~= 0 and className == className and className ~= "" and className then
|
|
19
15
|
for _k, _v in className do
|
|
20
16
|
_attributes[_k] = _v
|
|
21
17
|
end
|
|
22
18
|
end
|
|
23
|
-
local _attributes_1 =
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
for _k, _v in container do
|
|
27
|
-
_attributes_1[_k] = _v
|
|
28
|
-
end
|
|
19
|
+
local _attributes_1 = table.clone(container)
|
|
20
|
+
setmetatable(_attributes_1, nil)
|
|
29
21
|
return Roact.jsx("frame", _attributes, Roact.jsx("frame", _attributes_1, children))
|
|
30
22
|
end
|
|
31
23
|
local default = Sidebar
|
|
@@ -55,31 +55,21 @@ local function Toast(props)
|
|
|
55
55
|
end
|
|
56
56
|
end, {})
|
|
57
57
|
local _attributes = {
|
|
58
|
-
Key = "Toast",
|
|
59
58
|
Ref = frameRef,
|
|
60
59
|
}
|
|
61
60
|
for _k, _v in container do
|
|
62
61
|
_attributes[_k] = _v
|
|
63
62
|
end
|
|
64
63
|
local _exp = Roact.jsx("uicorner", {
|
|
65
|
-
Key = "Corner",
|
|
66
64
|
CornerRadius = UDim.new(0, DefaultTheme.shape.borderRadius),
|
|
67
65
|
})
|
|
68
66
|
local _exp_1 = Roact.jsx(Shadow)
|
|
69
|
-
local _attributes_1 =
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
for _k, _v in label do
|
|
73
|
-
_attributes_1[_k] = _v
|
|
74
|
-
end
|
|
67
|
+
local _attributes_1 = table.clone(label)
|
|
68
|
+
setmetatable(_attributes_1, nil)
|
|
75
69
|
_attributes_1.Text = text
|
|
76
70
|
local _exp_2 = Roact.jsx("textlabel", _attributes_1)
|
|
77
|
-
local _attributes_2 =
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
for _k, _v in close do
|
|
81
|
-
_attributes_2[_k] = _v
|
|
82
|
-
end
|
|
71
|
+
local _attributes_2 = table.clone(close)
|
|
72
|
+
setmetatable(_attributes_2, nil)
|
|
83
73
|
_attributes_2.Event = {
|
|
84
74
|
MouseButton1Click = function()
|
|
85
75
|
tween(Directions.Out)
|
|
@@ -134,12 +134,8 @@ local function TreeView(props)
|
|
|
134
134
|
-- Set expanded to new array
|
|
135
135
|
setExpanded(newExpanded)
|
|
136
136
|
end, { tree, filter })
|
|
137
|
-
local _attributes =
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
for _k, _v in root do
|
|
141
|
-
_attributes[_k] = _v
|
|
142
|
-
end
|
|
137
|
+
local _attributes = table.clone(root)
|
|
138
|
+
setmetatable(_attributes, nil)
|
|
143
139
|
if className then
|
|
144
140
|
for _k, _v in className do
|
|
145
141
|
_attributes[_k] = _v
|
|
@@ -157,12 +153,8 @@ local function TreeView(props)
|
|
|
157
153
|
_attributes_1.variant = "body"
|
|
158
154
|
_attributes_1.family = "bold"
|
|
159
155
|
local _exp = Roact.jsx(Typography, _attributes_1)
|
|
160
|
-
local _attributes_2 =
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
for _k, _v in list do
|
|
164
|
-
_attributes_2[_k] = _v
|
|
165
|
-
end
|
|
156
|
+
local _attributes_2 = table.clone(list)
|
|
157
|
+
setmetatable(_attributes_2, nil)
|
|
166
158
|
_attributes_2.CanvasSize = canvasSize
|
|
167
159
|
_attributes_2.Event = {
|
|
168
160
|
AncestryChanged = resizeScrollingFrame,
|
|
@@ -187,12 +179,8 @@ local function TreeView(props)
|
|
|
187
179
|
end
|
|
188
180
|
end
|
|
189
181
|
if matchesBranchFilter or hasMatchingLeaf then
|
|
190
|
-
local _attributes_4 =
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
for _k, _v in row do
|
|
194
|
-
_attributes_4[_k] = _v
|
|
195
|
-
end
|
|
182
|
+
local _attributes_4 = table.clone(row)
|
|
183
|
+
setmetatable(_attributes_4, nil)
|
|
196
184
|
_attributes_4.Event = {
|
|
197
185
|
MouseButton1Click = function()
|
|
198
186
|
if branch.onClick then
|
|
@@ -264,12 +252,8 @@ local function TreeView(props)
|
|
|
264
252
|
local _callback_1 = function(leaf, leafIndex)
|
|
265
253
|
local matchesLeafFilter = matchesFilter(leaf.title)
|
|
266
254
|
if matchesBranchFilter or matchesLeafFilter then
|
|
267
|
-
local _attributes_6 =
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
for _k, _v in row do
|
|
271
|
-
_attributes_6[_k] = _v
|
|
272
|
-
end
|
|
255
|
+
local _attributes_6 = table.clone(row)
|
|
256
|
+
setmetatable(_attributes_6, nil)
|
|
273
257
|
_attributes_6.Event = {
|
|
274
258
|
MouseButton1Click = function()
|
|
275
259
|
setSelectedLeaf(leaf)
|
|
@@ -13,12 +13,8 @@ local function Typography(props)
|
|
|
13
13
|
local _binding_1 = useTypographyStyles(props)
|
|
14
14
|
local root = _binding_1.root
|
|
15
15
|
local variantToken = _binding_1.variantToken
|
|
16
|
-
local _attributes =
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
for _k, _v in root do
|
|
20
|
-
_attributes[_k] = _v
|
|
21
|
-
end
|
|
16
|
+
local _attributes = table.clone(root)
|
|
17
|
+
setmetatable(_attributes, nil)
|
|
22
18
|
_attributes.Text = text
|
|
23
19
|
if className ~= 0 and className == className and className ~= "" and className then
|
|
24
20
|
for _k, _v in className do
|