@rbxts-ui/components 2.1.0 → 3.1.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/display/AlertBox.d.ts +11 -0
- package/dist/display/AlertBox.luau +56 -0
- package/dist/display/AlertBox.story.d.ts +12 -0
- package/dist/display/AlertBox.story.luau +37 -0
- 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/icons/InfoIcon.d.ts +8 -0
- package/dist/icons/InfoIcon.luau +80 -0
- package/dist/icons/WarningIcon.d.ts +8 -0
- package/dist/icons/WarningIcon.luau +85 -0
- package/dist/icons/WarningIcon.story.d.ts +16 -0
- package/dist/icons/WarningIcon.story.luau +60 -0
- package/dist/index.d.ts +52 -32
- package/dist/init.luau +68 -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/utils/InputCapture.d.ts +14 -0
- package/dist/utils/InputCapture.luau +217 -0
- package/dist/{Outline.d.ts → utils/Outline.d.ts} +1 -3
- package/dist/{Outline.luau → utils/Outline.luau} +3 -6
- package/package.json +12 -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
|
@@ -6,12 +6,12 @@ local useMotion = _pretty_react_hooks.useMotion
|
|
|
6
6
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
7
|
local React = _react
|
|
8
8
|
local useMemo = _react.useMemo
|
|
9
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
9
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
10
10
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
11
|
-
local Outline = TS.import(script, script.Parent, "Outline").Outline
|
|
12
|
-
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
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
13
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
14
|
-
local defaultTheme = TS.import(script, script
|
|
14
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
15
15
|
local function Checkbox(_param)
|
|
16
16
|
local checked = _param.checked
|
|
17
17
|
local onChecked = _param.onChecked
|
|
@@ -25,10 +25,7 @@ local function Checkbox(_param)
|
|
|
25
25
|
if disabled == nil then
|
|
26
26
|
disabled = false
|
|
27
27
|
end
|
|
28
|
-
local theme =
|
|
29
|
-
if theme == nil then
|
|
30
|
-
theme = defaultTheme
|
|
31
|
-
end
|
|
28
|
+
local theme = defaultTheme
|
|
32
29
|
local rem = useRem()
|
|
33
30
|
local hover, hoverMotion = useMotion(0)
|
|
34
31
|
local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
|
|
@@ -59,7 +56,6 @@ local function Checkbox(_param)
|
|
|
59
56
|
onHover = function(hovered)
|
|
60
57
|
return hoverMotion:spring(if hovered then 1 else 0)
|
|
61
58
|
end,
|
|
62
|
-
theme = theme,
|
|
63
59
|
}, React.createElement("uilistlayout", {
|
|
64
60
|
FillDirection = "Horizontal",
|
|
65
61
|
VerticalAlignment = "Center",
|
|
@@ -82,7 +78,6 @@ local function Checkbox(_param)
|
|
|
82
78
|
innerTransparency = 0,
|
|
83
79
|
outerTransparency = 1,
|
|
84
80
|
innerThickness = 2,
|
|
85
|
-
theme = theme,
|
|
86
81
|
}), React.createElement(Text, {
|
|
87
82
|
text = if checked then "✔" else "",
|
|
88
83
|
textColor = mainColor,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { type Theme } from "./theme";
|
|
3
2
|
interface CheckboxRowProps {
|
|
4
3
|
label: string;
|
|
5
4
|
checked: boolean;
|
|
@@ -7,8 +6,7 @@ interface CheckboxRowProps {
|
|
|
7
6
|
disabled?: boolean;
|
|
8
7
|
name?: string;
|
|
9
8
|
children?: React.ReactNode;
|
|
10
|
-
theme?: Theme;
|
|
11
9
|
}
|
|
12
|
-
export declare function CheckboxRow({ label, checked, onChecked, disabled, name, children,
|
|
10
|
+
export declare function CheckboxRow({ label, checked, onChecked, disabled, name, children, }: CheckboxRowProps): JSX.Element;
|
|
13
11
|
export type { CheckboxRowProps };
|
|
14
12
|
//# sourceMappingURL=CheckboxRow.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
4
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
5
5
|
local Checkbox = TS.import(script, script.Parent, "Checkbox").Checkbox
|
|
6
|
-
local Button = TS.import(script, script.Parent, "Button").Button
|
|
6
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
7
7
|
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
8
8
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
9
|
-
local defaultTheme = TS.import(script, script
|
|
9
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
10
10
|
local function CheckboxRow(_param)
|
|
11
11
|
local label = _param.label
|
|
12
12
|
local checked = _param.checked
|
|
@@ -17,10 +17,7 @@ local function CheckboxRow(_param)
|
|
|
17
17
|
end
|
|
18
18
|
local name = _param.name
|
|
19
19
|
local children = _param.children
|
|
20
|
-
local theme =
|
|
21
|
-
if theme == nil then
|
|
22
|
-
theme = defaultTheme
|
|
23
|
-
end
|
|
20
|
+
local theme = defaultTheme
|
|
24
21
|
local rem = useRem()
|
|
25
22
|
local textSize = rem(3)
|
|
26
23
|
return React.createElement(HStack, {
|
|
@@ -33,7 +30,6 @@ local function CheckboxRow(_param)
|
|
|
33
30
|
variant = "large",
|
|
34
31
|
onChecked = onChecked,
|
|
35
32
|
disabled = disabled,
|
|
36
|
-
theme = theme,
|
|
37
33
|
}), React.createElement(Button, {
|
|
38
34
|
backgroundTransparency = 1,
|
|
39
35
|
size = UDim2.new(1, 0, 0, rem(4)),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { type Theme } from "./theme";
|
|
3
2
|
interface DropdownOption<T> {
|
|
4
3
|
label: string;
|
|
5
4
|
value: T;
|
|
@@ -11,7 +10,6 @@ interface DropdownProps<T> {
|
|
|
11
10
|
size?: UDim2;
|
|
12
11
|
renderOption?: (option: DropdownOption<T>) => React.ReactNode;
|
|
13
12
|
portalRef?: React.RefObject<GuiObject>;
|
|
14
|
-
theme?: Theme;
|
|
15
13
|
}
|
|
16
14
|
export declare function Dropdown<T>(props: DropdownProps<T>): JSX.Element;
|
|
17
15
|
export type { DropdownOption, DropdownProps };
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local VStackScrolling = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).VStackScrolling
|
|
4
4
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
5
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
5
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
6
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
6
7
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
8
|
local React = _react
|
|
8
9
|
local useEffect = _react.useEffect
|
|
9
10
|
local useRef = _react.useRef
|
|
10
11
|
local useState = _react.useState
|
|
11
12
|
local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
|
|
12
|
-
local
|
|
13
|
-
local
|
|
14
|
-
local
|
|
15
|
-
local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
|
|
13
|
+
local DropdownButton = TS.import(script, script.Parent.Parent, "buttons", "DropdownButton").DropdownButton
|
|
14
|
+
local DropdownOptionButton = TS.import(script, script.Parent.Parent, "buttons", "DropdownOptionButton").DropdownOptionButton
|
|
15
|
+
local ClickOutsideLayer = TS.import(script, script.Parent.Parent, "utils", "ClickOutsideOverlay").ClickOutsideLayer
|
|
16
16
|
local function Dropdown(props)
|
|
17
17
|
local _binding = props
|
|
18
18
|
local options = _binding.options
|
|
@@ -21,10 +21,7 @@ local function Dropdown(props)
|
|
|
21
21
|
local size = _binding.size
|
|
22
22
|
local renderOption = _binding.renderOption
|
|
23
23
|
local portalRef = _binding.portalRef
|
|
24
|
-
local theme =
|
|
25
|
-
if theme == nil then
|
|
26
|
-
theme = defaultTheme
|
|
27
|
-
end
|
|
24
|
+
local theme = defaultTheme
|
|
28
25
|
local isOpen, setIsOpen = useState(false)
|
|
29
26
|
local dropdownBounds, setDropdownBounds = useState()
|
|
30
27
|
local dropdownRef = useRef()
|
|
@@ -89,7 +86,6 @@ local function Dropdown(props)
|
|
|
89
86
|
onChange(option.value)
|
|
90
87
|
setIsOpen(false)
|
|
91
88
|
end,
|
|
92
|
-
theme = theme,
|
|
93
89
|
}, if renderOption then renderOption(option) else nil)
|
|
94
90
|
end
|
|
95
91
|
for _k, _v in options do
|
|
@@ -109,7 +105,7 @@ local function Dropdown(props)
|
|
|
109
105
|
end
|
|
110
106
|
local container = _container
|
|
111
107
|
if not container then
|
|
112
|
-
|
|
108
|
+
return nil
|
|
113
109
|
end
|
|
114
110
|
if not dropdownBounds then
|
|
115
111
|
return nil
|
|
@@ -146,7 +142,6 @@ local function Dropdown(props)
|
|
|
146
142
|
_attributes.onClick = function()
|
|
147
143
|
return setIsOpen(not isOpen)
|
|
148
144
|
end
|
|
149
|
-
_attributes.theme = theme
|
|
150
145
|
return React.createElement(Frame, {
|
|
151
146
|
backgroundTransparency = 1,
|
|
152
147
|
size = frameSize,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
interface DropdownRowProps<T> {
|
|
3
|
+
label: string;
|
|
4
|
+
value?: T;
|
|
5
|
+
options: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: T;
|
|
8
|
+
}>;
|
|
9
|
+
onChange: (value: T) => void;
|
|
10
|
+
renderOption?: (option: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: T;
|
|
13
|
+
}) => React.ReactNode;
|
|
14
|
+
portalRef?: React.RefObject<GuiObject>;
|
|
15
|
+
}
|
|
16
|
+
export declare function DropdownRow<T>({ label, value, options, onChange, renderOption, portalRef }: DropdownRowProps<T>): JSX.Element;
|
|
17
|
+
export type { DropdownRowProps };
|
|
18
|
+
//# sourceMappingURL=DropdownRow.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
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 React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local Dropdown = TS.import(script, script.Parent, "Dropdown").Dropdown
|
|
6
|
+
local FormRow = TS.import(script, script.Parent, "FormRow").FormRow
|
|
7
|
+
local function DropdownRow(_param)
|
|
8
|
+
local label = _param.label
|
|
9
|
+
local value = _param.value
|
|
10
|
+
local options = _param.options
|
|
11
|
+
local onChange = _param.onChange
|
|
12
|
+
local renderOption = _param.renderOption
|
|
13
|
+
local portalRef = _param.portalRef
|
|
14
|
+
local rem = useRem()
|
|
15
|
+
return React.createElement(FormRow, {
|
|
16
|
+
label = label,
|
|
17
|
+
}, React.createElement(Dropdown, {
|
|
18
|
+
options = options,
|
|
19
|
+
value = value,
|
|
20
|
+
onChange = onChange,
|
|
21
|
+
size = UDim2.new(1, 0, 0, rem(5)),
|
|
22
|
+
renderOption = renderOption,
|
|
23
|
+
portalRef = portalRef,
|
|
24
|
+
}))
|
|
25
|
+
end
|
|
26
|
+
return {
|
|
27
|
+
DropdownRow = DropdownRow,
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
interface FormRowProps {
|
|
3
|
+
label: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function FormRow({ label, children, disabled }: FormRowProps): JSX.Element;
|
|
8
|
+
export type { FormRowProps };
|
|
9
|
+
//# sourceMappingURL=FormRow.d.ts.map
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
4
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
5
5
|
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
6
6
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
7
|
-
local defaultTheme = TS.import(script, script
|
|
7
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
8
8
|
local INPUT_HEIGHT = 5
|
|
9
9
|
local function FormRow(_param)
|
|
10
10
|
local label = _param.label
|
|
11
11
|
local children = _param.children
|
|
12
12
|
local disabled = _param.disabled
|
|
13
|
-
local theme =
|
|
14
|
-
if theme == nil then
|
|
15
|
-
theme = defaultTheme
|
|
16
|
-
end
|
|
13
|
+
local theme = defaultTheme
|
|
17
14
|
local rem = useRem()
|
|
18
15
|
local textSize = rem(3)
|
|
19
16
|
local labelWidth = rem(20)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
interface InputRoundProps {
|
|
3
|
+
readonly onClick?: () => void;
|
|
4
|
+
readonly emoji: string;
|
|
5
|
+
readonly placeholderText: string;
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly primary: Color3;
|
|
8
|
+
readonly order: number;
|
|
9
|
+
readonly width?: number;
|
|
10
|
+
readonly height?: number;
|
|
11
|
+
readonly children?: React.ReactNode;
|
|
12
|
+
readonly onTextChanged?: (text: string) => void;
|
|
13
|
+
readonly debounceDelay?: number;
|
|
14
|
+
readonly disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const InputRound: React.ForwardRefExoticComponent<InputRoundProps & React.RefAttributes<TextBox>>;
|
|
17
|
+
export type { InputRoundProps };
|
|
18
|
+
//# sourceMappingURL=InputRound.d.ts.map
|
|
@@ -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
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Theme } from "./theme";
|
|
2
1
|
interface RadioProps {
|
|
3
2
|
checked: boolean;
|
|
4
3
|
onChecked: (checked: boolean) => void;
|
|
@@ -6,8 +5,7 @@ interface RadioProps {
|
|
|
6
5
|
variant?: "default" | "large" | "small";
|
|
7
6
|
position?: UDim2;
|
|
8
7
|
disabled?: boolean;
|
|
9
|
-
theme?: Theme;
|
|
10
8
|
}
|
|
11
|
-
export declare function Radio({ checked, onChecked, text, variant, position, disabled
|
|
9
|
+
export declare function Radio({ checked, onChecked, text, variant, position, disabled }: RadioProps): JSX.Element;
|
|
12
10
|
export type { RadioProps };
|
|
13
11
|
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -6,12 +6,12 @@ local useMotion = _pretty_react_hooks.useMotion
|
|
|
6
6
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
7
|
local React = _react
|
|
8
8
|
local useMemo = _react.useMemo
|
|
9
|
-
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem")
|
|
9
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
10
10
|
local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
|
|
11
|
-
local Outline = TS.import(script, script.Parent, "Outline").Outline
|
|
12
|
-
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
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
13
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
14
|
-
local defaultTheme = TS.import(script, script
|
|
14
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
15
15
|
local function Radio(_param)
|
|
16
16
|
local checked = _param.checked
|
|
17
17
|
local onChecked = _param.onChecked
|
|
@@ -25,10 +25,7 @@ local function Radio(_param)
|
|
|
25
25
|
if disabled == nil then
|
|
26
26
|
disabled = false
|
|
27
27
|
end
|
|
28
|
-
local theme =
|
|
29
|
-
if theme == nil then
|
|
30
|
-
theme = defaultTheme
|
|
31
|
-
end
|
|
28
|
+
local theme = defaultTheme
|
|
32
29
|
local rem = useRem()
|
|
33
30
|
local hover, hoverMotion = useMotion(0)
|
|
34
31
|
local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
|
|
@@ -59,7 +56,6 @@ local function Radio(_param)
|
|
|
59
56
|
onHover = function(hovered)
|
|
60
57
|
return hoverMotion:spring(if hovered then 1 else 0)
|
|
61
58
|
end,
|
|
62
|
-
theme = theme,
|
|
63
59
|
}, React.createElement("uilistlayout", {
|
|
64
60
|
FillDirection = "Horizontal",
|
|
65
61
|
VerticalAlignment = "Center",
|
|
@@ -82,7 +78,6 @@ local function Radio(_param)
|
|
|
82
78
|
innerTransparency = 0,
|
|
83
79
|
outerTransparency = 1,
|
|
84
80
|
innerThickness = 2,
|
|
85
|
-
theme = theme,
|
|
86
81
|
}), if checked then (React.createElement(Frame, {
|
|
87
82
|
backgroundColor = theme.palette.blue,
|
|
88
83
|
backgroundTransparency = 0,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { type Theme } from "./theme";
|
|
2
1
|
export interface RadioRowProps {
|
|
3
2
|
label: string;
|
|
4
3
|
checked: boolean;
|
|
5
4
|
onChecked: () => void;
|
|
6
5
|
disabled?: boolean;
|
|
7
|
-
theme?: Theme;
|
|
8
6
|
}
|
|
9
|
-
export declare function RadioRow({ label, checked, onChecked, disabled,
|
|
7
|
+
export declare function RadioRow({ label, checked, onChecked, disabled, }: RadioRowProps): JSX.Element;
|
|
10
8
|
//# sourceMappingURL=RadioRow.d.ts.map
|
|
@@ -2,20 +2,17 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
4
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", "rem")
|
|
5
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
6
6
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
-
local Button = TS.import(script, script.Parent, "Button").Button
|
|
7
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
8
8
|
local Radio = TS.import(script, script.Parent, "Radio").Radio
|
|
9
|
-
local defaultTheme = TS.import(script, script
|
|
9
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
10
10
|
local function RadioRow(_param)
|
|
11
11
|
local label = _param.label
|
|
12
12
|
local checked = _param.checked
|
|
13
13
|
local onChecked = _param.onChecked
|
|
14
14
|
local disabled = _param.disabled
|
|
15
|
-
local theme =
|
|
16
|
-
if theme == nil then
|
|
17
|
-
theme = defaultTheme
|
|
18
|
-
end
|
|
15
|
+
local theme = defaultTheme
|
|
19
16
|
local rem = useRem()
|
|
20
17
|
local textSize = rem(3)
|
|
21
18
|
return React.createElement(HStack, {
|
|
@@ -27,7 +24,6 @@ local function RadioRow(_param)
|
|
|
27
24
|
variant = "large",
|
|
28
25
|
onChecked = onChecked,
|
|
29
26
|
disabled = disabled,
|
|
30
|
-
theme = theme,
|
|
31
27
|
}), React.createElement(Button, {
|
|
32
28
|
backgroundTransparency = 1,
|
|
33
29
|
size = UDim2.new(1, 0, 0, rem(4)),
|
|
@@ -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
|