@rbxts-ui/components 2.0.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/buttons/Button.d.ts +15 -0
- package/dist/buttons/Button.luau +66 -0
- package/dist/buttons/DropdownButton.d.ts +20 -0
- package/dist/buttons/DropdownButton.luau +106 -0
- package/dist/buttons/DropdownOptionButton.d.ts +11 -0
- package/dist/buttons/DropdownOptionButton.luau +66 -0
- package/dist/buttons/IconRoundButton.d.ts +21 -0
- package/dist/buttons/IconRoundButton.luau +145 -0
- package/dist/buttons/IconTileButton.d.ts +12 -0
- package/dist/buttons/IconTileButton.luau +86 -0
- package/dist/buttons/PrimaryButton.d.ts +23 -0
- package/dist/buttons/PrimaryButton.luau +84 -0
- package/dist/buttons/ReactiveButton.d.ts +32 -0
- package/dist/buttons/ReactiveButton.luau +163 -0
- package/dist/buttons/TextButton.d.ts +30 -0
- package/dist/buttons/TextButton.luau +121 -0
- package/dist/{Checkmark.luau → display/Checkmark.luau} +1 -1
- package/dist/display/Legend.d.ts +11 -0
- package/dist/display/Legend.luau +54 -0
- package/dist/display/PillText.d.ts +6 -0
- package/dist/display/PillText.luau +65 -0
- package/dist/display/TimeAgo.d.ts +8 -0
- package/dist/display/TimeAgo.luau +48 -0
- 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/form/Checkbox.d.ts +11 -0
- package/dist/form/Checkbox.luau +108 -0
- package/dist/form/CheckboxRow.d.ts +12 -0
- package/dist/form/CheckboxRow.luau +48 -0
- package/dist/form/Dropdown.d.ts +16 -0
- package/dist/form/Dropdown.luau +155 -0
- 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/form/FormRow.luau +36 -0
- 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/form/Radio.d.ts +11 -0
- package/dist/form/Radio.luau +105 -0
- package/dist/form/RadioRow.d.ts +8 -0
- package/dist/form/RadioRow.luau +46 -0
- 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/hooks/use-button-animation.d.ts +36 -0
- package/dist/hooks/use-button-animation.luau +80 -0
- package/dist/hooks/use-button-state.d.ts +13 -0
- package/dist/hooks/use-button-state.luau +81 -0
- package/dist/hooks/use-input-device.d.ts +7 -0
- package/dist/hooks/use-input-device.luau +38 -0
- package/dist/index.d.ts +48 -6
- package/dist/init.luau +72 -6
- package/dist/layout/Accordion.d.ts +14 -0
- package/dist/layout/Accordion.luau +101 -0
- package/dist/{Divider.luau → layout/Divider.luau} +1 -1
- package/dist/layout/Section.d.ts +10 -0
- package/dist/layout/Section.luau +51 -0
- package/dist/layout/SegmentedToggle.d.ts +17 -0
- package/dist/layout/SegmentedToggle.luau +117 -0
- 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/utils/ClickOutsideOverlay.d.ts +11 -0
- package/dist/utils/ClickOutsideOverlay.luau +35 -0
- package/dist/utils/Outline.d.ts +14 -0
- package/dist/utils/Outline.luau +99 -0
- package/package.json +19 -7
- /package/dist/{Checkmark.d.ts → display/Checkmark.d.ts} +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/{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,218 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local React = _react
|
|
6
|
+
local forwardRef = _react.forwardRef
|
|
7
|
+
local useEffect = _react.useEffect
|
|
8
|
+
local useRef = _react.useRef
|
|
9
|
+
local useState = _react.useState
|
|
10
|
+
local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
|
|
11
|
+
local Frame = _primitives.Frame
|
|
12
|
+
local Text = _primitives.Text
|
|
13
|
+
local TextField = TS.import(script, script.Parent, "TextField").TextField
|
|
14
|
+
local _layout = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist)
|
|
15
|
+
local HStack = _layout.HStack
|
|
16
|
+
local VStack = _layout.VStack
|
|
17
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
18
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
19
|
+
local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
|
|
20
|
+
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
21
|
+
local RoundEmoji = TS.import(script, script.Parent, "RoundEmoji").RoundEmoji
|
|
22
|
+
-- Default debounce delay in seconds
|
|
23
|
+
local DEFAULT_DEBOUNCE_DELAY = 0.3
|
|
24
|
+
local MARGIN_Y = 0
|
|
25
|
+
local PADDING_LEFT = 0.5
|
|
26
|
+
local PADDING_RIGHT = 2
|
|
27
|
+
local INTERNAL_PADDING = 1
|
|
28
|
+
local InputRound = forwardRef(function(props, ref)
|
|
29
|
+
local _binding = props
|
|
30
|
+
local onClick = _binding.onClick
|
|
31
|
+
local emoji = _binding.emoji
|
|
32
|
+
local placeholderText = _binding.placeholderText
|
|
33
|
+
local value = _binding.value
|
|
34
|
+
local primary = _binding.primary
|
|
35
|
+
local order = _binding.order
|
|
36
|
+
local width = _binding.width
|
|
37
|
+
local height = _binding.height
|
|
38
|
+
if height == nil then
|
|
39
|
+
height = 4
|
|
40
|
+
end
|
|
41
|
+
local children = _binding.children
|
|
42
|
+
local onTextChanged = _binding.onTextChanged
|
|
43
|
+
local debounceDelay = _binding.debounceDelay
|
|
44
|
+
if debounceDelay == nil then
|
|
45
|
+
debounceDelay = DEFAULT_DEBOUNCE_DELAY
|
|
46
|
+
end
|
|
47
|
+
local disabled = _binding.disabled
|
|
48
|
+
local hover, hoverMotion = useMotion(0)
|
|
49
|
+
local rem = useRem()
|
|
50
|
+
local theme = defaultTheme
|
|
51
|
+
-- Only use a single local state that updates immediately
|
|
52
|
+
local inputValue, setInputValue = useState(value)
|
|
53
|
+
local validationError, setValidationError = useState(nil)
|
|
54
|
+
local internalRef = useRef()
|
|
55
|
+
local debounceTimer = useRef(nil)
|
|
56
|
+
local isUserInput = useRef(false)
|
|
57
|
+
-- Use forwarded ref or internal ref
|
|
58
|
+
local actualRef = ref or internalRef
|
|
59
|
+
-- Clear any existing debounce timer
|
|
60
|
+
local clearDebounce = function()
|
|
61
|
+
if debounceTimer.current then
|
|
62
|
+
task.cancel(debounceTimer.current)
|
|
63
|
+
debounceTimer.current = nil
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
-- Handle value changes (including resets)
|
|
67
|
+
useEffect(function()
|
|
68
|
+
-- Skip if this is coming from user input (handled by debounce)
|
|
69
|
+
if isUserInput.current then
|
|
70
|
+
return nil
|
|
71
|
+
end
|
|
72
|
+
-- Clear any existing debounce timer
|
|
73
|
+
clearDebounce()
|
|
74
|
+
-- Update input value immediately
|
|
75
|
+
setInputValue(value)
|
|
76
|
+
-- Directly update TextBox if available
|
|
77
|
+
local currentTextBox = actualRef.current
|
|
78
|
+
if currentTextBox then
|
|
79
|
+
currentTextBox.Text = value
|
|
80
|
+
end
|
|
81
|
+
-- Clear validation errors
|
|
82
|
+
setValidationError(nil)
|
|
83
|
+
end, { value })
|
|
84
|
+
-- Function to handle debounced validation
|
|
85
|
+
local debouncedValidate = function(text)
|
|
86
|
+
clearDebounce()
|
|
87
|
+
debounceTimer.current = task.delay(debounceDelay, function()
|
|
88
|
+
if onTextChanged then
|
|
89
|
+
local err = onTextChanged(text)
|
|
90
|
+
if err ~= nil then
|
|
91
|
+
setValidationError(err)
|
|
92
|
+
else
|
|
93
|
+
setValidationError(nil)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
debounceTimer.current = nil
|
|
97
|
+
end)
|
|
98
|
+
end
|
|
99
|
+
-- Cleanup debounce timer on unmount
|
|
100
|
+
useEffect(function()
|
|
101
|
+
return function()
|
|
102
|
+
clearDebounce()
|
|
103
|
+
end
|
|
104
|
+
end, {})
|
|
105
|
+
local fullRound = UDim.new(1, 0)
|
|
106
|
+
local HEIGHT = PADDING_LEFT * 2 + height
|
|
107
|
+
-- Handle text box changes
|
|
108
|
+
useEffect(function()
|
|
109
|
+
local currentTextBox = actualRef.current
|
|
110
|
+
if not currentTextBox then
|
|
111
|
+
return nil
|
|
112
|
+
end
|
|
113
|
+
local connection = currentTextBox:GetPropertyChangedSignal("Text"):Connect(function()
|
|
114
|
+
local _result = currentTextBox
|
|
115
|
+
if _result ~= nil then
|
|
116
|
+
_result = _result.Text
|
|
117
|
+
end
|
|
118
|
+
local _condition = _result
|
|
119
|
+
if _condition == nil then
|
|
120
|
+
_condition = ""
|
|
121
|
+
end
|
|
122
|
+
local newText = _condition
|
|
123
|
+
-- Flag this as a user input
|
|
124
|
+
isUserInput.current = true
|
|
125
|
+
-- Update UI immediately
|
|
126
|
+
setInputValue(newText)
|
|
127
|
+
-- Schedule validation with debounce
|
|
128
|
+
debouncedValidate(newText)
|
|
129
|
+
-- Reset the flag after this event cycle
|
|
130
|
+
task.defer(function()
|
|
131
|
+
isUserInput.current = false
|
|
132
|
+
end)
|
|
133
|
+
end)
|
|
134
|
+
return function()
|
|
135
|
+
connection:Disconnect()
|
|
136
|
+
end
|
|
137
|
+
end, { actualRef.current })
|
|
138
|
+
local _attributes = {}
|
|
139
|
+
local _condition = width
|
|
140
|
+
if _condition == nil then
|
|
141
|
+
_condition = 1
|
|
142
|
+
end
|
|
143
|
+
_attributes.size = UDim2.new(_condition, 0, 1, 0)
|
|
144
|
+
_attributes.automaticSize = Enum.AutomaticSize.Y
|
|
145
|
+
_attributes.spacing = rem(0.5)
|
|
146
|
+
return React.createElement(VStack, _attributes, React.createElement(Frame, {
|
|
147
|
+
backgroundTransparency = 1,
|
|
148
|
+
size = UDim2.new(1, 0, 0, rem(HEIGHT)),
|
|
149
|
+
layoutOrder = order,
|
|
150
|
+
event = {
|
|
151
|
+
MouseEnter = function()
|
|
152
|
+
return hoverMotion:spring(1)
|
|
153
|
+
end,
|
|
154
|
+
MouseLeave = function()
|
|
155
|
+
return hoverMotion:spring(0)
|
|
156
|
+
end,
|
|
157
|
+
},
|
|
158
|
+
}, React.createElement(Padding, {
|
|
159
|
+
paddingY = rem(MARGIN_Y),
|
|
160
|
+
}), React.createElement(Frame, {
|
|
161
|
+
backgroundTransparency = 0,
|
|
162
|
+
backgroundColor = theme.palette.white,
|
|
163
|
+
cornerRadius = fullRound,
|
|
164
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
165
|
+
}), React.createElement(Outline, {
|
|
166
|
+
cornerRadius = fullRound,
|
|
167
|
+
innerColor = if disabled then theme.palette.disabled else theme.palette.crust,
|
|
168
|
+
innerTransparency = 0,
|
|
169
|
+
outerColor = theme.palette.white,
|
|
170
|
+
outerTransparency = 0,
|
|
171
|
+
outerThickness = 1,
|
|
172
|
+
}), React.createElement(HStack, {
|
|
173
|
+
spacing = rem(INTERNAL_PADDING),
|
|
174
|
+
}, React.createElement("uipadding", {
|
|
175
|
+
PaddingLeft = UDim.new(0, rem(PADDING_LEFT)),
|
|
176
|
+
PaddingRight = UDim.new(0, rem(PADDING_RIGHT)),
|
|
177
|
+
}), React.createElement(RoundEmoji, {
|
|
178
|
+
emoji = emoji,
|
|
179
|
+
primary = primary,
|
|
180
|
+
height = height,
|
|
181
|
+
}), React.createElement(TextField, {
|
|
182
|
+
ref = ref or internalRef,
|
|
183
|
+
font = theme.fonts.inter.medium,
|
|
184
|
+
text = inputValue,
|
|
185
|
+
textColor = if disabled then theme.palette.disabled else theme.palette.crust,
|
|
186
|
+
textTransparency = 0.05,
|
|
187
|
+
textSize = rem(3.5),
|
|
188
|
+
textXAlignment = "Left",
|
|
189
|
+
textYAlignment = "Center",
|
|
190
|
+
size = UDim2.new(1, -rem(height), 1, 0),
|
|
191
|
+
clearTextOnFocus = false,
|
|
192
|
+
placeholderText = placeholderText,
|
|
193
|
+
textEditable = not disabled,
|
|
194
|
+
event = {
|
|
195
|
+
FocusLost = function(rbx, enterPressed)
|
|
196
|
+
if enterPressed then
|
|
197
|
+
local _result = onClick
|
|
198
|
+
if _result ~= nil then
|
|
199
|
+
_result()
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end,
|
|
203
|
+
},
|
|
204
|
+
clipsDescendants = true,
|
|
205
|
+
}))), if validationError ~= "" and validationError then (React.createElement(Text, {
|
|
206
|
+
text = validationError,
|
|
207
|
+
font = theme.fonts.inter.bold,
|
|
208
|
+
textColor = theme.palette.red,
|
|
209
|
+
textScaled = true,
|
|
210
|
+
size = UDim2.new(1, 0, 0, rem(2.6)),
|
|
211
|
+
textXAlignment = "Left",
|
|
212
|
+
}, React.createElement("uicorner", {
|
|
213
|
+
CornerRadius = fullRound,
|
|
214
|
+
}))) else nil, children)
|
|
215
|
+
end)
|
|
216
|
+
return {
|
|
217
|
+
InputRound = InputRound,
|
|
218
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
export interface InputRowProps {
|
|
3
|
+
value: string;
|
|
4
|
+
emoji: string;
|
|
5
|
+
emojiColor: Color3;
|
|
6
|
+
placeholderText: string;
|
|
7
|
+
label: string;
|
|
8
|
+
onTextChanged: (value: string) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function InputRow({ value, emoji, emojiColor, placeholderText, label, onTextChanged, disabled, children, }: InputRowProps): JSX.Element;
|
|
13
|
+
//# sourceMappingURL=InputRow.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
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 FormRow = TS.import(script, script.Parent, "FormRow").FormRow
|
|
5
|
+
local InputRound = TS.import(script, script.Parent, "InputRound").InputRound
|
|
6
|
+
local function InputRow(_param)
|
|
7
|
+
local value = _param.value
|
|
8
|
+
local emoji = _param.emoji
|
|
9
|
+
local emojiColor = _param.emojiColor
|
|
10
|
+
local placeholderText = _param.placeholderText
|
|
11
|
+
local label = _param.label
|
|
12
|
+
local onTextChanged = _param.onTextChanged
|
|
13
|
+
local disabled = _param.disabled
|
|
14
|
+
local children = _param.children
|
|
15
|
+
return React.createElement(FormRow, {
|
|
16
|
+
label = label,
|
|
17
|
+
disabled = disabled,
|
|
18
|
+
}, React.createElement(InputRound, {
|
|
19
|
+
value = value,
|
|
20
|
+
emoji = emoji,
|
|
21
|
+
placeholderText = placeholderText,
|
|
22
|
+
primary = emojiColor,
|
|
23
|
+
order = 0,
|
|
24
|
+
onTextChanged = onTextChanged,
|
|
25
|
+
disabled = disabled,
|
|
26
|
+
}, React.createElement("uiflexitem", {
|
|
27
|
+
FlexMode = Enum.UIFlexMode.Fill,
|
|
28
|
+
})), children)
|
|
29
|
+
end
|
|
30
|
+
return {
|
|
31
|
+
InputRow = InputRow,
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface RadioProps {
|
|
2
|
+
checked: boolean;
|
|
3
|
+
onChecked: (checked: boolean) => void;
|
|
4
|
+
text?: string;
|
|
5
|
+
variant?: "default" | "large" | "small";
|
|
6
|
+
position?: UDim2;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function Radio({ checked, onChecked, text, variant, position, disabled }: RadioProps): JSX.Element;
|
|
10
|
+
export type { RadioProps };
|
|
11
|
+
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
|
|
4
|
+
local lerpBinding = _pretty_react_hooks.lerpBinding
|
|
5
|
+
local useMotion = _pretty_react_hooks.useMotion
|
|
6
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
+
local React = _react
|
|
8
|
+
local useMemo = _react.useMemo
|
|
9
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
10
|
+
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
11
|
+
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
12
|
+
local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
|
|
13
|
+
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
14
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
15
|
+
local function Radio(_param)
|
|
16
|
+
local checked = _param.checked
|
|
17
|
+
local onChecked = _param.onChecked
|
|
18
|
+
local text = _param.text
|
|
19
|
+
local variant = _param.variant
|
|
20
|
+
if variant == nil then
|
|
21
|
+
variant = "default"
|
|
22
|
+
end
|
|
23
|
+
local position = _param.position
|
|
24
|
+
local disabled = _param.disabled
|
|
25
|
+
if disabled == nil then
|
|
26
|
+
disabled = false
|
|
27
|
+
end
|
|
28
|
+
local theme = defaultTheme
|
|
29
|
+
local rem = useRem()
|
|
30
|
+
local hover, hoverMotion = useMotion(0)
|
|
31
|
+
local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
|
|
32
|
+
local buttonSize = UDim2.new(0, rem(checkboxSize), 0, rem(checkboxSize))
|
|
33
|
+
local textWidth, textWidthMotion = useMotion({
|
|
34
|
+
label = 0,
|
|
35
|
+
value = 0,
|
|
36
|
+
})
|
|
37
|
+
local size = useMemo(function()
|
|
38
|
+
return textWidth:map(function(_param_1)
|
|
39
|
+
local label = _param_1.label
|
|
40
|
+
local value = _param_1.value
|
|
41
|
+
local content = math.max(label, value)
|
|
42
|
+
local width = checkboxSize
|
|
43
|
+
return UDim2.new(0, rem(width) + content, 0, rem(checkboxSize))
|
|
44
|
+
end)
|
|
45
|
+
end, { rem })
|
|
46
|
+
local cornerRadius = UDim.new(1, 0)
|
|
47
|
+
local mainColor = if disabled then theme.palette.overlay0 else theme.palette.black
|
|
48
|
+
local textColor = if disabled then theme.palette.overlay0 else theme.palette.black
|
|
49
|
+
return React.createElement(ReactiveButton, {
|
|
50
|
+
backgroundTransparency = 1,
|
|
51
|
+
size = size,
|
|
52
|
+
position = position,
|
|
53
|
+
onClick = function()
|
|
54
|
+
return not disabled and onChecked(not checked)
|
|
55
|
+
end,
|
|
56
|
+
onHover = function(hovered)
|
|
57
|
+
return hoverMotion:spring(if hovered then 1 else 0)
|
|
58
|
+
end,
|
|
59
|
+
}, React.createElement("uilistlayout", {
|
|
60
|
+
FillDirection = "Horizontal",
|
|
61
|
+
VerticalAlignment = "Center",
|
|
62
|
+
Padding = UDim.new(0, 8),
|
|
63
|
+
}), React.createElement(Frame, {
|
|
64
|
+
backgroundTransparency = 1,
|
|
65
|
+
size = buttonSize,
|
|
66
|
+
}, React.createElement(Frame, {
|
|
67
|
+
backgroundColor = theme.palette.white,
|
|
68
|
+
cornerRadius = cornerRadius,
|
|
69
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
70
|
+
}, React.createElement("uigradient", {
|
|
71
|
+
Offset = lerpBinding(hover, Vector2.new(), Vector2.new(0, 1)),
|
|
72
|
+
Rotation = 90,
|
|
73
|
+
Transparency = NumberSequence.new(0, 0.1),
|
|
74
|
+
})), React.createElement(Outline, {
|
|
75
|
+
outerColor = mainColor,
|
|
76
|
+
innerColor = mainColor,
|
|
77
|
+
cornerRadius = cornerRadius,
|
|
78
|
+
innerTransparency = 0,
|
|
79
|
+
outerTransparency = 1,
|
|
80
|
+
innerThickness = 2,
|
|
81
|
+
}), if checked then (React.createElement(Frame, {
|
|
82
|
+
backgroundColor = theme.palette.blue,
|
|
83
|
+
backgroundTransparency = 0,
|
|
84
|
+
size = UDim2.new(0.7, 0, 0.7, 0),
|
|
85
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
86
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
87
|
+
}, React.createElement("uicorner", {
|
|
88
|
+
CornerRadius = cornerRadius,
|
|
89
|
+
}))) else nil), if text ~= "" and text then (React.createElement(Text, {
|
|
90
|
+
text = text,
|
|
91
|
+
size = UDim2.new(0, rem(2), 0, rem(2)),
|
|
92
|
+
textColor = textColor,
|
|
93
|
+
textXAlignment = "Left",
|
|
94
|
+
change = {
|
|
95
|
+
TextBounds = function(rbx)
|
|
96
|
+
textWidthMotion:spring({
|
|
97
|
+
value = rbx.TextBounds.X,
|
|
98
|
+
})
|
|
99
|
+
end,
|
|
100
|
+
},
|
|
101
|
+
})) else nil)
|
|
102
|
+
end
|
|
103
|
+
return {
|
|
104
|
+
Radio = Radio,
|
|
105
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface RadioRowProps {
|
|
2
|
+
label: string;
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onChecked: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function RadioRow({ label, checked, onChecked, disabled, }: RadioRowProps): JSX.Element;
|
|
8
|
+
//# sourceMappingURL=RadioRow.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
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 Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
5
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
6
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
8
|
+
local Radio = TS.import(script, script.Parent, "Radio").Radio
|
|
9
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
10
|
+
local function RadioRow(_param)
|
|
11
|
+
local label = _param.label
|
|
12
|
+
local checked = _param.checked
|
|
13
|
+
local onChecked = _param.onChecked
|
|
14
|
+
local disabled = _param.disabled
|
|
15
|
+
local theme = defaultTheme
|
|
16
|
+
local rem = useRem()
|
|
17
|
+
local textSize = rem(3)
|
|
18
|
+
return React.createElement(HStack, {
|
|
19
|
+
size = UDim2.new(1, 0, 0, 0),
|
|
20
|
+
automaticSize = Enum.AutomaticSize.Y,
|
|
21
|
+
spacing = rem(2),
|
|
22
|
+
}, React.createElement(Radio, {
|
|
23
|
+
checked = checked,
|
|
24
|
+
variant = "large",
|
|
25
|
+
onChecked = onChecked,
|
|
26
|
+
disabled = disabled,
|
|
27
|
+
}), React.createElement(Button, {
|
|
28
|
+
backgroundTransparency = 1,
|
|
29
|
+
size = UDim2.new(1, 0, 0, rem(4)),
|
|
30
|
+
onClick = onChecked,
|
|
31
|
+
}, React.createElement(Text, {
|
|
32
|
+
text = label,
|
|
33
|
+
textSize = textSize,
|
|
34
|
+
textScaled = true,
|
|
35
|
+
textColor = if disabled then theme.palette.disabled else theme.palette.crust,
|
|
36
|
+
size = UDim2.new(0.8, 0, 0, rem(4)),
|
|
37
|
+
textXAlignment = "Left",
|
|
38
|
+
}, React.createElement("uiflexitem", {
|
|
39
|
+
FlexMode = Enum.UIFlexMode.Fill,
|
|
40
|
+
}))), React.createElement("uiflexitem", {
|
|
41
|
+
FlexMode = Enum.UIFlexMode.Fill,
|
|
42
|
+
}))
|
|
43
|
+
end
|
|
44
|
+
return {
|
|
45
|
+
RadioRow = RadioRow,
|
|
46
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface RoundEmojiProps {
|
|
2
|
+
readonly emoji: string;
|
|
3
|
+
readonly primary: Color3;
|
|
4
|
+
readonly height?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function RoundEmoji({ emoji, primary, height }: RoundEmojiProps): JSX.Element;
|
|
7
|
+
export type { RoundEmojiProps };
|
|
8
|
+
//# sourceMappingURL=RoundEmoji.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
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 Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
5
|
+
local Group = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Group
|
|
6
|
+
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
8
|
+
local function RoundEmoji(_param)
|
|
9
|
+
local emoji = _param.emoji
|
|
10
|
+
local primary = _param.primary
|
|
11
|
+
local height = _param.height
|
|
12
|
+
if height == nil then
|
|
13
|
+
height = 4
|
|
14
|
+
end
|
|
15
|
+
local rem = useRem()
|
|
16
|
+
local fullRound = UDim.new(1, 0)
|
|
17
|
+
local CIRCLE_SIZE = height
|
|
18
|
+
local EMOJI_SIZE = CIRCLE_SIZE / 1.5
|
|
19
|
+
return React.createElement(Group, {
|
|
20
|
+
size = UDim2.new(0, rem(CIRCLE_SIZE), 0, rem(CIRCLE_SIZE)),
|
|
21
|
+
}, React.createElement(Frame, {
|
|
22
|
+
backgroundColor = primary,
|
|
23
|
+
backgroundTransparency = 0.8,
|
|
24
|
+
cornerRadius = fullRound,
|
|
25
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
26
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
27
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
28
|
+
}), React.createElement(Text, {
|
|
29
|
+
text = emoji,
|
|
30
|
+
textScaled = true,
|
|
31
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
32
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
33
|
+
size = UDim2.new(0, rem(EMOJI_SIZE), 0, rem(EMOJI_SIZE)),
|
|
34
|
+
textXAlignment = "Center",
|
|
35
|
+
textYAlignment = "Center",
|
|
36
|
+
}))
|
|
37
|
+
end
|
|
38
|
+
return {
|
|
39
|
+
RoundEmoji = RoundEmoji,
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FrameProps } from "@rbxts-ui/primitives";
|
|
2
|
+
import React from "@rbxts/react";
|
|
3
|
+
export interface TextBoxProps<T extends Instance = TextBox> extends FrameProps<T> {
|
|
4
|
+
font?: Font;
|
|
5
|
+
text?: string | React.Binding<string>;
|
|
6
|
+
textColor?: Color3 | React.Binding<Color3>;
|
|
7
|
+
textSize?: number | React.Binding<number>;
|
|
8
|
+
textTransparency?: number | React.Binding<number>;
|
|
9
|
+
textWrapped?: boolean | React.Binding<boolean>;
|
|
10
|
+
textXAlignment?: React.InferEnumNames<Enum.TextXAlignment>;
|
|
11
|
+
textYAlignment?: React.InferEnumNames<Enum.TextYAlignment>;
|
|
12
|
+
textTruncate?: React.InferEnumNames<Enum.TextTruncate>;
|
|
13
|
+
textScaled?: boolean | React.Binding<boolean>;
|
|
14
|
+
textHeight?: number | React.Binding<number>;
|
|
15
|
+
textAutoResize?: "X" | "Y" | "XY";
|
|
16
|
+
richText?: boolean | React.Binding<boolean>;
|
|
17
|
+
maxVisibleGraphemes?: number | React.Binding<number>;
|
|
18
|
+
lineHeight?: number | React.Binding<number>;
|
|
19
|
+
clearTextOnFocus?: boolean;
|
|
20
|
+
placeholderText?: string;
|
|
21
|
+
textEditable?: boolean | React.Binding<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare const TextBox: React.ForwardRefExoticComponent<Omit<TextBoxProps<TextBox>, "ref"> & React.RefAttributes<TextBox>>;
|
|
24
|
+
//# sourceMappingURL=TextBox.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local fonts = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).fonts
|
|
4
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
5
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
6
|
+
local React = _react
|
|
7
|
+
local forwardRef = _react.forwardRef
|
|
8
|
+
local TextBox = forwardRef(function(props, ref)
|
|
9
|
+
local rem = useRem()
|
|
10
|
+
local _attributes = {
|
|
11
|
+
ref = ref,
|
|
12
|
+
Font = Enum.Font.Arial,
|
|
13
|
+
FontFace = props.font or fonts.inter.regular,
|
|
14
|
+
Text = props.text,
|
|
15
|
+
TextColor3 = props.textColor,
|
|
16
|
+
}
|
|
17
|
+
local _condition = props.textSize
|
|
18
|
+
if _condition == nil then
|
|
19
|
+
_condition = rem(1)
|
|
20
|
+
end
|
|
21
|
+
_attributes.TextSize = _condition
|
|
22
|
+
_attributes.TextTransparency = props.textTransparency
|
|
23
|
+
_attributes.TextWrapped = props.textWrapped
|
|
24
|
+
_attributes.TextXAlignment = props.textXAlignment
|
|
25
|
+
_attributes.TextYAlignment = props.textYAlignment
|
|
26
|
+
_attributes.TextTruncate = props.textTruncate
|
|
27
|
+
_attributes.TextScaled = props.textScaled
|
|
28
|
+
_attributes.LineHeight = props.lineHeight
|
|
29
|
+
_attributes.RichText = props.richText
|
|
30
|
+
_attributes.MaxVisibleGraphemes = props.maxVisibleGraphemes
|
|
31
|
+
_attributes.Size = props.size
|
|
32
|
+
_attributes.AutomaticSize = props.textAutoResize or props.automaticSize
|
|
33
|
+
_attributes.Position = props.position
|
|
34
|
+
_attributes.AnchorPoint = props.anchorPoint
|
|
35
|
+
_attributes.BackgroundColor3 = props.backgroundColor
|
|
36
|
+
local _condition_1 = props.backgroundTransparency
|
|
37
|
+
if _condition_1 == nil then
|
|
38
|
+
_condition_1 = 1
|
|
39
|
+
end
|
|
40
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
41
|
+
_attributes.ClipsDescendants = props.clipsDescendants
|
|
42
|
+
_attributes.Visible = props.visible
|
|
43
|
+
_attributes.ZIndex = props.zIndex
|
|
44
|
+
_attributes.LayoutOrder = props.layoutOrder
|
|
45
|
+
_attributes.Change = props.change
|
|
46
|
+
_attributes.Event = props.event
|
|
47
|
+
_attributes.Rotation = props.rotation
|
|
48
|
+
_attributes.ClearTextOnFocus = props.clearTextOnFocus
|
|
49
|
+
_attributes.PlaceholderText = props.placeholderText
|
|
50
|
+
_attributes.TextEditable = props.textEditable
|
|
51
|
+
return React.createElement("textbox", _attributes, props.children, props.cornerRadius and React.createElement("uicorner", {
|
|
52
|
+
CornerRadius = props.cornerRadius,
|
|
53
|
+
}))
|
|
54
|
+
end)
|
|
55
|
+
return {
|
|
56
|
+
TextBox = TextBox,
|
|
57
|
+
}
|
|
@@ -8,5 +8,5 @@ export interface TextFieldProps extends TextProps<TextBox> {
|
|
|
8
8
|
multiLine?: boolean | React.Binding<boolean>;
|
|
9
9
|
textEditable?: boolean | React.Binding<boolean>;
|
|
10
10
|
}
|
|
11
|
-
export declare
|
|
11
|
+
export declare const TextField: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & React.RefAttributes<TextBox>>;
|
|
12
12
|
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
|
+
local forwardRef = _react.forwardRef
|
|
5
6
|
local useEffect = _react.useEffect
|
|
6
7
|
local useState = _react.useState
|
|
7
8
|
local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
|
|
8
9
|
local fonts = _primitives.fonts
|
|
9
10
|
local Group = _primitives.Group
|
|
10
|
-
local
|
|
11
|
+
local TextField = forwardRef(function(props, ref)
|
|
11
12
|
local childRef, setChildRef = useState(nil)
|
|
12
13
|
useEffect(function()
|
|
13
14
|
local _condition = childRef
|
|
@@ -27,6 +28,7 @@ local function TextField(props)
|
|
|
27
28
|
end
|
|
28
29
|
end, { childRef, props.text })
|
|
29
30
|
local _attributes = {
|
|
31
|
+
ref = ref,
|
|
30
32
|
PlaceholderText = props.placeholderText,
|
|
31
33
|
PlaceholderColor3 = props.placeholderColor,
|
|
32
34
|
ClearTextOnFocus = props.clearTextOnFocus,
|
|
@@ -65,7 +67,7 @@ local function TextField(props)
|
|
|
65
67
|
}), React.createElement(Group, {
|
|
66
68
|
ref = setChildRef,
|
|
67
69
|
}))
|
|
68
|
-
end
|
|
70
|
+
end)
|
|
69
71
|
return {
|
|
70
72
|
TextField = TextField,
|
|
71
73
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function validateAngle(val: string): "Please enter a valid number" | "Angle must be greater than 0" | "Angle must be less than 180" | undefined;
|
|
2
|
+
export declare function validatePosNumber(val: string): "Please enter a valid number" | "Number must be greater than 0" | undefined;
|
|
3
|
+
export declare function validateNumber(val: string): "Please enter a valid number" | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Validates that a number is within specified bounds
|
|
6
|
+
* @param val - String value to validate
|
|
7
|
+
* @param min - Minimum allowed value
|
|
8
|
+
* @param max - Maximum allowed value
|
|
9
|
+
* @param customErrorMsg - Optional custom error message for bounds error
|
|
10
|
+
* @returns Error message or undefined if valid
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateNumberBounds(val: string, min: number, max: number, customErrorMsg?: string): string | undefined;
|
|
13
|
+
//# sourceMappingURL=validation.d.ts.map
|