@rbxts/react-clean-ui 1.2.5 → 1.2.7
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/Input/Button.luau +109 -64
- package/out/Components/Input/Input.luau +18 -13
- package/out/Components/Input/Select.luau +34 -19
- package/out/Components/Layout/BreakpointProvider.d.ts +8 -0
- package/out/Components/Layout/BreakpointProvider.luau +67 -0
- package/out/Components/Layout/Tabs.d.ts +3 -0
- package/out/Components/Layout/Tabs.luau +101 -21
- package/out/Components/Layout/index.d.ts +1 -0
- package/out/Components/Layout/init.luau +3 -0
- package/out/Components/Surface/Badge.d.ts +10 -0
- package/out/Components/Surface/Badge.luau +89 -0
- package/out/Components/Surface/index.d.ts +1 -0
- package/out/Components/Surface/init.luau +3 -0
- package/out/Contexts/breakpoint.context.d.ts +9 -0
- package/out/Contexts/breakpoint.context.luau +65 -0
- package/out/Contexts/index.d.ts +1 -0
- package/out/Contexts/init.luau +3 -0
- package/out/Helpers/color.helper.luau +11 -1
- package/out/Interfaces/semantics.d.ts +1 -1
- package/out/Theme/theme.style.d.ts +1 -0
- package/out/Theme/theme.template.d.ts +18 -2
- package/out/Theme/themes/dark.theme.luau +99 -0
- package/out/Theme/themes/default.theme.luau +130 -0
- package/out/Theme/themes/sandstone.theme.luau +90 -0
- package/out/Theme/themes/wooden.theme.luau +132 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ local Padding = _Decorator.Padding
|
|
|
14
14
|
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
15
15
|
local ColorHelper = _Helpers.ColorHelper
|
|
16
16
|
local CssHelper = _Helpers.CssHelper
|
|
17
|
+
local SizeHelper = _Helpers.SizeHelper
|
|
17
18
|
local SpacingHelper = _Helpers.SpacingHelper
|
|
18
19
|
local TypographyHelper = _Helpers.TypographyHelper
|
|
19
20
|
local _HoverButton = TS.import(script, script.Parent.Parent, "Input", "HoverButton")
|
|
@@ -21,11 +22,44 @@ local HoverButton = _HoverButton.HoverButton
|
|
|
21
22
|
local HoverButtonContext = _HoverButton.HoverButtonContext
|
|
22
23
|
local TabsContext = React.createContext({
|
|
23
24
|
selected = nil,
|
|
24
|
-
|
|
25
|
+
claimTab = function() end,
|
|
26
|
+
selectTab = function() end,
|
|
25
27
|
})
|
|
28
|
+
local TabsListContext = React.createContext({
|
|
29
|
+
fill = false,
|
|
30
|
+
})
|
|
31
|
+
local function TabButtonCorners()
|
|
32
|
+
local theme = React.useContext(CleanThemeContext)
|
|
33
|
+
local cornerRadius = theme.components.tabs.button.cornerRadius
|
|
34
|
+
if not (type(cornerRadius) == "table") then
|
|
35
|
+
return React.createElement(Corners, {
|
|
36
|
+
radius = theme.components.tabs.list.cornerRadius,
|
|
37
|
+
})
|
|
38
|
+
end
|
|
39
|
+
local fallback = SizeHelper:toUDim(theme.components.tabs.list.cornerRadius)
|
|
40
|
+
local topLeftRadius = if cornerRadius.topLeft ~= nil then CssHelper:parseCssSize(cornerRadius.topLeft) else fallback
|
|
41
|
+
local topRightRadius = if cornerRadius.topRight ~= nil then CssHelper:parseCssSize(cornerRadius.topRight) else fallback
|
|
42
|
+
local bottomLeftRadius = if cornerRadius.bottomLeft ~= nil then CssHelper:parseCssSize(cornerRadius.bottomLeft) else fallback
|
|
43
|
+
local bottomRightRadius = if cornerRadius.bottomRight ~= nil then CssHelper:parseCssSize(cornerRadius.bottomRight) else fallback
|
|
44
|
+
local isZero = function(radius)
|
|
45
|
+
return radius.Scale == 0 and radius.Offset == 0
|
|
46
|
+
end
|
|
47
|
+
if isZero(topLeftRadius) and isZero(topRightRadius) and isZero(bottomLeftRadius) and isZero(bottomRightRadius) then
|
|
48
|
+
return nil
|
|
49
|
+
end
|
|
50
|
+
return React.createElement("uicorner", {
|
|
51
|
+
key = "Corners",
|
|
52
|
+
TopLeftRadius = topLeftRadius,
|
|
53
|
+
TopRightRadius = topRightRadius,
|
|
54
|
+
BottomLeftRadius = bottomLeftRadius,
|
|
55
|
+
BottomRightRadius = bottomRightRadius,
|
|
56
|
+
})
|
|
57
|
+
end
|
|
26
58
|
local function TabButtonContent(props)
|
|
27
59
|
local theme = React.useContext(CleanThemeContext)
|
|
28
60
|
local hover = React.useContext(HoverButtonContext)
|
|
61
|
+
local _binding = React.useContext(TabsListContext)
|
|
62
|
+
local fill = _binding.fill
|
|
29
63
|
local _result = hover
|
|
30
64
|
if _result ~= nil then
|
|
31
65
|
_result = _result.isSelected
|
|
@@ -41,13 +75,29 @@ local function TabButtonContent(props)
|
|
|
41
75
|
_result_1 = if _result_2 then "hover" else "default"
|
|
42
76
|
end
|
|
43
77
|
local intent = ColorHelper:getIntentColors(theme, "primary", _result_1, theme.components.tabs.button.intents)
|
|
44
|
-
|
|
45
|
-
|
|
78
|
+
local _condition = intent.borderThickness
|
|
79
|
+
if _condition == nil then
|
|
80
|
+
_condition = theme.components.tabs.button.borderThickness
|
|
81
|
+
end
|
|
82
|
+
local borderThickness = _condition
|
|
83
|
+
return React.createElement(React.Fragment, nil, React.createElement(TabButtonCorners), borderThickness > 0 and (React.createElement("uistroke", {
|
|
84
|
+
key = "Stroke",
|
|
85
|
+
Thickness = borderThickness,
|
|
86
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
87
|
+
Color = intent.borderColor,
|
|
88
|
+
})), React.createElement(Gradient, {
|
|
89
|
+
value = intent.backgroundGradient,
|
|
46
90
|
}), React.createElement(Padding, {
|
|
47
91
|
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props, theme.components.tabs.button.spacing, theme.components.tabs.button.padding),
|
|
48
92
|
}), React.createElement(BoxShadow, {
|
|
49
93
|
value = intent.boxShadow,
|
|
50
|
-
}), React.createElement(
|
|
94
|
+
}), fill and (React.createElement("uilistlayout", {
|
|
95
|
+
key = "TitleLayout",
|
|
96
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
97
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
98
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
99
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
100
|
+
})), React.createElement(Text, {
|
|
51
101
|
name = "TabTitleText",
|
|
52
102
|
TextColor3 = intent.textColor,
|
|
53
103
|
text = props.text,
|
|
@@ -58,16 +108,13 @@ local function TabTitle(props)
|
|
|
58
108
|
local theme = React.useContext(CleanThemeContext)
|
|
59
109
|
local _binding = React.useContext(TabsContext)
|
|
60
110
|
local selected = _binding.selected
|
|
61
|
-
local
|
|
111
|
+
local claimTab = _binding.claimTab
|
|
112
|
+
local selectTab = _binding.selectTab
|
|
113
|
+
local _binding_1 = React.useContext(TabsListContext)
|
|
114
|
+
local fill = _binding_1.fill
|
|
62
115
|
local isSelected = selected == props.value
|
|
63
116
|
React.useEffect(function()
|
|
64
|
-
|
|
65
|
-
local _condition = current
|
|
66
|
-
if _condition == nil then
|
|
67
|
-
_condition = props.value
|
|
68
|
-
end
|
|
69
|
-
return _condition
|
|
70
|
-
end)
|
|
117
|
+
claimTab(props.value)
|
|
71
118
|
end, {})
|
|
72
119
|
local buttonDefault = ColorHelper:getIntentColors(theme, "primary", "default", theme.components.tabs.button.intents)
|
|
73
120
|
local buttonHover = ColorHelper:getIntentColors(theme, "primary", "hover", theme.components.tabs.button.intents)
|
|
@@ -82,7 +129,7 @@ local function TabTitle(props)
|
|
|
82
129
|
name = `TabButton-{props.value}`,
|
|
83
130
|
default = {
|
|
84
131
|
Size = UDim2.fromScale(0, 0),
|
|
85
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
132
|
+
AutomaticSize = if fill then Enum.AutomaticSize.Y else Enum.AutomaticSize.XY,
|
|
86
133
|
BackgroundColor3 = buttonDefault.backgroundColor,
|
|
87
134
|
BackgroundTransparency = buttonDefault.backgroundTransparency,
|
|
88
135
|
BorderSizePixel = 0,
|
|
@@ -96,7 +143,7 @@ local function TabTitle(props)
|
|
|
96
143
|
TileSize = buttonDefaultBackgroundImage.TileSize,
|
|
97
144
|
Event = {
|
|
98
145
|
Activated = function()
|
|
99
|
-
|
|
146
|
+
selectTab(props.value)
|
|
100
147
|
end,
|
|
101
148
|
},
|
|
102
149
|
},
|
|
@@ -153,7 +200,15 @@ local TabsList = React.forwardRef(function(props, ref)
|
|
|
153
200
|
value = theme.components.tabs.list.backgroundGradient,
|
|
154
201
|
}), React.createElement(Padding, {
|
|
155
202
|
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.tabs.list.spacing, theme.components.tabs.list.padding),
|
|
156
|
-
}), React.createElement(
|
|
203
|
+
}), React.createElement(TabsListContext.Provider, {
|
|
204
|
+
value = {
|
|
205
|
+
fill = props.fill == true,
|
|
206
|
+
},
|
|
207
|
+
}, React.createElement(HStack, {
|
|
208
|
+
HorizontalFlex = if props.fill then Enum.UIFlexAlignment.Fill else nil,
|
|
209
|
+
Wraps = if props.fill then false else nil,
|
|
210
|
+
Padding = if theme.components.tabs.list.gap ~= nil then UDim.new(0, theme.components.tabs.list.gap) else nil,
|
|
211
|
+
}, props.children)))
|
|
157
212
|
end)
|
|
158
213
|
local TabsBody = React.forwardRef(function(props, ref)
|
|
159
214
|
local theme = React.useContext(CleanThemeContext)
|
|
@@ -162,12 +217,12 @@ local TabsBody = React.forwardRef(function(props, ref)
|
|
|
162
217
|
ref = ref,
|
|
163
218
|
width = "100%",
|
|
164
219
|
backgroundImage = props.backgroundImage or theme.components.tabs.backgroundImage,
|
|
165
|
-
}, React.createElement("uistroke", {
|
|
220
|
+
}, theme.components.tabs.borderThickness > 0 and (React.createElement("uistroke", {
|
|
166
221
|
key = "Stroke",
|
|
167
222
|
Thickness = theme.components.tabs.borderThickness,
|
|
168
223
|
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
169
224
|
Color = theme.components.tabs.borderColor,
|
|
170
|
-
}), React.createElement(Padding, {
|
|
225
|
+
})), React.createElement(Padding, {
|
|
171
226
|
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.tabs.spacing, theme.components.tabs.padding),
|
|
172
227
|
}), React.createElement(Corners, {
|
|
173
228
|
radius = theme.components.tabs.cornerRadius,
|
|
@@ -176,16 +231,41 @@ local TabsBody = React.forwardRef(function(props, ref)
|
|
|
176
231
|
}), props.children)
|
|
177
232
|
end)
|
|
178
233
|
local Tabs = React.forwardRef(function(props, _ref)
|
|
179
|
-
local
|
|
234
|
+
local theme = React.useContext(CleanThemeContext)
|
|
235
|
+
local uncontrolledSelected, setUncontrolledSelected = React.useState(props.defaultValue)
|
|
236
|
+
local controlled = props.value ~= nil
|
|
237
|
+
local selected = if controlled then props.value else uncontrolledSelected
|
|
238
|
+
local onValueChange = props.onValueChange
|
|
180
239
|
local contextValue = React.useMemo(function()
|
|
181
240
|
return {
|
|
182
241
|
selected = selected,
|
|
183
|
-
|
|
242
|
+
claimTab = function(value)
|
|
243
|
+
if not controlled then
|
|
244
|
+
setUncontrolledSelected(function(current)
|
|
245
|
+
local _condition = current
|
|
246
|
+
if _condition == nil then
|
|
247
|
+
_condition = value
|
|
248
|
+
end
|
|
249
|
+
return _condition
|
|
250
|
+
end)
|
|
251
|
+
end
|
|
252
|
+
end,
|
|
253
|
+
selectTab = function(value)
|
|
254
|
+
if not controlled then
|
|
255
|
+
setUncontrolledSelected(value)
|
|
256
|
+
end
|
|
257
|
+
local _result = onValueChange
|
|
258
|
+
if _result ~= nil then
|
|
259
|
+
_result(value)
|
|
260
|
+
end
|
|
261
|
+
end,
|
|
184
262
|
}
|
|
185
|
-
end, { selected })
|
|
263
|
+
end, { selected, controlled, onValueChange })
|
|
186
264
|
return React.createElement(TabsContext.Provider, {
|
|
187
265
|
value = contextValue,
|
|
188
|
-
}, React.createElement(VStack,
|
|
266
|
+
}, React.createElement(VStack, {
|
|
267
|
+
Padding = if theme.components.tabs.gap ~= nil then UDim.new(0, theme.components.tabs.gap) else nil,
|
|
268
|
+
}, props.children))
|
|
189
269
|
end)
|
|
190
270
|
Tabs.List = TabsList
|
|
191
271
|
Tabs.Body = TabsBody
|
|
@@ -7,6 +7,9 @@ end
|
|
|
7
7
|
for _k, _v in TS.import(script, script, "Accordion") or {} do
|
|
8
8
|
exports[_k] = _v
|
|
9
9
|
end
|
|
10
|
+
for _k, _v in TS.import(script, script, "BreakpointProvider") or {} do
|
|
11
|
+
exports[_k] = _v
|
|
12
|
+
end
|
|
10
13
|
for _k, _v in TS.import(script, script, "Container") or {} do
|
|
11
14
|
exports[_k] = _v
|
|
12
15
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { IconElementProps, IntentElementProps, ScalableElementProps } from "../../Interfaces/";
|
|
3
|
+
export interface BadgeProps extends IntentElementProps, ScalableElementProps, IconElementProps {
|
|
4
|
+
text: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
LayoutOrder?: number;
|
|
7
|
+
Position?: UDim2;
|
|
8
|
+
AnchorPoint?: Vector2;
|
|
9
|
+
}
|
|
10
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<ImageLabel>>;
|
|
@@ -0,0 +1,89 @@
|
|
|
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 _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
6
|
+
local Corners = _Decorator.Corners
|
|
7
|
+
local Gradient = _Decorator.Gradient
|
|
8
|
+
local Padding = _Decorator.Padding
|
|
9
|
+
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
10
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
11
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
12
|
+
local CssHelper = _Helpers.CssHelper
|
|
13
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
14
|
+
local TypographyHelper = _Helpers.TypographyHelper
|
|
15
|
+
local HStack = TS.import(script, script.Parent.Parent, "Layout").HStack
|
|
16
|
+
local Icon = TS.import(script, script.Parent, "Icon").Icon
|
|
17
|
+
local Badge = React.forwardRef(function(props, ref)
|
|
18
|
+
local theme = React.useContext(CleanThemeContext)
|
|
19
|
+
local badgeTheme = theme.components.badge
|
|
20
|
+
local scale = props.scale or theme.default.scale
|
|
21
|
+
local intentColors = ColorHelper:getIntentColors(theme, props.intent, "default", badgeTheme.intents)
|
|
22
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(intentColors.backgroundImage)
|
|
23
|
+
local padding = SpacingHelper:GetResolvedPadding(theme, {}, badgeTheme.spacing, badgeTheme.padding, scale)
|
|
24
|
+
local gap = math.ceil(SpacingHelper:GetPadding(theme, scale, badgeTheme.spacing) / 2)
|
|
25
|
+
local _attributes = {}
|
|
26
|
+
local _condition = props.name
|
|
27
|
+
if _condition == nil then
|
|
28
|
+
_condition = "Badge"
|
|
29
|
+
end
|
|
30
|
+
_attributes.key = _condition
|
|
31
|
+
_attributes.ref = ref
|
|
32
|
+
_attributes.Active = false
|
|
33
|
+
_attributes.Selectable = false
|
|
34
|
+
_attributes.Size = UDim2.fromOffset(0, 0)
|
|
35
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
36
|
+
_attributes.Position = props.Position
|
|
37
|
+
_attributes.AnchorPoint = props.AnchorPoint
|
|
38
|
+
_attributes.LayoutOrder = props.LayoutOrder
|
|
39
|
+
_attributes.BackgroundColor3 = intentColors.backgroundColor
|
|
40
|
+
local _condition_1 = intentColors.backgroundTransparency
|
|
41
|
+
if _condition_1 == nil then
|
|
42
|
+
_condition_1 = 0
|
|
43
|
+
end
|
|
44
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
45
|
+
_attributes.BorderSizePixel = 0
|
|
46
|
+
local _condition_2 = backgroundImage.Image
|
|
47
|
+
if _condition_2 == nil then
|
|
48
|
+
_condition_2 = ""
|
|
49
|
+
end
|
|
50
|
+
_attributes.Image = _condition_2
|
|
51
|
+
_attributes.ImageColor3 = backgroundImage.ImageColor3
|
|
52
|
+
_attributes.ImageTransparency = backgroundImage.ImageTransparency
|
|
53
|
+
_attributes.ScaleType = backgroundImage.ScaleType
|
|
54
|
+
_attributes.SliceCenter = backgroundImage.SliceCenter
|
|
55
|
+
_attributes.SliceScale = backgroundImage.SliceScale
|
|
56
|
+
_attributes.TileSize = backgroundImage.TileSize
|
|
57
|
+
return React.createElement("imagelabel", _attributes, React.createElement(Corners, {
|
|
58
|
+
radius = badgeTheme.cornerRadius,
|
|
59
|
+
}), badgeTheme.borderThickness > 0 and (React.createElement("uistroke", {
|
|
60
|
+
key = "Stroke",
|
|
61
|
+
Thickness = badgeTheme.borderThickness,
|
|
62
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
63
|
+
Color = intentColors.borderColor,
|
|
64
|
+
})), React.createElement(Gradient, {
|
|
65
|
+
value = intentColors.backgroundGradient,
|
|
66
|
+
}), React.createElement(Padding, {
|
|
67
|
+
resolvedPadding = padding,
|
|
68
|
+
}), React.createElement(HStack, {
|
|
69
|
+
valign = "Center",
|
|
70
|
+
Wraps = false,
|
|
71
|
+
Padding = UDim.new(0, gap),
|
|
72
|
+
}, props.icon ~= nil and React.createElement(Icon, {
|
|
73
|
+
name = "BadgeIcon",
|
|
74
|
+
LayoutOrder = 1,
|
|
75
|
+
scale = scale,
|
|
76
|
+
icon = props.icon,
|
|
77
|
+
color = intentColors.textColor,
|
|
78
|
+
}), React.createElement(Text, {
|
|
79
|
+
name = "BadgeText",
|
|
80
|
+
LayoutOrder = 2,
|
|
81
|
+
text = props.text,
|
|
82
|
+
TextWrap = false,
|
|
83
|
+
typography = TypographyHelper:getTypography(theme, scale, badgeTheme.typography),
|
|
84
|
+
TextColor3 = intentColors.textColor,
|
|
85
|
+
})))
|
|
86
|
+
end)
|
|
87
|
+
return {
|
|
88
|
+
Badge = Badge,
|
|
89
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { Breakpoint, ResponsiveValue } from "../Interfaces/responsive.types";
|
|
3
|
+
export interface BreakpointContextValue {
|
|
4
|
+
width: number;
|
|
5
|
+
breakpoint: Breakpoint;
|
|
6
|
+
}
|
|
7
|
+
export declare const BreakpointContext: React.Context<BreakpointContextValue | undefined>;
|
|
8
|
+
export declare function useBreakpoint(): Breakpoint;
|
|
9
|
+
export declare function useBreakpointValue<T>(value: ResponsiveValue<T> | undefined): T | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 Workspace = TS.import(script, TS.getModule(script, "@rbxts", "services")).Workspace
|
|
5
|
+
local BreakpointHelper = TS.import(script, script.Parent.Parent, "Helpers", "breakpoint.helper").BreakpointHelper
|
|
6
|
+
local SizeHelper = TS.import(script, script.Parent.Parent, "Helpers", "size.helper").SizeHelper
|
|
7
|
+
local CleanThemeContext = TS.import(script, script.Parent, "theme.context").CleanThemeContext
|
|
8
|
+
local BreakpointContext = React.createContext(nil)
|
|
9
|
+
local function getViewportBreakpoint(breakpoints)
|
|
10
|
+
local camera = Workspace.CurrentCamera
|
|
11
|
+
if camera == nil then
|
|
12
|
+
return nil
|
|
13
|
+
end
|
|
14
|
+
return BreakpointHelper:getBreakpoint(camera.ViewportSize.X, breakpoints)
|
|
15
|
+
end
|
|
16
|
+
local function useBreakpoint()
|
|
17
|
+
local context = React.useContext(BreakpointContext)
|
|
18
|
+
local theme = React.useContext(CleanThemeContext)
|
|
19
|
+
local viewportBreakpoint, setViewportBreakpoint = React.useState(function()
|
|
20
|
+
return (if context == nil then getViewportBreakpoint(theme.breakpoints) else nil) or "xs"
|
|
21
|
+
end)
|
|
22
|
+
React.useEffect(function()
|
|
23
|
+
if context ~= nil then
|
|
24
|
+
return nil
|
|
25
|
+
end
|
|
26
|
+
local viewportConnection
|
|
27
|
+
local update = function()
|
|
28
|
+
local resolved = getViewportBreakpoint(theme.breakpoints)
|
|
29
|
+
if resolved ~= nil then
|
|
30
|
+
setViewportBreakpoint(resolved)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
local bindCamera = function()
|
|
34
|
+
local _result = viewportConnection
|
|
35
|
+
if _result ~= nil then
|
|
36
|
+
_result:Disconnect()
|
|
37
|
+
end
|
|
38
|
+
viewportConnection = nil
|
|
39
|
+
local camera = Workspace.CurrentCamera
|
|
40
|
+
if camera ~= nil then
|
|
41
|
+
viewportConnection = camera:GetPropertyChangedSignal("ViewportSize"):Connect(update)
|
|
42
|
+
end
|
|
43
|
+
update()
|
|
44
|
+
end
|
|
45
|
+
local cameraConnection = Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(bindCamera)
|
|
46
|
+
bindCamera()
|
|
47
|
+
return function()
|
|
48
|
+
cameraConnection:Disconnect()
|
|
49
|
+
local _result = viewportConnection
|
|
50
|
+
if _result ~= nil then
|
|
51
|
+
_result:Disconnect()
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end, { context == nil, theme.breakpoints })
|
|
55
|
+
return if context ~= nil then context.breakpoint else viewportBreakpoint
|
|
56
|
+
end
|
|
57
|
+
local function useBreakpointValue(value)
|
|
58
|
+
local breakpoint = useBreakpoint()
|
|
59
|
+
return SizeHelper:resolveResponsiveValue(value, breakpoint)
|
|
60
|
+
end
|
|
61
|
+
return {
|
|
62
|
+
useBreakpoint = useBreakpoint,
|
|
63
|
+
useBreakpointValue = useBreakpointValue,
|
|
64
|
+
BreakpointContext = BreakpointContext,
|
|
65
|
+
}
|
package/out/Contexts/index.d.ts
CHANGED
package/out/Contexts/init.luau
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "breakpoint.context") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
4
7
|
for _k, _v in TS.import(script, script, "draggable.context") or {} do
|
|
5
8
|
exports[_k] = _v
|
|
6
9
|
end
|
|
@@ -40,7 +40,17 @@ do
|
|
|
40
40
|
_overrideMatching = _overrideMatching[selectedIntent]
|
|
41
41
|
end
|
|
42
42
|
local overrideMatching = _overrideMatching
|
|
43
|
-
local
|
|
43
|
+
local _exp = defaultPrimary.default
|
|
44
|
+
local _result = defaultMatching
|
|
45
|
+
if _result ~= nil then
|
|
46
|
+
_result = _result.default
|
|
47
|
+
end
|
|
48
|
+
local _exp_1 = defaultPrimary[state]
|
|
49
|
+
local _result_1 = defaultMatching
|
|
50
|
+
if _result_1 ~= nil then
|
|
51
|
+
_result_1 = _result_1[state]
|
|
52
|
+
end
|
|
53
|
+
local layers = { _exp, _result, _exp_1, _result_1, self:resolveComponentDefaultLayer(componentPrimary), self:resolveComponentDefaultLayer(componentMatching), self:resolveComponentStateLayer(componentPrimary, state), self:resolveComponentStateLayer(componentMatching, state), self:resolveComponentDefaultLayer(overridePrimary), self:resolveComponentDefaultLayer(overrideMatching), self:resolveComponentStateLayer(overridePrimary, state), self:resolveComponentStateLayer(overrideMatching, state) }
|
|
44
54
|
return self:mergeLayers(layers)
|
|
45
55
|
end
|
|
46
56
|
function ColorHelper:mergeLayers(layers)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type ButtonFlag = "default" | "hover" | "focus" | "disabled";
|
|
2
2
|
export type TextVariant = "display" | "title" | "heading" | "body" | "label" | "caption";
|
|
3
|
-
export type Intent = "primary" | "success" | "warning" | "danger" | "info";
|
|
3
|
+
export type Intent = "primary" | "secondary" | "success" | "warning" | "danger" | "info";
|
|
@@ -2,7 +2,7 @@ import { CssShadow, CssSize, ScaledCssPadding, Breakpoint, BreakpointValue, Scal
|
|
|
2
2
|
import { TypographyStyle, ScaledTypographyStyle, IntentScheme, IntentColors, InlineIntentColors, CssBackgroundImage, CssPosition, CssCornerRadius } from "./theme.style";
|
|
3
3
|
export interface ThemeTemplate {
|
|
4
4
|
colors: {
|
|
5
|
-
intents: Record<Intent, IntentColors
|
|
5
|
+
intents: Record<Exclude<Intent, "secondary">, IntentColors> & Partial<Record<"secondary", IntentColors>>;
|
|
6
6
|
};
|
|
7
7
|
breakpoints: BreakpointValue<number>;
|
|
8
8
|
default: {
|
|
@@ -55,6 +55,14 @@ export interface ThemeTemplate {
|
|
|
55
55
|
backgroundGradient?: CssBackgroundGradient;
|
|
56
56
|
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
57
57
|
};
|
|
58
|
+
badge: {
|
|
59
|
+
cornerRadius: CssSize;
|
|
60
|
+
borderThickness: number;
|
|
61
|
+
spacing?: ScaleSizeValue<number>;
|
|
62
|
+
padding?: ScaledCssPadding;
|
|
63
|
+
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
64
|
+
intents?: Partial<Record<Intent, InlineIntentColors>>;
|
|
65
|
+
};
|
|
58
66
|
button: {
|
|
59
67
|
backgroundTransparency: number;
|
|
60
68
|
cornerRadius: CssSize;
|
|
@@ -70,6 +78,8 @@ export interface ThemeTemplate {
|
|
|
70
78
|
borderColor: Color3;
|
|
71
79
|
borderThickness: number;
|
|
72
80
|
cornerRadius: CssSize;
|
|
81
|
+
backgroundColor?: Color3;
|
|
82
|
+
backgroundTransparency?: number;
|
|
73
83
|
typography?: Partial<TypographyStyle> | ScaledTypographyStyle;
|
|
74
84
|
backgroundImage?: CssBackgroundImage;
|
|
75
85
|
backgroundGradient?: CssBackgroundGradient;
|
|
@@ -80,6 +90,10 @@ export interface ThemeTemplate {
|
|
|
80
90
|
borderColor: Color3;
|
|
81
91
|
borderThickness: number;
|
|
82
92
|
cornerRadius: CssSize;
|
|
93
|
+
backgroundColor?: Color3;
|
|
94
|
+
backgroundTransparency?: number;
|
|
95
|
+
textColor?: Color3;
|
|
96
|
+
iconColor?: Color3;
|
|
83
97
|
backgroundImage?: CssBackgroundImage;
|
|
84
98
|
backgroundGradient?: CssBackgroundGradient;
|
|
85
99
|
dropDownBackgroundColor: Color3;
|
|
@@ -144,7 +158,9 @@ export interface ThemeTemplate {
|
|
|
144
158
|
cornerRadius: CssSize;
|
|
145
159
|
spacing?: ScaleSizeValue<number>;
|
|
146
160
|
padding?: ScaledCssPadding;
|
|
161
|
+
gap?: number;
|
|
147
162
|
list: {
|
|
163
|
+
gap?: number;
|
|
148
164
|
borderColor?: Color3;
|
|
149
165
|
backgroundColor?: Color3;
|
|
150
166
|
backgroundTransparency?: number;
|
|
@@ -157,7 +173,7 @@ export interface ThemeTemplate {
|
|
|
157
173
|
};
|
|
158
174
|
button: {
|
|
159
175
|
borderThickness: number;
|
|
160
|
-
cornerRadius: CssSize;
|
|
176
|
+
cornerRadius: CssSize | CssCornerRadius;
|
|
161
177
|
spacing?: ScaleSizeValue<number>;
|
|
162
178
|
padding?: ScaledCssPadding;
|
|
163
179
|
boxShadow?: CssShadow;
|
|
@@ -17,6 +17,18 @@ local DarkTheme = createTheme({
|
|
|
17
17
|
backgroundColor = Color3.fromHex("#4775CC"),
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
secondary = {
|
|
21
|
+
default = {
|
|
22
|
+
textColor = Color3.fromHex("#D5DAE3"),
|
|
23
|
+
borderColor = Color3.fromHex("#4A5263"),
|
|
24
|
+
backgroundColor = Color3.fromHex("#3A414E"),
|
|
25
|
+
},
|
|
26
|
+
hover = {
|
|
27
|
+
textColor = Color3.fromHex("#FFFFFF"),
|
|
28
|
+
borderColor = Color3.fromHex("#5E687B"),
|
|
29
|
+
backgroundColor = Color3.fromHex("#474F5E"),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
20
32
|
success = {
|
|
21
33
|
default = {
|
|
22
34
|
textColor = Color3.fromHex("#75E0A7"),
|
|
@@ -150,6 +162,55 @@ local DarkTheme = createTheme({
|
|
|
150
162
|
cornerRadius = 8,
|
|
151
163
|
boxShadow = "2px 2px 8px 0px",
|
|
152
164
|
},
|
|
165
|
+
badge = {
|
|
166
|
+
cornerRadius = "50%",
|
|
167
|
+
borderThickness = 1,
|
|
168
|
+
intents = {
|
|
169
|
+
primary = {
|
|
170
|
+
default = {
|
|
171
|
+
textColor = Color3.fromHex("#E8EDF8"),
|
|
172
|
+
backgroundColor = Color3.fromHex("#252B36"),
|
|
173
|
+
borderColor = Color3.fromHex("#343B49"),
|
|
174
|
+
backgroundTransparency = 0,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
secondary = {
|
|
178
|
+
default = {
|
|
179
|
+
textColor = Color3.fromHex("#D5DAE3"),
|
|
180
|
+
backgroundColor = Color3.fromHex("#2A303B"),
|
|
181
|
+
borderColor = Color3.fromHex("#4A5263"),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
success = {
|
|
185
|
+
default = {
|
|
186
|
+
textColor = Color3.fromHex("#75E0A7"),
|
|
187
|
+
backgroundColor = Color3.fromHex("#1B3A2A"),
|
|
188
|
+
borderColor = Color3.fromHex("#258A56"),
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
info = {
|
|
192
|
+
default = {
|
|
193
|
+
textColor = Color3.fromHex("#8DD0FF"),
|
|
194
|
+
backgroundColor = Color3.fromHex("#1B3345"),
|
|
195
|
+
borderColor = Color3.fromHex("#2F79B4"),
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
warning = {
|
|
199
|
+
default = {
|
|
200
|
+
textColor = Color3.fromHex("#FFD978"),
|
|
201
|
+
backgroundColor = Color3.fromHex("#3A2F17"),
|
|
202
|
+
borderColor = Color3.fromHex("#B68522"),
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
danger = {
|
|
206
|
+
default = {
|
|
207
|
+
textColor = Color3.fromHex("#FF8D8D"),
|
|
208
|
+
backgroundColor = Color3.fromHex("#3F1F1F"),
|
|
209
|
+
borderColor = Color3.fromHex("#B93A3A"),
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
153
214
|
button = {
|
|
154
215
|
backgroundTransparency = 0,
|
|
155
216
|
borderThickness = 1,
|
|
@@ -174,6 +235,21 @@ local DarkTheme = createTheme({
|
|
|
174
235
|
backgroundColor = Color3.fromHex("#b8b8b8"),
|
|
175
236
|
},
|
|
176
237
|
},
|
|
238
|
+
secondary = {
|
|
239
|
+
default = {
|
|
240
|
+
textColor = Color3.fromHex("#FFFFFF"),
|
|
241
|
+
borderColor = Color3.fromHex("#5E687B"),
|
|
242
|
+
backgroundGradient = {
|
|
243
|
+
colors = { Color3.fromHex("#3A414E"), Color3.fromHex("#474F5E") },
|
|
244
|
+
rotation = 90,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
disabled = {
|
|
248
|
+
backgroundColor = Color3.fromHex("#1D222B"),
|
|
249
|
+
borderColor = Color3.fromHex("#343B49"),
|
|
250
|
+
textColor = Color3.fromHex("#697386"),
|
|
251
|
+
},
|
|
252
|
+
},
|
|
177
253
|
success = {
|
|
178
254
|
default = {
|
|
179
255
|
textColor = Color3.fromHex("#FFFFFF"),
|
|
@@ -489,6 +565,13 @@ local DarkTheme = createTheme({
|
|
|
489
565
|
backgroundTransparency = 0,
|
|
490
566
|
},
|
|
491
567
|
},
|
|
568
|
+
secondary = {
|
|
569
|
+
default = {
|
|
570
|
+
backgroundColor = Color3.fromHex("#3A414E"),
|
|
571
|
+
backgroundTransparency = 0,
|
|
572
|
+
borderColor = Color3.fromHex("#4A5263"),
|
|
573
|
+
},
|
|
574
|
+
},
|
|
492
575
|
},
|
|
493
576
|
},
|
|
494
577
|
footer = {
|
|
@@ -499,6 +582,13 @@ local DarkTheme = createTheme({
|
|
|
499
582
|
backgroundTransparency = 0,
|
|
500
583
|
},
|
|
501
584
|
},
|
|
585
|
+
secondary = {
|
|
586
|
+
default = {
|
|
587
|
+
backgroundColor = Color3.fromHex("#3A414E"),
|
|
588
|
+
backgroundTransparency = 0,
|
|
589
|
+
borderColor = Color3.fromHex("#4A5263"),
|
|
590
|
+
},
|
|
591
|
+
},
|
|
502
592
|
},
|
|
503
593
|
},
|
|
504
594
|
},
|
|
@@ -570,6 +660,15 @@ local DarkTheme = createTheme({
|
|
|
570
660
|
},
|
|
571
661
|
},
|
|
572
662
|
},
|
|
663
|
+
secondary = {
|
|
664
|
+
default = {
|
|
665
|
+
backgroundColor = Color3.fromHex("#FFFFFF"),
|
|
666
|
+
backgroundGradient = {
|
|
667
|
+
colors = { Color3.fromHex("#6B7486"), Color3.fromHex("#474F5E") },
|
|
668
|
+
rotation = 90,
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
},
|
|
573
672
|
success = {
|
|
574
673
|
default = {
|
|
575
674
|
backgroundColor = Color3.fromHex("#FFFFFF"),
|