@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 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,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,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
|
|
@@ -28,8 +25,8 @@ local CardHeader = React.forwardRef(function(props, ref)
|
|
|
28
25
|
for _k, _v in props do
|
|
29
26
|
_attributes[_k] = _v
|
|
30
27
|
end
|
|
31
|
-
_attributes.Size = UDim2.fromScale(
|
|
32
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.
|
|
28
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
29
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
33
30
|
_attributes.BackgroundTransparency = intent.backgroundTransparency
|
|
34
31
|
_attributes.BackgroundColor3 = intent.backgroundColor
|
|
35
32
|
_attributes.BorderSizePixel = 0
|
|
@@ -55,8 +52,8 @@ local CardBody = React.forwardRef(function(props, ref)
|
|
|
55
52
|
for _k, _v in props do
|
|
56
53
|
_attributes[_k] = _v
|
|
57
54
|
end
|
|
58
|
-
_attributes.Size = UDim2.fromScale(
|
|
59
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.
|
|
55
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
56
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
60
57
|
return React.createElement(FlexItem, nil, React.createElement(Container, _attributes, React.createElement(Padding, {
|
|
61
58
|
resolvedPadding = padding,
|
|
62
59
|
}), props.children))
|
|
@@ -73,8 +70,8 @@ local CardFooter = React.forwardRef(function(props, ref)
|
|
|
73
70
|
for _k, _v in props do
|
|
74
71
|
_attributes[_k] = _v
|
|
75
72
|
end
|
|
76
|
-
_attributes.Size = UDim2.fromScale(
|
|
77
|
-
_attributes.AutomaticSize = Enum.AutomaticSize.
|
|
73
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
74
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
78
75
|
_attributes.BackgroundTransparency = intent.backgroundTransparency
|
|
79
76
|
_attributes.BackgroundColor3 = intent.backgroundColor
|
|
80
77
|
_attributes.BorderSizePixel = 0
|
|
@@ -91,45 +88,28 @@ local CardFooter = React.forwardRef(function(props, ref)
|
|
|
91
88
|
BottomRightRadius = corners,
|
|
92
89
|
}), props.children)
|
|
93
90
|
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,
|
|
91
|
+
local Card = React.forwardRef(function(props, ref)
|
|
92
|
+
local theme = React.useContext(CleanThemeContext)
|
|
93
|
+
local contextValue = React.useMemo(function()
|
|
94
|
+
return {
|
|
95
|
+
intent = props.intent,
|
|
114
96
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Card = ReactComponent(Card) or Card
|
|
132
|
-
end
|
|
97
|
+
end, { props.intent })
|
|
98
|
+
local intent = ColorHelper:getIntentColors(theme, props.intent or "primary", "default", theme.components.card.header.intents)
|
|
99
|
+
local _attributes = table.clone(props)
|
|
100
|
+
setmetatable(_attributes, nil)
|
|
101
|
+
_attributes.ref = ref
|
|
102
|
+
_attributes.spacing = "None"
|
|
103
|
+
_attributes["border-color"] = intent.borderColor
|
|
104
|
+
return React.createElement(CardContext.Provider, {
|
|
105
|
+
value = contextValue,
|
|
106
|
+
}, React.createElement(Box, _attributes, React.createElement(VStack, {
|
|
107
|
+
spacing = "None",
|
|
108
|
+
}, props.children)))
|
|
109
|
+
end)
|
|
110
|
+
Card.Header = CardHeader
|
|
111
|
+
Card.Footer = CardFooter
|
|
112
|
+
Card.Body = CardBody
|
|
133
113
|
return {
|
|
134
114
|
CardHeader = CardHeader,
|
|
135
115
|
CardBody = CardBody,
|
package/out/Components/init.luau
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssShadow, CssSize } from "../Interfaces/clean.element.props";
|
|
1
|
+
import { CssBoxShadow, CssShadow, CssSize } from "../Interfaces/clean.element.props";
|
|
2
2
|
interface ParsedShadow {
|
|
3
3
|
offset: UDim2;
|
|
4
4
|
blurRadius: UDim;
|
|
@@ -8,5 +8,6 @@ export declare class CssHelper {
|
|
|
8
8
|
static parseCssShadow(value: CssShadow): ParsedShadow | undefined;
|
|
9
9
|
private static isZero;
|
|
10
10
|
static parseCssSize(value: CssSize): UDim;
|
|
11
|
+
static ResolveShadow(shadow: CssBoxShadow): React.InstanceProps<UIShadow>;
|
|
11
12
|
}
|
|
12
13
|
export {};
|
|
@@ -108,6 +108,31 @@ do
|
|
|
108
108
|
end
|
|
109
109
|
return UDim.new(0, _condition)
|
|
110
110
|
end
|
|
111
|
+
function CssHelper:ResolveShadow(shadow)
|
|
112
|
+
local offset = self:parseCssShadow(shadow.shadow)
|
|
113
|
+
local _object = {}
|
|
114
|
+
local _left = "Offset"
|
|
115
|
+
local _result = offset
|
|
116
|
+
if _result ~= nil then
|
|
117
|
+
_result = _result.offset
|
|
118
|
+
end
|
|
119
|
+
_object[_left] = _result
|
|
120
|
+
local _left_1 = "BlurRadius"
|
|
121
|
+
local _result_1 = offset
|
|
122
|
+
if _result_1 ~= nil then
|
|
123
|
+
_result_1 = _result_1.blurRadius
|
|
124
|
+
end
|
|
125
|
+
_object[_left_1] = _result_1
|
|
126
|
+
local _left_2 = "Spread"
|
|
127
|
+
local _result_2 = offset
|
|
128
|
+
if _result_2 ~= nil then
|
|
129
|
+
_result_2 = _result_2.spread
|
|
130
|
+
end
|
|
131
|
+
_object[_left_2] = _result_2
|
|
132
|
+
_object.Color = shadow.color
|
|
133
|
+
_object.Transparency = shadow.transparency
|
|
134
|
+
return _object
|
|
135
|
+
end
|
|
111
136
|
end
|
|
112
137
|
return {
|
|
113
138
|
CssHelper = CssHelper,
|
|
@@ -65,7 +65,7 @@ do
|
|
|
65
65
|
if props.width == "Auto" then
|
|
66
66
|
return Enum.AutomaticSize.X
|
|
67
67
|
end
|
|
68
|
-
local _condition = props.Size
|
|
68
|
+
local _condition = props.Size ~= nil
|
|
69
69
|
if not _condition then
|
|
70
70
|
local _condition_1 = props.width
|
|
71
71
|
if _condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1 then
|
|
@@ -47,6 +47,11 @@ export type CssBreakpointSize = {
|
|
|
47
47
|
};
|
|
48
48
|
export type CssQuad = CssSize | `${CssSize} ${CssSize}` | `${CssSize} ${CssSize} ${CssSize}` | `${CssSize} ${CssSize} ${CssSize} ${CssSize}`;
|
|
49
49
|
export type CssShadow = CssQuad;
|
|
50
|
+
export type CssBoxShadow = {
|
|
51
|
+
shadow: CssShadow;
|
|
52
|
+
color: Color3;
|
|
53
|
+
transparency: number;
|
|
54
|
+
};
|
|
50
55
|
export type CssPadding = CssQuad;
|
|
51
56
|
export type ResponsiveCssSize = CssSize | CssBreakpointSize;
|
|
52
57
|
export interface ZIndexElementProps {
|
|
@@ -20,6 +20,7 @@ export interface RegistryContextValue {
|
|
|
20
20
|
unregister: <T extends defined>(guiObject: GuiObject, key: RegistryKey<T>) => void;
|
|
21
21
|
get: <T extends defined>(guiObject: GuiObject, key: RegistryKey<T>) => T | undefined;
|
|
22
22
|
getAll: <T extends defined>(key: RegistryKey<T>) => T[];
|
|
23
|
+
GetNextId: () => string;
|
|
23
24
|
}
|
|
24
25
|
export declare const RegistryContext: React.Context<RegistryContextValue | undefined>;
|
|
25
26
|
export interface RegistryProviderProps {
|
|
@@ -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 HttpService = TS.import(script, TS.getModule(script, "@rbxts", "services")).HttpService
|
|
4
5
|
-- This registry is used to keep a global map of GuiObjects => React components
|
|
5
6
|
-- For example Droppable zones use this to register themselves
|
|
6
7
|
local DroppableRegistryKey = {
|
|
@@ -72,11 +73,15 @@ local function RegistryProvider(props)
|
|
|
72
73
|
end
|
|
73
74
|
return result
|
|
74
75
|
end
|
|
76
|
+
local GetNextId = function()
|
|
77
|
+
return HttpService:GenerateGUID(false)
|
|
78
|
+
end
|
|
75
79
|
local contextValue = {
|
|
76
80
|
register = register,
|
|
77
81
|
unregister = unregister,
|
|
78
82
|
get = get,
|
|
79
83
|
getAll = getAll,
|
|
84
|
+
GetNextId = GetNextId,
|
|
80
85
|
}
|
|
81
86
|
return React.createElement(RegistryContext.Provider, {
|
|
82
87
|
value = contextValue,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssShadow, CssSize, Breakpoint, BreakpointValue, ScaleSizeValue, ScaleSize, Intent, IconSet, TextVariant, ButtonFlag, PositionElementProps } from "../Interfaces/";
|
|
1
|
+
import { CssShadow, CssSize, Breakpoint, BreakpointValue, ScaleSizeValue, ScaleSize, Intent, IconSet, TextVariant, ButtonFlag, PositionElementProps, CssBoxShadow } from "../Interfaces/";
|
|
2
2
|
export interface TypographyStyle {
|
|
3
3
|
font: Enum.Font;
|
|
4
4
|
size: Enum.FontSize;
|
|
@@ -188,6 +188,20 @@ export interface CleanTheme {
|
|
|
188
188
|
cornerRadius: CssSize;
|
|
189
189
|
intents?: Partial<Record<Intent, Partial<IntentScheme>>>;
|
|
190
190
|
};
|
|
191
|
+
pie: {
|
|
192
|
+
colors: Color3[];
|
|
193
|
+
boxShadow?: CssBoxShadow;
|
|
194
|
+
hoverDarken: number;
|
|
195
|
+
labels: {
|
|
196
|
+
spacing?: ScaleSizeValue<number>;
|
|
197
|
+
backgroundColor?: Color3;
|
|
198
|
+
backgroundTransparency?: number;
|
|
199
|
+
typography?: Partial<TypographyStyle>;
|
|
200
|
+
borderColor?: Color3;
|
|
201
|
+
borderThickness?: number;
|
|
202
|
+
cornerRadius?: CssSize;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
191
205
|
};
|
|
192
206
|
icons: Partial<IconSet>;
|
|
193
207
|
iconSize: ScaleSizeValue<number>;
|