@rbxts/uiblox 0.2.0-alpha.4 → 0.2.0-alpha.5
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/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
- package/out/ui/packages/chip/components/Chip.d.ts +1 -0
- package/out/ui/packages/chip/components/Chip.luau +37 -2
- package/out/ui/packages/chip/components/Chip.styles.d.ts +1 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +29 -1
- package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
- package/out/ui/packages/formText/components/FormHelperText.luau +44 -0
- package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
- package/out/ui/packages/formText/components/FormLabel.luau +46 -0
- package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
- package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
- package/out/ui/packages/formText/index.d.ts +4 -0
- package/out/ui/packages/formText/init.luau +6 -0
- package/out/ui/packages/index.d.ts +2 -0
- package/out/ui/packages/init.luau +6 -0
- package/out/ui/packages/layout/components/Stack.d.ts +12 -0
- package/out/ui/packages/layout/components/Stack.luau +49 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
- package/out/ui/packages/layout/components/stackAlign.luau +29 -0
- package/out/ui/packages/layout/index.d.ts +3 -0
- package/out/ui/packages/layout/init.luau +1 -0
- package/out/ui/packages/menu/components/Menu.d.ts +3 -0
- package/out/ui/packages/menu/components/Menu.luau +48 -23
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/select/components/Select.d.ts +5 -0
- package/out/ui/packages/select/components/Select.luau +48 -24
- package/out/ui/packages/select/components/Select.styles.luau +1 -1
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +17 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +92 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +2 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +26 -0
- package/out/ui/packages/speedDial/index.d.ts +2 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/stateMatrix.luau +193 -75
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +6 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +32 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
- package/out/ui/packages/virtualList/index.d.ts +2 -0
- package/out/ui/packages/virtualList/init.luau +1 -0
- package/package.json +2 -2
|
@@ -13,6 +13,10 @@ local function Autocomplete(props)
|
|
|
13
13
|
local loading = _binding.loading
|
|
14
14
|
local placeholder = _binding.placeholder
|
|
15
15
|
local searchable = _binding.searchable
|
|
16
|
+
local defaultOpen = _binding.defaultOpen
|
|
17
|
+
local defaultQuery = _binding.defaultQuery
|
|
18
|
+
local emptyText = _binding.emptyText
|
|
19
|
+
local empty = _binding.empty
|
|
16
20
|
local reducedMotion = _binding.reducedMotion
|
|
17
21
|
local size = _binding.size
|
|
18
22
|
local className = _binding.className
|
|
@@ -28,6 +32,10 @@ local function Autocomplete(props)
|
|
|
28
32
|
loading = loading,
|
|
29
33
|
placeholder = placeholder,
|
|
30
34
|
searchable = autocompleteSearchable(searchable),
|
|
35
|
+
defaultOpen = defaultOpen,
|
|
36
|
+
defaultQuery = defaultQuery,
|
|
37
|
+
emptyText = emptyText,
|
|
38
|
+
empty = empty,
|
|
31
39
|
reducedMotion = reducedMotion,
|
|
32
40
|
size = size,
|
|
33
41
|
className = className,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
4
5
|
local useChipStyles = TS.import(script, script.Parent, "Chip.styles").default
|
|
5
6
|
local function Chip(props)
|
|
6
7
|
local _binding = props
|
|
@@ -8,13 +9,16 @@ local function Chip(props)
|
|
|
8
9
|
local selected = _binding.selected
|
|
9
10
|
local disabled = _binding.disabled
|
|
10
11
|
local onActivated = _binding.onActivated
|
|
12
|
+
local onDelete = _binding.onDelete
|
|
11
13
|
local className = _binding.className
|
|
12
14
|
local sx = _binding.sx
|
|
13
15
|
local id = _binding.id
|
|
14
16
|
local ref = _binding.ref
|
|
17
|
+
local deletable = onDelete ~= nil
|
|
15
18
|
local styles = useChipStyles({
|
|
16
19
|
selected = selected,
|
|
17
20
|
disabled = disabled,
|
|
21
|
+
deletable = deletable,
|
|
18
22
|
})
|
|
19
23
|
local _attributes = {}
|
|
20
24
|
local _condition = id
|
|
@@ -36,7 +40,7 @@ local function Chip(props)
|
|
|
36
40
|
_attributes[_k] = _v
|
|
37
41
|
end
|
|
38
42
|
end
|
|
39
|
-
_attributes.Text = label
|
|
43
|
+
_attributes.Text = if deletable then "" else label
|
|
40
44
|
_attributes.Event = {
|
|
41
45
|
Activated = function()
|
|
42
46
|
if disabled ~= true then
|
|
@@ -55,7 +59,38 @@ local function Chip(props)
|
|
|
55
59
|
local _exp_1 = React.createElement("uicorner", _attributes_2)
|
|
56
60
|
local _attributes_3 = table.clone(styles.stroke)
|
|
57
61
|
setmetatable(_attributes_3, nil)
|
|
58
|
-
|
|
62
|
+
local _exp_2 = React.createElement("uistroke", _attributes_3)
|
|
63
|
+
local _condition_1 = deletable
|
|
64
|
+
if _condition_1 then
|
|
65
|
+
local _attributes_4 = table.clone(styles.row)
|
|
66
|
+
setmetatable(_attributes_4, nil)
|
|
67
|
+
local _exp_3 = React.createElement("uilistlayout", _attributes_4)
|
|
68
|
+
local _attributes_5 = {
|
|
69
|
+
key = "Label",
|
|
70
|
+
}
|
|
71
|
+
for _k, _v in styles.label do
|
|
72
|
+
_attributes_5[_k] = _v
|
|
73
|
+
end
|
|
74
|
+
_attributes_5.Text = label
|
|
75
|
+
local _exp_4 = React.createElement("textlabel", _attributes_5)
|
|
76
|
+
local _attributes_6 = {
|
|
77
|
+
key = "Delete",
|
|
78
|
+
}
|
|
79
|
+
for _k, _v in styles.delete do
|
|
80
|
+
_attributes_6[_k] = _v
|
|
81
|
+
end
|
|
82
|
+
_attributes_6.Image = tostring(Icons.Close)
|
|
83
|
+
_attributes_6.Active = disabled ~= true
|
|
84
|
+
_attributes_6.Event = {
|
|
85
|
+
Activated = function()
|
|
86
|
+
if disabled ~= true then
|
|
87
|
+
onDelete()
|
|
88
|
+
end
|
|
89
|
+
end,
|
|
90
|
+
}
|
|
91
|
+
_condition_1 = (React.createElement(React.Fragment, nil, _exp_3, _exp_4, React.createElement("imagebutton", _attributes_6)))
|
|
92
|
+
end
|
|
93
|
+
return React.createElement("textbutton", _attributes, _exp, _exp_1, _exp_2, _condition_1)
|
|
59
94
|
end
|
|
60
95
|
local default = Chip
|
|
61
96
|
return {
|
|
@@ -12,6 +12,10 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
|
|
|
12
12
|
if disabled == nil then
|
|
13
13
|
disabled = false
|
|
14
14
|
end
|
|
15
|
+
local deletable = _param.deletable
|
|
16
|
+
if deletable == nil then
|
|
17
|
+
deletable = false
|
|
18
|
+
end
|
|
15
19
|
return createStyles({
|
|
16
20
|
root = {
|
|
17
21
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -29,7 +33,7 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
|
|
|
29
33
|
PaddingTop = UDim.new(0, theme.padding.calc(0.5)),
|
|
30
34
|
PaddingBottom = UDim.new(0, theme.padding.calc(0.5)),
|
|
31
35
|
PaddingLeft = UDim.new(0, theme.padding.calc(1.5)),
|
|
32
|
-
PaddingRight = UDim.new(0, theme.padding.calc(1.5)),
|
|
36
|
+
PaddingRight = UDim.new(0, theme.padding.calc(if deletable then 0.5 else 1.5)),
|
|
33
37
|
},
|
|
34
38
|
corner = {
|
|
35
39
|
CornerRadius = UDim.new(theme.shape.pillScale, 0),
|
|
@@ -39,6 +43,30 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
|
|
|
39
43
|
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
40
44
|
Transparency = if selected then 1 else 0,
|
|
41
45
|
},
|
|
46
|
+
row = {
|
|
47
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
48
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
49
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
50
|
+
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
51
|
+
},
|
|
52
|
+
label = {
|
|
53
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
54
|
+
Size = UDim2.fromScale(0, 0),
|
|
55
|
+
BackgroundTransparency = 1,
|
|
56
|
+
BorderSizePixel = 0,
|
|
57
|
+
TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
|
|
58
|
+
Font = theme.typography.fontFamilies.default,
|
|
59
|
+
TextSize = theme.typography.fontSizes.body,
|
|
60
|
+
LayoutOrder = 1,
|
|
61
|
+
},
|
|
62
|
+
delete = {
|
|
63
|
+
Size = UDim2.fromOffset(theme.spacing.calc(2), theme.spacing.calc(2)),
|
|
64
|
+
BackgroundTransparency = 1,
|
|
65
|
+
BorderSizePixel = 0,
|
|
66
|
+
AutoButtonColor = false,
|
|
67
|
+
ImageColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.secondary,
|
|
68
|
+
LayoutOrder = 2,
|
|
69
|
+
},
|
|
42
70
|
})
|
|
43
71
|
end)
|
|
44
72
|
local default = useChipStyles
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
export interface FormHelperTextProps {
|
|
3
|
+
text: string;
|
|
4
|
+
hasError?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function FormHelperText(props: CustomizedProps<TextLabel, FormHelperTextProps>): JSX.Element;
|
|
8
|
+
export default FormHelperText;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useFormTextStyles = TS.import(script, script.Parent, "FormText.styles").default
|
|
5
|
+
local function FormHelperText(props)
|
|
6
|
+
local _binding = props
|
|
7
|
+
local text = _binding.text
|
|
8
|
+
local hasError = _binding.hasError
|
|
9
|
+
local disabled = _binding.disabled
|
|
10
|
+
local className = _binding.className
|
|
11
|
+
local sx = _binding.sx
|
|
12
|
+
local id = _binding.id
|
|
13
|
+
local ref = _binding.ref
|
|
14
|
+
local styles = useFormTextStyles({
|
|
15
|
+
hasError = hasError,
|
|
16
|
+
disabled = disabled,
|
|
17
|
+
})
|
|
18
|
+
local _attributes = {}
|
|
19
|
+
local _condition = id
|
|
20
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
21
|
+
_condition = "FormHelperText"
|
|
22
|
+
end
|
|
23
|
+
_attributes.key = _condition
|
|
24
|
+
_attributes.ref = ref
|
|
25
|
+
for _k, _v in styles.root do
|
|
26
|
+
_attributes[_k] = _v
|
|
27
|
+
end
|
|
28
|
+
if className then
|
|
29
|
+
for _k, _v in className do
|
|
30
|
+
_attributes[_k] = _v
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
if sx then
|
|
34
|
+
for _k, _v in sx do
|
|
35
|
+
_attributes[_k] = _v
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
_attributes.Text = text
|
|
39
|
+
return React.createElement("textlabel", _attributes)
|
|
40
|
+
end
|
|
41
|
+
local default = FormHelperText
|
|
42
|
+
return {
|
|
43
|
+
default = default,
|
|
44
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
export interface FormLabelProps {
|
|
3
|
+
text: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
hasError?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function FormLabel(props: CustomizedProps<TextLabel, FormLabelProps>): JSX.Element;
|
|
9
|
+
export default FormLabel;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useFormTextStyles = TS.import(script, script.Parent, "FormText.styles").default
|
|
5
|
+
local function FormLabel(props)
|
|
6
|
+
local _binding = props
|
|
7
|
+
local text = _binding.text
|
|
8
|
+
local required = _binding.required
|
|
9
|
+
local hasError = _binding.hasError
|
|
10
|
+
local disabled = _binding.disabled
|
|
11
|
+
local className = _binding.className
|
|
12
|
+
local sx = _binding.sx
|
|
13
|
+
local id = _binding.id
|
|
14
|
+
local ref = _binding.ref
|
|
15
|
+
local styles = useFormTextStyles({
|
|
16
|
+
hasError = hasError,
|
|
17
|
+
disabled = disabled,
|
|
18
|
+
})
|
|
19
|
+
local caption = if required == true then `{text} *` else text
|
|
20
|
+
local _attributes = {}
|
|
21
|
+
local _condition = id
|
|
22
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
23
|
+
_condition = "FormLabel"
|
|
24
|
+
end
|
|
25
|
+
_attributes.key = _condition
|
|
26
|
+
_attributes.ref = ref
|
|
27
|
+
for _k, _v in styles.root do
|
|
28
|
+
_attributes[_k] = _v
|
|
29
|
+
end
|
|
30
|
+
if className then
|
|
31
|
+
for _k, _v in className do
|
|
32
|
+
_attributes[_k] = _v
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
if sx then
|
|
36
|
+
for _k, _v in sx do
|
|
37
|
+
_attributes[_k] = _v
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
_attributes.Text = caption
|
|
41
|
+
return React.createElement("textlabel", _attributes)
|
|
42
|
+
end
|
|
43
|
+
local default = FormLabel
|
|
44
|
+
return {
|
|
45
|
+
default = default,
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local useFormTextStyles = componentStyles("FormText", function(theme, _param)
|
|
7
|
+
local hasError = _param.hasError
|
|
8
|
+
if hasError == nil then
|
|
9
|
+
hasError = false
|
|
10
|
+
end
|
|
11
|
+
local disabled = _param.disabled
|
|
12
|
+
if disabled == nil then
|
|
13
|
+
disabled = false
|
|
14
|
+
end
|
|
15
|
+
local color = if disabled then theme.palette.text.disabled elseif hasError then theme.palette.status.error.main else theme.palette.text.secondary
|
|
16
|
+
return createStyles({
|
|
17
|
+
root = {
|
|
18
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
19
|
+
Size = UDim2.fromScale(0, 0),
|
|
20
|
+
BackgroundTransparency = 1,
|
|
21
|
+
BorderSizePixel = 0,
|
|
22
|
+
TextColor3 = color,
|
|
23
|
+
Font = theme.typography.fontFamilies.default,
|
|
24
|
+
TextSize = theme.typography.fontSizes.caption,
|
|
25
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
26
|
+
TextWrapped = true,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
end)
|
|
30
|
+
local default = useFormTextStyles
|
|
31
|
+
return {
|
|
32
|
+
default = default,
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.FormLabel = TS.import(script, script, "components", "FormLabel").default
|
|
5
|
+
exports.FormHelperText = TS.import(script, script, "components", "FormHelperText").default
|
|
6
|
+
return exports
|
|
@@ -5,6 +5,7 @@ export * from "./errorBoundary/index";
|
|
|
5
5
|
export * from "./icon/index";
|
|
6
6
|
export * from "./iconButton/index";
|
|
7
7
|
export * from "./input/index";
|
|
8
|
+
export * from "./formText/index";
|
|
8
9
|
export * from "./layout/index";
|
|
9
10
|
export * from "./preloader/index";
|
|
10
11
|
export * from "./progressBar/index";
|
|
@@ -48,6 +49,7 @@ export * from "./snackbar/index";
|
|
|
48
49
|
export * from "./table/index";
|
|
49
50
|
export * from "./autocomplete/index";
|
|
50
51
|
export * from "./fab/index";
|
|
52
|
+
export * from "./speedDial/index";
|
|
51
53
|
export * from "./appBar/index";
|
|
52
54
|
export * from "./bottomNavigation/index";
|
|
53
55
|
export * from "./alert/index";
|
|
@@ -22,6 +22,9 @@ end
|
|
|
22
22
|
for _k, _v in TS.import(script, script, "input") or {} do
|
|
23
23
|
exports[_k] = _v
|
|
24
24
|
end
|
|
25
|
+
for _k, _v in TS.import(script, script, "formText") or {} do
|
|
26
|
+
exports[_k] = _v
|
|
27
|
+
end
|
|
25
28
|
for _k, _v in TS.import(script, script, "layout") or {} do
|
|
26
29
|
exports[_k] = _v
|
|
27
30
|
end
|
|
@@ -151,6 +154,9 @@ end
|
|
|
151
154
|
for _k, _v in TS.import(script, script, "fab") or {} do
|
|
152
155
|
exports[_k] = _v
|
|
153
156
|
end
|
|
157
|
+
for _k, _v in TS.import(script, script, "speedDial") or {} do
|
|
158
|
+
exports[_k] = _v
|
|
159
|
+
end
|
|
154
160
|
for _k, _v in TS.import(script, script, "appBar") or {} do
|
|
155
161
|
exports[_k] = _v
|
|
156
162
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { StackAlign, StackDirection, StackJustify } from "./stackAlign";
|
|
4
|
+
export interface StackProps {
|
|
5
|
+
direction?: StackDirection;
|
|
6
|
+
spacing?: number;
|
|
7
|
+
alignItems?: StackAlign;
|
|
8
|
+
justifyContent?: StackJustify;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function Stack(props: CustomizedProps<Frame, StackProps>): JSX.Element;
|
|
12
|
+
export default Stack;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useStackStyles = TS.import(script, script.Parent, "Stack.styles").default
|
|
5
|
+
local function Stack(props)
|
|
6
|
+
local _binding = props
|
|
7
|
+
local direction = _binding.direction
|
|
8
|
+
local spacing = _binding.spacing
|
|
9
|
+
local alignItems = _binding.alignItems
|
|
10
|
+
local justifyContent = _binding.justifyContent
|
|
11
|
+
local children = _binding.children
|
|
12
|
+
local className = _binding.className
|
|
13
|
+
local sx = _binding.sx
|
|
14
|
+
local id = _binding.id
|
|
15
|
+
local ref = _binding.ref
|
|
16
|
+
local styles = useStackStyles({
|
|
17
|
+
direction = direction,
|
|
18
|
+
spacing = spacing,
|
|
19
|
+
alignItems = alignItems,
|
|
20
|
+
justifyContent = justifyContent,
|
|
21
|
+
})
|
|
22
|
+
local _attributes = {}
|
|
23
|
+
local _condition = id
|
|
24
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
25
|
+
_condition = "Stack"
|
|
26
|
+
end
|
|
27
|
+
_attributes.key = _condition
|
|
28
|
+
_attributes.ref = ref
|
|
29
|
+
for _k, _v in styles.root do
|
|
30
|
+
_attributes[_k] = _v
|
|
31
|
+
end
|
|
32
|
+
if className then
|
|
33
|
+
for _k, _v in className do
|
|
34
|
+
_attributes[_k] = _v
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
if sx then
|
|
38
|
+
for _k, _v in sx do
|
|
39
|
+
_attributes[_k] = _v
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
local _attributes_1 = table.clone(styles.list)
|
|
43
|
+
setmetatable(_attributes_1, nil)
|
|
44
|
+
return React.createElement("frame", _attributes, React.createElement("uilistlayout", _attributes_1), children)
|
|
45
|
+
end
|
|
46
|
+
local default = Stack
|
|
47
|
+
return {
|
|
48
|
+
default = default,
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StackAlign, StackDirection, StackJustify } from "./stackAlign";
|
|
2
|
+
declare const useStackStyles: (props: {
|
|
3
|
+
direction?: StackDirection;
|
|
4
|
+
spacing?: number;
|
|
5
|
+
alignItems?: StackAlign;
|
|
6
|
+
justifyContent?: StackJustify;
|
|
7
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
8
|
+
export default useStackStyles;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local _stackAlign = TS.import(script, script.Parent, "stackAlign")
|
|
7
|
+
local stackAlignKey = _stackAlign.stackAlignKey
|
|
8
|
+
local stackGap = _stackAlign.stackGap
|
|
9
|
+
local stackIsRow = _stackAlign.stackIsRow
|
|
10
|
+
local stackJustifyKey = _stackAlign.stackJustifyKey
|
|
11
|
+
local stackUsesFlex = _stackAlign.stackUsesFlex
|
|
12
|
+
local function horizontalAlign(key)
|
|
13
|
+
if key == "center" then
|
|
14
|
+
return Enum.HorizontalAlignment.Center
|
|
15
|
+
end
|
|
16
|
+
if key == "end" then
|
|
17
|
+
return Enum.HorizontalAlignment.Right
|
|
18
|
+
end
|
|
19
|
+
return Enum.HorizontalAlignment.Left
|
|
20
|
+
end
|
|
21
|
+
local function verticalAlign(key)
|
|
22
|
+
if key == "center" then
|
|
23
|
+
return Enum.VerticalAlignment.Center
|
|
24
|
+
end
|
|
25
|
+
if key == "end" then
|
|
26
|
+
return Enum.VerticalAlignment.Bottom
|
|
27
|
+
end
|
|
28
|
+
return Enum.VerticalAlignment.Top
|
|
29
|
+
end
|
|
30
|
+
local function mainFlex(justify)
|
|
31
|
+
if justify == "space-between" then
|
|
32
|
+
return Enum.UIFlexAlignment.SpaceBetween
|
|
33
|
+
end
|
|
34
|
+
if justify == "space-around" then
|
|
35
|
+
return Enum.UIFlexAlignment.SpaceAround
|
|
36
|
+
end
|
|
37
|
+
if justify == "space-evenly" then
|
|
38
|
+
return Enum.UIFlexAlignment.SpaceEvenly
|
|
39
|
+
end
|
|
40
|
+
return Enum.UIFlexAlignment.None
|
|
41
|
+
end
|
|
42
|
+
local useStackStyles = componentStyles("Stack", function(theme, _param)
|
|
43
|
+
local direction = _param.direction
|
|
44
|
+
local spacing = _param.spacing
|
|
45
|
+
local alignItems = _param.alignItems
|
|
46
|
+
local justifyContent = _param.justifyContent
|
|
47
|
+
local row = stackIsRow(direction)
|
|
48
|
+
local cross = stackAlignKey(alignItems)
|
|
49
|
+
local main = stackJustifyKey(justifyContent)
|
|
50
|
+
local flex = if stackUsesFlex(main) then mainFlex(main) else Enum.UIFlexAlignment.None
|
|
51
|
+
return createStyles({
|
|
52
|
+
root = {
|
|
53
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
54
|
+
Size = UDim2.fromScale(0, 0),
|
|
55
|
+
BackgroundTransparency = 1,
|
|
56
|
+
BorderSizePixel = 0,
|
|
57
|
+
},
|
|
58
|
+
list = {
|
|
59
|
+
FillDirection = if row then Enum.FillDirection.Horizontal else Enum.FillDirection.Vertical,
|
|
60
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
61
|
+
Padding = UDim.new(0, theme.spacing.calc(stackGap(spacing))),
|
|
62
|
+
HorizontalAlignment = if row then horizontalAlign(main) else horizontalAlign(cross),
|
|
63
|
+
VerticalAlignment = if row then verticalAlign(cross) else verticalAlign(main),
|
|
64
|
+
HorizontalFlex = if row then flex else Enum.UIFlexAlignment.None,
|
|
65
|
+
VerticalFlex = if row then Enum.UIFlexAlignment.None else flex,
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
end)
|
|
69
|
+
local default = useStackStyles
|
|
70
|
+
return {
|
|
71
|
+
default = default,
|
|
72
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type StackDirection = "row" | "column";
|
|
2
|
+
export type StackAlign = "start" | "center" | "end";
|
|
3
|
+
export type StackJustify = "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
4
|
+
export declare function stackIsRow(direction?: StackDirection): direction is "row";
|
|
5
|
+
export declare function stackGap(spacing?: number): number;
|
|
6
|
+
export declare function stackUsesFlex(justify?: StackJustify): justify is "space-between" | "space-around" | "space-evenly";
|
|
7
|
+
export declare function stackAlignKey(align?: StackAlign): StackAlign;
|
|
8
|
+
export declare function stackJustifyKey(justify?: StackJustify): StackJustify;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function stackIsRow(direction)
|
|
3
|
+
return direction == "row"
|
|
4
|
+
end
|
|
5
|
+
local function stackGap(spacing)
|
|
6
|
+
return if spacing == nil then 1 else spacing
|
|
7
|
+
end
|
|
8
|
+
local function stackUsesFlex(justify)
|
|
9
|
+
return justify == "space-between" or justify == "space-around" or justify == "space-evenly"
|
|
10
|
+
end
|
|
11
|
+
local function stackAlignKey(align)
|
|
12
|
+
if align == "center" or align == "end" then
|
|
13
|
+
return align
|
|
14
|
+
end
|
|
15
|
+
return "start"
|
|
16
|
+
end
|
|
17
|
+
local function stackJustifyKey(justify)
|
|
18
|
+
if justify == "center" or justify == "end" or justify == "space-between" or justify == "space-around" or justify == "space-evenly" then
|
|
19
|
+
return justify
|
|
20
|
+
end
|
|
21
|
+
return "start"
|
|
22
|
+
end
|
|
23
|
+
return {
|
|
24
|
+
stackIsRow = stackIsRow,
|
|
25
|
+
stackGap = stackGap,
|
|
26
|
+
stackUsesFlex = stackUsesFlex,
|
|
27
|
+
stackAlignKey = stackAlignKey,
|
|
28
|
+
stackJustifyKey = stackJustifyKey,
|
|
29
|
+
}
|
|
@@ -4,3 +4,6 @@ export * from "./components/Grid";
|
|
|
4
4
|
export { default as List } from "./components/List";
|
|
5
5
|
export { ListProps } from "./components/List";
|
|
6
6
|
export * from "./components/List";
|
|
7
|
+
export { default as Stack } from "./components/Stack";
|
|
8
|
+
export { StackProps } from "./components/Stack";
|
|
9
|
+
export { StackAlign, StackDirection, StackJustify } from "./components/stackAlign";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
1
2
|
export interface MenuItem {
|
|
2
3
|
id: string;
|
|
3
4
|
text: string;
|
|
@@ -9,6 +10,8 @@ export interface MenuProps {
|
|
|
9
10
|
items: MenuItem[];
|
|
10
11
|
onSelect: (id: string) => void;
|
|
11
12
|
onClose: () => void;
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
empty?: React.Element;
|
|
12
15
|
}
|
|
13
16
|
declare function Menu(props: MenuProps): JSX.Element | undefined;
|
|
14
17
|
export default Menu;
|