@rbxts/react-clean-ui 1.0.9 → 1.0.12
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.d.ts +7 -7
- package/out/Components/Input/Button.luau +8 -33
- package/out/Components/Interaction/Toast.luau +0 -1
- package/out/Components/Interaction/Tooltip.d.ts +11 -0
- package/out/Components/Interaction/Tooltip.luau +256 -0
- package/out/Components/Interaction/index.d.ts +2 -0
- package/out/Components/Interaction/init.luau +10 -0
- package/out/Components/Typography/Text.d.ts +2 -7
- package/out/Components/Typography/Text.luau +22 -42
- package/out/Components/index.d.ts +2 -3
- package/out/Components/init.luau +4 -7
- package/out/Theme/index.d.ts +1 -1
- package/out/Theme/init.luau +0 -3
- package/out/Theme/theme.template.d.ts +8 -0
- package/out/Theme/themes/default.theme.luau +27 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import { BackgroundElementProps, IconElementProps, IntentElementProps, ScalableElementProps, ShadowElementProps, SpacedElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
3
|
import { IconProps } from "../Surface";
|
|
4
4
|
export interface ButtonProps extends SpacedElementProps, ShadowElementProps, ZIndexElementProps, BackgroundElementProps, IntentElementProps, ScalableElementProps, IconElementProps {
|
|
@@ -16,9 +16,9 @@ declare function ButtonText(props: ButtonTextProps): React.JSX.Element;
|
|
|
16
16
|
export interface ButtonIconProps extends IconProps, IntentElementProps {
|
|
17
17
|
}
|
|
18
18
|
declare function ButtonIcon(props: ButtonIconProps): React.JSX.Element;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export {};
|
|
19
|
+
type ButtonComponent = React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<ImageButton>> & {
|
|
20
|
+
Text: typeof ButtonText;
|
|
21
|
+
Icon: typeof ButtonIcon;
|
|
22
|
+
};
|
|
23
|
+
declare const Button: ButtonComponent;
|
|
24
|
+
export { Button };
|
|
@@ -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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
8
5
|
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
9
6
|
local BoxShadow = _Decorator.BoxShadow
|
|
@@ -37,12 +34,14 @@ local function ButtonIcon(props)
|
|
|
37
34
|
color = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.button.intents).textColor,
|
|
38
35
|
})
|
|
39
36
|
end
|
|
40
|
-
local
|
|
37
|
+
local Button = React.forwardRef(function(props, ref)
|
|
41
38
|
local theme = React.useContext(CleanThemeContext)
|
|
42
39
|
local hover, setHover = React.useState(false)
|
|
43
40
|
local group = React.useContext(GroupContext)
|
|
44
41
|
local padding = SpacingHelper:GetResolvedPadding(theme, props)
|
|
45
|
-
local _attributes = {
|
|
42
|
+
local _attributes = {
|
|
43
|
+
ref = ref,
|
|
44
|
+
}
|
|
46
45
|
local _object = {}
|
|
47
46
|
local _spread = props.Event
|
|
48
47
|
if _spread then
|
|
@@ -127,33 +126,9 @@ local function ButtonRender(props)
|
|
|
127
126
|
intent = props.intent,
|
|
128
127
|
scale = props.scale,
|
|
129
128
|
})), props.children))
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
local super = Component
|
|
134
|
-
Button = setmetatable({}, {
|
|
135
|
-
__tostring = function()
|
|
136
|
-
return "Button"
|
|
137
|
-
end,
|
|
138
|
-
__index = super,
|
|
139
|
-
})
|
|
140
|
-
Button.__index = Button
|
|
141
|
-
function Button.new(...)
|
|
142
|
-
local self = setmetatable({}, Button)
|
|
143
|
-
return self:constructor(...) or self
|
|
144
|
-
end
|
|
145
|
-
function Button:constructor(...)
|
|
146
|
-
super.constructor(self, ...)
|
|
147
|
-
end
|
|
148
|
-
function Button:render()
|
|
149
|
-
local _attributes = table.clone(self.props)
|
|
150
|
-
setmetatable(_attributes, nil)
|
|
151
|
-
return React.createElement(ButtonRender, _attributes)
|
|
152
|
-
end
|
|
153
|
-
Button.Text = ButtonText
|
|
154
|
-
Button.Icon = ButtonIcon
|
|
155
|
-
Button = ReactComponent(Button) or Button
|
|
156
|
-
end
|
|
129
|
+
end)
|
|
130
|
+
Button.Text = ButtonText
|
|
131
|
+
Button.Icon = ButtonIcon
|
|
157
132
|
return {
|
|
158
133
|
Button = Button,
|
|
159
134
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { IntentElementProps } from "../../Interfaces";
|
|
3
|
+
import { BoxProps } from "../Surface";
|
|
4
|
+
type TooltipPlacement = "Top" | "Bottom" | "Left" | "Right";
|
|
5
|
+
interface TooltipProps extends BoxProps, IntentElementProps {
|
|
6
|
+
content: React.ReactNode | string;
|
|
7
|
+
children: React.ReactElement<React.InstanceProps<GuiObject>>;
|
|
8
|
+
placement?: TooltipPlacement;
|
|
9
|
+
}
|
|
10
|
+
export declare function Tooltip(props: TooltipProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,256 @@
|
|
|
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 _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
|
|
5
|
+
local CleanThemeContext = _Contexts.CleanThemeContext
|
|
6
|
+
local OverlayConsumer = _Contexts.OverlayConsumer
|
|
7
|
+
local Text = TS.import(script, script.Parent.Parent, "Typography").Text
|
|
8
|
+
local ReactRoblox = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox"))
|
|
9
|
+
local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
|
|
10
|
+
local BoxShadow = _Decorator.BoxShadow
|
|
11
|
+
local Corners = _Decorator.Corners
|
|
12
|
+
local Padding = _Decorator.Padding
|
|
13
|
+
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
14
|
+
local ColorHelper = _Helpers.ColorHelper
|
|
15
|
+
local CssHelper = _Helpers.CssHelper
|
|
16
|
+
local SpacingHelper = _Helpers.SpacingHelper
|
|
17
|
+
local useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple").src).useTween
|
|
18
|
+
local function TooltipPopup(props)
|
|
19
|
+
local theme = React.useContext(CleanThemeContext)
|
|
20
|
+
local groupTransparency, transparencyTween = useTween(1, {
|
|
21
|
+
duration = props.fadeDuration,
|
|
22
|
+
easing = "quadOut",
|
|
23
|
+
})
|
|
24
|
+
React.useEffect(function()
|
|
25
|
+
transparencyTween:setGoal(if props.visible then 0 else 1)
|
|
26
|
+
end, { props.visible, transparencyTween })
|
|
27
|
+
local resolvedPadding = {
|
|
28
|
+
top = 0,
|
|
29
|
+
bottom = 0,
|
|
30
|
+
left = 0,
|
|
31
|
+
right = 0,
|
|
32
|
+
}
|
|
33
|
+
local _value = theme.components.tooltip.boxShadow
|
|
34
|
+
local shadow = if _value ~= 0 and _value == _value and _value ~= "" and _value then CssHelper:parseCssShadow(theme.components.tooltip.boxShadow) else nil
|
|
35
|
+
if shadow ~= nil then
|
|
36
|
+
resolvedPadding.top += shadow.blurRadius.Offset + shadow.spread.Y.Offset - shadow.offset.Y.Offset
|
|
37
|
+
resolvedPadding.bottom += shadow.blurRadius.Offset + shadow.spread.Y.Offset + shadow.offset.Y.Offset
|
|
38
|
+
resolvedPadding.left += shadow.blurRadius.Offset + shadow.spread.X.Offset - shadow.offset.X.Offset
|
|
39
|
+
resolvedPadding.right += shadow.blurRadius.Offset + shadow.spread.X.Offset + shadow.offset.X.Offset
|
|
40
|
+
end
|
|
41
|
+
local pointerSize = theme.components.tooltip.pointerSize
|
|
42
|
+
local anchor = Vector2.zero
|
|
43
|
+
local _position = props.target.position
|
|
44
|
+
local _absolutePosition = props.overlay.AbsolutePosition
|
|
45
|
+
local position = _position - _absolutePosition
|
|
46
|
+
local pointerRotation = 45
|
|
47
|
+
local pointerAnchor = Vector2.new(0.5, 1)
|
|
48
|
+
local pointerPosition = UDim2.new(0.5, 0, 1, 0)
|
|
49
|
+
local factor = 1.41421356
|
|
50
|
+
local pointerHeight = (factor * pointerSize) / 2
|
|
51
|
+
local pointerDiff = pointerHeight - (pointerSize / 2)
|
|
52
|
+
local _exp = props.placement or "Top"
|
|
53
|
+
repeat
|
|
54
|
+
if _exp == "Top" then
|
|
55
|
+
anchor = Vector2.new(0.5, 1)
|
|
56
|
+
local _position_1 = position
|
|
57
|
+
local _vector2 = Vector2.new(props.target.size.X / 2, 0)
|
|
58
|
+
position = _position_1 + _vector2
|
|
59
|
+
pointerPosition = UDim2.new(0.5, (resolvedPadding.left - resolvedPadding.right) / 2, 1, -math.max(math.ceil(pointerDiff), resolvedPadding.bottom - pointerDiff))
|
|
60
|
+
resolvedPadding.bottom = math.max(math.floor(pointerHeight), resolvedPadding.bottom)
|
|
61
|
+
break
|
|
62
|
+
end
|
|
63
|
+
if _exp == "Bottom" then
|
|
64
|
+
anchor = Vector2.new(0.5, 0)
|
|
65
|
+
local _position_1 = position
|
|
66
|
+
local _vector2 = Vector2.new(props.target.size.X / 2, props.target.size.Y)
|
|
67
|
+
position = _position_1 + _vector2
|
|
68
|
+
pointerAnchor = Vector2.new(0.5, 0)
|
|
69
|
+
pointerRotation = -135
|
|
70
|
+
pointerPosition = UDim2.new(0.5, (resolvedPadding.left - resolvedPadding.right) / 2, 0, math.max(math.ceil(pointerDiff), resolvedPadding.top - pointerDiff))
|
|
71
|
+
resolvedPadding.top = math.max(math.floor(pointerHeight), resolvedPadding.top)
|
|
72
|
+
break
|
|
73
|
+
end
|
|
74
|
+
if _exp == "Left" then
|
|
75
|
+
anchor = Vector2.new(1, 0.5)
|
|
76
|
+
local _position_1 = position
|
|
77
|
+
local _vector2 = Vector2.new(0, props.target.size.Y / 2)
|
|
78
|
+
position = _position_1 + _vector2
|
|
79
|
+
pointerRotation = -45
|
|
80
|
+
pointerAnchor = Vector2.new(1, 0.5)
|
|
81
|
+
pointerPosition = UDim2.new(1, -math.max(math.ceil(pointerDiff), resolvedPadding.right - pointerDiff), 0.5, 0)
|
|
82
|
+
resolvedPadding.right = math.max(math.floor(pointerHeight), resolvedPadding.right)
|
|
83
|
+
break
|
|
84
|
+
end
|
|
85
|
+
if _exp == "Right" then
|
|
86
|
+
anchor = Vector2.new(0, 0.5)
|
|
87
|
+
local _position_1 = position
|
|
88
|
+
local _vector2 = Vector2.new(props.target.size.X, props.target.size.Y / 2)
|
|
89
|
+
position = _position_1 + _vector2
|
|
90
|
+
pointerRotation = 135
|
|
91
|
+
pointerAnchor = Vector2.new(0, 0.5)
|
|
92
|
+
pointerPosition = UDim2.new(0, math.max(math.ceil(pointerDiff), resolvedPadding.left - pointerDiff), 0.5, 0)
|
|
93
|
+
resolvedPadding.left = math.max(math.floor(pointerHeight), resolvedPadding.left)
|
|
94
|
+
break
|
|
95
|
+
end
|
|
96
|
+
until true
|
|
97
|
+
local intent = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.tooltip.intents)
|
|
98
|
+
local padding = SpacingHelper:ResolveNumberPadding(SpacingHelper:GetPadding(theme, props.spacing, theme.components.tooltip.spacing))
|
|
99
|
+
local _exp_1 = React.createElement(Padding, {
|
|
100
|
+
resolvedPadding = resolvedPadding,
|
|
101
|
+
})
|
|
102
|
+
local _attributes = table.clone(props)
|
|
103
|
+
setmetatable(_attributes, nil)
|
|
104
|
+
_attributes.value = theme.components.tooltip.boxShadow
|
|
105
|
+
local _exp_2 = React.createElement(BoxShadow, _attributes)
|
|
106
|
+
local _exp_3 = React.createElement(Corners, {
|
|
107
|
+
radius = theme.components.button.cornerRadius,
|
|
108
|
+
})
|
|
109
|
+
local _attributes_1 = table.clone(props)
|
|
110
|
+
setmetatable(_attributes_1, nil)
|
|
111
|
+
_attributes_1.resolvedPadding = padding
|
|
112
|
+
local _exp_4 = React.createElement(Padding, _attributes_1)
|
|
113
|
+
local _attributes_2 = {}
|
|
114
|
+
local _condition = props["border-thickness"]
|
|
115
|
+
if _condition == nil then
|
|
116
|
+
_condition = theme.components.box.borderThickness
|
|
117
|
+
end
|
|
118
|
+
_attributes_2.Thickness = _condition
|
|
119
|
+
_attributes_2.BorderStrokePosition = Enum.BorderStrokePosition.Inner
|
|
120
|
+
_attributes_2.Color = props["border-color"] or intent.borderColor
|
|
121
|
+
local _exp_5 = React.createElement("uistroke", _attributes_2)
|
|
122
|
+
local _content = props.content
|
|
123
|
+
return React.createElement("canvasgroup", {
|
|
124
|
+
Position = UDim2.fromOffset(position.X, position.Y),
|
|
125
|
+
AnchorPoint = anchor,
|
|
126
|
+
Size = UDim2.fromOffset(0, 0),
|
|
127
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
128
|
+
GroupTransparency = groupTransparency,
|
|
129
|
+
BackgroundTransparency = 1,
|
|
130
|
+
}, React.createElement("frame", {
|
|
131
|
+
Size = UDim2.fromOffset(0, 0),
|
|
132
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
133
|
+
BackgroundTransparency = 1,
|
|
134
|
+
}, _exp_1, React.createElement("frame", {
|
|
135
|
+
Size = UDim2.fromOffset(0, 0),
|
|
136
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
137
|
+
BackgroundColor3 = intent.backgroundColor,
|
|
138
|
+
BackgroundTransparency = intent.backgroundTransparency,
|
|
139
|
+
}, _exp_2, _exp_3, _exp_4, _exp_5, if type(_content) == "string" then React.createElement(Text, {
|
|
140
|
+
text = props.content,
|
|
141
|
+
TextColor3 = intent.textColor,
|
|
142
|
+
}) else props.content)), pointerSize > 0 and React.createElement("frame", {
|
|
143
|
+
Size = UDim2.fromOffset(pointerSize, pointerSize),
|
|
144
|
+
AnchorPoint = pointerAnchor,
|
|
145
|
+
Position = pointerPosition,
|
|
146
|
+
BorderSizePixel = 1,
|
|
147
|
+
BackgroundColor3 = intent.backgroundColor,
|
|
148
|
+
BorderColor3 = props["border-color"] or intent.borderColor,
|
|
149
|
+
BackgroundTransparency = intent.backgroundTransparency,
|
|
150
|
+
Rotation = 45,
|
|
151
|
+
}, React.createElement("uigradient", {
|
|
152
|
+
Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.4999, 1), NumberSequenceKeypoint.new(0.5, 0), NumberSequenceKeypoint.new(1, 0) }),
|
|
153
|
+
Rotation = pointerRotation,
|
|
154
|
+
})))
|
|
155
|
+
end
|
|
156
|
+
local function Tooltip(props)
|
|
157
|
+
local targetRef = React.useRef()
|
|
158
|
+
local hideRequest = React.useRef(0)
|
|
159
|
+
local target, setTarget = React.useState()
|
|
160
|
+
local visible, setVisible = React.useState(false)
|
|
161
|
+
local theme = React.useContext(CleanThemeContext)
|
|
162
|
+
local fadeDuration = theme.components.tooltip.fadeDuration
|
|
163
|
+
local show = function()
|
|
164
|
+
hideRequest.current += 1
|
|
165
|
+
local _result = targetRef.current
|
|
166
|
+
if _result ~= nil then
|
|
167
|
+
_result = _result.AbsolutePosition
|
|
168
|
+
end
|
|
169
|
+
if _result then
|
|
170
|
+
local _object = {}
|
|
171
|
+
local _left = "position"
|
|
172
|
+
local _result_1 = targetRef.current
|
|
173
|
+
if _result_1 ~= nil then
|
|
174
|
+
_result_1 = _result_1.AbsolutePosition
|
|
175
|
+
end
|
|
176
|
+
_object[_left] = _result_1
|
|
177
|
+
local _left_1 = "size"
|
|
178
|
+
local _result_2 = targetRef.current
|
|
179
|
+
if _result_2 ~= nil then
|
|
180
|
+
_result_2 = _result_2.AbsoluteSize
|
|
181
|
+
end
|
|
182
|
+
_object[_left_1] = _result_2
|
|
183
|
+
setTarget(_object)
|
|
184
|
+
end
|
|
185
|
+
setVisible(true)
|
|
186
|
+
end
|
|
187
|
+
local hide = function()
|
|
188
|
+
setVisible(false)
|
|
189
|
+
local request = hideRequest.current + 1
|
|
190
|
+
hideRequest.current = request
|
|
191
|
+
if fadeDuration <= 0 then
|
|
192
|
+
setTarget(nil)
|
|
193
|
+
return nil
|
|
194
|
+
end
|
|
195
|
+
task.delay(fadeDuration, function()
|
|
196
|
+
-- Do not remove it if the tooltip was shown again.
|
|
197
|
+
if hideRequest.current == request then
|
|
198
|
+
setTarget(nil)
|
|
199
|
+
end
|
|
200
|
+
end)
|
|
201
|
+
end
|
|
202
|
+
local _exp = props.children
|
|
203
|
+
local _object = {
|
|
204
|
+
ref = targetRef,
|
|
205
|
+
}
|
|
206
|
+
local _left = "Event"
|
|
207
|
+
local _object_1 = {}
|
|
208
|
+
local _spread = props.children.props.Event
|
|
209
|
+
if _spread then
|
|
210
|
+
for _k, _v in _spread do
|
|
211
|
+
_object_1[_k] = _v
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
_object_1.MouseEnter = function(guiObject, x, y)
|
|
215
|
+
local _result = props.children.props.Event
|
|
216
|
+
if _result ~= nil then
|
|
217
|
+
_result = _result.MouseEnter
|
|
218
|
+
if _result ~= nil then
|
|
219
|
+
_result(guiObject, x, y)
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
show()
|
|
223
|
+
end
|
|
224
|
+
_object_1.MouseLeave = function(guiObject, x, y)
|
|
225
|
+
local _result = props.children.props.Event
|
|
226
|
+
if _result ~= nil then
|
|
227
|
+
_result = _result.MouseLeave
|
|
228
|
+
if _result ~= nil then
|
|
229
|
+
_result(guiObject, x, y)
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
hide()
|
|
233
|
+
end
|
|
234
|
+
_object[_left] = _object_1
|
|
235
|
+
local child = React.cloneElement(_exp, _object)
|
|
236
|
+
return React.createElement(React.Fragment, nil, child, target ~= nil and (React.createElement(OverlayConsumer, {
|
|
237
|
+
render = function(overlay)
|
|
238
|
+
if overlay == nil then
|
|
239
|
+
return nil
|
|
240
|
+
end
|
|
241
|
+
local _attributes = {
|
|
242
|
+
fadeDuration = fadeDuration,
|
|
243
|
+
}
|
|
244
|
+
for _k, _v in props do
|
|
245
|
+
_attributes[_k] = _v
|
|
246
|
+
end
|
|
247
|
+
_attributes.overlay = overlay
|
|
248
|
+
_attributes.target = target
|
|
249
|
+
_attributes.visible = visible
|
|
250
|
+
return ReactRoblox.createPortal(React.createElement(TooltipPopup, _attributes), overlay)
|
|
251
|
+
end,
|
|
252
|
+
})))
|
|
253
|
+
end
|
|
254
|
+
return {
|
|
255
|
+
Tooltip = Tooltip,
|
|
256
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "Toast") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "Tooltip") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
10
|
+
return exports
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { CleanThemeContext } from "../../Contexts";
|
|
1
|
+
import React from "@rbxts/react";
|
|
3
2
|
import { TypographyStyle } from "../../Theme";
|
|
4
3
|
import { TextVariant } from "../../Interfaces/";
|
|
5
4
|
interface TextProps extends React.InstanceProps<TextLabel> {
|
|
@@ -10,9 +9,5 @@ interface TextProps extends React.InstanceProps<TextLabel> {
|
|
|
10
9
|
align?: "Left" | "Right" | "Center";
|
|
11
10
|
TextWrap?: boolean;
|
|
12
11
|
}
|
|
13
|
-
export declare
|
|
14
|
-
static contextType: React.Context<import("../../Theme").CleanTheme>;
|
|
15
|
-
context: React.ContextType<typeof CleanThemeContext>;
|
|
16
|
-
render(): React.ReactNode;
|
|
17
|
-
}
|
|
12
|
+
export declare const Text: React.ForwardRefExoticComponent<Omit<TextProps, "ref"> & React.RefAttributes<TextLabel>>;
|
|
18
13
|
export {};
|
|
@@ -1,48 +1,28 @@
|
|
|
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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
8
|
-
local Text
|
|
9
|
-
|
|
10
|
-
local
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Size = UDim2.fromScale(0, 0),
|
|
30
|
-
AutomaticSize = Enum.AutomaticSize.XY,
|
|
31
|
-
LineHeight = style.lineHeight,
|
|
32
|
-
BackgroundTransparency = 1,
|
|
33
|
-
TextXAlignment = self.props.align or (self.props.TextXAlignment or Enum.TextXAlignment.Left),
|
|
34
|
-
TextColor3 = self.props.TextColor3 or self.context.colors.intents.primary.default.textColor,
|
|
35
|
-
Text = self.props.text,
|
|
36
|
-
TextWrap = self.props.TextWrap == nil or self.props.TextWrap == true,
|
|
37
|
-
FontFace = Font.fromName(style.font.Name, weight),
|
|
38
|
-
FontSize = style.size,
|
|
39
|
-
RichText = true,
|
|
40
|
-
TextScaled = false,
|
|
41
|
-
}, self.props.children)
|
|
42
|
-
end
|
|
43
|
-
Text.contextType = CleanThemeContext
|
|
44
|
-
Text = ReactComponent(Text) or Text
|
|
45
|
-
end
|
|
5
|
+
local Text = React.forwardRef(function(props, ref)
|
|
6
|
+
local theme = React.useContext(CleanThemeContext)
|
|
7
|
+
local style = props.typography or theme.typography[props.variant or "body"]
|
|
8
|
+
local weight = if props.weight == "bold" then Enum.FontWeight.Bold else props.weight or style.weight or Enum.FontWeight.Regular
|
|
9
|
+
return React.createElement("textlabel", {
|
|
10
|
+
ref = ref,
|
|
11
|
+
Size = UDim2.fromScale(0, 0),
|
|
12
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
13
|
+
LineHeight = style.lineHeight,
|
|
14
|
+
BackgroundTransparency = 1,
|
|
15
|
+
TextXAlignment = props.align or (props.TextXAlignment or Enum.TextXAlignment.Left),
|
|
16
|
+
TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor,
|
|
17
|
+
Text = props.text,
|
|
18
|
+
TextWrap = props.TextWrap == nil or props.TextWrap == true,
|
|
19
|
+
FontFace = Font.fromName(style.font.Name, weight),
|
|
20
|
+
FontSize = style.size,
|
|
21
|
+
RichText = true,
|
|
22
|
+
Event = props.Event,
|
|
23
|
+
TextScaled = false,
|
|
24
|
+
}, props.children)
|
|
25
|
+
end)
|
|
46
26
|
return {
|
|
47
27
|
Text = Text,
|
|
48
28
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from './Decorator/
|
|
2
|
-
export * from './Decorator/Corners';
|
|
3
|
-
export * from './Decorator/Padding';
|
|
1
|
+
export * from './Decorator/';
|
|
4
2
|
export * from './Surface/';
|
|
5
3
|
export * from './Layout/';
|
|
6
4
|
export * from './Input/';
|
|
7
5
|
export * from './Typography/Text';
|
|
8
6
|
export * from './Navigation/Menu';
|
|
7
|
+
export * from './Interaction';
|
package/out/Components/init.luau
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
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, "Decorator"
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "Decorator", "Corners") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
for _k, _v in TS.import(script, script, "Decorator", "Padding") or {} do
|
|
4
|
+
for _k, _v in TS.import(script, script, "Decorator") or {} do
|
|
11
5
|
exports[_k] = _v
|
|
12
6
|
end
|
|
13
7
|
for _k, _v in TS.import(script, script, "Surface") or {} do
|
|
@@ -25,4 +19,7 @@ end
|
|
|
25
19
|
for _k, _v in TS.import(script, script, "Navigation", "Menu") or {} do
|
|
26
20
|
exports[_k] = _v
|
|
27
21
|
end
|
|
22
|
+
for _k, _v in TS.import(script, script, "Interaction") or {} do
|
|
23
|
+
exports[_k] = _v
|
|
24
|
+
end
|
|
28
25
|
return exports
|
package/out/Theme/index.d.ts
CHANGED
package/out/Theme/init.luau
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
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, "theme.template") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
4
|
for _k, _v in TS.import(script, script, "theme.factory") or {} do
|
|
8
5
|
exports[_k] = _v
|
|
9
6
|
end
|
|
@@ -180,6 +180,14 @@ export interface CleanTheme {
|
|
|
180
180
|
intents?: Partial<Record<Intent, Partial<IntentScheme>>>;
|
|
181
181
|
};
|
|
182
182
|
};
|
|
183
|
+
tooltip: {
|
|
184
|
+
fadeDuration: number;
|
|
185
|
+
pointerSize: number;
|
|
186
|
+
spacing?: ScaleSizeValue<number>;
|
|
187
|
+
boxShadow?: CssShadow;
|
|
188
|
+
cornerRadius: CssSize;
|
|
189
|
+
intents?: Partial<Record<Intent, Partial<IntentScheme>>>;
|
|
190
|
+
};
|
|
183
191
|
};
|
|
184
192
|
icons: Partial<IconSet>;
|
|
185
193
|
iconSize: ScaleSizeValue<number>;
|
|
@@ -441,6 +441,33 @@ local DefaultTheme = {
|
|
|
441
441
|
},
|
|
442
442
|
},
|
|
443
443
|
},
|
|
444
|
+
tooltip = {
|
|
445
|
+
fadeDuration = 0.25,
|
|
446
|
+
pointerSize = 10,
|
|
447
|
+
spacing = {
|
|
448
|
+
xs = 2,
|
|
449
|
+
sm = 6,
|
|
450
|
+
md = 10,
|
|
451
|
+
lg = 12,
|
|
452
|
+
xl = 20,
|
|
453
|
+
},
|
|
454
|
+
cornerRadius = 8,
|
|
455
|
+
boxShadow = "2px 2px 2px 2px",
|
|
456
|
+
intents = {
|
|
457
|
+
success = {
|
|
458
|
+
textColor = Color3.fromHex("#FFFFFF"),
|
|
459
|
+
},
|
|
460
|
+
warning = {
|
|
461
|
+
textColor = Color3.fromHex("#75520f"),
|
|
462
|
+
},
|
|
463
|
+
danger = {
|
|
464
|
+
textColor = Color3.fromHex("#731717"),
|
|
465
|
+
},
|
|
466
|
+
info = {
|
|
467
|
+
textColor = Color3.fromHex("#FFFFFF"),
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
444
471
|
},
|
|
445
472
|
icons = {
|
|
446
473
|
["shopping-cart"] = 112388431913339,
|