@rbxts/react-clean-ui 1.0.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/README.md +3 -0
- package/out/Components/Decorator/BoxShadow.d.ts +10 -0
- package/out/Components/Decorator/BoxShadow.luau +41 -0
- package/out/Components/Decorator/Corners.d.ts +7 -0
- package/out/Components/Decorator/Corners.luau +15 -0
- package/out/Components/Decorator/Padding.d.ts +3 -0
- package/out/Components/Decorator/Padding.luau +18 -0
- package/out/Components/Decorator/index.d.ts +3 -0
- package/out/Components/Decorator/init.luau +13 -0
- package/out/Components/Input/Button.d.ts +24 -0
- package/out/Components/Input/Button.luau +159 -0
- package/out/Components/Input/Checkbox.d.ts +12 -0
- package/out/Components/Input/Checkbox.luau +79 -0
- package/out/Components/Input/HoverButton.d.ts +16 -0
- package/out/Components/Input/HoverButton.luau +127 -0
- package/out/Components/Input/Input.d.ts +12 -0
- package/out/Components/Input/Input.luau +92 -0
- package/out/Components/Input/Select.d.ts +30 -0
- package/out/Components/Input/Select.luau +288 -0
- package/out/Components/Input/Slider.d.ts +51 -0
- package/out/Components/Input/Slider.luau +415 -0
- package/out/Components/Input/index.d.ts +6 -0
- package/out/Components/Input/init.luau +22 -0
- package/out/Components/Layout/Column.d.ts +13 -0
- package/out/Components/Layout/Column.luau +60 -0
- package/out/Components/Layout/Container.d.ts +6 -0
- package/out/Components/Layout/Container.luau +73 -0
- package/out/Components/Layout/Draggable.d.ts +46 -0
- package/out/Components/Layout/Draggable.luau +315 -0
- package/out/Components/Layout/Droppable.d.ts +10 -0
- package/out/Components/Layout/Droppable.luau +34 -0
- package/out/Components/Layout/Fieldset.d.ts +34 -0
- package/out/Components/Layout/Fieldset.luau +130 -0
- package/out/Components/Layout/FlexItem.d.ts +11 -0
- package/out/Components/Layout/FlexItem.luau +20 -0
- package/out/Components/Layout/Group.d.ts +34 -0
- package/out/Components/Layout/Group.luau +168 -0
- package/out/Components/Layout/HStack.d.ts +12 -0
- package/out/Components/Layout/HStack.luau +21 -0
- package/out/Components/Layout/Row.d.ts +15 -0
- package/out/Components/Layout/Row.luau +87 -0
- package/out/Components/Layout/Scroller.d.ts +7 -0
- package/out/Components/Layout/Scroller.luau +54 -0
- package/out/Components/Layout/Tabs.d.ts +31 -0
- package/out/Components/Layout/Tabs.luau +189 -0
- package/out/Components/Layout/VStack.d.ts +11 -0
- package/out/Components/Layout/VStack.luau +21 -0
- package/out/Components/Layout/index.d.ts +12 -0
- package/out/Components/Layout/init.luau +40 -0
- package/out/Components/Navigation/Menu.d.ts +19 -0
- package/out/Components/Navigation/Menu.luau +91 -0
- package/out/Components/Navigation/index.d.ts +1 -0
- package/out/Components/Navigation/init.luau +7 -0
- package/out/Components/Surface/Box.d.ts +7 -0
- package/out/Components/Surface/Box.luau +50 -0
- package/out/Components/Surface/Card.d.ts +25 -0
- package/out/Components/Surface/Card.luau +138 -0
- package/out/Components/Surface/Icon.d.ts +10 -0
- package/out/Components/Surface/Icon.luau +64 -0
- package/out/Components/Surface/Panel.d.ts +4 -0
- package/out/Components/Surface/Panel.luau +33 -0
- package/out/Components/Surface/index.d.ts +4 -0
- package/out/Components/Surface/init.luau +16 -0
- package/out/Components/Typography/Text.d.ts +18 -0
- package/out/Components/Typography/Text.luau +48 -0
- package/out/Components/Typography/index.d.ts +1 -0
- package/out/Components/Typography/init.luau +7 -0
- package/out/Components/index.d.ts +8 -0
- package/out/Components/init.luau +28 -0
- package/out/Contexts/draggable.context.d.ts +8 -0
- package/out/Contexts/draggable.context.luau +7 -0
- package/out/Contexts/droppable.context.d.ts +6 -0
- package/out/Contexts/droppable.context.luau +7 -0
- package/out/Contexts/index.d.ts +6 -0
- package/out/Contexts/init.luau +22 -0
- package/out/Contexts/navigation.context.d.ts +5 -0
- package/out/Contexts/navigation.context.luau +9 -0
- package/out/Contexts/overlay.context.d.ts +13 -0
- package/out/Contexts/overlay.context.luau +17 -0
- package/out/Contexts/row.context.d.ts +9 -0
- package/out/Contexts/row.context.luau +12 -0
- package/out/Contexts/theme.context.d.ts +3 -0
- package/out/Contexts/theme.context.luau +8 -0
- package/out/Helpers/breakpoint.helper.d.ts +7 -0
- package/out/Helpers/breakpoint.helper.luau +124 -0
- package/out/Helpers/color.helper.d.ts +5 -0
- package/out/Helpers/color.helper.luau +101 -0
- package/out/Helpers/create-ui-story.d.ts +16 -0
- package/out/Helpers/create-ui-story.luau +38 -0
- package/out/Helpers/css.helper.d.ts +12 -0
- package/out/Helpers/css.helper.luau +114 -0
- package/out/Helpers/gui.helper.d.ts +10 -0
- package/out/Helpers/gui.helper.luau +134 -0
- package/out/Helpers/index.d.ts +8 -0
- package/out/Helpers/init.luau +28 -0
- package/out/Helpers/size.helper.d.ts +14 -0
- package/out/Helpers/size.helper.luau +162 -0
- package/out/Helpers/spacing.helper.d.ts +7 -0
- package/out/Helpers/spacing.helper.luau +57 -0
- package/out/Helpers/typography.helper.d.ts +7 -0
- package/out/Helpers/typography.helper.luau +91 -0
- package/out/Interfaces/clean.element.props.d.ts +109 -0
- package/out/Interfaces/clean.element.props.luau +5 -0
- package/out/Interfaces/icon.d.ts +2 -0
- package/out/Interfaces/icon.luau +2 -0
- package/out/Interfaces/index.d.ts +3 -0
- package/out/Interfaces/init.luau +13 -0
- package/out/Interfaces/userinput.d.ts +22 -0
- package/out/Interfaces/userinput.luau +8 -0
- package/out/Providers/index.d.ts +3 -0
- package/out/Providers/init.luau +13 -0
- package/out/Providers/overlay.provider.d.ts +3 -0
- package/out/Providers/overlay.provider.luau +25 -0
- package/out/Providers/registry.provider.d.ts +33 -0
- package/out/Providers/registry.provider.luau +119 -0
- package/out/Providers/theme.provider.d.ts +8 -0
- package/out/Providers/theme.provider.luau +12 -0
- package/out/Theme/CleanTheme.d.ts +169 -0
- package/out/Theme/CleanTheme.luau +2 -0
- package/out/Theme/DefaultIcons.d.ts +2 -0
- package/out/Theme/DefaultIcons.luau +791 -0
- package/out/Theme/index.d.ts +3 -0
- package/out/Theme/init.luau +13 -0
- package/out/Theme/themes/dark.theme.d.ts +2 -0
- package/out/Theme/themes/dark.theme.luau +345 -0
- package/out/Theme/themes/default.theme.d.ts +2 -0
- package/out/Theme/themes/default.theme.luau +403 -0
- package/out/Theme/themes/index.d.ts +3 -0
- package/out/Theme/themes/init.luau +13 -0
- package/out/Theme/themes/sandstone.theme.d.ts +2 -0
- package/out/Theme/themes/sandstone.theme.luau +345 -0
- package/out/index.d.ts +6 -0
- package/out/init.luau +22 -0
- package/package.json +43 -0
|
@@ -0,0 +1,168 @@
|
|
|
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 React = _react
|
|
5
|
+
local Component = _react.Component
|
|
6
|
+
local ReactComponent = _react.ReactComponent
|
|
7
|
+
local HttpService = TS.import(script, TS.getModule(script, "@rbxts", "services")).HttpService
|
|
8
|
+
local GroupContext = React.createContext(nil)
|
|
9
|
+
local function GroupElement(props)
|
|
10
|
+
local context = React.useContext(GroupContext)
|
|
11
|
+
local id = React.useRef(HttpService:GenerateGUID(false)).current
|
|
12
|
+
local _result = context
|
|
13
|
+
if _result ~= nil then
|
|
14
|
+
_result = _result.removeElement
|
|
15
|
+
end
|
|
16
|
+
local removeElementRef = React.useRef(_result)
|
|
17
|
+
local _result_1 = context
|
|
18
|
+
if _result_1 ~= nil then
|
|
19
|
+
_result_1 = _result_1.removeElement
|
|
20
|
+
end
|
|
21
|
+
removeElementRef.current = _result_1
|
|
22
|
+
React.useEffect(function()
|
|
23
|
+
return function()
|
|
24
|
+
local _result_2 = removeElementRef.current
|
|
25
|
+
if _result_2 ~= nil then
|
|
26
|
+
_result_2(id)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end, {})
|
|
30
|
+
if not props.enabled or context == nil then
|
|
31
|
+
return props.children
|
|
32
|
+
end
|
|
33
|
+
return React.createElement("frame", {
|
|
34
|
+
BackgroundTransparency = 1,
|
|
35
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
36
|
+
Change = {
|
|
37
|
+
AbsoluteSize = function(instance)
|
|
38
|
+
local _exp = instance.AbsoluteSize.X
|
|
39
|
+
local _result_2 = props.padding
|
|
40
|
+
if _result_2 ~= nil then
|
|
41
|
+
_result_2 = _result_2.left
|
|
42
|
+
end
|
|
43
|
+
local _condition = _result_2
|
|
44
|
+
if _condition == nil then
|
|
45
|
+
_condition = 0
|
|
46
|
+
end
|
|
47
|
+
local _exp_1 = _exp + _condition
|
|
48
|
+
local _result_3 = props.padding
|
|
49
|
+
if _result_3 ~= nil then
|
|
50
|
+
_result_3 = _result_3.right
|
|
51
|
+
end
|
|
52
|
+
local _condition_1 = _result_3
|
|
53
|
+
if _condition_1 == nil then
|
|
54
|
+
_condition_1 = 0
|
|
55
|
+
end
|
|
56
|
+
local _exp_2 = _exp_1 + _condition_1
|
|
57
|
+
local _exp_3 = instance.AbsoluteSize.Y
|
|
58
|
+
local _result_4 = props.padding
|
|
59
|
+
if _result_4 ~= nil then
|
|
60
|
+
_result_4 = _result_4.top
|
|
61
|
+
end
|
|
62
|
+
local _condition_2 = _result_4
|
|
63
|
+
if _condition_2 == nil then
|
|
64
|
+
_condition_2 = 0
|
|
65
|
+
end
|
|
66
|
+
local _exp_4 = _exp_3 + _condition_2
|
|
67
|
+
local _result_5 = props.padding
|
|
68
|
+
if _result_5 ~= nil then
|
|
69
|
+
_result_5 = _result_5.bottom
|
|
70
|
+
end
|
|
71
|
+
local _condition_3 = _result_5
|
|
72
|
+
if _condition_3 == nil then
|
|
73
|
+
_condition_3 = 0
|
|
74
|
+
end
|
|
75
|
+
context.reportSize(id, Vector2.new(_exp_2, _exp_4 + _condition_3))
|
|
76
|
+
end,
|
|
77
|
+
},
|
|
78
|
+
}, props.children)
|
|
79
|
+
end
|
|
80
|
+
local function getMaxVector2(map)
|
|
81
|
+
local max
|
|
82
|
+
for _, vector in map do
|
|
83
|
+
if max == nil then
|
|
84
|
+
max = vector
|
|
85
|
+
else
|
|
86
|
+
max = Vector2.new(math.max(max.X, vector.X), math.max(max.Y, vector.Y))
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
return max
|
|
90
|
+
end
|
|
91
|
+
local Group
|
|
92
|
+
do
|
|
93
|
+
local super = Component
|
|
94
|
+
Group = setmetatable({}, {
|
|
95
|
+
__tostring = function()
|
|
96
|
+
return "Group"
|
|
97
|
+
end,
|
|
98
|
+
__index = super,
|
|
99
|
+
})
|
|
100
|
+
Group.__index = Group
|
|
101
|
+
function Group.new(...)
|
|
102
|
+
local self = setmetatable({}, Group)
|
|
103
|
+
return self:constructor(...) or self
|
|
104
|
+
end
|
|
105
|
+
function Group:constructor(...)
|
|
106
|
+
super.constructor(self, ...)
|
|
107
|
+
self.state = {
|
|
108
|
+
size = Vector2.new(0, 0),
|
|
109
|
+
sizes = {},
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
function Group:render()
|
|
113
|
+
local context = {
|
|
114
|
+
size = self.state.size,
|
|
115
|
+
sizes = self.state.sizes,
|
|
116
|
+
reportSize = function(id, size)
|
|
117
|
+
local _sizes = self.state.sizes
|
|
118
|
+
local _id = id
|
|
119
|
+
local current = _sizes[_id]
|
|
120
|
+
if current ~= nil and current.X == size.X and current.Y == size.Y then
|
|
121
|
+
return nil
|
|
122
|
+
end
|
|
123
|
+
self:setState(function(state)
|
|
124
|
+
local sizes = {}
|
|
125
|
+
for elementId, elementSize in state.sizes do
|
|
126
|
+
sizes[elementId] = elementSize
|
|
127
|
+
end
|
|
128
|
+
local _id_1 = id
|
|
129
|
+
local _size = size
|
|
130
|
+
sizes[_id_1] = _size
|
|
131
|
+
return {
|
|
132
|
+
sizes = sizes,
|
|
133
|
+
size = getMaxVector2(sizes) or Vector2.new(0, 0),
|
|
134
|
+
}
|
|
135
|
+
end)
|
|
136
|
+
end,
|
|
137
|
+
removeElement = function(id)
|
|
138
|
+
local _sizes = self.state.sizes
|
|
139
|
+
local _id = id
|
|
140
|
+
if not (_sizes[_id] ~= nil) then
|
|
141
|
+
return nil
|
|
142
|
+
end
|
|
143
|
+
self:setState(function(state)
|
|
144
|
+
local sizes = {}
|
|
145
|
+
for elementId, elementSize in state.sizes do
|
|
146
|
+
if elementId ~= id then
|
|
147
|
+
sizes[elementId] = elementSize
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
return {
|
|
151
|
+
sizes = sizes,
|
|
152
|
+
size = getMaxVector2(sizes) or Vector2.new(0, 0),
|
|
153
|
+
}
|
|
154
|
+
end)
|
|
155
|
+
end,
|
|
156
|
+
}
|
|
157
|
+
return React.createElement(GroupContext.Provider, {
|
|
158
|
+
value = context,
|
|
159
|
+
}, self.props.children)
|
|
160
|
+
end
|
|
161
|
+
Group.Element = GroupElement
|
|
162
|
+
Group.contextType = GroupContext
|
|
163
|
+
Group = ReactComponent(Group) or Group
|
|
164
|
+
end
|
|
165
|
+
return {
|
|
166
|
+
GroupContext = GroupContext,
|
|
167
|
+
Group = Group,
|
|
168
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface HStackProps extends SpacedElementProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
valign?: Enum.VerticalAlignment | "Center" | "Top" | "Bottom" | React.Binding<Enum.VerticalAlignment> | undefined;
|
|
6
|
+
Wraps?: boolean;
|
|
7
|
+
HorizontalFlex?: Enum.UIFlexAlignment;
|
|
8
|
+
Event?: React.InstanceEvent<UIListLayout>;
|
|
9
|
+
Change?: React.InstanceChangeEvent<UIListLayout>;
|
|
10
|
+
}
|
|
11
|
+
export declare function HStack(props: HStackProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
5
|
+
local SpacingHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SpacingHelper
|
|
6
|
+
local function HStack(props)
|
|
7
|
+
local theme = React.useContext(CleanThemeContext)
|
|
8
|
+
local padding = UDim.new(0, math.ceil(SpacingHelper:GetPadding(theme, props.spacing) / 2))
|
|
9
|
+
return React.createElement(React.Fragment, nil, React.createElement("uilistlayout", {
|
|
10
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
11
|
+
HorizontalFlex = props.HorizontalFlex,
|
|
12
|
+
VerticalAlignment = props.valign,
|
|
13
|
+
Padding = padding,
|
|
14
|
+
Wraps = if props.Wraps == nil then true else props.Wraps,
|
|
15
|
+
Change = props.Change,
|
|
16
|
+
Event = props.Event,
|
|
17
|
+
}), props.children)
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
HStack = HStack,
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { Component } from "@rbxts/react";
|
|
2
|
+
import { BreakPointElementProps, SpacedElementProps } from "../../Interfaces/";
|
|
3
|
+
import { CleanThemeContext } from "../../Contexts";
|
|
4
|
+
interface RowProps extends SpacedElementProps, BreakPointElementProps {
|
|
5
|
+
}
|
|
6
|
+
interface RowState {
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class Row extends Component<RowProps, RowState> {
|
|
10
|
+
static contextType: React.Context<import("../..").CleanTheme>;
|
|
11
|
+
context: React.ContextType<typeof CleanThemeContext>;
|
|
12
|
+
state: RowState;
|
|
13
|
+
render(): React.JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 React = _react
|
|
5
|
+
local Component = _react.Component
|
|
6
|
+
local ReactComponent = _react.ReactComponent
|
|
7
|
+
local Column = TS.import(script, script.Parent, "Column").Column
|
|
8
|
+
local _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
|
|
9
|
+
local CleanThemeContext = _Contexts.CleanThemeContext
|
|
10
|
+
local RowContext = _Contexts.RowContext
|
|
11
|
+
local _ = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
12
|
+
local BreakpointHelper = _.BreakpointHelper
|
|
13
|
+
local SpacingHelper = _.SpacingHelper
|
|
14
|
+
local Row
|
|
15
|
+
do
|
|
16
|
+
local super = Component
|
|
17
|
+
Row = setmetatable({}, {
|
|
18
|
+
__tostring = function()
|
|
19
|
+
return "Row"
|
|
20
|
+
end,
|
|
21
|
+
__index = super,
|
|
22
|
+
})
|
|
23
|
+
Row.__index = Row
|
|
24
|
+
function Row.new(...)
|
|
25
|
+
local self = setmetatable({}, Row)
|
|
26
|
+
return self:constructor(...) or self
|
|
27
|
+
end
|
|
28
|
+
function Row:constructor(...)
|
|
29
|
+
super.constructor(self, ...)
|
|
30
|
+
self.state = {
|
|
31
|
+
width = 0,
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
function Row:render()
|
|
35
|
+
local breakpoints = (if self.props.breakpoints ~= nil then self.props.breakpoints else self.context.breakpoints)
|
|
36
|
+
local padding = UDim.new(0, SpacingHelper:GetPadding(self.context, self.props.spacing))
|
|
37
|
+
local _exp = React.createElement("uilistlayout", {
|
|
38
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
39
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
40
|
+
Padding = padding,
|
|
41
|
+
Wraps = true,
|
|
42
|
+
})
|
|
43
|
+
local _attributes = {}
|
|
44
|
+
local _object = {
|
|
45
|
+
width = self.state.width,
|
|
46
|
+
}
|
|
47
|
+
local _left = "children"
|
|
48
|
+
local _exp_1 = React.Children.toArray(self.props.children)
|
|
49
|
+
-- ▼ ReadonlyArray.filter ▼
|
|
50
|
+
local _newValue = {}
|
|
51
|
+
local _callback = function(child)
|
|
52
|
+
return React.isValidElement(child) and child.type == Column
|
|
53
|
+
end
|
|
54
|
+
local _length = 0
|
|
55
|
+
for _k, _v in _exp_1 do
|
|
56
|
+
if _callback(_v, _k - 1, _exp_1) == true then
|
|
57
|
+
_length += 1
|
|
58
|
+
_newValue[_length] = _v
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
-- ▲ ReadonlyArray.filter ▲
|
|
62
|
+
_object[_left] = #_newValue
|
|
63
|
+
_object.padding = padding
|
|
64
|
+
_object.breakpoint = BreakpointHelper:getBreakpoint(self.state.width, breakpoints)
|
|
65
|
+
_attributes.value = _object
|
|
66
|
+
return React.createElement("frame", {
|
|
67
|
+
Size = UDim2.fromScale(1, 1),
|
|
68
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
69
|
+
BackgroundTransparency = 1,
|
|
70
|
+
Change = {
|
|
71
|
+
AbsoluteSize = function(instance)
|
|
72
|
+
local width = instance.AbsoluteSize.X
|
|
73
|
+
if width ~= self.state.width then
|
|
74
|
+
self:setState({
|
|
75
|
+
width = width,
|
|
76
|
+
})
|
|
77
|
+
end
|
|
78
|
+
end,
|
|
79
|
+
},
|
|
80
|
+
}, _exp, React.createElement(RowContext.Provider, _attributes, self.props.children))
|
|
81
|
+
end
|
|
82
|
+
Row.contextType = CleanThemeContext
|
|
83
|
+
Row = ReactComponent(Row) or Row
|
|
84
|
+
end
|
|
85
|
+
return {
|
|
86
|
+
Row = Row,
|
|
87
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { PositionElementProps, SizeElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface ScrollerProps extends SizeElementProps, SpacedElementProps, PositionElementProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function Scroller(props: ScrollerProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
5
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
6
|
+
local SizeHelper = _Helpers.SizeHelper
|
|
7
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
8
|
+
local function Scroller(props)
|
|
9
|
+
local theme = React.useContext(CleanThemeContext)
|
|
10
|
+
local thickness = 12
|
|
11
|
+
local isScrolling, setIsScrolling = React.useState(false)
|
|
12
|
+
local ref = React.useRef()
|
|
13
|
+
React.useEffect(function()
|
|
14
|
+
local frame = ref.current
|
|
15
|
+
if not frame then
|
|
16
|
+
return nil
|
|
17
|
+
end
|
|
18
|
+
local updateScrolling = function()
|
|
19
|
+
setIsScrolling(frame.AbsoluteCanvasSize.Y > frame.AbsoluteWindowSize.Y)
|
|
20
|
+
end
|
|
21
|
+
updateScrolling()
|
|
22
|
+
local canvasConn = frame:GetPropertyChangedSignal("AbsoluteCanvasSize"):Connect(updateScrolling)
|
|
23
|
+
local windowConn = frame:GetPropertyChangedSignal("AbsoluteWindowSize"):Connect(updateScrolling)
|
|
24
|
+
return function()
|
|
25
|
+
canvasConn:Disconnect()
|
|
26
|
+
windowConn:Disconnect()
|
|
27
|
+
end
|
|
28
|
+
end, {})
|
|
29
|
+
local spacing = SpacingHelper:GetPadding(theme, props.spacing)
|
|
30
|
+
return React.createElement("scrollingframe", {
|
|
31
|
+
ref = ref,
|
|
32
|
+
AnchorPoint = SizeHelper:GetAnchor(props),
|
|
33
|
+
AutomaticSize = SizeHelper:GetAutoSize(props, Enum.AutomaticSize.None),
|
|
34
|
+
Position = SizeHelper:GetPosition(props),
|
|
35
|
+
Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 1)),
|
|
36
|
+
BorderSizePixel = 0,
|
|
37
|
+
ScrollingDirection = Enum.ScrollingDirection.Y,
|
|
38
|
+
ScrollBarImageColor3 = theme.components.scroller.barColor,
|
|
39
|
+
CanvasSize = UDim2.fromScale(1, 0),
|
|
40
|
+
BackgroundTransparency = 1,
|
|
41
|
+
ScrollBarThickness = thickness,
|
|
42
|
+
VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar,
|
|
43
|
+
AutomaticCanvasSize = Enum.AutomaticSize.Y,
|
|
44
|
+
}, React.createElement("uilistlayout", {
|
|
45
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
46
|
+
}), React.createElement("frame", {
|
|
47
|
+
Size = UDim2.new(1, if isScrolling then -thickness - spacing else 0, 0, 0),
|
|
48
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
49
|
+
BackgroundTransparency = 1,
|
|
50
|
+
}, props.children))
|
|
51
|
+
end
|
|
52
|
+
return {
|
|
53
|
+
Scroller = Scroller,
|
|
54
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { Component } from "@rbxts/react";
|
|
2
|
+
import { CleanThemeContext } from "../../Contexts";
|
|
3
|
+
import { ScalableElementProps } from "../../Interfaces";
|
|
4
|
+
interface TabProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare function Tab(props: TabProps): undefined;
|
|
8
|
+
interface TabTitleProps {
|
|
9
|
+
text: string;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare function TabTitle(props: TabTitleProps): undefined;
|
|
13
|
+
interface TabContentProps {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function TabContent(props: TabContentProps): undefined;
|
|
17
|
+
interface TabsProps extends ScalableElementProps {
|
|
18
|
+
}
|
|
19
|
+
interface TabsState {
|
|
20
|
+
selected: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class Tabs extends Component<TabsProps, TabsState> {
|
|
23
|
+
static Tab: typeof Tab;
|
|
24
|
+
static Title: typeof TabTitle;
|
|
25
|
+
static Content: typeof TabContent;
|
|
26
|
+
static contextType: React.Context<import("../..").CleanTheme>;
|
|
27
|
+
context: React.ContextType<typeof CleanThemeContext>;
|
|
28
|
+
state: TabsState;
|
|
29
|
+
render(): React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
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 React = _react
|
|
5
|
+
local Component = _react.Component
|
|
6
|
+
local ReactComponent = _react.ReactComponent
|
|
7
|
+
local HStack = TS.import(script, script.Parent, "HStack").HStack
|
|
8
|
+
local VStack = TS.import(script, script.Parent, "VStack").VStack
|
|
9
|
+
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
10
|
+
local Container = TS.import(script, script.Parent, "Container").Container
|
|
11
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
12
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
13
|
+
local BoxShadow = _Decorator.BoxShadow
|
|
14
|
+
local Corners = _Decorator.Corners
|
|
15
|
+
local Padding = _Decorator.Padding
|
|
16
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
17
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
18
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
19
|
+
local TypographyHelper = _Helpers.TypographyHelper
|
|
20
|
+
local _HoverButton = TS.import(script, script.Parent.Parent, "Input", "HoverButton")
|
|
21
|
+
local HoverButton = _HoverButton.HoverButton
|
|
22
|
+
local HoverButtonContext = _HoverButton.HoverButtonContext
|
|
23
|
+
local TabsContext = React.createContext(nil)
|
|
24
|
+
local function Tab(props)
|
|
25
|
+
return nil
|
|
26
|
+
end
|
|
27
|
+
local function TabTitle(props)
|
|
28
|
+
return nil
|
|
29
|
+
end
|
|
30
|
+
local function TabContent(props)
|
|
31
|
+
return nil
|
|
32
|
+
end
|
|
33
|
+
local function TabButtonContent(props)
|
|
34
|
+
local theme = React.useContext(CleanThemeContext)
|
|
35
|
+
local hover = React.useContext(HoverButtonContext)
|
|
36
|
+
local _result = hover
|
|
37
|
+
if _result ~= nil then
|
|
38
|
+
_result = _result.isSelected
|
|
39
|
+
end
|
|
40
|
+
local _result_1
|
|
41
|
+
if _result then
|
|
42
|
+
_result_1 = "focus"
|
|
43
|
+
else
|
|
44
|
+
local _result_2 = hover
|
|
45
|
+
if _result_2 ~= nil then
|
|
46
|
+
_result_2 = _result_2.hover
|
|
47
|
+
end
|
|
48
|
+
_result_1 = if _result_2 then "hover" else "default"
|
|
49
|
+
end
|
|
50
|
+
local intent = ColorHelper:getIntentColors(theme, "primary", _result_1, theme.components.tabs.button.intents)
|
|
51
|
+
return React.createElement(React.Fragment, nil, React.createElement(Corners, {
|
|
52
|
+
radius = theme.components.tabs.button.cornerRadius,
|
|
53
|
+
}), React.createElement(Padding, {
|
|
54
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.tabs.button.spacing),
|
|
55
|
+
}), React.createElement(BoxShadow, {
|
|
56
|
+
value = intent.boxShadow,
|
|
57
|
+
}), React.createElement(Text, {
|
|
58
|
+
TextColor3 = intent.textColor,
|
|
59
|
+
text = props.text,
|
|
60
|
+
typography = TypographyHelper:getTypography(theme, nil, intent.typography),
|
|
61
|
+
}))
|
|
62
|
+
end
|
|
63
|
+
local Tabs
|
|
64
|
+
do
|
|
65
|
+
local super = Component
|
|
66
|
+
Tabs = setmetatable({}, {
|
|
67
|
+
__tostring = function()
|
|
68
|
+
return "Tabs"
|
|
69
|
+
end,
|
|
70
|
+
__index = super,
|
|
71
|
+
})
|
|
72
|
+
Tabs.__index = Tabs
|
|
73
|
+
function Tabs.new(...)
|
|
74
|
+
local self = setmetatable({}, Tabs)
|
|
75
|
+
return self:constructor(...) or self
|
|
76
|
+
end
|
|
77
|
+
function Tabs:constructor(...)
|
|
78
|
+
super.constructor(self, ...)
|
|
79
|
+
self.state = {
|
|
80
|
+
selected = 0,
|
|
81
|
+
}
|
|
82
|
+
end
|
|
83
|
+
function Tabs:render()
|
|
84
|
+
local context = {
|
|
85
|
+
selected = self.state.selected,
|
|
86
|
+
}
|
|
87
|
+
local tabs = {}
|
|
88
|
+
React.Children.forEach(self.props.children, function(child)
|
|
89
|
+
if not React.isValidElement(child) or child.type ~= Tab then
|
|
90
|
+
return nil
|
|
91
|
+
end
|
|
92
|
+
local title
|
|
93
|
+
local content
|
|
94
|
+
local tab = child
|
|
95
|
+
React.Children.forEach(tab.props.children, function(tabChild)
|
|
96
|
+
if not React.isValidElement(tabChild) then
|
|
97
|
+
return nil
|
|
98
|
+
end
|
|
99
|
+
if tabChild.type == TabTitle then
|
|
100
|
+
title = (tabChild.props)
|
|
101
|
+
elseif tabChild.type == TabContent then
|
|
102
|
+
content = (tabChild.props).children
|
|
103
|
+
end
|
|
104
|
+
end)
|
|
105
|
+
if title ~= nil then
|
|
106
|
+
local _arg0 = {
|
|
107
|
+
title = title,
|
|
108
|
+
content = content,
|
|
109
|
+
}
|
|
110
|
+
table.insert(tabs, _arg0)
|
|
111
|
+
end
|
|
112
|
+
end)
|
|
113
|
+
local selectedTab = tabs[self.state.selected + 1]
|
|
114
|
+
local _exp = React.createElement(Corners, {
|
|
115
|
+
radius = self.context.components.tabs.list.cornerRadius,
|
|
116
|
+
})
|
|
117
|
+
local _exp_1 = React.createElement(Padding, {
|
|
118
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(self.context, {}, self.context.components.tabs.list.spacing),
|
|
119
|
+
})
|
|
120
|
+
-- ▼ ReadonlyArray.map ▼
|
|
121
|
+
local _newValue = table.create(#tabs)
|
|
122
|
+
local _callback = function(tab, index)
|
|
123
|
+
return React.createElement(HoverButton, {
|
|
124
|
+
isSelected = self.state.selected == index,
|
|
125
|
+
default = {
|
|
126
|
+
Size = UDim2.fromScale(0, 0),
|
|
127
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
128
|
+
ImageTransparency = 1,
|
|
129
|
+
BackgroundColor3 = ColorHelper:getIntentColors(self.context, "primary", "default", self.context.components.tabs.button.intents).backgroundColor,
|
|
130
|
+
BackgroundTransparency = ColorHelper:getIntentColors(self.context, "primary", "default", self.context.components.tabs.button.intents).backgroundTransparency,
|
|
131
|
+
BorderSizePixel = 0,
|
|
132
|
+
AutoButtonColor = false,
|
|
133
|
+
Event = {
|
|
134
|
+
Activated = function()
|
|
135
|
+
self:setState({
|
|
136
|
+
selected = index,
|
|
137
|
+
})
|
|
138
|
+
end,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
hover = {
|
|
142
|
+
BackgroundColor3 = ColorHelper:getIntentColors(self.context, "primary", "hover", self.context.components.tabs.button.intents).backgroundColor,
|
|
143
|
+
BackgroundTransparency = ColorHelper:getIntentColors(self.context, "primary", "hover", self.context.components.tabs.button.intents).backgroundTransparency,
|
|
144
|
+
},
|
|
145
|
+
focus = {
|
|
146
|
+
BackgroundColor3 = ColorHelper:getIntentColors(self.context, "primary", "focus", self.context.components.tabs.button.intents).backgroundColor,
|
|
147
|
+
BackgroundTransparency = ColorHelper:getIntentColors(self.context, "primary", "focus", self.context.components.tabs.button.intents).backgroundTransparency,
|
|
148
|
+
},
|
|
149
|
+
}, React.createElement(TabButtonContent, {
|
|
150
|
+
text = tab.title.text,
|
|
151
|
+
}))
|
|
152
|
+
end
|
|
153
|
+
for _k, _v in tabs do
|
|
154
|
+
_newValue[_k] = _callback(_v, _k - 1, tabs)
|
|
155
|
+
end
|
|
156
|
+
-- ▲ ReadonlyArray.map ▲
|
|
157
|
+
local _exp_2 = React.createElement(Container, {
|
|
158
|
+
BackgroundColor3 = self.context.components.tabs.list.backgroundColor,
|
|
159
|
+
width = "100%",
|
|
160
|
+
BackgroundTransparency = 0,
|
|
161
|
+
}, _exp, _exp_1, React.createElement(HStack, nil, _newValue))
|
|
162
|
+
local _exp_3 = React.createElement("uistroke", {
|
|
163
|
+
Thickness = self.context.components.tabs.borderThickness,
|
|
164
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
165
|
+
Color = self.context.components.tabs.borderColor,
|
|
166
|
+
})
|
|
167
|
+
local _exp_4 = React.createElement(Padding, {
|
|
168
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(self.context, {}, self.context.components.tabs.spacing),
|
|
169
|
+
})
|
|
170
|
+
local _exp_5 = React.createElement(Corners, {
|
|
171
|
+
radius = self.context.components.tabs.list.cornerRadius,
|
|
172
|
+
})
|
|
173
|
+
local _result = selectedTab
|
|
174
|
+
if _result ~= nil then
|
|
175
|
+
_result = _result.content
|
|
176
|
+
end
|
|
177
|
+
return React.createElement(TabsContext.Provider, {
|
|
178
|
+
value = context,
|
|
179
|
+
}, React.createElement(VStack, nil, _exp_2, React.createElement(Container, nil, _exp_3, _exp_4, _exp_5, _result)))
|
|
180
|
+
end
|
|
181
|
+
Tabs.Tab = Tab
|
|
182
|
+
Tabs.Title = TabTitle
|
|
183
|
+
Tabs.Content = TabContent
|
|
184
|
+
Tabs.contextType = CleanThemeContext
|
|
185
|
+
Tabs = ReactComponent(Tabs) or Tabs
|
|
186
|
+
end
|
|
187
|
+
return {
|
|
188
|
+
Tabs = Tabs,
|
|
189
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { SpacedElementProps } from "../../Interfaces";
|
|
3
|
+
interface VStackProps extends SpacedElementProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
HorizontalFlex?: Enum.UIFlexAlignment;
|
|
6
|
+
VerticalFlex?: Enum.UIFlexAlignment;
|
|
7
|
+
Event?: React.InstanceEvent<UIListLayout>;
|
|
8
|
+
Change?: React.InstanceChangeEvent<UIListLayout>;
|
|
9
|
+
}
|
|
10
|
+
export declare function VStack(props: VStackProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
5
|
+
local SpacingHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SpacingHelper
|
|
6
|
+
local function VStack(props)
|
|
7
|
+
local theme = React.useContext(CleanThemeContext)
|
|
8
|
+
local padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.spacing))
|
|
9
|
+
return React.createElement(React.Fragment, nil, React.createElement("uilistlayout", {
|
|
10
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
11
|
+
HorizontalFlex = props.HorizontalFlex or Enum.UIFlexAlignment.Fill,
|
|
12
|
+
VerticalFlex = props.VerticalFlex,
|
|
13
|
+
Padding = padding,
|
|
14
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
15
|
+
Change = props.Change,
|
|
16
|
+
Event = props.Event,
|
|
17
|
+
}), props.children)
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
VStack = VStack,
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Column';
|
|
2
|
+
export * from './Container';
|
|
3
|
+
export * from './Draggable';
|
|
4
|
+
export * from './Droppable';
|
|
5
|
+
export * from './Fieldset';
|
|
6
|
+
export * from './FlexItem';
|
|
7
|
+
export * from './Group';
|
|
8
|
+
export * from './HStack';
|
|
9
|
+
export * from './Row';
|
|
10
|
+
export * from './Scroller';
|
|
11
|
+
export * from './Tabs';
|
|
12
|
+
export * from './VStack';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "Column") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "Container") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
10
|
+
for _k, _v in TS.import(script, script, "Draggable") or {} do
|
|
11
|
+
exports[_k] = _v
|
|
12
|
+
end
|
|
13
|
+
for _k, _v in TS.import(script, script, "Droppable") or {} do
|
|
14
|
+
exports[_k] = _v
|
|
15
|
+
end
|
|
16
|
+
for _k, _v in TS.import(script, script, "Fieldset") or {} do
|
|
17
|
+
exports[_k] = _v
|
|
18
|
+
end
|
|
19
|
+
for _k, _v in TS.import(script, script, "FlexItem") or {} do
|
|
20
|
+
exports[_k] = _v
|
|
21
|
+
end
|
|
22
|
+
for _k, _v in TS.import(script, script, "Group") or {} do
|
|
23
|
+
exports[_k] = _v
|
|
24
|
+
end
|
|
25
|
+
for _k, _v in TS.import(script, script, "HStack") or {} do
|
|
26
|
+
exports[_k] = _v
|
|
27
|
+
end
|
|
28
|
+
for _k, _v in TS.import(script, script, "Row") or {} do
|
|
29
|
+
exports[_k] = _v
|
|
30
|
+
end
|
|
31
|
+
for _k, _v in TS.import(script, script, "Scroller") or {} do
|
|
32
|
+
exports[_k] = _v
|
|
33
|
+
end
|
|
34
|
+
for _k, _v in TS.import(script, script, "Tabs") or {} do
|
|
35
|
+
exports[_k] = _v
|
|
36
|
+
end
|
|
37
|
+
for _k, _v in TS.import(script, script, "VStack") or {} do
|
|
38
|
+
exports[_k] = _v
|
|
39
|
+
end
|
|
40
|
+
return exports
|