@rbxts/react-clean-ui 1.0.12 → 1.0.19
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/Components/Chart/Pie.d.ts +27 -0
- package/out/Components/Chart/Pie.luau +281 -0
- package/out/Components/Chart/index.d.ts +1 -0
- package/out/Components/Chart/init.luau +7 -0
- package/out/Components/Decorator/BoxShadow.d.ts +2 -1
- package/out/Components/Decorator/BoxShadow.luau +51 -28
- package/out/Components/Input/Select.d.ts +6 -14
- package/out/Components/Input/Select.luau +111 -151
- package/out/Components/Input/Slider.d.ts +3 -37
- package/out/Components/Input/Slider.luau +271 -300
- package/out/Components/Layout/Column.d.ts +2 -8
- package/out/Components/Layout/Column.luau +28 -48
- package/out/Components/Layout/Draggable.d.ts +7 -31
- package/out/Components/Layout/Draggable.luau +190 -214
- package/out/Components/Layout/Fieldset.d.ts +8 -18
- package/out/Components/Layout/Fieldset.luau +42 -84
- package/out/Components/Layout/Group.d.ts +7 -14
- package/out/Components/Layout/Group.luau +111 -129
- package/out/Components/Layout/Row.d.ts +2 -11
- package/out/Components/Layout/Row.luau +46 -71
- package/out/Components/Layout/Tabs.d.ts +10 -18
- package/out/Components/Layout/Tabs.luau +85 -104
- package/out/Components/Navigation/Menu.d.ts +6 -10
- package/out/Components/Navigation/Menu.luau +38 -65
- package/out/Components/Surface/Card.d.ts +8 -11
- package/out/Components/Surface/Card.luau +28 -48
- package/out/Components/Surface/index.d.ts +0 -1
- package/out/Components/Surface/init.luau +0 -3
- package/out/Components/index.d.ts +1 -0
- package/out/Components/init.luau +3 -0
- package/out/Helpers/css.helper.d.ts +2 -1
- package/out/Helpers/css.helper.luau +25 -0
- package/out/Helpers/size.helper.luau +1 -1
- package/out/Interfaces/clean.element.props.d.ts +5 -0
- package/out/Providers/registry.provider.d.ts +1 -0
- package/out/Providers/registry.provider.luau +5 -0
- package/out/Theme/theme.template.d.ts +15 -1
- package/out/Theme/themes/dark.theme.luau +3 -0
- package/out/Theme/themes/default.theme.luau +15 -0
- package/out/Theme/themes/sandstone.theme.luau +13 -0
- package/package.json +1 -1
- package/out/Components/Surface/Panel.d.ts +0 -4
- package/out/Components/Surface/Panel.luau +0 -33
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local React = _react
|
|
5
|
-
local Component = _react.Component
|
|
6
|
-
local ReactComponent = _react.ReactComponent
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
4
|
local FlexItem = TS.import(script, script.Parent, "FlexItem").FlexItem
|
|
8
5
|
local Container = TS.import(script, script.Parent, "Container").Container
|
|
9
6
|
local HStack = TS.import(script, script.Parent, "HStack").HStack
|
|
@@ -24,10 +21,7 @@ local function FieldsetLabel(props)
|
|
|
24
21
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
25
22
|
Event = {
|
|
26
23
|
Activated = function()
|
|
27
|
-
|
|
28
|
-
if _result ~= nil then
|
|
29
|
-
_result:Fire()
|
|
30
|
-
end
|
|
24
|
+
context.labelActivated:Fire()
|
|
31
25
|
end,
|
|
32
26
|
},
|
|
33
27
|
}, props.children))
|
|
@@ -42,88 +36,52 @@ local function FieldsetControl(props)
|
|
|
42
36
|
GrowRatio = if context.checkbox then 0 else 1,
|
|
43
37
|
}, props.children)
|
|
44
38
|
end
|
|
45
|
-
local Fieldset
|
|
46
|
-
|
|
47
|
-
local
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
local
|
|
57
|
-
|
|
58
|
-
end
|
|
59
|
-
function Fieldset:constructor(...)
|
|
60
|
-
super.constructor(self, ...)
|
|
61
|
-
self.labelActivated = Instance.new("BindableEvent")
|
|
62
|
-
self.fieldsetContext = {
|
|
63
|
-
disabled = false,
|
|
64
|
-
checkbox = false,
|
|
65
|
-
labelActivated = self.labelActivated,
|
|
66
|
-
}
|
|
67
|
-
end
|
|
68
|
-
function Fieldset:getFieldsetContext()
|
|
69
|
-
local _condition = self.props.disabled
|
|
39
|
+
local Fieldset = React.forwardRef(function(props, ref)
|
|
40
|
+
local theme = React.useContext(CleanThemeContext)
|
|
41
|
+
local width, setWidth = React.useState(0)
|
|
42
|
+
local labelActivated = React.useRef(Instance.new("BindableEvent")).current
|
|
43
|
+
React.useEffect(function()
|
|
44
|
+
return function()
|
|
45
|
+
labelActivated:Destroy()
|
|
46
|
+
end
|
|
47
|
+
end, {})
|
|
48
|
+
local fieldsetContext = React.useMemo(function()
|
|
49
|
+
local _object = {}
|
|
50
|
+
local _left = "disabled"
|
|
51
|
+
local _condition = props.disabled
|
|
70
52
|
if _condition == nil then
|
|
71
53
|
_condition = false
|
|
72
54
|
end
|
|
73
|
-
|
|
74
|
-
local
|
|
55
|
+
_object[_left] = _condition
|
|
56
|
+
local _left_1 = "checkbox"
|
|
57
|
+
local _condition_1 = props.checkbox
|
|
75
58
|
if _condition_1 == nil then
|
|
76
59
|
_condition_1 = false
|
|
77
60
|
end
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
return React.createElement(FieldsetContext.Provider, {
|
|
104
|
-
value = context,
|
|
105
|
-
}, React.createElement(Container, {
|
|
106
|
-
Change = {
|
|
107
|
-
AbsoluteSize = function(instance)
|
|
108
|
-
local width = instance.AbsoluteSize.X
|
|
109
|
-
if width ~= self.state.width then
|
|
110
|
-
self:setState({
|
|
111
|
-
width = width,
|
|
112
|
-
})
|
|
113
|
-
end
|
|
114
|
-
end,
|
|
115
|
-
},
|
|
116
|
-
}, React.createElement(HStack, {
|
|
117
|
-
Wraps = wrap,
|
|
118
|
-
valign = "Center",
|
|
119
|
-
HorizontalFlex = Enum.UIFlexAlignment.Fill,
|
|
120
|
-
}, self.props.children)))
|
|
121
|
-
end
|
|
122
|
-
Fieldset.Label = FieldsetLabel
|
|
123
|
-
Fieldset.Control = FieldsetControl
|
|
124
|
-
Fieldset.contextType = CleanThemeContext
|
|
125
|
-
Fieldset = ReactComponent(Fieldset) or Fieldset
|
|
126
|
-
end
|
|
61
|
+
_object[_left_1] = _condition_1
|
|
62
|
+
_object.labelActivated = labelActivated
|
|
63
|
+
return _object
|
|
64
|
+
end, { props.disabled, props.checkbox })
|
|
65
|
+
local breakpoints = props.breakpoints or theme.breakpoints
|
|
66
|
+
local breakpoint = BreakpointHelper:getBreakpoint(width, breakpoints)
|
|
67
|
+
local wrap = BreakpointHelper:compare(breakpoint, "<=", props.wrap or "lg")
|
|
68
|
+
return React.createElement(FieldsetContext.Provider, {
|
|
69
|
+
value = fieldsetContext,
|
|
70
|
+
}, React.createElement(Container, {
|
|
71
|
+
ref = ref,
|
|
72
|
+
Change = {
|
|
73
|
+
AbsoluteSize = function(instance)
|
|
74
|
+
setWidth(instance.AbsoluteSize.X)
|
|
75
|
+
end,
|
|
76
|
+
},
|
|
77
|
+
}, React.createElement(HStack, {
|
|
78
|
+
Wraps = wrap,
|
|
79
|
+
valign = "Center",
|
|
80
|
+
HorizontalFlex = Enum.UIFlexAlignment.Fill,
|
|
81
|
+
}, props.children)))
|
|
82
|
+
end)
|
|
83
|
+
Fieldset.Label = FieldsetLabel
|
|
84
|
+
Fieldset.Control = FieldsetControl
|
|
127
85
|
return {
|
|
128
86
|
FieldsetContext = FieldsetContext,
|
|
129
87
|
Fieldset = Fieldset,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import { ResolvedPadding } from "../../Interfaces";
|
|
3
3
|
interface GroupContextValue {
|
|
4
4
|
size: Vector2;
|
|
@@ -16,19 +16,12 @@ declare function GroupElement(props: GroupElementProps): boolean | ReadonlyMap<R
|
|
|
16
16
|
readonly [key: string]: React.ReactNode;
|
|
17
17
|
readonly [key: number]: React.ReactNode;
|
|
18
18
|
} | readonly React.ReactNode[] | React.JSX.Element | undefined;
|
|
19
|
-
interface
|
|
19
|
+
interface GroupProps {
|
|
20
20
|
children?: React.ReactNode;
|
|
21
21
|
BackgroundTransparency?: number;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
static Element: typeof GroupElement;
|
|
29
|
-
static contextType: React.Context<GroupContextValue | undefined>;
|
|
30
|
-
state: GroupState;
|
|
31
|
-
context: React.ContextType<typeof GroupContext>;
|
|
32
|
-
render(): React.ReactNode;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
23
|
+
type GroupComponent = React.ForwardRefExoticComponent<GroupProps & React.RefAttributes<Frame>> & {
|
|
24
|
+
Element: typeof GroupElement;
|
|
25
|
+
};
|
|
26
|
+
declare const Group: GroupComponent;
|
|
27
|
+
export { Group };
|
|
@@ -1,78 +1,82 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
|
|
5
|
-
local
|
|
6
|
-
local ReactComponent = _react.ReactComponent
|
|
7
|
-
local HttpService = TS.import(script, TS.getModule(script, "@rbxts", "services")).HttpService
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
-- import { HttpService } from "@rbxts/services";
|
|
5
|
+
local RegistryContext = TS.import(script, script.Parent.Parent.Parent, "Providers").RegistryContext
|
|
8
6
|
local GroupContext = React.createContext(nil)
|
|
9
7
|
local function GroupElement(props)
|
|
8
|
+
local registry = React.useContext(RegistryContext)
|
|
10
9
|
local context = React.useContext(GroupContext)
|
|
11
|
-
local
|
|
12
|
-
local _result = context
|
|
10
|
+
local _result = registry
|
|
13
11
|
if _result ~= nil then
|
|
14
|
-
_result = _result.
|
|
12
|
+
_result = _result.GetNextId()
|
|
13
|
+
end
|
|
14
|
+
local _condition = _result
|
|
15
|
+
if _condition == nil then
|
|
16
|
+
_condition = ""
|
|
17
|
+
end
|
|
18
|
+
local id = React.useRef(_condition).current
|
|
19
|
+
local enabled = props.enabled == true and context ~= nil
|
|
20
|
+
local _exp = function()
|
|
21
|
+
if not enabled then
|
|
22
|
+
local _result_1 = context
|
|
23
|
+
if _result_1 ~= nil then
|
|
24
|
+
_result_1.removeElement(id)
|
|
25
|
+
end
|
|
26
|
+
return nil
|
|
27
|
+
end
|
|
28
|
+
return function()
|
|
29
|
+
context.removeElement(id)
|
|
30
|
+
end
|
|
15
31
|
end
|
|
16
|
-
local removeElementRef = React.useRef(_result)
|
|
17
32
|
local _result_1 = context
|
|
18
33
|
if _result_1 ~= nil then
|
|
19
34
|
_result_1 = _result_1.removeElement
|
|
20
35
|
end
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
36
|
+
React.useEffect(_exp, { enabled, _result_1 })
|
|
37
|
+
if not enabled then
|
|
31
38
|
return props.children
|
|
32
39
|
end
|
|
40
|
+
local _result_2 = props.padding
|
|
41
|
+
if _result_2 ~= nil then
|
|
42
|
+
_result_2 = _result_2.left
|
|
43
|
+
end
|
|
44
|
+
local _condition_1 = _result_2
|
|
45
|
+
if _condition_1 == nil then
|
|
46
|
+
_condition_1 = 0
|
|
47
|
+
end
|
|
48
|
+
local _result_3 = props.padding
|
|
49
|
+
if _result_3 ~= nil then
|
|
50
|
+
_result_3 = _result_3.right
|
|
51
|
+
end
|
|
52
|
+
local _condition_2 = _result_3
|
|
53
|
+
if _condition_2 == nil then
|
|
54
|
+
_condition_2 = 0
|
|
55
|
+
end
|
|
56
|
+
local horizontalPadding = _condition_1 + _condition_2
|
|
57
|
+
local _result_4 = props.padding
|
|
58
|
+
if _result_4 ~= nil then
|
|
59
|
+
_result_4 = _result_4.top
|
|
60
|
+
end
|
|
61
|
+
local _condition_3 = _result_4
|
|
62
|
+
if _condition_3 == nil then
|
|
63
|
+
_condition_3 = 0
|
|
64
|
+
end
|
|
65
|
+
local _result_5 = props.padding
|
|
66
|
+
if _result_5 ~= nil then
|
|
67
|
+
_result_5 = _result_5.bottom
|
|
68
|
+
end
|
|
69
|
+
local _condition_4 = _result_5
|
|
70
|
+
if _condition_4 == nil then
|
|
71
|
+
_condition_4 = 0
|
|
72
|
+
end
|
|
73
|
+
local verticalPadding = _condition_3 + _condition_4
|
|
33
74
|
return React.createElement("frame", {
|
|
34
75
|
BackgroundTransparency = 1,
|
|
35
76
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
36
77
|
Change = {
|
|
37
78
|
AbsoluteSize = function(instance)
|
|
38
|
-
|
|
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))
|
|
79
|
+
context.reportSize(id, Vector2.new(instance.AbsoluteSize.X + horizontalPadding, instance.AbsoluteSize.Y + verticalPadding))
|
|
76
80
|
end,
|
|
77
81
|
},
|
|
78
82
|
}, props.children)
|
|
@@ -88,80 +92,58 @@ local function getMaxVector2(map)
|
|
|
88
92
|
end
|
|
89
93
|
return max
|
|
90
94
|
end
|
|
91
|
-
local Group
|
|
92
|
-
|
|
93
|
-
local
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
95
|
+
local Group = React.forwardRef(function(props, _ref)
|
|
96
|
+
local sizes, setSizes = React.useState({})
|
|
97
|
+
local size = React.useMemo(function()
|
|
98
|
+
return getMaxVector2(sizes) or Vector2.zero
|
|
99
|
+
end, { sizes })
|
|
100
|
+
local reportSize = React.useCallback(function(id, reportedSize)
|
|
101
|
+
setSizes(function(currentSizes)
|
|
102
|
+
local _currentSizes = currentSizes
|
|
103
|
+
local _id = id
|
|
104
|
+
local current = _currentSizes[_id]
|
|
105
|
+
if current ~= nil and current.X == reportedSize.X and current.Y == reportedSize.Y then
|
|
106
|
+
return currentSizes
|
|
107
|
+
end
|
|
108
|
+
local newSizes = {}
|
|
109
|
+
for elementId, elementSize in currentSizes do
|
|
110
|
+
newSizes[elementId] = elementSize
|
|
111
|
+
end
|
|
112
|
+
local _id_1 = id
|
|
113
|
+
local _reportedSize = reportedSize
|
|
114
|
+
newSizes[_id_1] = _reportedSize
|
|
115
|
+
return newSizes
|
|
116
|
+
end)
|
|
117
|
+
end, {})
|
|
118
|
+
local removeElement = React.useCallback(function(id)
|
|
119
|
+
setSizes(function(currentSizes)
|
|
120
|
+
local _currentSizes = currentSizes
|
|
121
|
+
local _id = id
|
|
122
|
+
if not (_currentSizes[_id] ~= nil) then
|
|
123
|
+
return currentSizes
|
|
124
|
+
end
|
|
125
|
+
local newSizes = {}
|
|
126
|
+
for elementId, elementSize in currentSizes do
|
|
127
|
+
if elementId ~= id then
|
|
128
|
+
newSizes[elementId] = elementSize
|
|
142
129
|
end
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
end)
|
|
155
|
-
end,
|
|
130
|
+
end
|
|
131
|
+
return newSizes
|
|
132
|
+
end)
|
|
133
|
+
end, {})
|
|
134
|
+
local context = React.useMemo(function()
|
|
135
|
+
return {
|
|
136
|
+
size = size,
|
|
137
|
+
sizes = sizes,
|
|
138
|
+
reportSize = reportSize,
|
|
139
|
+
removeElement = removeElement,
|
|
156
140
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Group = ReactComponent(Group) or Group
|
|
164
|
-
end
|
|
141
|
+
end, { size, sizes, reportSize, removeElement })
|
|
142
|
+
return React.createElement(GroupContext.Provider, {
|
|
143
|
+
value = context,
|
|
144
|
+
}, props.children)
|
|
145
|
+
end)
|
|
146
|
+
Group.Element = GroupElement
|
|
165
147
|
return {
|
|
166
148
|
GroupContext = GroupContext,
|
|
167
149
|
Group = Group,
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import { BreakPointElementProps, SpacedElementProps } from "../../Interfaces/";
|
|
3
|
-
import { CleanThemeContext } from "../../Contexts";
|
|
4
3
|
interface RowProps extends SpacedElementProps, BreakPointElementProps {
|
|
5
4
|
}
|
|
6
|
-
|
|
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
|
-
}
|
|
5
|
+
export declare const Row: React.ForwardRefExoticComponent<RowProps & React.RefAttributes<Frame>>;
|
|
15
6
|
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local React = _react
|
|
5
|
-
local Component = _react.Component
|
|
6
|
-
local ReactComponent = _react.ReactComponent
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
4
|
local Column = TS.import(script, script.Parent, "Column").Column
|
|
8
5
|
local _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
|
|
9
6
|
local CleanThemeContext = _Contexts.CleanThemeContext
|
|
@@ -11,77 +8,55 @@ local RowContext = _Contexts.RowContext
|
|
|
11
8
|
local _ = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
12
9
|
local BreakpointHelper = _.BreakpointHelper
|
|
13
10
|
local SpacingHelper = _.SpacingHelper
|
|
14
|
-
local Row
|
|
15
|
-
|
|
16
|
-
local
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
local Row = React.forwardRef(function(props, ref)
|
|
12
|
+
local theme = React.useContext(CleanThemeContext)
|
|
13
|
+
local width, setWidth = React.useState(0)
|
|
14
|
+
local breakpoints = props.breakpoints or theme.breakpoints
|
|
15
|
+
local padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.spacing))
|
|
16
|
+
local _exp = React.createElement("uilistlayout", {
|
|
17
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
18
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
19
|
+
Padding = padding,
|
|
20
|
+
Wraps = true,
|
|
22
21
|
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
local _attributes = {}
|
|
23
|
+
local _object = {
|
|
24
|
+
width = width,
|
|
25
|
+
}
|
|
26
|
+
local _left = "children"
|
|
27
|
+
local _exp_1 = React.Children.toArray(props.children)
|
|
28
|
+
-- ▼ ReadonlyArray.filter ▼
|
|
29
|
+
local _newValue = {}
|
|
30
|
+
local _callback = function(child)
|
|
31
|
+
return React.isValidElement(child) and child.type == Column
|
|
27
32
|
end
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
33
|
+
local _length = 0
|
|
34
|
+
for _k, _v in _exp_1 do
|
|
35
|
+
if _callback(_v, _k - 1, _exp_1) == true then
|
|
36
|
+
_length += 1
|
|
37
|
+
_newValue[_length] = _v
|
|
60
38
|
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
39
|
end
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
40
|
+
-- ▲ ReadonlyArray.filter ▲
|
|
41
|
+
_object[_left] = #_newValue
|
|
42
|
+
_object.padding = padding
|
|
43
|
+
_object.breakpoint = BreakpointHelper:getBreakpoint(width, breakpoints)
|
|
44
|
+
_attributes.value = _object
|
|
45
|
+
return React.createElement("frame", {
|
|
46
|
+
ref = ref,
|
|
47
|
+
Size = UDim2.fromScale(1, 1),
|
|
48
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
49
|
+
BackgroundTransparency = 1,
|
|
50
|
+
Change = {
|
|
51
|
+
AbsoluteSize = function(instance)
|
|
52
|
+
local nextWidth = instance.AbsoluteSize.X
|
|
53
|
+
setWidth(function(currentWidth)
|
|
54
|
+
return if currentWidth == nextWidth then currentWidth else nextWidth
|
|
55
|
+
end)
|
|
56
|
+
end,
|
|
57
|
+
},
|
|
58
|
+
}, _exp, React.createElement(RowContext.Provider, _attributes, props.children))
|
|
59
|
+
end)
|
|
85
60
|
return {
|
|
86
61
|
Row = Row,
|
|
87
62
|
}
|
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { CleanThemeContext } from "../../Contexts";
|
|
1
|
+
import React from "@rbxts/react";
|
|
3
2
|
import { ScalableElementProps } from "../../Interfaces";
|
|
4
3
|
interface TabProps {
|
|
5
4
|
children?: React.ReactNode;
|
|
6
5
|
}
|
|
7
|
-
declare function Tab(
|
|
6
|
+
declare function Tab(_props: TabProps): undefined;
|
|
8
7
|
interface TabTitleProps {
|
|
9
8
|
text: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
9
|
}
|
|
12
|
-
declare function TabTitle(
|
|
10
|
+
declare function TabTitle(_props: TabTitleProps): undefined;
|
|
13
11
|
interface TabContentProps {
|
|
14
12
|
children?: React.ReactNode;
|
|
15
13
|
}
|
|
16
14
|
declare function TabContent(props: TabContentProps): undefined;
|
|
17
15
|
interface TabsProps extends ScalableElementProps {
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
static contextType: React.Context<import("../..").CleanTheme>;
|
|
27
|
-
context: React.ContextType<typeof CleanThemeContext>;
|
|
28
|
-
state: TabsState;
|
|
29
|
-
render(): React.ReactNode;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
17
|
+
type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<Frame>> & {
|
|
18
|
+
Tab: typeof Tab;
|
|
19
|
+
Title: typeof TabTitle;
|
|
20
|
+
Content: typeof TabContent;
|
|
21
|
+
};
|
|
22
|
+
declare const Tabs: TabsComponent;
|
|
23
|
+
export { Tabs };
|