@rbxts-ui/components 2.1.0 → 3.0.0
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/dist/DynamicWindow/DynamicWindow.d.ts +19 -0
- package/dist/DynamicWindow/DynamicWindow.luau +327 -0
- package/dist/DynamicWindow/DynamicWindow.utils.d.ts +13 -0
- package/dist/DynamicWindow/DynamicWindow.utils.luau +46 -0
- package/dist/DynamicWindow/ResizeCornerButton.d.ts +13 -0
- package/dist/DynamicWindow/ResizeCornerButton.luau +47 -0
- package/dist/DynamicWindow/TrafficLightButton.d.ts +8 -0
- package/dist/DynamicWindow/TrafficLightButton.luau +26 -0
- package/dist/{DropdownButton.d.ts → buttons/DropdownButton.d.ts} +1 -3
- package/dist/{DropdownButton.luau → buttons/DropdownButton.luau} +4 -9
- package/dist/{DropdownOptionButton.d.ts → buttons/DropdownOptionButton.d.ts} +1 -3
- package/dist/{DropdownOptionButton.luau → buttons/DropdownOptionButton.luau} +3 -7
- package/dist/{IconRoundButton.d.ts → buttons/IconRoundButton.d.ts} +1 -3
- package/dist/{IconRoundButton.luau → buttons/IconRoundButton.luau} +4 -8
- package/dist/{IconTileButton.d.ts → buttons/IconTileButton.d.ts} +1 -3
- package/dist/{IconTileButton.luau → buttons/IconTileButton.luau} +8 -11
- package/dist/{PrimaryButton.d.ts → buttons/PrimaryButton.d.ts} +1 -3
- package/dist/{PrimaryButton.luau → buttons/PrimaryButton.luau} +4 -9
- package/dist/{ReactiveButton.d.ts → buttons/ReactiveButton.d.ts} +1 -3
- package/dist/{ReactiveButton.luau → buttons/ReactiveButton.luau} +5 -10
- package/dist/{TextButton.d.ts → buttons/TextButton.d.ts} +1 -3
- package/dist/{TextButton.luau → buttons/TextButton.luau} +7 -11
- package/dist/{Checkmark.luau → display/Checkmark.luau} +1 -1
- package/dist/{Legend.luau → display/Legend.luau} +1 -1
- package/dist/{PillText.d.ts → display/PillText.d.ts} +0 -2
- package/dist/{PillText.luau → display/PillText.luau} +6 -10
- package/dist/error-handler/ErrorHandler.d.ts +3 -0
- package/dist/error-handler/ErrorHandler.luau +18 -0
- package/dist/error-handler/ErrorPage.d.ts +6 -0
- package/dist/error-handler/ErrorPage.luau +144 -0
- package/dist/error-handler/index.d.ts +3 -0
- package/dist/error-handler/init.luau +6 -0
- package/dist/{Checkbox.d.ts → form/Checkbox.d.ts} +1 -3
- package/dist/{Checkbox.luau → form/Checkbox.luau} +5 -10
- package/dist/{CheckboxRow.d.ts → form/CheckboxRow.d.ts} +1 -3
- package/dist/{CheckboxRow.luau → form/CheckboxRow.luau} +4 -8
- package/dist/{Dropdown.d.ts → form/Dropdown.d.ts} +0 -2
- package/dist/{Dropdown.luau → form/Dropdown.luau} +7 -12
- package/dist/form/DropdownRow.d.ts +18 -0
- package/dist/form/DropdownRow.luau +28 -0
- package/dist/form/FormRow.d.ts +9 -0
- package/dist/{FormRow.luau → form/FormRow.luau} +3 -6
- package/dist/form/InputRound.d.ts +18 -0
- package/dist/form/InputRound.luau +218 -0
- package/dist/form/InputRow.d.ts +13 -0
- package/dist/form/InputRow.luau +32 -0
- package/dist/{Radio.d.ts → form/Radio.d.ts} +1 -3
- package/dist/{Radio.luau → form/Radio.luau} +5 -10
- package/dist/{RadioRow.d.ts → form/RadioRow.d.ts} +1 -3
- package/dist/{RadioRow.luau → form/RadioRow.luau} +4 -8
- package/dist/form/RoundEmoji.d.ts +8 -0
- package/dist/form/RoundEmoji.luau +40 -0
- package/dist/form/TextBox.d.ts +24 -0
- package/dist/form/TextBox.luau +57 -0
- package/dist/{TextField.d.ts → form/TextField.d.ts} +1 -1
- package/dist/{TextField.luau → form/TextField.luau} +4 -2
- package/dist/form/validation.d.ts +13 -0
- package/dist/form/validation.luau +80 -0
- package/dist/{use-button-animation.d.ts → hooks/use-button-animation.d.ts} +1 -3
- package/dist/{use-button-animation.luau → hooks/use-button-animation.luau} +3 -6
- package/dist/index.d.ts +48 -32
- package/dist/init.luau +63 -34
- package/dist/{Accordion.d.ts → layout/Accordion.d.ts} +1 -3
- package/dist/{Accordion.luau → layout/Accordion.luau} +4 -8
- package/dist/{Divider.luau → layout/Divider.luau} +1 -1
- package/dist/{Section.d.ts → layout/Section.d.ts} +1 -3
- package/dist/{Section.luau → layout/Section.luau} +4 -7
- package/dist/{SegmentedToggle.d.ts → layout/SegmentedToggle.d.ts} +1 -3
- package/dist/{SegmentedToggle.luau → layout/SegmentedToggle.luau} +4 -7
- package/dist/layout/SegmentedToggle.story.d.ts +10 -0
- package/dist/layout/SegmentedToggle.story.luau +72 -0
- package/dist/table/ExampleTable.d.ts +2 -0
- package/dist/table/ExampleTable.luau +46 -0
- package/dist/table/Table.d.ts +10 -0
- package/dist/table/Table.luau +26 -0
- package/dist/table/TableCell.d.ts +9 -0
- package/dist/table/TableCell.luau +26 -0
- package/dist/table/TableFooter.d.ts +9 -0
- package/dist/table/TableFooter.luau +12 -0
- package/dist/table/TableHeader.d.ts +9 -0
- package/dist/table/TableHeader.luau +12 -0
- package/dist/table/TableRow.d.ts +9 -0
- package/dist/table/TableRow.luau +24 -0
- package/dist/tooltip/Tooltip.d.ts +14 -0
- package/dist/tooltip/Tooltip.luau +65 -0
- package/dist/tooltip/useTooltip.d.ts +12 -0
- package/dist/tooltip/useTooltip.luau +40 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{Outline.d.ts → utils/Outline.d.ts} +1 -3
- package/dist/{Outline.luau → utils/Outline.luau} +3 -6
- package/package.json +11 -9
- package/dist/FormRow.d.ts +0 -11
- package/dist/theme.d.ts +0 -41
- package/dist/theme.luau +0 -58
- /package/dist/{Button.d.ts → buttons/Button.d.ts} +0 -0
- /package/dist/{Button.luau → buttons/Button.luau} +0 -0
- /package/dist/{Checkmark.d.ts → display/Checkmark.d.ts} +0 -0
- /package/dist/{Legend.d.ts → display/Legend.d.ts} +0 -0
- /package/dist/{TimeAgo.d.ts → display/TimeAgo.d.ts} +0 -0
- /package/dist/{TimeAgo.luau → display/TimeAgo.luau} +0 -0
- /package/dist/{use-button-state.d.ts → hooks/use-button-state.d.ts} +0 -0
- /package/dist/{use-button-state.luau → hooks/use-button-state.luau} +0 -0
- /package/dist/{use-input-device.d.ts → hooks/use-input-device.d.ts} +0 -0
- /package/dist/{use-input-device.luau → hooks/use-input-device.luau} +0 -0
- /package/dist/{Divider.d.ts → layout/Divider.d.ts} +0 -0
- /package/dist/{Padding.d.ts → layout/Padding.d.ts} +0 -0
- /package/dist/{Padding.luau → layout/Padding.luau} +0 -0
- /package/dist/{ClickOutsideOverlay.d.ts → utils/ClickOutsideOverlay.d.ts} +0 -0
- /package/dist/{ClickOutsideOverlay.luau → utils/ClickOutsideOverlay.luau} +0 -0
- /package/dist/{DelayRender.d.ts → utils/DelayRender.d.ts} +0 -0
- /package/dist/{DelayRender.luau → utils/DelayRender.luau} +0 -0
- /package/dist/{ErrorBoundary.d.ts → utils/ErrorBoundary.d.ts} +0 -0
- /package/dist/{ErrorBoundary.luau → utils/ErrorBoundary.luau} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
export interface ExtendableFrameProps extends React.PropsWithChildren {
|
|
3
|
+
readonly size?: UDim2 | React.Binding<UDim2>;
|
|
4
|
+
readonly position?: UDim2 | React.Binding<UDim2>;
|
|
5
|
+
readonly backgroundColor?: Color3 | React.Binding<Color3>;
|
|
6
|
+
readonly backgroundTransparency?: number | React.Binding<number>;
|
|
7
|
+
readonly clipsDescendants?: boolean | React.Binding<boolean>;
|
|
8
|
+
readonly initialSize?: UDim2;
|
|
9
|
+
readonly initialPosition?: UDim2;
|
|
10
|
+
readonly title?: string;
|
|
11
|
+
readonly onClose?: () => void;
|
|
12
|
+
readonly onPositionChange?: (position: UDim2) => void;
|
|
13
|
+
readonly onSizeChange?: (size: UDim2) => void;
|
|
14
|
+
readonly active?: boolean;
|
|
15
|
+
readonly zIndex?: number;
|
|
16
|
+
readonly resizeEnabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function DynamicWindow({ children, size, position, backgroundColor, backgroundTransparency, clipsDescendants, initialSize, initialPosition, title, resizeEnabled, onClose, onPositionChange, onSizeChange, active, zIndex, }: ExtendableFrameProps): JSX.Element;
|
|
19
|
+
//# sourceMappingURL=DynamicWindow.d.ts.map
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
4
|
+
local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
|
|
5
|
+
local Frame = _primitives.Frame
|
|
6
|
+
local Text = _primitives.Text
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
8
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
9
|
+
local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
|
|
10
|
+
local useEventListener = _pretty_react_hooks.useEventListener
|
|
11
|
+
local useLatest = _pretty_react_hooks.useLatest
|
|
12
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
13
|
+
local React = _react
|
|
14
|
+
local useBinding = _react.useBinding
|
|
15
|
+
local useRef = _react.useRef
|
|
16
|
+
local useState = _react.useState
|
|
17
|
+
local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
|
|
18
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
19
|
+
local Divider = TS.import(script, script.Parent.Parent, "layout", "Divider").Divider
|
|
20
|
+
local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
|
|
21
|
+
local _DynamicWindow_utils = TS.import(script, script.Parent, "DynamicWindow.utils")
|
|
22
|
+
local getInputViewportPos = _DynamicWindow_utils.getInputViewportPos
|
|
23
|
+
local getMouseViewportPos = _DynamicWindow_utils.getMouseViewportPos
|
|
24
|
+
local ResizeCornerButton = TS.import(script, script.Parent, "ResizeCornerButton").ResizeCornerButton
|
|
25
|
+
local TrafficLightButton = TS.import(script, script.Parent, "TrafficLightButton").TrafficLightButton
|
|
26
|
+
local ROBLOX_TOOLBAR_HEIGHT = 68
|
|
27
|
+
local function DynamicWindow(_param)
|
|
28
|
+
local children = _param.children
|
|
29
|
+
local size = _param.size
|
|
30
|
+
local position = _param.position
|
|
31
|
+
local backgroundColor = _param.backgroundColor
|
|
32
|
+
local backgroundTransparency = _param.backgroundTransparency
|
|
33
|
+
if backgroundTransparency == nil then
|
|
34
|
+
backgroundTransparency = 0
|
|
35
|
+
end
|
|
36
|
+
local clipsDescendants = _param.clipsDescendants
|
|
37
|
+
if clipsDescendants == nil then
|
|
38
|
+
clipsDescendants = true
|
|
39
|
+
end
|
|
40
|
+
local initialSize = _param.initialSize
|
|
41
|
+
local initialPosition = _param.initialPosition
|
|
42
|
+
local title = _param.title
|
|
43
|
+
if title == nil then
|
|
44
|
+
title = "Workspace"
|
|
45
|
+
end
|
|
46
|
+
local resizeEnabled = _param.resizeEnabled
|
|
47
|
+
if resizeEnabled == nil then
|
|
48
|
+
resizeEnabled = true
|
|
49
|
+
end
|
|
50
|
+
local onClose = _param.onClose
|
|
51
|
+
local onPositionChange = _param.onPositionChange
|
|
52
|
+
local onSizeChange = _param.onSizeChange
|
|
53
|
+
local active = _param.active
|
|
54
|
+
local zIndex = _param.zIndex
|
|
55
|
+
local rem = useRem()
|
|
56
|
+
local theme = defaultTheme
|
|
57
|
+
local titleBarHeight = rem(7)
|
|
58
|
+
local titleBarPadding = rem(1)
|
|
59
|
+
local trafficLightSize = rem(2.5)
|
|
60
|
+
local titleFontSize = rem(3.2)
|
|
61
|
+
local titleBarColor = theme.palette.lightblue
|
|
62
|
+
local corner = UDim.new(0, rem(1.5))
|
|
63
|
+
-- Defaults: fixed offset size/position so move/resize make sense immediately
|
|
64
|
+
local fallbackPosition = UDim2.new(0, 0, 0, ROBLOX_TOOLBAR_HEIGHT)
|
|
65
|
+
local fallbackSize = UDim2.new(0, rem(30), 1, -ROBLOX_TOOLBAR_HEIGHT)
|
|
66
|
+
local defaultPosition = initialPosition or fallbackPosition
|
|
67
|
+
local defaultSize = initialSize or fallbackSize
|
|
68
|
+
local internalPositionBinding, setInternalPosition = useBinding(defaultPosition)
|
|
69
|
+
local internalSizeBinding, setInternalSize = useBinding(defaultSize)
|
|
70
|
+
local positionBinding = position or internalPositionBinding
|
|
71
|
+
local sizeBinding = size or internalSizeBinding
|
|
72
|
+
local mode, setMode = useState("none")
|
|
73
|
+
local modeRef = useLatest(mode)
|
|
74
|
+
local minimized, setMinimized = useState(false)
|
|
75
|
+
local prevSizeRef = useRef()
|
|
76
|
+
local dragRef = useRef()
|
|
77
|
+
local frameRef = useRef(nil)
|
|
78
|
+
local applyInternalPosition = function(positionValue)
|
|
79
|
+
setInternalPosition(positionValue)
|
|
80
|
+
local _result = onPositionChange
|
|
81
|
+
if _result ~= nil then
|
|
82
|
+
_result(positionValue)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
local applyInternalSize = function(sizeValue)
|
|
86
|
+
setInternalSize(sizeValue)
|
|
87
|
+
local _result = onSizeChange
|
|
88
|
+
if _result ~= nil then
|
|
89
|
+
_result(sizeValue)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
local startInteraction = function(nextMode, mousePos, resizeCorner)
|
|
93
|
+
if nextMode == "resize" and (minimized or not resizeEnabled) then
|
|
94
|
+
return nil
|
|
95
|
+
end
|
|
96
|
+
local frame = frameRef.current
|
|
97
|
+
if not frame then
|
|
98
|
+
return nil
|
|
99
|
+
end
|
|
100
|
+
dragRef.current = {
|
|
101
|
+
startMouse = mousePos,
|
|
102
|
+
startPos = frame.Position,
|
|
103
|
+
startSize = frame.Size,
|
|
104
|
+
startAbsSize = frame.AbsoluteSize,
|
|
105
|
+
startAbsPos = frame.AbsolutePosition,
|
|
106
|
+
resizeCorner = resizeCorner,
|
|
107
|
+
}
|
|
108
|
+
setMode(nextMode)
|
|
109
|
+
end
|
|
110
|
+
local onDrag
|
|
111
|
+
local stopInteraction = function(commitPosition)
|
|
112
|
+
if commitPosition and dragRef.current then
|
|
113
|
+
onDrag(commitPosition)
|
|
114
|
+
end
|
|
115
|
+
dragRef.current = nil
|
|
116
|
+
if modeRef.current ~= "none" then
|
|
117
|
+
setMode("none")
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
useEventListener(UserInputService.InputChanged, function(input)
|
|
121
|
+
if modeRef.current == "none" then
|
|
122
|
+
return nil
|
|
123
|
+
end
|
|
124
|
+
if not dragRef.current then
|
|
125
|
+
return nil
|
|
126
|
+
end
|
|
127
|
+
if input.UserInputType ~= Enum.UserInputType.MouseMovement then
|
|
128
|
+
return nil
|
|
129
|
+
end
|
|
130
|
+
onDrag(getInputViewportPos(input))
|
|
131
|
+
end)
|
|
132
|
+
useEventListener(UserInputService.InputEnded, function(input)
|
|
133
|
+
if modeRef.current ~= "none" and input.UserInputType == Enum.UserInputType.MouseButton1 then
|
|
134
|
+
stopInteraction(getInputViewportPos(input))
|
|
135
|
+
end
|
|
136
|
+
end)
|
|
137
|
+
onDrag = function(mousePos)
|
|
138
|
+
local drag = dragRef.current
|
|
139
|
+
if not drag then
|
|
140
|
+
return nil
|
|
141
|
+
end
|
|
142
|
+
local _mousePos = mousePos
|
|
143
|
+
local _startMouse = drag.startMouse
|
|
144
|
+
local delta = _mousePos - _startMouse
|
|
145
|
+
local currentMode = modeRef.current
|
|
146
|
+
if currentMode == "move" then
|
|
147
|
+
local nextPos = UDim2.new(drag.startPos.X.Scale, drag.startPos.X.Offset + delta.X, drag.startPos.Y.Scale, drag.startPos.Y.Offset + delta.Y)
|
|
148
|
+
applyInternalPosition(nextPos)
|
|
149
|
+
elseif currentMode == "resize" then
|
|
150
|
+
if minimized then
|
|
151
|
+
return nil
|
|
152
|
+
end
|
|
153
|
+
local resizeCorner = drag.resizeCorner or "bottomRight"
|
|
154
|
+
local minW = rem(24)
|
|
155
|
+
local minH = titleBarHeight + rem(6)
|
|
156
|
+
local currentAbsSize = drag.startAbsSize
|
|
157
|
+
local isLeft = resizeCorner == "topLeft" or resizeCorner == "bottomLeft"
|
|
158
|
+
local isTop = resizeCorner == "topLeft" or resizeCorner == "topRight"
|
|
159
|
+
local desiredAbsW = currentAbsSize.X + (if isLeft then -delta.X else delta.X)
|
|
160
|
+
local desiredAbsH = currentAbsSize.Y + (if isTop then -delta.Y else delta.Y)
|
|
161
|
+
local finalAbsW = math.max(minW, desiredAbsW)
|
|
162
|
+
local finalAbsH = math.max(minH, desiredAbsH)
|
|
163
|
+
local usedDeltaX = finalAbsW - currentAbsSize.X
|
|
164
|
+
local usedDeltaY = finalAbsH - currentAbsSize.Y
|
|
165
|
+
local nextSize = UDim2.new(drag.startSize.X.Scale, drag.startSize.X.Offset + usedDeltaX, drag.startSize.Y.Scale, drag.startSize.Y.Offset + usedDeltaY)
|
|
166
|
+
applyInternalSize(nextSize)
|
|
167
|
+
if isLeft or isTop then
|
|
168
|
+
local nextPos = drag.startPos
|
|
169
|
+
if isLeft then
|
|
170
|
+
local positionDeltaX = currentAbsSize.X - finalAbsW
|
|
171
|
+
nextPos = UDim2.new(nextPos.X.Scale, nextPos.X.Offset + positionDeltaX, nextPos.Y.Scale, nextPos.Y.Offset)
|
|
172
|
+
end
|
|
173
|
+
if isTop then
|
|
174
|
+
local positionDeltaY = currentAbsSize.Y - finalAbsH
|
|
175
|
+
nextPos = UDim2.new(nextPos.X.Scale, nextPos.X.Offset, nextPos.Y.Scale, nextPos.Y.Offset + positionDeltaY)
|
|
176
|
+
end
|
|
177
|
+
applyInternalPosition(nextPos)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
local toggleMinimize = function()
|
|
182
|
+
stopInteraction()
|
|
183
|
+
if not minimized then
|
|
184
|
+
local currentSize = internalSizeBinding:getValue()
|
|
185
|
+
prevSizeRef.current = currentSize
|
|
186
|
+
local collapsed = UDim2.new(currentSize.X.Scale, currentSize.X.Offset, 0, titleBarHeight)
|
|
187
|
+
applyInternalSize(collapsed)
|
|
188
|
+
setMinimized(true)
|
|
189
|
+
else
|
|
190
|
+
local prev = prevSizeRef.current
|
|
191
|
+
if prev then
|
|
192
|
+
applyInternalSize(prev)
|
|
193
|
+
end
|
|
194
|
+
setMinimized(false)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
local handleClose = function()
|
|
198
|
+
stopInteraction()
|
|
199
|
+
local _result = onClose
|
|
200
|
+
if _result ~= nil then
|
|
201
|
+
_result()
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
local maximize = function()
|
|
205
|
+
applyInternalSize(UDim2.new(1, 0, 1, -ROBLOX_TOOLBAR_HEIGHT))
|
|
206
|
+
applyInternalPosition(UDim2.new(0, 0, 0, ROBLOX_TOOLBAR_HEIGHT))
|
|
207
|
+
end
|
|
208
|
+
local commonResizeCornerProps = {
|
|
209
|
+
size = rem(2.5),
|
|
210
|
+
startInteraction = startInteraction,
|
|
211
|
+
stopInteraction = stopInteraction,
|
|
212
|
+
visible = resizeEnabled and not minimized,
|
|
213
|
+
}
|
|
214
|
+
local defaultBackgroundColor = backgroundColor or theme.palette.white
|
|
215
|
+
local _exp = React.createElement("uistroke", {
|
|
216
|
+
Color = theme.palette.offwhite,
|
|
217
|
+
Transparency = 0.5,
|
|
218
|
+
Thickness = 1,
|
|
219
|
+
}, children)
|
|
220
|
+
local _exp_1 = React.createElement(Button, {
|
|
221
|
+
backgroundColor = titleBarColor,
|
|
222
|
+
backgroundTransparency = 1,
|
|
223
|
+
size = UDim2.new(1, 0, 0, titleBarHeight),
|
|
224
|
+
event = {
|
|
225
|
+
MouseButton1Down = function()
|
|
226
|
+
startInteraction("move", getMouseViewportPos())
|
|
227
|
+
end,
|
|
228
|
+
MouseButton1Up = function()
|
|
229
|
+
stopInteraction(getMouseViewportPos())
|
|
230
|
+
end,
|
|
231
|
+
},
|
|
232
|
+
}, React.createElement("uicorner", {
|
|
233
|
+
CornerRadius = corner,
|
|
234
|
+
}), React.createElement(Padding, {
|
|
235
|
+
padding = titleBarPadding,
|
|
236
|
+
}), React.createElement(HStack, {
|
|
237
|
+
size = UDim2.new(0.2, 0, 1, 0),
|
|
238
|
+
backgroundTransparency = 1,
|
|
239
|
+
verticalAlignment = Enum.VerticalAlignment.Center,
|
|
240
|
+
horizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
241
|
+
spacing = rem(0.75),
|
|
242
|
+
}, React.createElement(TrafficLightButton, {
|
|
243
|
+
color = theme.palette.macRed,
|
|
244
|
+
size = trafficLightSize,
|
|
245
|
+
onClick = handleClose,
|
|
246
|
+
}), resizeEnabled and (React.createElement(React.Fragment, nil, React.createElement(TrafficLightButton, {
|
|
247
|
+
color = theme.palette.macYellow,
|
|
248
|
+
size = trafficLightSize,
|
|
249
|
+
onClick = toggleMinimize,
|
|
250
|
+
}), React.createElement(TrafficLightButton, {
|
|
251
|
+
color = theme.palette.macGreen,
|
|
252
|
+
size = trafficLightSize,
|
|
253
|
+
onClick = maximize,
|
|
254
|
+
})))), React.createElement(Text, {
|
|
255
|
+
text = title,
|
|
256
|
+
textSize = titleFontSize,
|
|
257
|
+
textColor = theme.palette.crust,
|
|
258
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
259
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
260
|
+
}))
|
|
261
|
+
local _exp_2 = React.createElement(Divider, {
|
|
262
|
+
zIndex = 2,
|
|
263
|
+
position = UDim2.new(0, 0, 0, titleBarHeight),
|
|
264
|
+
color = theme.palette.offwhite,
|
|
265
|
+
thickness = 1,
|
|
266
|
+
})
|
|
267
|
+
local _exp_3 = React.createElement(Frame, {
|
|
268
|
+
size = UDim2.new(1, 0, 1, -titleBarHeight),
|
|
269
|
+
position = UDim2.new(0, 0, 0, titleBarHeight),
|
|
270
|
+
backgroundTransparency = 1,
|
|
271
|
+
visible = not minimized,
|
|
272
|
+
zIndex = 1,
|
|
273
|
+
}, children)
|
|
274
|
+
local _attributes = {
|
|
275
|
+
handleCorner = "topLeft",
|
|
276
|
+
anchorPoint = Vector2.new(0, 0),
|
|
277
|
+
position = UDim2.new(0, 0, 0, 0),
|
|
278
|
+
}
|
|
279
|
+
for _k, _v in commonResizeCornerProps do
|
|
280
|
+
_attributes[_k] = _v
|
|
281
|
+
end
|
|
282
|
+
local _exp_4 = React.createElement(ResizeCornerButton, _attributes)
|
|
283
|
+
local _attributes_1 = {
|
|
284
|
+
handleCorner = "topRight",
|
|
285
|
+
anchorPoint = Vector2.new(1, 0),
|
|
286
|
+
position = UDim2.new(1, 0, 0, 0),
|
|
287
|
+
}
|
|
288
|
+
for _k, _v in commonResizeCornerProps do
|
|
289
|
+
_attributes_1[_k] = _v
|
|
290
|
+
end
|
|
291
|
+
local _exp_5 = React.createElement(ResizeCornerButton, _attributes_1)
|
|
292
|
+
local _attributes_2 = {
|
|
293
|
+
handleCorner = "bottomLeft",
|
|
294
|
+
anchorPoint = Vector2.new(0, 1),
|
|
295
|
+
position = UDim2.new(0, 0, 1, 0),
|
|
296
|
+
}
|
|
297
|
+
for _k, _v in commonResizeCornerProps do
|
|
298
|
+
_attributes_2[_k] = _v
|
|
299
|
+
end
|
|
300
|
+
local _exp_6 = React.createElement(ResizeCornerButton, _attributes_2)
|
|
301
|
+
local _attributes_3 = {
|
|
302
|
+
handleCorner = "bottomRight",
|
|
303
|
+
anchorPoint = Vector2.new(1, 1),
|
|
304
|
+
position = UDim2.new(1, 0, 1, 0),
|
|
305
|
+
}
|
|
306
|
+
for _k, _v in commonResizeCornerProps do
|
|
307
|
+
_attributes_3[_k] = _v
|
|
308
|
+
end
|
|
309
|
+
return React.createElement(Frame, {
|
|
310
|
+
ref = frameRef,
|
|
311
|
+
size = sizeBinding,
|
|
312
|
+
position = positionBinding,
|
|
313
|
+
clipsDescendants = false,
|
|
314
|
+
active = active,
|
|
315
|
+
zIndex = zIndex,
|
|
316
|
+
}, React.createElement(Frame, {
|
|
317
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
318
|
+
backgroundTransparency = backgroundTransparency,
|
|
319
|
+
backgroundColor = defaultBackgroundColor,
|
|
320
|
+
cornerRadius = corner,
|
|
321
|
+
clipsDescendants = clipsDescendants,
|
|
322
|
+
active = active,
|
|
323
|
+
}, _exp, _exp_1, _exp_2, _exp_3, _exp_4, _exp_5, _exp_6, React.createElement(ResizeCornerButton, _attributes_3)))
|
|
324
|
+
end
|
|
325
|
+
return {
|
|
326
|
+
DynamicWindow = DynamicWindow,
|
|
327
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ResizeCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
2
|
+
export type Mode = "none" | "move" | "resize";
|
|
3
|
+
export declare const toViewportPoint: (pos: Vector2) => Vector2;
|
|
4
|
+
export declare const getInputViewportPos: (input: InputObject) => Vector2;
|
|
5
|
+
export declare const getMouseViewportPos: () => Vector2;
|
|
6
|
+
export interface WindowSpawnOptions {
|
|
7
|
+
readonly size: Vector2;
|
|
8
|
+
readonly preferredPosition?: Vector2;
|
|
9
|
+
readonly fallbackInstance?: GuiObject;
|
|
10
|
+
}
|
|
11
|
+
export declare const clampViewportPosition: (position: Vector2, size: Vector2) => Vector2;
|
|
12
|
+
export declare const resolveWindowSpawnPosition: ({ size, preferredPosition, fallbackInstance }: WindowSpawnOptions) => UDim2;
|
|
13
|
+
//# sourceMappingURL=DynamicWindow.utils.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
4
|
+
local GuiService = _services.GuiService
|
|
5
|
+
local UserInputService = _services.UserInputService
|
|
6
|
+
local Workspace = _services.Workspace
|
|
7
|
+
local toViewportPoint = function(pos)
|
|
8
|
+
local inset = GuiService:GetGuiInset()
|
|
9
|
+
return Vector2.new(pos.X - inset.X, pos.Y - inset.Y)
|
|
10
|
+
end
|
|
11
|
+
local getInputViewportPos = function(input)
|
|
12
|
+
return Vector2.new(input.Position.X, input.Position.Y)
|
|
13
|
+
end
|
|
14
|
+
local getMouseViewportPos = function()
|
|
15
|
+
return toViewportPoint(UserInputService:GetMouseLocation())
|
|
16
|
+
end
|
|
17
|
+
local clampViewportPosition = function(position, size)
|
|
18
|
+
local camera = Workspace.CurrentCamera
|
|
19
|
+
if not camera then
|
|
20
|
+
return position
|
|
21
|
+
end
|
|
22
|
+
local viewportSize = camera.ViewportSize
|
|
23
|
+
local maxX = math.max(0, viewportSize.X - size.X)
|
|
24
|
+
local maxY = math.max(0, viewportSize.Y - size.Y)
|
|
25
|
+
return Vector2.new(math.clamp(position.X, 0, maxX), math.clamp(position.Y, 0, maxY))
|
|
26
|
+
end
|
|
27
|
+
local resolveWindowSpawnPosition = function(_param)
|
|
28
|
+
local size = _param.size
|
|
29
|
+
local preferredPosition = _param.preferredPosition
|
|
30
|
+
local fallbackInstance = _param.fallbackInstance
|
|
31
|
+
local _fallbackPos = fallbackInstance
|
|
32
|
+
if _fallbackPos ~= nil then
|
|
33
|
+
_fallbackPos = _fallbackPos.AbsolutePosition
|
|
34
|
+
end
|
|
35
|
+
local fallbackPos = _fallbackPos
|
|
36
|
+
local basePosition = preferredPosition or fallbackPos or Vector2.zero
|
|
37
|
+
local clamped = clampViewportPosition(basePosition, size)
|
|
38
|
+
return UDim2.new(0, clamped.X, 0, clamped.Y)
|
|
39
|
+
end
|
|
40
|
+
return {
|
|
41
|
+
toViewportPoint = toViewportPoint,
|
|
42
|
+
getInputViewportPos = getInputViewportPos,
|
|
43
|
+
getMouseViewportPos = getMouseViewportPos,
|
|
44
|
+
clampViewportPosition = clampViewportPosition,
|
|
45
|
+
resolveWindowSpawnPosition = resolveWindowSpawnPosition,
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Mode, ResizeCorner } from "./DynamicWindow.utils";
|
|
2
|
+
interface ResizeCornerButtonProps {
|
|
3
|
+
readonly size: number;
|
|
4
|
+
readonly handleCorner: ResizeCorner;
|
|
5
|
+
readonly anchorPoint: Vector2;
|
|
6
|
+
readonly position: UDim2;
|
|
7
|
+
startInteraction: (mode: Mode, mousePos: Vector2, handleCorner?: ResizeCorner) => void;
|
|
8
|
+
stopInteraction: (mousePos: Vector2) => void;
|
|
9
|
+
readonly visible: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function ResizeCornerButton({ size, handleCorner, anchorPoint, position, startInteraction, stopInteraction, visible, }: ResizeCornerButtonProps): JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=ResizeCornerButton.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
4
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
5
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
6
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
7
|
+
local getMouseViewportPos = TS.import(script, script.Parent, "DynamicWindow.utils").getMouseViewportPos
|
|
8
|
+
local function ResizeCornerButton(_param)
|
|
9
|
+
local size = _param.size
|
|
10
|
+
local handleCorner = _param.handleCorner
|
|
11
|
+
local anchorPoint = _param.anchorPoint
|
|
12
|
+
local position = _param.position
|
|
13
|
+
local startInteraction = _param.startInteraction
|
|
14
|
+
local stopInteraction = _param.stopInteraction
|
|
15
|
+
local visible = _param.visible
|
|
16
|
+
local rem = useRem()
|
|
17
|
+
local theme = defaultTheme
|
|
18
|
+
local isHovering, setIsHovering = React.useState(false)
|
|
19
|
+
local handleMouseEnter = function()
|
|
20
|
+
return setIsHovering(true)
|
|
21
|
+
end
|
|
22
|
+
local handleMouseLeave = function()
|
|
23
|
+
return setIsHovering(false)
|
|
24
|
+
end
|
|
25
|
+
return React.createElement(Button, {
|
|
26
|
+
key = handleCorner,
|
|
27
|
+
size = UDim2.new(0, size, 0, size),
|
|
28
|
+
position = position,
|
|
29
|
+
anchorPoint = anchorPoint,
|
|
30
|
+
visible = visible,
|
|
31
|
+
backgroundColor = theme.palette.surface2,
|
|
32
|
+
backgroundTransparency = if isHovering then 0.65 else 1,
|
|
33
|
+
cornerRadius = UDim.new(0, rem(1.5)),
|
|
34
|
+
selectable = false,
|
|
35
|
+
onMouseEnter = handleMouseEnter,
|
|
36
|
+
onMouseLeave = handleMouseLeave,
|
|
37
|
+
onMouseDown = function()
|
|
38
|
+
startInteraction("resize", getMouseViewportPos(), handleCorner)
|
|
39
|
+
end,
|
|
40
|
+
onMouseUp = function()
|
|
41
|
+
stopInteraction(getMouseViewportPos())
|
|
42
|
+
end,
|
|
43
|
+
})
|
|
44
|
+
end
|
|
45
|
+
return {
|
|
46
|
+
ResizeCornerButton = ResizeCornerButton,
|
|
47
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TrafficLightButtonProps {
|
|
2
|
+
readonly size: number;
|
|
3
|
+
readonly color: Color3;
|
|
4
|
+
readonly onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function TrafficLightButton({ color, size, onClick }: TrafficLightButtonProps): JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=TrafficLightButton.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
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 function TrafficLightButton(_param)
|
|
5
|
+
local color = _param.color
|
|
6
|
+
local size = _param.size
|
|
7
|
+
local onClick = _param.onClick
|
|
8
|
+
return React.createElement("imagebutton", {
|
|
9
|
+
BackgroundColor3 = color,
|
|
10
|
+
BackgroundTransparency = 0,
|
|
11
|
+
BorderSizePixel = 0,
|
|
12
|
+
AutoButtonColor = false,
|
|
13
|
+
Selectable = false,
|
|
14
|
+
Size = UDim2.new(0, size, 0, size),
|
|
15
|
+
Event = if onClick then {
|
|
16
|
+
MouseButton1Click = function()
|
|
17
|
+
onClick()
|
|
18
|
+
end,
|
|
19
|
+
} else nil,
|
|
20
|
+
}, React.createElement("uicorner", {
|
|
21
|
+
CornerRadius = UDim.new(1, 0),
|
|
22
|
+
}))
|
|
23
|
+
end
|
|
24
|
+
return {
|
|
25
|
+
TrafficLightButton = TrafficLightButton,
|
|
26
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { type Theme } from "./theme";
|
|
3
2
|
interface DropdownButtonProps extends React.PropsWithChildren {
|
|
4
3
|
readonly text: string;
|
|
5
4
|
readonly onClick?: () => void;
|
|
@@ -15,8 +14,7 @@ interface DropdownButtonProps extends React.PropsWithChildren {
|
|
|
15
14
|
readonly hasShadow?: boolean;
|
|
16
15
|
readonly padding?: number;
|
|
17
16
|
readonly radius?: number;
|
|
18
|
-
readonly theme?: Theme;
|
|
19
17
|
}
|
|
20
|
-
export declare function DropdownButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, isDisabled, size, padding, radius,
|
|
18
|
+
export declare function DropdownButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, isDisabled, size, padding, radius, }: DropdownButtonProps): JSX.Element;
|
|
21
19
|
export type { DropdownButtonProps };
|
|
22
20
|
//# sourceMappingURL=DropdownButton.d.ts.map
|
|
@@ -4,12 +4,12 @@ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pr
|
|
|
4
4
|
local lerpBinding = _pretty_react_hooks.lerpBinding
|
|
5
5
|
local useMotion = _pretty_react_hooks.useMotion
|
|
6
6
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
8
8
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
9
|
-
local Outline = TS.import(script, script.Parent, "Outline").Outline
|
|
9
|
+
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
10
10
|
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
11
11
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
12
|
-
local defaultTheme = TS.import(script, script
|
|
12
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
13
13
|
local function DropdownButton(_param)
|
|
14
14
|
local text = _param.text
|
|
15
15
|
local onClick = _param.onClick
|
|
@@ -21,10 +21,7 @@ local function DropdownButton(_param)
|
|
|
21
21
|
local size = _param.size
|
|
22
22
|
local padding = _param.padding
|
|
23
23
|
local radius = _param.radius
|
|
24
|
-
local theme =
|
|
25
|
-
if theme == nil then
|
|
26
|
-
theme = defaultTheme
|
|
27
|
-
end
|
|
24
|
+
local theme = defaultTheme
|
|
28
25
|
local rem = useRem()
|
|
29
26
|
local hover, hoverMotion = useMotion(0)
|
|
30
27
|
local textColor = theme.palette.crust
|
|
@@ -51,7 +48,6 @@ local function DropdownButton(_param)
|
|
|
51
48
|
outerColor = theme.palette.white,
|
|
52
49
|
outerTransparency = 0,
|
|
53
50
|
outerThickness = 1,
|
|
54
|
-
theme = theme,
|
|
55
51
|
})
|
|
56
52
|
local _attributes = {
|
|
57
53
|
key = "mainText",
|
|
@@ -103,7 +99,6 @@ local function DropdownButton(_param)
|
|
|
103
99
|
size = size or UDim2.new(0, rem(10), 0, rem(4)),
|
|
104
100
|
position = position,
|
|
105
101
|
layoutOrder = layoutOrder,
|
|
106
|
-
theme = theme,
|
|
107
102
|
}, _exp, _exp_1, _exp_2, React.createElement(Text, _attributes_1))
|
|
108
103
|
end
|
|
109
104
|
return {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { type Theme } from "./theme";
|
|
3
2
|
interface DropdownOptionButtonProps extends React.PropsWithChildren {
|
|
4
3
|
readonly text: string;
|
|
5
4
|
readonly onClick?: () => void;
|
|
6
5
|
readonly onHover?: (hovered: boolean) => void;
|
|
7
6
|
readonly size?: UDim2;
|
|
8
7
|
readonly padding?: number;
|
|
9
|
-
readonly theme?: Theme;
|
|
10
8
|
}
|
|
11
|
-
export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children,
|
|
9
|
+
export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children, }: DropdownOptionButtonProps): JSX.Element;
|
|
12
10
|
export type { DropdownOptionButtonProps };
|
|
13
11
|
//# sourceMappingURL=DropdownOptionButton.d.ts.map
|
|
@@ -4,11 +4,11 @@ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pr
|
|
|
4
4
|
local lerpBinding = _pretty_react_hooks.lerpBinding
|
|
5
5
|
local useMotion = _pretty_react_hooks.useMotion
|
|
6
6
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
8
8
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
9
9
|
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
10
10
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
11
|
-
local defaultTheme = TS.import(script, script
|
|
11
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
12
12
|
local function DropdownOptionButton(_param)
|
|
13
13
|
local text = _param.text
|
|
14
14
|
local onClick = _param.onClick
|
|
@@ -16,10 +16,7 @@ local function DropdownOptionButton(_param)
|
|
|
16
16
|
local size = _param.size
|
|
17
17
|
local padding = _param.padding
|
|
18
18
|
local children = _param.children
|
|
19
|
-
local theme =
|
|
20
|
-
if theme == nil then
|
|
21
|
-
theme = defaultTheme
|
|
22
|
-
end
|
|
19
|
+
local theme = defaultTheme
|
|
23
20
|
local rem = useRem()
|
|
24
21
|
local hover, hoverMotion = useMotion(0)
|
|
25
22
|
local textColor = theme.palette.crust
|
|
@@ -62,7 +59,6 @@ local function DropdownOptionButton(_param)
|
|
|
62
59
|
end,
|
|
63
60
|
backgroundTransparency = 1,
|
|
64
61
|
size = size or UDim2.new(0, rem(10), 0, rem(4)),
|
|
65
|
-
theme = theme,
|
|
66
62
|
}, _exp, _result)
|
|
67
63
|
end
|
|
68
64
|
return {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { type Theme } from "./theme";
|
|
3
2
|
interface IconRoundButtonProps {
|
|
4
3
|
readonly onClick?: () => void;
|
|
5
4
|
readonly emoji?: string;
|
|
@@ -16,8 +15,7 @@ interface IconRoundButtonProps {
|
|
|
16
15
|
readonly position?: UDim2;
|
|
17
16
|
readonly onMouseDown?: () => void;
|
|
18
17
|
readonly onMouseUp?: () => void;
|
|
19
|
-
readonly theme?: Theme;
|
|
20
18
|
}
|
|
21
|
-
export declare function IconRoundButton({ onClick, emoji, label, primaryColor, enabled, order, circleSize, width, addShadow, emojiSize, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp,
|
|
19
|
+
export declare function IconRoundButton({ onClick, emoji, label, primaryColor, enabled, order, circleSize, width, addShadow, emojiSize, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp, }: IconRoundButtonProps): JSX.Element;
|
|
22
20
|
export type { IconRoundButtonProps };
|
|
23
21
|
//# sourceMappingURL=IconRoundButton.d.ts.map
|
|
@@ -4,16 +4,16 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useEffect = _react.useEffect
|
|
6
6
|
local useState = _react.useState
|
|
7
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
8
8
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
9
9
|
local Group = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Group
|
|
10
10
|
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
11
11
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
12
12
|
local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
|
|
13
13
|
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
14
|
-
local Padding = TS.import(script, script.Parent, "Padding").Padding
|
|
14
|
+
local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
|
|
15
15
|
local Transition = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).Transition
|
|
16
|
-
local defaultTheme = TS.import(script, script
|
|
16
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
17
17
|
local MARGIN_Y = 0
|
|
18
18
|
local PADDING_LEFT = 2
|
|
19
19
|
local PADDING_RIGHT = 2
|
|
@@ -46,10 +46,7 @@ local function IconRoundButton(_param)
|
|
|
46
46
|
local position = _param.position
|
|
47
47
|
local onMouseDown = _param.onMouseDown
|
|
48
48
|
local onMouseUp = _param.onMouseUp
|
|
49
|
-
local theme =
|
|
50
|
-
if theme == nil then
|
|
51
|
-
theme = defaultTheme
|
|
52
|
-
end
|
|
49
|
+
local theme = defaultTheme
|
|
53
50
|
local rem = useRem()
|
|
54
51
|
local CIRCLE_SIZE = circleSize
|
|
55
52
|
local EMOJI_SIZE = CIRCLE_SIZE / emojiSize
|
|
@@ -97,7 +94,6 @@ local function IconRoundButton(_param)
|
|
|
97
94
|
position = position,
|
|
98
95
|
onMouseDown = onMouseDown,
|
|
99
96
|
onMouseUp = onMouseUp,
|
|
100
|
-
theme = theme,
|
|
101
97
|
}, React.createElement(Transition, {
|
|
102
98
|
groupTransparency = transparency,
|
|
103
99
|
size = UDim2.new(1, 0, 1, rem(2 * MARGIN_Y)),
|