@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,144 @@
|
|
|
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 Layer = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).Layer
|
|
5
|
+
local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
|
|
6
|
+
local Frame = _primitives.Frame
|
|
7
|
+
local Group = _primitives.Group
|
|
8
|
+
local Text = _primitives.Text
|
|
9
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
10
|
+
local PrimaryButton = TS.import(script, script.Parent.Parent, "buttons", "PrimaryButton").PrimaryButton
|
|
11
|
+
local TextField = TS.import(script, script.Parent.Parent, "form", "TextField").TextField
|
|
12
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
13
|
+
local function ErrorPage(_param)
|
|
14
|
+
local message = _param.message
|
|
15
|
+
local rem = useRem()
|
|
16
|
+
local index = 0
|
|
17
|
+
local _exp = React.createElement("uilistlayout", {
|
|
18
|
+
FillDirection = "Vertical",
|
|
19
|
+
VerticalAlignment = "Center",
|
|
20
|
+
HorizontalAlignment = "Center",
|
|
21
|
+
SortOrder = "LayoutOrder",
|
|
22
|
+
})
|
|
23
|
+
local _attributes = {
|
|
24
|
+
text = "⚠️",
|
|
25
|
+
textSize = rem(5),
|
|
26
|
+
size = UDim2.new(0, rem(5), 0, rem(5)),
|
|
27
|
+
}
|
|
28
|
+
local _original = index
|
|
29
|
+
index += 1
|
|
30
|
+
_attributes.layoutOrder = _original
|
|
31
|
+
local _exp_1 = React.createElement(Text, _attributes)
|
|
32
|
+
local _attributes_1 = {
|
|
33
|
+
font = defaultTheme.fonts.inter.bold,
|
|
34
|
+
text = "Oh Noes!",
|
|
35
|
+
textColor = defaultTheme.palette.text,
|
|
36
|
+
textSize = rem(3),
|
|
37
|
+
textAutoResize = "XY",
|
|
38
|
+
}
|
|
39
|
+
local _original_1 = index
|
|
40
|
+
index += 1
|
|
41
|
+
_attributes_1.layoutOrder = _original_1
|
|
42
|
+
local _exp_2 = React.createElement(Text, _attributes_1)
|
|
43
|
+
local _attributes_2 = {
|
|
44
|
+
size = UDim2.new(0, 0, 0, rem(2)),
|
|
45
|
+
}
|
|
46
|
+
local _original_2 = index
|
|
47
|
+
index += 1
|
|
48
|
+
_attributes_2.layoutOrder = _original_2
|
|
49
|
+
local _exp_3 = React.createElement(Group, _attributes_2)
|
|
50
|
+
local _attributes_3 = {
|
|
51
|
+
font = defaultTheme.fonts.inter.regular,
|
|
52
|
+
text = "Something went wrong, and we were unable to recover.",
|
|
53
|
+
textColor = defaultTheme.palette.text,
|
|
54
|
+
textSize = rem(1.5),
|
|
55
|
+
textAutoResize = "XY",
|
|
56
|
+
}
|
|
57
|
+
local _original_3 = index
|
|
58
|
+
index += 1
|
|
59
|
+
_attributes_3.layoutOrder = _original_3
|
|
60
|
+
local _exp_4 = React.createElement(Text, _attributes_3)
|
|
61
|
+
local _attributes_4 = {
|
|
62
|
+
size = UDim2.new(0, 0, 0, rem(0.5)),
|
|
63
|
+
}
|
|
64
|
+
local _original_4 = index
|
|
65
|
+
index += 1
|
|
66
|
+
_attributes_4.layoutOrder = _original_4
|
|
67
|
+
local _exp_5 = React.createElement(Group, _attributes_4)
|
|
68
|
+
local _attributes_5 = {
|
|
69
|
+
font = defaultTheme.fonts.inter.regular,
|
|
70
|
+
text = "Please send this error to the developers, and try reconnecting:",
|
|
71
|
+
textColor = defaultTheme.palette.text,
|
|
72
|
+
textSize = rem(1.5),
|
|
73
|
+
textAutoResize = "XY",
|
|
74
|
+
}
|
|
75
|
+
local _original_5 = index
|
|
76
|
+
index += 1
|
|
77
|
+
_attributes_5.layoutOrder = _original_5
|
|
78
|
+
local _exp_6 = React.createElement(Text, _attributes_5)
|
|
79
|
+
local _attributes_6 = {
|
|
80
|
+
size = UDim2.new(0, 0, 0, rem(2)),
|
|
81
|
+
}
|
|
82
|
+
local _original_6 = index
|
|
83
|
+
index += 1
|
|
84
|
+
_attributes_6.layoutOrder = _original_6
|
|
85
|
+
local _exp_7 = React.createElement(Group, _attributes_6)
|
|
86
|
+
local _attributes_7 = {
|
|
87
|
+
clearTextOnFocus = false,
|
|
88
|
+
textEditable = false,
|
|
89
|
+
font = defaultTheme.fonts.roboto.regular,
|
|
90
|
+
text = `{message}`,
|
|
91
|
+
textColor = defaultTheme.palette.red,
|
|
92
|
+
textSize = rem(1.5),
|
|
93
|
+
textAutoResize = "XY",
|
|
94
|
+
textXAlignment = "Left",
|
|
95
|
+
maxVisibleGraphemes = 512,
|
|
96
|
+
backgroundColor = defaultTheme.palette.crust,
|
|
97
|
+
backgroundTransparency = 0,
|
|
98
|
+
cornerRadius = UDim.new(0, rem(1.5)),
|
|
99
|
+
}
|
|
100
|
+
local _original_7 = index
|
|
101
|
+
index += 1
|
|
102
|
+
_attributes_7.layoutOrder = _original_7
|
|
103
|
+
local _exp_8 = React.createElement(TextField, _attributes_7, React.createElement("uipadding", {
|
|
104
|
+
PaddingLeft = UDim.new(0, rem(2)),
|
|
105
|
+
PaddingRight = UDim.new(0, rem(2)),
|
|
106
|
+
PaddingTop = UDim.new(0, rem(2)),
|
|
107
|
+
PaddingBottom = UDim.new(0, rem(2)),
|
|
108
|
+
}), React.createElement("uistroke", {
|
|
109
|
+
Color = defaultTheme.palette.red,
|
|
110
|
+
Transparency = 0.3,
|
|
111
|
+
Thickness = 1,
|
|
112
|
+
ApplyStrokeMode = "Border",
|
|
113
|
+
}))
|
|
114
|
+
local _attributes_8 = {
|
|
115
|
+
size = UDim2.new(0, 0, 0, rem(2)),
|
|
116
|
+
}
|
|
117
|
+
local _original_8 = index
|
|
118
|
+
index += 1
|
|
119
|
+
_attributes_8.layoutOrder = _original_8
|
|
120
|
+
local _exp_9 = React.createElement(Group, _attributes_8)
|
|
121
|
+
local _attributes_9 = {
|
|
122
|
+
onClick = TS.async(function()
|
|
123
|
+
warn("Reconnecting...")
|
|
124
|
+
end),
|
|
125
|
+
overlayGradient = ColorSequence.new(defaultTheme.palette.blue, defaultTheme.palette.blueishColor),
|
|
126
|
+
size = UDim2.new(0, rem(12), 0, rem(5)),
|
|
127
|
+
}
|
|
128
|
+
local _original_9 = index
|
|
129
|
+
index += 1
|
|
130
|
+
_attributes_9.layoutOrder = _original_9
|
|
131
|
+
return React.createElement(Layer, nil, React.createElement(Frame, {
|
|
132
|
+
backgroundColor = defaultTheme.palette.crust,
|
|
133
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
134
|
+
}, _exp, _exp_1, _exp_2, _exp_3, _exp_4, _exp_5, _exp_6, _exp_7, _exp_8, _exp_9, React.createElement(PrimaryButton, _attributes_9, React.createElement(Text, {
|
|
135
|
+
font = defaultTheme.fonts.inter.medium,
|
|
136
|
+
text = "Reconnect →",
|
|
137
|
+
textColor = defaultTheme.palette.text,
|
|
138
|
+
textSize = rem(1.5),
|
|
139
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
140
|
+
}))))
|
|
141
|
+
end
|
|
142
|
+
return {
|
|
143
|
+
ErrorPage = ErrorPage,
|
|
144
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface CheckboxProps {
|
|
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 Checkbox({ checked, onChecked, text, variant, position, disabled, }: CheckboxProps): JSX.Element;
|
|
10
|
+
export type { CheckboxProps };
|
|
11
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
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 Checkbox(_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(0, rem(1))
|
|
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
|
+
}), React.createElement(Text, {
|
|
82
|
+
text = if checked then "✔" else "",
|
|
83
|
+
textColor = mainColor,
|
|
84
|
+
textScaled = true,
|
|
85
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
86
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
87
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
88
|
+
textXAlignment = "Center",
|
|
89
|
+
textYAlignment = "Center",
|
|
90
|
+
padding = 0.9,
|
|
91
|
+
rem = rem,
|
|
92
|
+
})), if text ~= "" and text then (React.createElement(Text, {
|
|
93
|
+
text = text,
|
|
94
|
+
size = UDim2.new(0, rem(2), 0, rem(2)),
|
|
95
|
+
textColor = textColor,
|
|
96
|
+
textXAlignment = "Left",
|
|
97
|
+
change = {
|
|
98
|
+
TextBounds = function(rbx)
|
|
99
|
+
textWidthMotion:spring({
|
|
100
|
+
value = rbx.TextBounds.X,
|
|
101
|
+
})
|
|
102
|
+
end,
|
|
103
|
+
},
|
|
104
|
+
})) else nil)
|
|
105
|
+
end
|
|
106
|
+
return {
|
|
107
|
+
Checkbox = Checkbox,
|
|
108
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
interface CheckboxRowProps {
|
|
3
|
+
label: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
onChecked: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function CheckboxRow({ label, checked, onChecked, disabled, name, children, }: CheckboxRowProps): JSX.Element;
|
|
11
|
+
export type { CheckboxRowProps };
|
|
12
|
+
//# sourceMappingURL=CheckboxRow.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
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 useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
5
|
+
local Checkbox = TS.import(script, script.Parent, "Checkbox").Checkbox
|
|
6
|
+
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
7
|
+
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
8
|
+
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
9
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
10
|
+
local function CheckboxRow(_param)
|
|
11
|
+
local label = _param.label
|
|
12
|
+
local checked = _param.checked
|
|
13
|
+
local onChecked = _param.onChecked
|
|
14
|
+
local disabled = _param.disabled
|
|
15
|
+
if disabled == nil then
|
|
16
|
+
disabled = false
|
|
17
|
+
end
|
|
18
|
+
local name = _param.name
|
|
19
|
+
local children = _param.children
|
|
20
|
+
local theme = defaultTheme
|
|
21
|
+
local rem = useRem()
|
|
22
|
+
local textSize = rem(3)
|
|
23
|
+
return React.createElement(HStack, {
|
|
24
|
+
size = UDim2.new(1, 0, 0, 0),
|
|
25
|
+
automaticSize = Enum.AutomaticSize.Y,
|
|
26
|
+
spacing = rem(2),
|
|
27
|
+
name = name,
|
|
28
|
+
}, React.createElement(Checkbox, {
|
|
29
|
+
checked = checked,
|
|
30
|
+
variant = "large",
|
|
31
|
+
onChecked = onChecked,
|
|
32
|
+
disabled = disabled,
|
|
33
|
+
}), React.createElement(Button, {
|
|
34
|
+
backgroundTransparency = 1,
|
|
35
|
+
size = UDim2.new(1, 0, 0, rem(4)),
|
|
36
|
+
onClick = if disabled then function() end else onChecked,
|
|
37
|
+
}, React.createElement(Text, {
|
|
38
|
+
text = label,
|
|
39
|
+
textSize = textSize,
|
|
40
|
+
textScaled = true,
|
|
41
|
+
textColor = if disabled then theme.palette.overlay0 else theme.palette.crust,
|
|
42
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
43
|
+
textXAlignment = "Left",
|
|
44
|
+
})), children)
|
|
45
|
+
end
|
|
46
|
+
return {
|
|
47
|
+
CheckboxRow = CheckboxRow,
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
interface DropdownOption<T> {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
}
|
|
6
|
+
interface DropdownProps<T> {
|
|
7
|
+
options: Array<DropdownOption<T>>;
|
|
8
|
+
value?: T;
|
|
9
|
+
onChange: (value: T) => void;
|
|
10
|
+
size?: UDim2;
|
|
11
|
+
renderOption?: (option: DropdownOption<T>) => React.ReactNode;
|
|
12
|
+
portalRef?: React.RefObject<GuiObject>;
|
|
13
|
+
}
|
|
14
|
+
export declare function Dropdown<T>(props: DropdownProps<T>): JSX.Element;
|
|
15
|
+
export type { DropdownOption, DropdownProps };
|
|
16
|
+
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local VStackScrolling = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).VStackScrolling
|
|
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", "@rbxts-ui/rem")).useRem
|
|
6
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
7
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
8
|
+
local React = _react
|
|
9
|
+
local useEffect = _react.useEffect
|
|
10
|
+
local useRef = _react.useRef
|
|
11
|
+
local useState = _react.useState
|
|
12
|
+
local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
|
|
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
|
+
local function Dropdown(props)
|
|
17
|
+
local _binding = props
|
|
18
|
+
local options = _binding.options
|
|
19
|
+
local value = _binding.value
|
|
20
|
+
local onChange = _binding.onChange
|
|
21
|
+
local size = _binding.size
|
|
22
|
+
local renderOption = _binding.renderOption
|
|
23
|
+
local portalRef = _binding.portalRef
|
|
24
|
+
local theme = defaultTheme
|
|
25
|
+
local isOpen, setIsOpen = useState(false)
|
|
26
|
+
local dropdownBounds, setDropdownBounds = useState()
|
|
27
|
+
local dropdownRef = useRef()
|
|
28
|
+
local rem = useRem()
|
|
29
|
+
local frameSize = size or UDim2.new(0.4, 0, 0, rem(5))
|
|
30
|
+
local optionHeight = rem(5)
|
|
31
|
+
-- ▼ ReadonlyArray.find ▼
|
|
32
|
+
local _callback = function(option)
|
|
33
|
+
return option.value == value
|
|
34
|
+
end
|
|
35
|
+
local _result
|
|
36
|
+
for _i, _v in options do
|
|
37
|
+
if _callback(_v, _i - 1, options) == true then
|
|
38
|
+
_result = _v
|
|
39
|
+
break
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
-- ▲ ReadonlyArray.find ▲
|
|
43
|
+
local selectedOption = _result
|
|
44
|
+
local cornerRadius = UDim.new(0, rem(1.7))
|
|
45
|
+
local dropdownHeight = #options * optionHeight
|
|
46
|
+
useEffect(function()
|
|
47
|
+
if not isOpen then
|
|
48
|
+
setDropdownBounds(nil)
|
|
49
|
+
return nil
|
|
50
|
+
end
|
|
51
|
+
local frame = dropdownRef.current
|
|
52
|
+
if not frame then
|
|
53
|
+
return nil
|
|
54
|
+
end
|
|
55
|
+
local updateBounds = function()
|
|
56
|
+
setDropdownBounds({
|
|
57
|
+
position = frame.AbsolutePosition,
|
|
58
|
+
size = frame.AbsoluteSize,
|
|
59
|
+
})
|
|
60
|
+
end
|
|
61
|
+
updateBounds()
|
|
62
|
+
local positionConnection = frame:GetPropertyChangedSignal("AbsolutePosition"):Connect(updateBounds)
|
|
63
|
+
local sizeConnection = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(updateBounds)
|
|
64
|
+
return function()
|
|
65
|
+
positionConnection:Disconnect()
|
|
66
|
+
sizeConnection:Disconnect()
|
|
67
|
+
end
|
|
68
|
+
end, { isOpen })
|
|
69
|
+
local renderOptions = function()
|
|
70
|
+
local _exp = React.createElement("uicorner", {
|
|
71
|
+
CornerRadius = cornerRadius,
|
|
72
|
+
})
|
|
73
|
+
local _exp_1 = React.createElement("uistroke", {
|
|
74
|
+
Color = theme.palette.crust,
|
|
75
|
+
Transparency = 0.5,
|
|
76
|
+
Thickness = 1,
|
|
77
|
+
})
|
|
78
|
+
-- ▼ ReadonlyArray.map ▼
|
|
79
|
+
local _newValue = table.create(#options)
|
|
80
|
+
local _callback_1 = function(option)
|
|
81
|
+
return React.createElement(DropdownOptionButton, {
|
|
82
|
+
key = tostring(option.value),
|
|
83
|
+
text = option.label,
|
|
84
|
+
size = UDim2.new(1, 0, 0, optionHeight),
|
|
85
|
+
onClick = function()
|
|
86
|
+
onChange(option.value)
|
|
87
|
+
setIsOpen(false)
|
|
88
|
+
end,
|
|
89
|
+
}, if renderOption then renderOption(option) else nil)
|
|
90
|
+
end
|
|
91
|
+
for _k, _v in options do
|
|
92
|
+
_newValue[_k] = _callback_1(_v, _k - 1, options)
|
|
93
|
+
end
|
|
94
|
+
-- ▲ ReadonlyArray.map ▲
|
|
95
|
+
return React.createElement(React.Fragment, nil, _exp, _exp_1, _newValue)
|
|
96
|
+
end
|
|
97
|
+
local dropdownOverlay = (function()
|
|
98
|
+
if not isOpen then
|
|
99
|
+
return nil
|
|
100
|
+
end
|
|
101
|
+
-- Use provided portalRef or fallback to Players.LocalPlayer.PlayerGui
|
|
102
|
+
local _container = portalRef
|
|
103
|
+
if _container ~= nil then
|
|
104
|
+
_container = _container.current
|
|
105
|
+
end
|
|
106
|
+
local container = _container
|
|
107
|
+
if not container then
|
|
108
|
+
return nil
|
|
109
|
+
end
|
|
110
|
+
if not dropdownBounds then
|
|
111
|
+
return nil
|
|
112
|
+
end
|
|
113
|
+
local containerPosition = container.AbsolutePosition
|
|
114
|
+
local relativePosition = dropdownBounds.position - containerPosition
|
|
115
|
+
local dropdownY = relativePosition.Y + dropdownBounds.size.Y
|
|
116
|
+
return createPortal(React.createElement(ClickOutsideLayer, {
|
|
117
|
+
onClickOutside = function()
|
|
118
|
+
return setIsOpen(false)
|
|
119
|
+
end,
|
|
120
|
+
}, React.createElement(VStackScrolling, {
|
|
121
|
+
Position = UDim2.new(0, relativePosition.X, 0, dropdownY),
|
|
122
|
+
Size = UDim2.new(0, dropdownBounds.size.X, 0, dropdownHeight),
|
|
123
|
+
BackgroundColor3 = theme.palette.white,
|
|
124
|
+
BackgroundTransparency = 0,
|
|
125
|
+
ClipsDescendants = true,
|
|
126
|
+
BorderColor3 = theme.palette.crust,
|
|
127
|
+
ZIndex = 2000,
|
|
128
|
+
paddingBottom = rem(1),
|
|
129
|
+
}, renderOptions())), container)
|
|
130
|
+
end)()
|
|
131
|
+
local _attributes = {}
|
|
132
|
+
local _result_1 = selectedOption
|
|
133
|
+
if _result_1 ~= nil then
|
|
134
|
+
_result_1 = _result_1.label
|
|
135
|
+
end
|
|
136
|
+
local _condition = _result_1
|
|
137
|
+
if not (_condition ~= "" and _condition) then
|
|
138
|
+
_condition = "Select..."
|
|
139
|
+
end
|
|
140
|
+
_attributes.text = _condition
|
|
141
|
+
_attributes.size = UDim2.new(1, 0, 1, 0)
|
|
142
|
+
_attributes.onClick = function()
|
|
143
|
+
return setIsOpen(not isOpen)
|
|
144
|
+
end
|
|
145
|
+
return React.createElement(Frame, {
|
|
146
|
+
backgroundTransparency = 1,
|
|
147
|
+
size = frameSize,
|
|
148
|
+
ref = dropdownRef,
|
|
149
|
+
}, React.createElement(DropdownButton, _attributes), dropdownOverlay, React.createElement("uiflexitem", {
|
|
150
|
+
FlexMode = Enum.UIFlexMode.Fill,
|
|
151
|
+
}))
|
|
152
|
+
end
|
|
153
|
+
return {
|
|
154
|
+
Dropdown = Dropdown,
|
|
155
|
+
}
|
|
@@ -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
|
|
@@ -0,0 +1,36 @@
|
|
|
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 useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
|
|
5
|
+
local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
|
|
6
|
+
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
7
|
+
local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
|
|
8
|
+
local INPUT_HEIGHT = 5
|
|
9
|
+
local function FormRow(_param)
|
|
10
|
+
local label = _param.label
|
|
11
|
+
local children = _param.children
|
|
12
|
+
local disabled = _param.disabled
|
|
13
|
+
local theme = defaultTheme
|
|
14
|
+
local rem = useRem()
|
|
15
|
+
local textSize = rem(3)
|
|
16
|
+
local labelWidth = rem(20)
|
|
17
|
+
return React.createElement(HStack, {
|
|
18
|
+
size = UDim2.new(1, 0, 0, 0),
|
|
19
|
+
automaticSize = Enum.AutomaticSize.Y,
|
|
20
|
+
}, React.createElement(Text, {
|
|
21
|
+
text = label,
|
|
22
|
+
textSize = textSize,
|
|
23
|
+
textScaled = true,
|
|
24
|
+
textColor = if disabled then theme.palette.disabled else theme.palette.crust,
|
|
25
|
+
size = UDim2.new(0.3, 0, 0, rem(INPUT_HEIGHT)),
|
|
26
|
+
textXAlignment = "Left",
|
|
27
|
+
}, React.createElement("uisizeconstraint", {
|
|
28
|
+
MaxSize = Vector2.new(labelWidth, math.huge),
|
|
29
|
+
})), React.createElement(HStack, {
|
|
30
|
+
size = UDim2.new(0.7, 0, 0, rem(INPUT_HEIGHT)),
|
|
31
|
+
spacing = rem(2),
|
|
32
|
+
}, children))
|
|
33
|
+
end
|
|
34
|
+
return {
|
|
35
|
+
FormRow = FormRow,
|
|
36
|
+
}
|
|
@@ -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
|