@rbxts/react-clean-ui 1.1.0 → 1.2.4
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 +1 -0
- package/out/Components/Chart/BarChart.luau +149 -112
- package/out/Components/Chart/Pie.d.ts +1 -0
- package/out/Components/Chart/Pie.luau +21 -6
- package/out/Components/Decorator/BoxShadow.d.ts +1 -0
- package/out/Components/Decorator/BoxShadow.luau +12 -5
- package/out/Components/Decorator/Corners.d.ts +1 -0
- package/out/Components/Decorator/Corners.luau +8 -3
- package/out/Components/Decorator/Gradient.d.ts +8 -0
- package/out/Components/Decorator/Gradient.luau +23 -0
- package/out/Components/Decorator/Padding.d.ts +3 -1
- package/out/Components/Decorator/Padding.luau +11 -6
- package/out/Components/Decorator/index.d.ts +1 -0
- package/out/Components/Decorator/init.luau +3 -0
- package/out/Components/Input/Button.d.ts +1 -0
- package/out/Components/Input/Button.luau +49 -34
- package/out/Components/Input/Checkbox.d.ts +1 -0
- package/out/Components/Input/Checkbox.luau +28 -18
- package/out/Components/Input/HoverButton.d.ts +1 -0
- package/out/Components/Input/HoverButton.luau +44 -42
- package/out/Components/Input/Increment.d.ts +1 -0
- package/out/Components/Input/Increment.luau +10 -3
- package/out/Components/Input/Input.d.ts +3 -1
- package/out/Components/Input/Input.luau +89 -68
- package/out/Components/Input/Select.d.ts +11 -1
- package/out/Components/Input/Select.luau +315 -39
- package/out/Components/Input/Slider.luau +44 -53
- package/out/Components/Input/Switch.d.ts +9 -0
- package/out/Components/Input/Switch.luau +145 -0
- package/out/Components/Input/index.d.ts +1 -0
- package/out/Components/Input/init.luau +3 -0
- package/out/Components/Interaction/Modal.d.ts +14 -0
- package/out/Components/Interaction/Modal.luau +262 -0
- package/out/Components/Interaction/Toast.d.ts +2 -1
- package/out/Components/Interaction/Toast.luau +53 -28
- package/out/Components/Interaction/Tooltip.luau +36 -25
- package/out/Components/Interaction/index.d.ts +1 -0
- package/out/Components/Interaction/init.luau +3 -0
- package/out/Components/Layout/Accordion.d.ts +1 -0
- package/out/Components/Layout/Accordion.luau +51 -55
- package/out/Components/Layout/Column.d.ts +1 -0
- package/out/Components/Layout/Column.luau +11 -6
- package/out/Components/Layout/Container.d.ts +3 -0
- package/out/Components/Layout/Container.luau +26 -17
- package/out/Components/Layout/Draggable.luau +25 -3
- package/out/Components/Layout/Fieldset.d.ts +1 -0
- package/out/Components/Layout/Fieldset.luau +14 -42
- package/out/Components/Layout/FlexItem.luau +7 -0
- package/out/Components/Layout/Grid.d.ts +10 -0
- package/out/Components/Layout/Grid.luau +172 -0
- package/out/Components/Layout/Group.d.ts +1 -0
- package/out/Components/Layout/Group.luau +48 -60
- package/out/Components/Layout/HStack.d.ts +4 -0
- package/out/Components/Layout/HStack.luau +17 -10
- package/out/Components/Layout/Pagination.d.ts +32 -0
- package/out/Components/Layout/Pagination.luau +400 -0
- package/out/Components/Layout/Row.d.ts +1 -0
- package/out/Components/Layout/Row.luau +20 -48
- package/out/Components/Layout/Scroller.d.ts +1 -0
- package/out/Components/Layout/Scroller.luau +26 -34
- package/out/Components/Layout/Table.d.ts +31 -0
- package/out/Components/Layout/Table.luau +342 -0
- package/out/Components/Layout/Tabs.d.ts +20 -10
- package/out/Components/Layout/Tabs.luau +113 -119
- package/out/Components/Layout/VStack.d.ts +3 -0
- package/out/Components/Layout/VStack.luau +17 -10
- package/out/Components/Layout/index.d.ts +3 -0
- package/out/Components/Layout/init.luau +9 -0
- package/out/Components/Navigation/Menu.d.ts +1 -0
- package/out/Components/Navigation/Menu.luau +12 -3
- package/out/Components/Surface/Box.d.ts +3 -1
- package/out/Components/Surface/Box.luau +15 -4
- package/out/Components/Surface/Card.d.ts +1 -0
- package/out/Components/Surface/Card.luau +56 -154
- package/out/Components/Surface/Icon.d.ts +1 -0
- package/out/Components/Surface/Icon.luau +25 -16
- package/out/Components/Surface/ProgressBar.d.ts +14 -0
- package/out/Components/Surface/ProgressBar.luau +230 -0
- package/out/Components/Surface/index.d.ts +1 -0
- package/out/Components/Surface/init.luau +3 -0
- package/out/Components/Typography/Text.d.ts +1 -0
- package/out/Components/Typography/Text.luau +57 -53
- package/out/Contexts/index.d.ts +1 -0
- package/out/Contexts/init.luau +3 -0
- package/out/Contexts/modal.context.d.ts +15 -0
- package/out/Contexts/modal.context.luau +23 -0
- package/out/Contexts/toast.context.d.ts +1 -0
- package/out/Helpers/color.helper.luau +28 -0
- package/out/Helpers/css.helper.d.ts +4 -1
- package/out/Helpers/css.helper.luau +76 -6
- package/out/Helpers/gui.helper.luau +0 -3
- package/out/Helpers/size.helper.luau +0 -2
- package/out/Helpers/spacing.helper.luau +0 -3
- package/out/Helpers/typography.helper.luau +0 -2
- package/out/Interfaces/css.types.d.ts +7 -0
- package/out/Interfaces/css.types.luau +0 -20
- package/out/Providers/app.provider.luau +2 -1
- package/out/Providers/index.d.ts +1 -0
- package/out/Providers/init.luau +3 -0
- package/out/Providers/modal.provider.d.ts +6 -0
- package/out/Providers/modal.provider.luau +86 -0
- package/out/Providers/overlay.provider.luau +1 -0
- package/out/Providers/registry.provider.luau +0 -2
- package/out/Theme/theme.style.d.ts +2 -1
- package/out/Theme/theme.template.d.ts +126 -1
- package/out/Theme/themes/dark.theme.luau +225 -0
- package/out/Theme/themes/default.theme.luau +210 -0
- package/out/Theme/themes/sandstone.theme.luau +173 -0
- package/out/Theme/themes/wooden.theme.luau +195 -0
- package/package.json +1 -1
|
@@ -0,0 +1,230 @@
|
|
|
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 useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple").src).useTween
|
|
5
|
+
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
6
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
7
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
8
|
+
local CssHelper = _Helpers.CssHelper
|
|
9
|
+
local SizeHelper = _Helpers.SizeHelper
|
|
10
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
11
|
+
local TypographyHelper = _Helpers.TypographyHelper
|
|
12
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
13
|
+
local Corners = _Decorator.Corners
|
|
14
|
+
local Gradient = _Decorator.Gradient
|
|
15
|
+
local _Layout = TS.import(script, script.Parent.Parent, "Layout")
|
|
16
|
+
local Container = _Layout.Container
|
|
17
|
+
local HStack = _Layout.HStack
|
|
18
|
+
local VStack = _Layout.VStack
|
|
19
|
+
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
20
|
+
local function defaultValueFormatter(value, max)
|
|
21
|
+
local percent = if max > 0 then (value / max) * 100 else 0
|
|
22
|
+
return `{math.round(percent)}%`
|
|
23
|
+
end
|
|
24
|
+
local ProgressBar = React.forwardRef(function(props, ref)
|
|
25
|
+
local theme = React.useContext(CleanThemeContext)
|
|
26
|
+
local progressBarTheme = theme.components.progressBar
|
|
27
|
+
local _condition = props.max
|
|
28
|
+
if _condition == nil then
|
|
29
|
+
_condition = 100
|
|
30
|
+
end
|
|
31
|
+
local maxValue = math.max(_condition, 0)
|
|
32
|
+
local clampedValue = math.clamp(props.value, 0, maxValue)
|
|
33
|
+
local targetProgress = if maxValue > 0 then clampedValue / maxValue else 0
|
|
34
|
+
local duration = progressBarTheme.animation.duration
|
|
35
|
+
local progress, progressTween = useTween(targetProgress, {
|
|
36
|
+
duration = duration,
|
|
37
|
+
})
|
|
38
|
+
React.useEffect(function()
|
|
39
|
+
progressTween:setGoal(targetProgress, {
|
|
40
|
+
duration = duration,
|
|
41
|
+
})
|
|
42
|
+
if duration == 0 then
|
|
43
|
+
progressTween:setPosition(targetProgress)
|
|
44
|
+
end
|
|
45
|
+
end, { targetProgress, duration, progressTween })
|
|
46
|
+
local colors = ColorHelper:getIntentColors(theme, props.intent, "default", progressBarTheme.fill.intents)
|
|
47
|
+
local height = SizeHelper:toUDim(progressBarTheme.height[props.scale or theme.default.scale])
|
|
48
|
+
local fillSize = progress:map(function(value)
|
|
49
|
+
return UDim2.fromScale(value, 1)
|
|
50
|
+
end)
|
|
51
|
+
local fillPosition = UDim2.fromScale(0, 0)
|
|
52
|
+
local stripeTheme = progressBarTheme.fill.stripe
|
|
53
|
+
local _condition_1 = props.striped
|
|
54
|
+
if _condition_1 == nil then
|
|
55
|
+
local _result = stripeTheme
|
|
56
|
+
if _result ~= nil then
|
|
57
|
+
_result = _result.enabled
|
|
58
|
+
end
|
|
59
|
+
_condition_1 = _result
|
|
60
|
+
if _condition_1 == nil then
|
|
61
|
+
_condition_1 = false
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
local striped = _condition_1
|
|
65
|
+
local _condition_2 = props.stripeDuration
|
|
66
|
+
if _condition_2 == nil then
|
|
67
|
+
local _result = stripeTheme
|
|
68
|
+
if _result ~= nil then
|
|
69
|
+
_result = _result.duration
|
|
70
|
+
end
|
|
71
|
+
_condition_2 = _result
|
|
72
|
+
if _condition_2 == nil then
|
|
73
|
+
_condition_2 = 0.75
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
local stripeDuration = _condition_2
|
|
77
|
+
local _condition_3 = props.stripeDirection
|
|
78
|
+
if _condition_3 == nil then
|
|
79
|
+
local _result = stripeTheme
|
|
80
|
+
if _result ~= nil then
|
|
81
|
+
_result = _result.direction
|
|
82
|
+
end
|
|
83
|
+
_condition_3 = _result
|
|
84
|
+
end
|
|
85
|
+
local rawStripeDirection = _condition_3
|
|
86
|
+
local stripeDirection = if rawStripeDirection == -1 then -1 else 1
|
|
87
|
+
local _result = stripeTheme
|
|
88
|
+
if _result ~= nil then
|
|
89
|
+
_result = _result.image
|
|
90
|
+
end
|
|
91
|
+
local resolvedStripeImage = CssHelper:resolveBackgroundImage(_result)
|
|
92
|
+
local stripeTileSize = resolvedStripeImage.TileSize or UDim2.fromOffset(16, 16)
|
|
93
|
+
local stripeTileWidth = if stripeTileSize.X.Offset ~= 0 then stripeTileSize.X.Offset else 16
|
|
94
|
+
local stripeProgress, stripeTween = useTween(0, {
|
|
95
|
+
duration = stripeDuration,
|
|
96
|
+
easing = "linear",
|
|
97
|
+
repeats = math.huge,
|
|
98
|
+
reverses = false,
|
|
99
|
+
})
|
|
100
|
+
React.useEffect(function()
|
|
101
|
+
if not striped then
|
|
102
|
+
return nil
|
|
103
|
+
end
|
|
104
|
+
stripeTween:setPosition(0)
|
|
105
|
+
stripeTween:setGoal(1, {
|
|
106
|
+
duration = stripeDuration,
|
|
107
|
+
})
|
|
108
|
+
end, { striped, stripeDuration, stripeTween })
|
|
109
|
+
local stripePosition = stripeProgress:map(function(value)
|
|
110
|
+
return if stripeDirection == 1 then UDim2.fromOffset(-stripeTileWidth + value * stripeTileWidth, 0) else UDim2.fromOffset(-value * stripeTileWidth, 0)
|
|
111
|
+
end)
|
|
112
|
+
local showHeader = props.label ~= nil or props.showValue == true
|
|
113
|
+
local formattedValue = if props.showValue then (props.valueFormatter or defaultValueFormatter)(clampedValue, maxValue) else nil
|
|
114
|
+
local labelTypography = TypographyHelper:getTypography(theme, props.scale, progressBarTheme.header.label.typography)
|
|
115
|
+
local valueTypography = TypographyHelper:getTypography(theme, props.scale, progressBarTheme.header.value.typography or progressBarTheme.header.label.typography)
|
|
116
|
+
local _attributes = {}
|
|
117
|
+
local _condition_4 = props.name
|
|
118
|
+
if _condition_4 == nil then
|
|
119
|
+
_condition_4 = "ProgressBar"
|
|
120
|
+
end
|
|
121
|
+
_attributes.name = _condition_4
|
|
122
|
+
_attributes.ref = ref
|
|
123
|
+
for _k, _v in props do
|
|
124
|
+
_attributes[_k] = _v
|
|
125
|
+
end
|
|
126
|
+
_attributes.Size = SizeHelper:GetSize(props, UDim2.new(UDim.new(1, 0), height))
|
|
127
|
+
local _condition_5 = props.ClipsDescendants
|
|
128
|
+
if _condition_5 == nil then
|
|
129
|
+
_condition_5 = true
|
|
130
|
+
end
|
|
131
|
+
_attributes.ClipsDescendants = _condition_5
|
|
132
|
+
_attributes.BackgroundColor3 = progressBarTheme.track.backgroundColor
|
|
133
|
+
_attributes.BackgroundTransparency = progressBarTheme.track.backgroundTransparency
|
|
134
|
+
_attributes.backgroundImage = progressBarTheme.track.backgroundImage
|
|
135
|
+
_attributes.backgroundGradient = progressBarTheme.track.backgroundGradient
|
|
136
|
+
local _exp = React.createElement("uistroke", {
|
|
137
|
+
key = "Stroke",
|
|
138
|
+
Thickness = progressBarTheme.track.borderThickness,
|
|
139
|
+
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
140
|
+
Color = progressBarTheme.track.borderColor,
|
|
141
|
+
})
|
|
142
|
+
local _exp_1 = React.createElement(Corners, {
|
|
143
|
+
radius = progressBarTheme.track.cornerRadius,
|
|
144
|
+
})
|
|
145
|
+
local _attributes_1 = {
|
|
146
|
+
key = "Fill",
|
|
147
|
+
Size = fillSize,
|
|
148
|
+
Position = fillPosition,
|
|
149
|
+
BackgroundColor3 = colors.backgroundColor,
|
|
150
|
+
}
|
|
151
|
+
local _condition_6 = colors.backgroundTransparency
|
|
152
|
+
if _condition_6 == nil then
|
|
153
|
+
_condition_6 = 0
|
|
154
|
+
end
|
|
155
|
+
_attributes_1.BackgroundTransparency = _condition_6
|
|
156
|
+
_attributes_1.BorderSizePixel = 0
|
|
157
|
+
_attributes_1.ClipsDescendants = true
|
|
158
|
+
local _exp_2 = React.createElement(Corners, {
|
|
159
|
+
radius = progressBarTheme.fill.cornerRadius,
|
|
160
|
+
})
|
|
161
|
+
local _exp_3 = React.createElement(Gradient, {
|
|
162
|
+
value = colors.backgroundGradient,
|
|
163
|
+
})
|
|
164
|
+
local _condition_7 = striped
|
|
165
|
+
if _condition_7 then
|
|
166
|
+
local _attributes_2 = {
|
|
167
|
+
key = "Stripe",
|
|
168
|
+
BackgroundTransparency = 1,
|
|
169
|
+
}
|
|
170
|
+
local _condition_8 = resolvedStripeImage.ImageTransparency
|
|
171
|
+
if _condition_8 == nil then
|
|
172
|
+
_condition_8 = 0.9
|
|
173
|
+
end
|
|
174
|
+
_attributes_2.ImageTransparency = _condition_8
|
|
175
|
+
_attributes_2.ImageColor3 = resolvedStripeImage.ImageColor3
|
|
176
|
+
_attributes_2.Size = UDim2.new(1, stripeTileWidth, 1, 0)
|
|
177
|
+
_attributes_2.Position = stripePosition
|
|
178
|
+
local _condition_9 = resolvedStripeImage.Image
|
|
179
|
+
if _condition_9 == nil then
|
|
180
|
+
_condition_9 = `rbxassetid://86644568183933`
|
|
181
|
+
end
|
|
182
|
+
_attributes_2.Image = _condition_9
|
|
183
|
+
_attributes_2.ScaleType = Enum.ScaleType.Tile
|
|
184
|
+
_attributes_2.TileSize = stripeTileSize
|
|
185
|
+
_condition_7 = (React.createElement("imagelabel", _attributes_2))
|
|
186
|
+
end
|
|
187
|
+
local track = (React.createElement(Container, _attributes, _exp, _exp_1, React.createElement("frame", _attributes_1, _exp_2, _exp_3, _condition_7)))
|
|
188
|
+
if not showHeader then
|
|
189
|
+
return track
|
|
190
|
+
end
|
|
191
|
+
local _attributes_2 = {}
|
|
192
|
+
local _condition_8 = props.name
|
|
193
|
+
if _condition_8 == nil then
|
|
194
|
+
_condition_8 = "ProgressBar"
|
|
195
|
+
end
|
|
196
|
+
_attributes_2.key = _condition_8
|
|
197
|
+
_attributes_2.BackgroundTransparency = 1
|
|
198
|
+
_attributes_2.Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 0))
|
|
199
|
+
_attributes_2.AutomaticSize = Enum.AutomaticSize.Y
|
|
200
|
+
_attributes_2.Position = SizeHelper:GetPosition(props)
|
|
201
|
+
_attributes_2.AnchorPoint = SizeHelper:GetAnchor(props)
|
|
202
|
+
_attributes_2.ZIndex = props.ZIndex
|
|
203
|
+
return React.createElement("frame", _attributes_2, React.createElement(VStack, {
|
|
204
|
+
spacing = "None",
|
|
205
|
+
HorizontalFlex = Enum.UIFlexAlignment.None,
|
|
206
|
+
Padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.scale, progressBarTheme.header.spacing)),
|
|
207
|
+
}, React.createElement("frame", {
|
|
208
|
+
key = "ProgressBarHeader",
|
|
209
|
+
BackgroundTransparency = 1,
|
|
210
|
+
Size = UDim2.fromScale(1, 0),
|
|
211
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
212
|
+
}, React.createElement(HStack, {
|
|
213
|
+
valign = "Center",
|
|
214
|
+
Wraps = false,
|
|
215
|
+
HorizontalFlex = Enum.UIFlexAlignment.SpaceBetween,
|
|
216
|
+
}, props.label ~= nil and (React.createElement(Text, {
|
|
217
|
+
name = "ProgressBarLabel",
|
|
218
|
+
text = props.label,
|
|
219
|
+
TextColor3 = labelTypography.color,
|
|
220
|
+
typography = labelTypography,
|
|
221
|
+
})), formattedValue ~= nil and (React.createElement(Text, {
|
|
222
|
+
name = "ProgressBarValue",
|
|
223
|
+
text = formattedValue,
|
|
224
|
+
TextColor3 = valueTypography.color,
|
|
225
|
+
typography = valueTypography,
|
|
226
|
+
})))), track))
|
|
227
|
+
end)
|
|
228
|
+
return {
|
|
229
|
+
ProgressBar = ProgressBar,
|
|
230
|
+
}
|
|
@@ -9,6 +9,7 @@ interface TextProps extends React.InstanceProps<TextLabel> {
|
|
|
9
9
|
align?: "Left" | "Right" | "Center";
|
|
10
10
|
TextWrap?: boolean;
|
|
11
11
|
letterSpacing?: number;
|
|
12
|
+
name?: string;
|
|
12
13
|
}
|
|
13
14
|
export declare const Text: React.ForwardRefExoticComponent<Omit<TextProps, "ref"> & React.RefAttributes<TextLabel>>;
|
|
14
15
|
export {};
|
|
@@ -12,12 +12,6 @@ local Text = React.forwardRef(function(props, ref)
|
|
|
12
12
|
_condition = style.letterSpacing
|
|
13
13
|
end
|
|
14
14
|
local letterSpacing = _condition
|
|
15
|
-
-- Roblox text instances have no native letter-spacing property, so a nonzero
|
|
16
|
-
-- value is faked by splitting the text into one TextLabel per character laid
|
|
17
|
-
-- out in a UIListLayout row with the spacing as its Padding. This only makes
|
|
18
|
-
-- sense for short, single-line, plain text: RichText is forced off per-character
|
|
19
|
-
-- (markup tags can't survive being split apart), and wrapping/truncation are
|
|
20
|
-
-- moot since each character label auto-sizes to itself and never overflows.
|
|
21
15
|
if letterSpacing ~= nil and letterSpacing ~= 0 and props.text ~= "" then
|
|
22
16
|
local characters = {}
|
|
23
17
|
for index = 0, #props.text - 1 do
|
|
@@ -27,7 +21,23 @@ local Text = React.forwardRef(function(props, ref)
|
|
|
27
21
|
local _arg0_1 = string.sub(_text, _arg0, _arg1)
|
|
28
22
|
table.insert(characters, _arg0_1)
|
|
29
23
|
end
|
|
24
|
+
local _attributes = {}
|
|
25
|
+
local _condition_1 = props.name
|
|
26
|
+
if _condition_1 == nil then
|
|
27
|
+
_condition_1 = "Text"
|
|
28
|
+
end
|
|
29
|
+
_attributes.key = _condition_1
|
|
30
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
31
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
32
|
+
_attributes.AnchorPoint = props.AnchorPoint
|
|
33
|
+
_attributes.BackgroundTransparency = 1
|
|
34
|
+
_attributes.Position = props.Position
|
|
35
|
+
_attributes.ZIndex = props.ZIndex
|
|
36
|
+
_attributes.LayoutOrder = props.LayoutOrder
|
|
37
|
+
_attributes.Visible = props.Visible
|
|
38
|
+
_attributes.Rotation = props.Rotation
|
|
30
39
|
local _exp = React.createElement("uilistlayout", {
|
|
40
|
+
key = "LetterSpacing",
|
|
31
41
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
32
42
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
33
43
|
Padding = UDim.new(0, letterSpacing),
|
|
@@ -37,7 +47,7 @@ local Text = React.forwardRef(function(props, ref)
|
|
|
37
47
|
-- ▼ ReadonlyArray.map ▼
|
|
38
48
|
local _newValue = table.create(#characters)
|
|
39
49
|
local _callback = function(character, index)
|
|
40
|
-
local
|
|
50
|
+
local _attributes_1 = {
|
|
41
51
|
key = index,
|
|
42
52
|
LayoutOrder = index,
|
|
43
53
|
Size = UDim2.fromScale(0, 0),
|
|
@@ -46,56 +56,50 @@ local Text = React.forwardRef(function(props, ref)
|
|
|
46
56
|
TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor,
|
|
47
57
|
Text = character,
|
|
48
58
|
}
|
|
49
|
-
local
|
|
50
|
-
if _condition_1 == nil then
|
|
51
|
-
_condition_1 = style.lineHeight
|
|
52
|
-
end
|
|
53
|
-
_attributes.LineHeight = _condition_1
|
|
54
|
-
_attributes.FontFace = Font.fromName(style.font.Name, weight)
|
|
55
|
-
_attributes.FontSize = style.size
|
|
56
|
-
_attributes.RichText = false
|
|
57
|
-
local _condition_2 = props.TextScaled
|
|
59
|
+
local _condition_2 = props.LineHeight
|
|
58
60
|
if _condition_2 == nil then
|
|
59
|
-
_condition_2 =
|
|
61
|
+
_condition_2 = style.lineHeight
|
|
60
62
|
end
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
_attributes_1.LineHeight = _condition_2
|
|
64
|
+
_attributes_1.FontFace = Font.fromName(style.font.Name, weight)
|
|
65
|
+
_attributes_1.FontSize = style.size
|
|
66
|
+
_attributes_1.RichText = false
|
|
67
|
+
local _condition_3 = props.TextScaled
|
|
68
|
+
if _condition_3 == nil then
|
|
69
|
+
_condition_3 = false
|
|
70
|
+
end
|
|
71
|
+
_attributes_1.TextScaled = _condition_3
|
|
72
|
+
_attributes_1.TextStrokeColor3 = props.TextStrokeColor3
|
|
73
|
+
_attributes_1.TextStrokeTransparency = props.TextStrokeTransparency
|
|
74
|
+
_attributes_1.TextTransparency = props.TextTransparency
|
|
75
|
+
return React.createElement("textlabel", _attributes_1)
|
|
66
76
|
end
|
|
67
77
|
for _k, _v in characters do
|
|
68
78
|
_newValue[_k] = _callback(_v, _k - 1, characters)
|
|
69
79
|
end
|
|
70
80
|
-- ▲ ReadonlyArray.map ▲
|
|
71
|
-
return React.createElement("frame",
|
|
72
|
-
Size = UDim2.fromScale(0, 0),
|
|
73
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
74
|
-
AnchorPoint = props.AnchorPoint,
|
|
75
|
-
BackgroundTransparency = 1,
|
|
76
|
-
Position = props.Position,
|
|
77
|
-
ZIndex = props.ZIndex,
|
|
78
|
-
LayoutOrder = props.LayoutOrder,
|
|
79
|
-
Visible = props.Visible,
|
|
80
|
-
Rotation = props.Rotation,
|
|
81
|
-
}, _exp, _newValue)
|
|
81
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
82
82
|
end
|
|
83
|
-
local _attributes = {
|
|
84
|
-
|
|
85
|
-
Size = UDim2.fromScale(0, 0),
|
|
86
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
87
|
-
AnchorPoint = props.AnchorPoint,
|
|
88
|
-
}
|
|
89
|
-
local _condition_1 = props.LineHeight
|
|
83
|
+
local _attributes = {}
|
|
84
|
+
local _condition_1 = props.name
|
|
90
85
|
if _condition_1 == nil then
|
|
91
|
-
_condition_1 =
|
|
86
|
+
_condition_1 = "Text"
|
|
92
87
|
end
|
|
93
|
-
_attributes.
|
|
94
|
-
|
|
88
|
+
_attributes.key = _condition_1
|
|
89
|
+
_attributes.ref = ref
|
|
90
|
+
_attributes.Size = UDim2.fromScale(0, 0)
|
|
91
|
+
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
92
|
+
_attributes.AnchorPoint = props.AnchorPoint
|
|
93
|
+
local _condition_2 = props.LineHeight
|
|
95
94
|
if _condition_2 == nil then
|
|
96
|
-
_condition_2 =
|
|
95
|
+
_condition_2 = style.lineHeight
|
|
96
|
+
end
|
|
97
|
+
_attributes.LineHeight = _condition_2
|
|
98
|
+
local _condition_3 = props.BackgroundTransparency
|
|
99
|
+
if _condition_3 == nil then
|
|
100
|
+
_condition_3 = 1
|
|
97
101
|
end
|
|
98
|
-
_attributes.BackgroundTransparency =
|
|
102
|
+
_attributes.BackgroundTransparency = _condition_3
|
|
99
103
|
_attributes.TextXAlignment = props.align or (props.TextXAlignment or Enum.TextXAlignment.Left)
|
|
100
104
|
_attributes.TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor
|
|
101
105
|
_attributes.Text = props.text
|
|
@@ -104,16 +108,16 @@ local Text = React.forwardRef(function(props, ref)
|
|
|
104
108
|
_attributes.TextWrapped = textwrapped
|
|
105
109
|
_attributes.FontFace = Font.fromName(style.font.Name, weight)
|
|
106
110
|
_attributes.FontSize = style.size
|
|
107
|
-
local
|
|
108
|
-
if _condition_3 == nil then
|
|
109
|
-
_condition_3 = true
|
|
110
|
-
end
|
|
111
|
-
_attributes.RichText = _condition_3
|
|
112
|
-
local _condition_4 = props.TextScaled
|
|
111
|
+
local _condition_4 = props.RichText
|
|
113
112
|
if _condition_4 == nil then
|
|
114
|
-
_condition_4 =
|
|
113
|
+
_condition_4 = true
|
|
114
|
+
end
|
|
115
|
+
_attributes.RichText = _condition_4
|
|
116
|
+
local _condition_5 = props.TextScaled
|
|
117
|
+
if _condition_5 == nil then
|
|
118
|
+
_condition_5 = false
|
|
115
119
|
end
|
|
116
|
-
_attributes.TextScaled =
|
|
120
|
+
_attributes.TextScaled = _condition_5
|
|
117
121
|
_attributes.ZIndex = props.ZIndex
|
|
118
122
|
_attributes.LayoutOrder = props.LayoutOrder
|
|
119
123
|
_attributes.Visible = props.Visible
|
package/out/Contexts/index.d.ts
CHANGED
package/out/Contexts/init.luau
CHANGED
|
@@ -7,6 +7,9 @@ end
|
|
|
7
7
|
for _k, _v in TS.import(script, script, "droppable.context") or {} do
|
|
8
8
|
exports[_k] = _v
|
|
9
9
|
end
|
|
10
|
+
for _k, _v in TS.import(script, script, "modal.context") or {} do
|
|
11
|
+
exports[_k] = _v
|
|
12
|
+
end
|
|
10
13
|
for _k, _v in TS.import(script, script, "navigation.context") or {} do
|
|
11
14
|
exports[_k] = _v
|
|
12
15
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
export interface ModalStackLayer {
|
|
3
|
+
id: string;
|
|
4
|
+
closeOnEscape: () => boolean;
|
|
5
|
+
requestClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ModalStackContextValue {
|
|
8
|
+
register: (layer: ModalStackLayer) => void;
|
|
9
|
+
unregister: (id: string) => void;
|
|
10
|
+
getLayerIndex: (id: string) => number;
|
|
11
|
+
}
|
|
12
|
+
export declare const ModalStackContext: React.Context<ModalStackContextValue | undefined>;
|
|
13
|
+
export declare function useModalStack(): ModalStackContextValue;
|
|
14
|
+
export declare const ModalCloseContext: React.Context<(() => void) | undefined>;
|
|
15
|
+
export declare function useModalClose(): () => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 ModalStackContext = React.createContext(nil)
|
|
5
|
+
local function useModalStack()
|
|
6
|
+
local context = React.useContext(ModalStackContext)
|
|
7
|
+
local _arg0 = context ~= nil
|
|
8
|
+
assert(_arg0, "ModalProvider is missing.")
|
|
9
|
+
return context
|
|
10
|
+
end
|
|
11
|
+
local ModalCloseContext = React.createContext(nil)
|
|
12
|
+
local function useModalClose()
|
|
13
|
+
local context = React.useContext(ModalCloseContext)
|
|
14
|
+
local _arg0 = context ~= nil
|
|
15
|
+
assert(_arg0, "useModalClose must be used inside a Modal.")
|
|
16
|
+
return context
|
|
17
|
+
end
|
|
18
|
+
return {
|
|
19
|
+
useModalStack = useModalStack,
|
|
20
|
+
useModalClose = useModalClose,
|
|
21
|
+
ModalStackContext = ModalStackContext,
|
|
22
|
+
ModalCloseContext = ModalCloseContext,
|
|
23
|
+
}
|
|
@@ -46,6 +46,7 @@ do
|
|
|
46
46
|
function ColorHelper:mergeLayers(layers)
|
|
47
47
|
local merged = {}
|
|
48
48
|
local backgroundImage
|
|
49
|
+
local backgroundGradient
|
|
49
50
|
local typography
|
|
50
51
|
for _, layer in layers do
|
|
51
52
|
if layer == nil then
|
|
@@ -69,6 +70,32 @@ do
|
|
|
69
70
|
end
|
|
70
71
|
backgroundImage = _object_1
|
|
71
72
|
end
|
|
73
|
+
if layer.backgroundGradient ~= nil then
|
|
74
|
+
local _result
|
|
75
|
+
if layer.backgroundGradient.colors ~= nil then
|
|
76
|
+
local _object_1 = {}
|
|
77
|
+
if backgroundGradient then
|
|
78
|
+
for _k, _v in backgroundGradient do
|
|
79
|
+
_object_1[_k] = _v
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
_object_1.stops = nil
|
|
83
|
+
_result = _object_1
|
|
84
|
+
else
|
|
85
|
+
_result = backgroundGradient
|
|
86
|
+
end
|
|
87
|
+
local inheritedGradient = _result
|
|
88
|
+
local _object_1 = {}
|
|
89
|
+
if inheritedGradient then
|
|
90
|
+
for _k, _v in inheritedGradient do
|
|
91
|
+
_object_1[_k] = _v
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
for _k, _v in layer.backgroundGradient do
|
|
95
|
+
_object_1[_k] = _v
|
|
96
|
+
end
|
|
97
|
+
backgroundGradient = _object_1
|
|
98
|
+
end
|
|
72
99
|
if layer.typography ~= nil then
|
|
73
100
|
local _object_1 = {}
|
|
74
101
|
if typography then
|
|
@@ -83,6 +110,7 @@ do
|
|
|
83
110
|
end
|
|
84
111
|
end
|
|
85
112
|
merged.backgroundImage = backgroundImage
|
|
113
|
+
merged.backgroundGradient = backgroundGradient
|
|
86
114
|
merged.typography = typography
|
|
87
115
|
return merged
|
|
88
116
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssBoxShadow, CssShadow, CssCalcSize, CssQuad, CssDual, CssSliceInset } from "../Interfaces/css.types";
|
|
1
|
+
import { CssBoxShadow, CssShadow, CssCalcSize, CssQuad, CssDual, CssSliceInset, CssBackgroundGradient } from "../Interfaces/css.types";
|
|
2
2
|
import { CssBackgroundImage } from "../Theme";
|
|
3
3
|
interface ParsedShadow {
|
|
4
4
|
offset: UDim2;
|
|
@@ -35,5 +35,8 @@ export declare class CssHelper {
|
|
|
35
35
|
SliceScale?: number;
|
|
36
36
|
TileSize?: UDim2;
|
|
37
37
|
};
|
|
38
|
+
static resolveBackgroundGradient(value: Partial<CssBackgroundGradient> | undefined): React.InstanceProps<UIGradient> | undefined;
|
|
39
|
+
private static buildColorSequence;
|
|
40
|
+
private static buildTransparencySequence;
|
|
38
41
|
}
|
|
39
42
|
export {};
|
|
@@ -86,12 +86,6 @@ do
|
|
|
86
86
|
if type(_value) == "number" then
|
|
87
87
|
return UDim.new(0, value)
|
|
88
88
|
end
|
|
89
|
-
-- The one CSS calc() shape supported: "<percent>% - <px>px" /
|
|
90
|
-
-- "<percent>% + <px>px" (e.g. "100% - 50px") maps directly onto
|
|
91
|
-
-- UDim(scale, offset) — split on the literal " - "/" + " separator
|
|
92
|
-
-- and parse each term with this same function. Anything without
|
|
93
|
-
-- either separator falls through to the single-token parsing below,
|
|
94
|
-
-- unchanged.
|
|
95
89
|
local minusParts = string.split(value, " - ")
|
|
96
90
|
if #minusParts == 2 then
|
|
97
91
|
local scale = self:parseCssSize(minusParts[1]).Scale
|
|
@@ -341,6 +335,82 @@ do
|
|
|
341
335
|
_object.TileSize = if value.tileSize ~= nil then self:parseCssDual(value.tileSize) else nil
|
|
342
336
|
return _object
|
|
343
337
|
end
|
|
338
|
+
function CssHelper:resolveBackgroundGradient(value)
|
|
339
|
+
local _colors = value
|
|
340
|
+
if _colors ~= nil then
|
|
341
|
+
_colors = _colors.colors
|
|
342
|
+
end
|
|
343
|
+
local colors = _colors
|
|
344
|
+
if value == nil or colors == nil then
|
|
345
|
+
return nil
|
|
346
|
+
end
|
|
347
|
+
if not (typeof(colors) == "ColorSequence") and #colors == 0 then
|
|
348
|
+
return nil
|
|
349
|
+
end
|
|
350
|
+
local color = if typeof(colors) == "ColorSequence" then colors else self:buildColorSequence(colors, value.stops)
|
|
351
|
+
return {
|
|
352
|
+
Color = color,
|
|
353
|
+
Transparency = self:buildTransparencySequence(value.transparency),
|
|
354
|
+
Rotation = value.rotation,
|
|
355
|
+
Offset = value.offset,
|
|
356
|
+
}
|
|
357
|
+
end
|
|
358
|
+
function CssHelper:buildColorSequence(colors, stops)
|
|
359
|
+
if #colors == 1 then
|
|
360
|
+
return ColorSequence.new(colors[1])
|
|
361
|
+
end
|
|
362
|
+
local lastIndex = #colors - 1
|
|
363
|
+
-- ▼ ReadonlyArray.map ▼
|
|
364
|
+
local _newValue = table.create(#colors)
|
|
365
|
+
local _callback = function(color, index)
|
|
366
|
+
local _result = stops
|
|
367
|
+
if _result ~= nil then
|
|
368
|
+
_result = _result[index + 1]
|
|
369
|
+
end
|
|
370
|
+
local time = if _result ~= nil then math.clamp(stops[index + 1], 0, 1) else index / lastIndex
|
|
371
|
+
if index == 0 then
|
|
372
|
+
time = 0
|
|
373
|
+
elseif index == lastIndex then
|
|
374
|
+
time = 1
|
|
375
|
+
end
|
|
376
|
+
return {
|
|
377
|
+
time = time,
|
|
378
|
+
color = color,
|
|
379
|
+
index = index,
|
|
380
|
+
}
|
|
381
|
+
end
|
|
382
|
+
for _k, _v in colors do
|
|
383
|
+
_newValue[_k] = _callback(_v, _k - 1, colors)
|
|
384
|
+
end
|
|
385
|
+
-- ▲ ReadonlyArray.map ▲
|
|
386
|
+
local entries = _newValue
|
|
387
|
+
table.sort(entries, function(a, b)
|
|
388
|
+
if a.time ~= b.time then
|
|
389
|
+
return a.time < b.time
|
|
390
|
+
end
|
|
391
|
+
return a.index < b.index
|
|
392
|
+
end)
|
|
393
|
+
-- ▼ ReadonlyArray.map ▼
|
|
394
|
+
local _newValue_1 = table.create(#entries)
|
|
395
|
+
local _callback_1 = function(entry)
|
|
396
|
+
return ColorSequenceKeypoint.new(entry.time, entry.color)
|
|
397
|
+
end
|
|
398
|
+
for _k, _v in entries do
|
|
399
|
+
_newValue_1[_k] = _callback_1(_v, _k - 1, entries)
|
|
400
|
+
end
|
|
401
|
+
-- ▲ ReadonlyArray.map ▲
|
|
402
|
+
return ColorSequence.new(_newValue_1)
|
|
403
|
+
end
|
|
404
|
+
function CssHelper:buildTransparencySequence(value)
|
|
405
|
+
if value == nil then
|
|
406
|
+
return nil
|
|
407
|
+
end
|
|
408
|
+
local _value = value
|
|
409
|
+
if typeof(_value) == "NumberSequence" then
|
|
410
|
+
return value
|
|
411
|
+
end
|
|
412
|
+
return NumberSequence.new(math.clamp(value, 0, 1))
|
|
413
|
+
end
|
|
344
414
|
end
|
|
345
415
|
return {
|
|
346
416
|
CssHelper = CssHelper,
|
|
@@ -84,7 +84,6 @@ do
|
|
|
84
84
|
rootIndex = index,
|
|
85
85
|
}
|
|
86
86
|
table.insert(surfaces, _arg0)
|
|
87
|
-
-- Don't recurse into another render surface.
|
|
88
87
|
continue
|
|
89
88
|
end
|
|
90
89
|
visit(child)
|
|
@@ -117,11 +116,9 @@ do
|
|
|
117
116
|
if a.object.ZIndex ~= b.object.ZIndex then
|
|
118
117
|
return a.object.ZIndex < b.object.ZIndex
|
|
119
118
|
end
|
|
120
|
-
-- Preserve sibling order.
|
|
121
119
|
return a.siblingIndex < b.siblingIndex
|
|
122
120
|
end)
|
|
123
121
|
for _, child in children do
|
|
124
|
-
-- Parent renders before its children.
|
|
125
122
|
local _result = result
|
|
126
123
|
local _object = child.object
|
|
127
124
|
table.insert(_result, _object)
|
|
@@ -63,8 +63,6 @@ do
|
|
|
63
63
|
if props.AutomaticSize ~= nil then
|
|
64
64
|
return props.AutomaticSize
|
|
65
65
|
end
|
|
66
|
-
-- "Auto" behaves like an unset dimension for the purposes of deciding
|
|
67
|
-
-- which axes get AutomaticSize, but still forces that axis to 0 in GetSize.
|
|
68
66
|
local width = if props.width == "Auto" then nil else props.width
|
|
69
67
|
local height = if props.height == "Auto" then nil else props.height
|
|
70
68
|
local _condition = props.Size ~= nil
|
|
@@ -39,9 +39,6 @@ do
|
|
|
39
39
|
end
|
|
40
40
|
local isNone = props.spacing == "None"
|
|
41
41
|
local key = if props.spacing ~= nil and props.spacing ~= "None" then props.spacing else (defaultSpacing or theme.default.spacing)
|
|
42
|
-
-- tier 3: a scale-indexed map picks the quad for the active key
|
|
43
|
-
-- (falling through to tiers 1/2 if that key isn't defined in the
|
|
44
|
-
-- map); a plain quad applies regardless of key.
|
|
45
42
|
local _result
|
|
46
43
|
if isNone or componentPadding == nil then
|
|
47
44
|
_result = nil
|