@rbxts/react-clean-ui 1.0.14 → 1.0.36
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/BarChart.d.ts +47 -0
- package/out/Components/Chart/BarChart.luau +880 -0
- package/out/Components/Chart/Pie.d.ts +27 -0
- package/out/Components/Chart/Pie.luau +281 -0
- package/out/Components/Chart/index.d.ts +2 -0
- package/out/Components/Chart/init.luau +10 -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/Interaction/Toast.d.ts +1 -1
- package/out/Components/Interaction/Toast.luau +4 -4
- package/out/Components/Interaction/Tooltip.d.ts +1 -1
- package/out/Components/Interaction/Tooltip.luau +8 -1
- package/out/Components/Layout/Accordion.d.ts +34 -0
- package/out/Components/Layout/Accordion.luau +430 -0
- package/out/Components/Layout/Column.d.ts +2 -8
- package/out/Components/Layout/Column.luau +28 -48
- package/out/Components/Layout/Container.luau +21 -5
- 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/HStack.d.ts +2 -1
- package/out/Components/Layout/HStack.luau +1 -2
- 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/Layout/VStack.d.ts +4 -1
- package/out/Components/Layout/VStack.luau +2 -2
- package/out/Components/Layout/index.d.ts +1 -0
- package/out/Components/Layout/init.luau +3 -0
- package/out/Components/Navigation/Menu.d.ts +6 -10
- package/out/Components/Navigation/Menu.luau +38 -65
- package/out/Components/Surface/Box.d.ts +2 -2
- package/out/Components/Surface/Card.d.ts +8 -11
- package/out/Components/Surface/Card.luau +40 -48
- package/out/Components/Surface/Icon.d.ts +1 -1
- package/out/Components/Surface/Icon.luau +1 -0
- package/out/Components/Surface/index.d.ts +0 -1
- package/out/Components/Surface/init.luau +0 -3
- package/out/Components/Typography/Text.luau +26 -13
- package/out/Components/index.d.ts +1 -0
- package/out/Components/init.luau +3 -0
- package/out/Helpers/create-ui-story.d.ts +6 -4
- package/out/Helpers/create-ui-story.luau +15 -4
- 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 +7 -2
- package/out/Providers/registry.provider.d.ts +1 -0
- package/out/Providers/registry.provider.luau +5 -0
- package/out/Theme/theme.template.d.ts +72 -1
- package/out/Theme/themes/dark.theme.luau +47 -0
- package/out/Theme/themes/default.theme.luau +116 -1
- package/out/Theme/themes/sandstone.theme.luau +59 -0
- package/package.json +4 -2
- 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 HStack = TS.import(script, script.Parent, "HStack").HStack
|
|
8
5
|
local VStack = TS.import(script, script.Parent, "VStack").VStack
|
|
9
6
|
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
@@ -20,11 +17,10 @@ local TypographyHelper = _Helpers.TypographyHelper
|
|
|
20
17
|
local _HoverButton = TS.import(script, script.Parent.Parent, "Input", "HoverButton")
|
|
21
18
|
local HoverButton = _HoverButton.HoverButton
|
|
22
19
|
local HoverButtonContext = _HoverButton.HoverButtonContext
|
|
23
|
-
local
|
|
24
|
-
local function Tab(props)
|
|
20
|
+
local function Tab(_props)
|
|
25
21
|
return nil
|
|
26
22
|
end
|
|
27
|
-
local function TabTitle(
|
|
23
|
+
local function TabTitle(_props)
|
|
28
24
|
return nil
|
|
29
25
|
end
|
|
30
26
|
local function TabContent(props)
|
|
@@ -60,32 +56,12 @@ local function TabButtonContent(props)
|
|
|
60
56
|
typography = TypographyHelper:getTypography(theme, nil, intent.typography),
|
|
61
57
|
}))
|
|
62
58
|
end
|
|
63
|
-
local Tabs
|
|
64
|
-
|
|
65
|
-
local
|
|
66
|
-
|
|
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
|
-
}
|
|
59
|
+
local Tabs = React.forwardRef(function(props, ref)
|
|
60
|
+
local theme = React.useContext(CleanThemeContext)
|
|
61
|
+
local selected, setSelected = React.useState(0)
|
|
62
|
+
local tabs = React.useMemo(function()
|
|
87
63
|
local tabs = {}
|
|
88
|
-
React.Children.forEach(
|
|
64
|
+
React.Children.forEach(props.children, function(child)
|
|
89
65
|
if not React.isValidElement(child) or child.type ~= Tab then
|
|
90
66
|
return nil
|
|
91
67
|
end
|
|
@@ -110,80 +86,85 @@ do
|
|
|
110
86
|
table.insert(tabs, _arg0)
|
|
111
87
|
end
|
|
112
88
|
end)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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)
|
|
89
|
+
return tabs
|
|
90
|
+
end, { props.children })
|
|
91
|
+
local tabCount = #tabs
|
|
92
|
+
React.useEffect(function()
|
|
93
|
+
if selected >= tabCount then
|
|
94
|
+
setSelected(math.max(0, tabCount - 1))
|
|
155
95
|
end
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
96
|
+
end, { selected, tabCount })
|
|
97
|
+
local selectedTab = tabs[selected + 1]
|
|
98
|
+
local buttonDefault = ColorHelper:getIntentColors(theme, "primary", "default", theme.components.tabs.button.intents)
|
|
99
|
+
local buttonHover = ColorHelper:getIntentColors(theme, "primary", "hover", theme.components.tabs.button.intents)
|
|
100
|
+
local buttonFocus = ColorHelper:getIntentColors(theme, "primary", "focus", theme.components.tabs.button.intents)
|
|
101
|
+
local _exp = React.createElement(Corners, {
|
|
102
|
+
radius = theme.components.tabs.list.cornerRadius,
|
|
103
|
+
})
|
|
104
|
+
local _exp_1 = React.createElement(Padding, {
|
|
105
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.tabs.list.spacing),
|
|
106
|
+
})
|
|
107
|
+
-- ▼ ReadonlyArray.map ▼
|
|
108
|
+
local _newValue = table.create(#tabs)
|
|
109
|
+
local _callback = function(tab, index)
|
|
110
|
+
return React.createElement(HoverButton, {
|
|
111
|
+
isSelected = selected == index,
|
|
112
|
+
default = {
|
|
113
|
+
Size = UDim2.fromScale(0, 0),
|
|
114
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
115
|
+
ImageTransparency = 1,
|
|
116
|
+
BackgroundColor3 = buttonDefault.backgroundColor,
|
|
117
|
+
BackgroundTransparency = buttonDefault.backgroundTransparency,
|
|
118
|
+
BorderSizePixel = 0,
|
|
119
|
+
AutoButtonColor = false,
|
|
120
|
+
Event = {
|
|
121
|
+
Activated = function()
|
|
122
|
+
setSelected(index)
|
|
123
|
+
end,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
hover = {
|
|
127
|
+
BackgroundColor3 = buttonHover.backgroundColor,
|
|
128
|
+
BackgroundTransparency = buttonHover.backgroundTransparency,
|
|
129
|
+
},
|
|
130
|
+
focus = {
|
|
131
|
+
BackgroundColor3 = buttonFocus.backgroundColor,
|
|
132
|
+
BackgroundTransparency = buttonFocus.backgroundTransparency,
|
|
133
|
+
},
|
|
134
|
+
}, React.createElement(TabButtonContent, {
|
|
135
|
+
text = tab.title.text,
|
|
136
|
+
}))
|
|
180
137
|
end
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
138
|
+
for _k, _v in tabs do
|
|
139
|
+
_newValue[_k] = _callback(_v, _k - 1, tabs)
|
|
140
|
+
end
|
|
141
|
+
-- ▲ ReadonlyArray.map ▲
|
|
142
|
+
local _exp_2 = React.createElement(Container, {
|
|
143
|
+
ref = ref,
|
|
144
|
+
BackgroundColor3 = theme.components.tabs.list.backgroundColor,
|
|
145
|
+
width = "100%",
|
|
146
|
+
BackgroundTransparency = 0,
|
|
147
|
+
}, _exp, _exp_1, React.createElement(HStack, nil, _newValue))
|
|
148
|
+
local _exp_3 = React.createElement("uistroke", {
|
|
149
|
+
Thickness = theme.components.tabs.borderThickness,
|
|
150
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
151
|
+
Color = theme.components.tabs.borderColor,
|
|
152
|
+
})
|
|
153
|
+
local _exp_4 = React.createElement(Padding, {
|
|
154
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.tabs.spacing),
|
|
155
|
+
})
|
|
156
|
+
local _exp_5 = React.createElement(Corners, {
|
|
157
|
+
radius = theme.components.tabs.list.cornerRadius,
|
|
158
|
+
})
|
|
159
|
+
local _result = selectedTab
|
|
160
|
+
if _result ~= nil then
|
|
161
|
+
_result = _result.content
|
|
162
|
+
end
|
|
163
|
+
return React.createElement(VStack, nil, _exp_2, React.createElement(Container, nil, _exp_3, _exp_4, _exp_5, _result))
|
|
164
|
+
end)
|
|
165
|
+
Tabs.Title = TabTitle
|
|
166
|
+
Tabs.Tab = Tab
|
|
167
|
+
Tabs.Content = TabContent
|
|
187
168
|
return {
|
|
188
169
|
Tabs = Tabs,
|
|
189
170
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React from "@rbxts/react";
|
|
1
|
+
import React, { Binding } from "@rbxts/react";
|
|
2
2
|
import { SpacedElementProps } from "../../Interfaces";
|
|
3
3
|
interface VStackProps extends SpacedElementProps {
|
|
4
|
+
valign?: Enum.VerticalAlignment | "Center" | "Top" | "Bottom" | React.Binding<Enum.VerticalAlignment> | undefined;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
HorizontalFlex?: Enum.UIFlexAlignment;
|
|
6
7
|
VerticalFlex?: Enum.UIFlexAlignment;
|
|
8
|
+
VerticalAlignment?: Enum.VerticalAlignment;
|
|
7
9
|
Event?: React.InstanceEvent<UIListLayout>;
|
|
8
10
|
Change?: React.InstanceChangeEvent<UIListLayout>;
|
|
11
|
+
Padding?: UDim | Binding<UDim>;
|
|
9
12
|
}
|
|
10
13
|
export declare function VStack(props: VStackProps): React.JSX.Element;
|
|
11
14
|
export {};
|
|
@@ -5,12 +5,12 @@ local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contex
|
|
|
5
5
|
local SpacingHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SpacingHelper
|
|
6
6
|
local function VStack(props)
|
|
7
7
|
local theme = React.useContext(CleanThemeContext)
|
|
8
|
-
local padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.spacing))
|
|
9
8
|
return React.createElement(React.Fragment, nil, React.createElement("uilistlayout", {
|
|
10
9
|
FillDirection = Enum.FillDirection.Vertical,
|
|
11
10
|
HorizontalFlex = props.HorizontalFlex or Enum.UIFlexAlignment.Fill,
|
|
12
11
|
VerticalFlex = props.VerticalFlex,
|
|
13
|
-
|
|
12
|
+
VerticalAlignment = props.VerticalAlignment or props.valign,
|
|
13
|
+
Padding = props.Padding or UDim.new(0, SpacingHelper:GetPadding(theme, props.spacing)),
|
|
14
14
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
15
15
|
Change = props.Change,
|
|
16
16
|
Event = props.Event,
|
|
@@ -4,6 +4,9 @@ local exports = {}
|
|
|
4
4
|
for _k, _v in TS.import(script, script, "Column") or {} do
|
|
5
5
|
exports[_k] = _v
|
|
6
6
|
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "Accordion") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
7
10
|
for _k, _v in TS.import(script, script, "Container") or {} do
|
|
8
11
|
exports[_k] = _v
|
|
9
12
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import { ButtonProps } from "../Input";
|
|
3
3
|
interface MenuItemProps extends ButtonProps {
|
|
4
4
|
title: string;
|
|
@@ -8,12 +8,8 @@ interface MenuProps {
|
|
|
8
8
|
title: string;
|
|
9
9
|
collapsed?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
state: MenuState;
|
|
17
|
-
render(): React.ReactNode;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
11
|
+
type MenuComponent = React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<Frame>> & {
|
|
12
|
+
Item: typeof MenuItem;
|
|
13
|
+
};
|
|
14
|
+
declare const Menu: MenuComponent;
|
|
15
|
+
export { Menu };
|
|
@@ -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 Button = TS.import(script, script.Parent.Parent, "Input").Button
|
|
8
5
|
local _Layout = TS.import(script, script.Parent.Parent, "Layout")
|
|
9
6
|
local Container = _Layout.Container
|
|
@@ -23,68 +20,44 @@ local function MenuItem(props)
|
|
|
23
20
|
group = true,
|
|
24
21
|
})
|
|
25
22
|
end
|
|
26
|
-
local Menu
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
__tostring = function()
|
|
31
|
-
return "Menu"
|
|
32
|
-
end,
|
|
33
|
-
__index = super,
|
|
34
|
-
})
|
|
35
|
-
Menu.__index = Menu
|
|
36
|
-
function Menu.new(...)
|
|
37
|
-
local self = setmetatable({}, Menu)
|
|
38
|
-
return self:constructor(...) or self
|
|
39
|
-
end
|
|
40
|
-
function Menu:constructor(...)
|
|
41
|
-
super.constructor(self, ...)
|
|
42
|
-
local _object = {}
|
|
43
|
-
local _left = "collapsed"
|
|
44
|
-
local _condition = self.props.collapsed
|
|
45
|
-
if _condition == nil then
|
|
46
|
-
_condition = false
|
|
47
|
-
end
|
|
48
|
-
_object[_left] = _condition
|
|
49
|
-
self.state = _object
|
|
50
|
-
end
|
|
51
|
-
function Menu:render()
|
|
52
|
-
return React.createElement(NavigationContext.Provider, {
|
|
53
|
-
value = {
|
|
54
|
-
collapsed = self.state.collapsed,
|
|
55
|
-
},
|
|
56
|
-
}, React.createElement(Group, nil, React.createElement(VStack, {
|
|
57
|
-
spacing = "sm",
|
|
58
|
-
}, React.createElement(Container, {
|
|
59
|
-
group = true,
|
|
60
|
-
}, React.createElement(HStack, {
|
|
61
|
-
valign = "Center",
|
|
62
|
-
}, React.createElement(Button, {
|
|
63
|
-
icon = "bars",
|
|
64
|
-
Event = {
|
|
65
|
-
Activated = function()
|
|
66
|
-
self:setState(function(state)
|
|
67
|
-
return {
|
|
68
|
-
collapsed = not state.collapsed,
|
|
69
|
-
}
|
|
70
|
-
end)
|
|
71
|
-
end,
|
|
72
|
-
},
|
|
73
|
-
}), not self.state.collapsed and React.createElement(Text, {
|
|
74
|
-
text = self.props.title,
|
|
75
|
-
variant = "heading",
|
|
76
|
-
}))), React.createElement(FlexItem, {
|
|
77
|
-
mode = "Fill",
|
|
78
|
-
}, React.createElement(Scroller, {
|
|
79
|
-
height = "100%",
|
|
80
|
-
}, React.createElement(VStack, {
|
|
81
|
-
spacing = "sm",
|
|
82
|
-
HorizontalFlex = Enum.UIFlexAlignment.None,
|
|
83
|
-
}, self.props.children))))))
|
|
23
|
+
local Menu = React.forwardRef(function(props, ref)
|
|
24
|
+
local _condition = props.collapsed
|
|
25
|
+
if _condition == nil then
|
|
26
|
+
_condition = false
|
|
84
27
|
end
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
28
|
+
local collapsed, setCollapsed = React.useState(_condition)
|
|
29
|
+
return React.createElement(NavigationContext.Provider, {
|
|
30
|
+
value = {
|
|
31
|
+
collapsed = collapsed,
|
|
32
|
+
},
|
|
33
|
+
}, React.createElement(Container, {
|
|
34
|
+
ref = ref,
|
|
35
|
+
}, React.createElement(Group, nil, React.createElement(VStack, {
|
|
36
|
+
spacing = "sm",
|
|
37
|
+
}, React.createElement(Container, {
|
|
38
|
+
group = true,
|
|
39
|
+
}, React.createElement(HStack, {
|
|
40
|
+
valign = "Center",
|
|
41
|
+
}, React.createElement(Button, {
|
|
42
|
+
icon = "bars",
|
|
43
|
+
Event = {
|
|
44
|
+
Activated = function()
|
|
45
|
+
setCollapsed(not collapsed)
|
|
46
|
+
end,
|
|
47
|
+
},
|
|
48
|
+
}), not collapsed and React.createElement(Text, {
|
|
49
|
+
text = props.title,
|
|
50
|
+
variant = "heading",
|
|
51
|
+
}))), React.createElement(FlexItem, {
|
|
52
|
+
mode = "Fill",
|
|
53
|
+
}, React.createElement(Scroller, {
|
|
54
|
+
height = "100%",
|
|
55
|
+
}, React.createElement(VStack, {
|
|
56
|
+
spacing = "sm",
|
|
57
|
+
HorizontalFlex = Enum.UIFlexAlignment.None,
|
|
58
|
+
}, props.children)))))))
|
|
59
|
+
end)
|
|
60
|
+
Menu.Item = MenuItem
|
|
88
61
|
return {
|
|
89
62
|
MenuItem = MenuItem,
|
|
90
63
|
Menu = Menu,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { BackgroundElementProps, ShadowElementProps, SizeElementProps, SpacedElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
|
-
export interface BoxProps extends SpacedElementProps, ShadowElementProps, BackgroundElementProps, ZIndexElementProps, SizeElementProps, React.InstanceProps<Frame> {
|
|
2
|
+
import { BackgroundElementProps, PositionElementProps, ShadowElementProps, SizeElementProps, SpacedElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
|
+
export interface BoxProps extends SpacedElementProps, ShadowElementProps, BackgroundElementProps, ZIndexElementProps, SizeElementProps, PositionElementProps, React.InstanceProps<Frame> {
|
|
4
4
|
'border-thickness'?: number;
|
|
5
5
|
'border-color'?: Color3;
|
|
6
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import { BoxProps } from "./Box";
|
|
3
|
-
import { CleanThemeContext } from "../../Contexts";
|
|
4
3
|
import { IntentElementProps } from "../../Interfaces";
|
|
5
4
|
interface CardHeaderProps extends IntentElementProps {
|
|
6
5
|
children?: React.ReactNode;
|
|
@@ -14,12 +13,10 @@ interface CardFooterProps extends BoxProps, IntentElementProps {
|
|
|
14
13
|
export declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardFooterProps, "ref"> & React.RefAttributes<Frame>>;
|
|
15
14
|
interface CardProps extends BoxProps, IntentElementProps {
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
16
|
+
type CardComponent = React.ForwardRefExoticComponent<CardProps & React.RefAttributes<Frame>> & {
|
|
17
|
+
Header: typeof CardHeader;
|
|
18
|
+
Footer: typeof CardFooter;
|
|
19
|
+
Body: typeof CardBody;
|
|
20
|
+
};
|
|
21
|
+
declare const Card: CardComponent;
|
|
22
|
+
export { Card };
|
|
@@ -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 Box = TS.import(script, script.Parent, "Box").Box
|
|
8
5
|
local _Layout = TS.import(script, script.Parent.Parent, "Layout")
|
|
9
6
|
local Container = _Layout.Container
|
|
@@ -12,6 +9,7 @@ local VStack = _Layout.VStack
|
|
|
12
9
|
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
13
10
|
local ColorHelper = _Helpers.ColorHelper
|
|
14
11
|
local CssHelper = _Helpers.CssHelper
|
|
12
|
+
local SizeHelper = _Helpers.SizeHelper
|
|
15
13
|
local SpacingHelper = _Helpers.SpacingHelper
|
|
16
14
|
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
17
15
|
local Padding = TS.import(script, script.Parent.Parent, "Decorator").Padding
|
|
@@ -28,8 +26,8 @@ local CardHeader = React.forwardRef(function(props, ref)
|
|
|
28
26
|
for _k, _v in props do
|
|
29
27
|
_attributes[_k] = _v
|
|
30
28
|
end
|
|
31
|
-
_attributes.Size = UDim2.fromScale(
|
|
32
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.
|
|
29
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
30
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
33
31
|
_attributes.BackgroundTransparency = intent.backgroundTransparency
|
|
34
32
|
_attributes.BackgroundColor3 = intent.backgroundColor
|
|
35
33
|
_attributes.BorderSizePixel = 0
|
|
@@ -51,12 +49,12 @@ local CardBody = React.forwardRef(function(props, ref)
|
|
|
51
49
|
local padding = SpacingHelper:ResolveNumberPadding(SpacingHelper:GetPadding(theme, "md", theme.components.card.header.spacing))
|
|
52
50
|
local _attributes = {
|
|
53
51
|
ref = ref,
|
|
52
|
+
Size = SizeHelper:GetSize(props, UDim2.fromScale(0, 0)),
|
|
54
53
|
}
|
|
55
54
|
for _k, _v in props do
|
|
56
55
|
_attributes[_k] = _v
|
|
57
56
|
end
|
|
58
|
-
_attributes.
|
|
59
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.Y
|
|
57
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
60
58
|
return React.createElement(FlexItem, nil, React.createElement(Container, _attributes, React.createElement(Padding, {
|
|
61
59
|
resolvedPadding = padding,
|
|
62
60
|
}), props.children))
|
|
@@ -73,8 +71,8 @@ local CardFooter = React.forwardRef(function(props, ref)
|
|
|
73
71
|
for _k, _v in props do
|
|
74
72
|
_attributes[_k] = _v
|
|
75
73
|
end
|
|
76
|
-
_attributes.Size = UDim2.fromScale(
|
|
77
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.
|
|
74
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
75
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
78
76
|
_attributes.BackgroundTransparency = intent.backgroundTransparency
|
|
79
77
|
_attributes.BackgroundColor3 = intent.backgroundColor
|
|
80
78
|
_attributes.BorderSizePixel = 0
|
|
@@ -91,45 +89,39 @@ local CardFooter = React.forwardRef(function(props, ref)
|
|
|
91
89
|
BottomRightRadius = corners,
|
|
92
90
|
}), props.children)
|
|
93
91
|
end)
|
|
94
|
-
local Card
|
|
95
|
-
|
|
96
|
-
local
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return "Card"
|
|
100
|
-
end,
|
|
101
|
-
__index = super,
|
|
102
|
-
})
|
|
103
|
-
Card.__index = Card
|
|
104
|
-
function Card.new(...)
|
|
105
|
-
local self = setmetatable({}, Card)
|
|
106
|
-
return self:constructor(...) or self
|
|
107
|
-
end
|
|
108
|
-
function Card:constructor(...)
|
|
109
|
-
super.constructor(self, ...)
|
|
110
|
-
end
|
|
111
|
-
function Card:render()
|
|
112
|
-
local contextValue = {
|
|
113
|
-
intent = self.props.intent,
|
|
92
|
+
local Card = React.forwardRef(function(props, ref)
|
|
93
|
+
local theme = React.useContext(CleanThemeContext)
|
|
94
|
+
local contextValue = React.useMemo(function()
|
|
95
|
+
return {
|
|
96
|
+
intent = props.intent,
|
|
114
97
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
98
|
+
end, { props.intent })
|
|
99
|
+
local intent = ColorHelper:getIntentColors(theme, props.intent or "primary", "default", theme.components.card.header.intents)
|
|
100
|
+
local _attributes = table.clone(props)
|
|
101
|
+
setmetatable(_attributes, nil)
|
|
102
|
+
_attributes.ref = ref
|
|
103
|
+
_attributes.center = nil
|
|
104
|
+
_attributes.spacing = "None"
|
|
105
|
+
_attributes["border-color"] = intent.borderColor
|
|
106
|
+
local cardBox = (React.createElement(Box, _attributes, React.createElement(VStack, {
|
|
107
|
+
spacing = "None",
|
|
108
|
+
}, props.children)))
|
|
109
|
+
local isCentered = props.center == true and props.Position == nil and props.AnchorPoint == nil
|
|
110
|
+
return React.createElement(CardContext.Provider, {
|
|
111
|
+
value = contextValue,
|
|
112
|
+
}, if isCentered then (React.createElement(Container, {
|
|
113
|
+
Size = UDim2.fromScale(1, 1),
|
|
114
|
+
ZIndex = props.ZIndex,
|
|
115
|
+
LayoutOrder = props.LayoutOrder,
|
|
116
|
+
}, React.createElement("uilistlayout", {
|
|
117
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
118
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
119
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
120
|
+
}), cardBox)) else cardBox)
|
|
121
|
+
end)
|
|
122
|
+
Card.Header = CardHeader
|
|
123
|
+
Card.Footer = CardFooter
|
|
124
|
+
Card.Body = CardBody
|
|
133
125
|
return {
|
|
134
126
|
CardHeader = CardHeader,
|
|
135
127
|
CardBody = CardBody,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Binding } from "@rbxts/react";
|
|
2
2
|
import { IconElementProps, ScalableElementProps } from "../../Interfaces/";
|
|
3
|
-
export interface IconProps extends IconElementProps, ScalableElementProps {
|
|
3
|
+
export interface IconProps extends IconElementProps, ScalableElementProps, React.InstanceProps<ImageLabel> {
|
|
4
4
|
color?: Color3;
|
|
5
5
|
Size?: UDim2;
|
|
6
6
|
spinning?: boolean;
|
|
@@ -54,6 +54,7 @@ function Icon(props)
|
|
|
54
54
|
return React.createElement("imagelabel", {
|
|
55
55
|
Rotation = props.Rotation,
|
|
56
56
|
Size = props.Size or UDim2.fromOffset(size, size),
|
|
57
|
+
LayoutOrder = props.LayoutOrder,
|
|
57
58
|
Image = if iconId == nil then nil else `rbxassetid://{iconId}`,
|
|
58
59
|
BackgroundTransparency = 1,
|
|
59
60
|
ImageColor3 = props.color or theme.colors.intents.primary.default.textColor,
|