@rbxts-ui/components 7.0.2 → 8.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 +20 -0
- package/dist/DynamicWindow/DynamicWindow.luau +19 -10
- package/dist/DynamicWindow/ResizeCornerButton.luau +6 -3
- package/dist/buttons/DropdownButton.d.ts +13 -1
- package/dist/buttons/DropdownButton.luau +14 -5
- package/dist/buttons/DropdownOptionButton.d.ts +11 -1
- package/dist/buttons/DropdownOptionButton.luau +11 -3
- package/dist/buttons/IconRoundButton.d.ts +13 -3
- package/dist/buttons/IconRoundButton.luau +23 -15
- package/dist/buttons/IconTextButton.d.ts +24 -0
- package/dist/buttons/IconTextButton.luau +92 -0
- package/dist/buttons/IconTileButton.d.ts +17 -1
- package/dist/buttons/IconTileButton.luau +16 -5
- package/dist/buttons/PrimaryButton.luau +0 -2
- package/dist/buttons/TextButton.d.ts +23 -1
- package/dist/buttons/TextButton.luau +20 -9
- package/dist/display/AlertBox.luau +9 -3
- package/dist/display/PillText.d.ts +9 -0
- package/dist/display/PillText.luau +10 -6
- package/dist/error-handler/ErrorPage.luau +20 -10
- package/dist/form/Checkbox.d.ts +15 -1
- package/dist/form/Checkbox.luau +52 -20
- package/dist/form/CheckboxRow.d.ts +11 -1
- package/dist/form/CheckboxRow.luau +8 -3
- package/dist/form/Dropdown.d.ts +10 -0
- package/dist/form/Dropdown.luau +9 -5
- package/dist/form/FormRow.d.ts +11 -1
- package/dist/form/FormRow.luau +8 -3
- package/dist/form/IconChip.d.ts +15 -0
- package/dist/form/IconChip.luau +47 -0
- package/dist/form/InputRound.d.ts +18 -1
- package/dist/form/InputRound.luau +21 -10
- package/dist/form/InputRow.d.ts +4 -3
- package/dist/form/InputRow.luau +4 -4
- package/dist/form/Radio.d.ts +17 -1
- package/dist/form/Radio.luau +14 -6
- package/dist/form/RadioRow.d.ts +12 -1
- package/dist/form/RadioRow.luau +8 -3
- package/dist/form/SegmentedToggle.d.ts +18 -1
- package/dist/form/SegmentedToggle.luau +15 -7
- package/dist/icons/InfoIcon.luau +8 -3
- package/dist/icons/WarningIcon.luau +8 -3
- package/dist/index.d.ts +2 -0
- package/dist/init.luau +2 -0
- package/dist/layout/Accordion.d.ts +9 -0
- package/dist/layout/Accordion.luau +11 -4
- package/dist/layout/Section.d.ts +9 -1
- package/dist/layout/Section.luau +7 -3
- package/dist/tooltip/Tooltip.luau +12 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/Outline.luau +8 -4
- package/package.json +11 -9
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
3
|
+
import type { IconName } from "@rbxts-ui/icons";
|
|
4
|
+
declare const useInputRoundStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
5
|
+
bgColor: "surface";
|
|
6
|
+
outlineColor: "border";
|
|
7
|
+
textColor: "textPrimary";
|
|
8
|
+
disabledColor: "textMuted";
|
|
9
|
+
errorColor: "danger";
|
|
10
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
11
|
+
bgColor: "surface";
|
|
12
|
+
outlineColor: "border";
|
|
13
|
+
textColor: "textPrimary";
|
|
14
|
+
disabledColor: "textMuted";
|
|
15
|
+
errorColor: "danger";
|
|
16
|
+
}>;
|
|
17
|
+
export type InputRoundStyle = StyleProps<typeof useInputRoundStyle>;
|
|
2
18
|
interface InputRoundProps {
|
|
3
19
|
readonly onClick?: () => void;
|
|
4
|
-
readonly
|
|
20
|
+
readonly icon: IconName;
|
|
5
21
|
readonly placeholderText: string;
|
|
6
22
|
readonly value: string | React.Binding<string>;
|
|
7
23
|
readonly primary: Color3;
|
|
@@ -13,6 +29,7 @@ interface InputRoundProps {
|
|
|
13
29
|
readonly debounceDelay?: number;
|
|
14
30
|
readonly disabled?: boolean;
|
|
15
31
|
readonly name?: string;
|
|
32
|
+
readonly style?: InputRoundStyle;
|
|
16
33
|
}
|
|
17
34
|
export declare const InputRound: React.ForwardRefExoticComponent<InputRoundProps & React.RefAttributes<TextBox>>;
|
|
18
35
|
export type { InputRoundProps };
|
|
@@ -15,12 +15,21 @@ local _layout = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").di
|
|
|
15
15
|
local HStack = _layout.HStack
|
|
16
16
|
local VStack = _layout.VStack
|
|
17
17
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
18
|
-
local
|
|
18
|
+
local _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
|
|
19
|
+
local defaultTheme = _theme.defaultTheme
|
|
20
|
+
local makeStyle = _theme.makeStyle
|
|
19
21
|
local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
|
|
20
22
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
21
|
-
local
|
|
23
|
+
local IconChip = TS.import(script, script.Parent, "IconChip").IconChip
|
|
22
24
|
-- Default debounce delay in seconds
|
|
23
25
|
local DEFAULT_DEBOUNCE_DELAY = 0.3
|
|
26
|
+
local useInputRoundStyle = makeStyle({
|
|
27
|
+
bgColor = "surface",
|
|
28
|
+
outlineColor = "border",
|
|
29
|
+
textColor = "textPrimary",
|
|
30
|
+
disabledColor = "textMuted",
|
|
31
|
+
errorColor = "danger",
|
|
32
|
+
})
|
|
24
33
|
local MARGIN_Y = 0
|
|
25
34
|
local PADDING_LEFT = 0.5
|
|
26
35
|
local PADDING_RIGHT = 2
|
|
@@ -28,7 +37,7 @@ local INTERNAL_PADDING = 1
|
|
|
28
37
|
local InputRound = forwardRef(function(props, ref)
|
|
29
38
|
local _binding = props
|
|
30
39
|
local onClick = _binding.onClick
|
|
31
|
-
local
|
|
40
|
+
local icon = _binding.icon
|
|
32
41
|
local placeholderText = _binding.placeholderText
|
|
33
42
|
local valueProp = _binding.value
|
|
34
43
|
local primary = _binding.primary
|
|
@@ -46,9 +55,11 @@ local InputRound = forwardRef(function(props, ref)
|
|
|
46
55
|
end
|
|
47
56
|
local disabled = _binding.disabled
|
|
48
57
|
local name = _binding.name
|
|
58
|
+
local styleOverride = _binding.style
|
|
49
59
|
local hover, hoverMotion = useMotion(0)
|
|
50
60
|
local rem = useRem()
|
|
51
61
|
local theme = defaultTheme
|
|
62
|
+
local style = useInputRoundStyle(styleOverride)
|
|
52
63
|
-- Check if value is a binding
|
|
53
64
|
local isBinding = type(valueProp) == "table" and valueProp.getValue ~= nil
|
|
54
65
|
local valueBinding = if isBinding then valueProp else nil
|
|
@@ -165,14 +176,14 @@ local InputRound = forwardRef(function(props, ref)
|
|
|
165
176
|
paddingY = rem(MARGIN_Y),
|
|
166
177
|
}), React.createElement(Frame, {
|
|
167
178
|
backgroundTransparency = 0,
|
|
168
|
-
backgroundColor =
|
|
179
|
+
backgroundColor = style.bgColor,
|
|
169
180
|
cornerRadius = fullRound,
|
|
170
181
|
size = UDim2.new(1, 0, 1, 0),
|
|
171
182
|
}), React.createElement(Outline, {
|
|
172
183
|
cornerRadius = fullRound,
|
|
173
|
-
innerColor = if disabled then
|
|
184
|
+
innerColor = if disabled then style.disabledColor else style.outlineColor,
|
|
174
185
|
innerTransparency = 0,
|
|
175
|
-
outerColor =
|
|
186
|
+
outerColor = style.bgColor,
|
|
176
187
|
outerTransparency = 0,
|
|
177
188
|
outerThickness = 1,
|
|
178
189
|
}), React.createElement(HStack, {
|
|
@@ -180,15 +191,15 @@ local InputRound = forwardRef(function(props, ref)
|
|
|
180
191
|
}, React.createElement("uipadding", {
|
|
181
192
|
PaddingLeft = UDim.new(0, rem(PADDING_LEFT)),
|
|
182
193
|
PaddingRight = UDim.new(0, rem(PADDING_RIGHT)),
|
|
183
|
-
}), React.createElement(
|
|
184
|
-
|
|
194
|
+
}), React.createElement(IconChip, {
|
|
195
|
+
icon = icon,
|
|
185
196
|
primary = primary,
|
|
186
197
|
height = height,
|
|
187
198
|
}), React.createElement(TextField, {
|
|
188
199
|
ref = ref or internalRef,
|
|
189
200
|
font = theme.fonts.inter.medium,
|
|
190
201
|
text = inputValue,
|
|
191
|
-
textColor = if disabled then
|
|
202
|
+
textColor = if disabled then style.disabledColor else style.textColor,
|
|
192
203
|
textTransparency = 0.05,
|
|
193
204
|
textSize = rem(3.5),
|
|
194
205
|
textXAlignment = "Left",
|
|
@@ -211,7 +222,7 @@ local InputRound = forwardRef(function(props, ref)
|
|
|
211
222
|
}))), if validationError ~= "" and validationError then (React.createElement(Text, {
|
|
212
223
|
text = validationError,
|
|
213
224
|
font = theme.fonts.inter.bold,
|
|
214
|
-
textColor =
|
|
225
|
+
textColor = style.errorColor,
|
|
215
226
|
textScaled = true,
|
|
216
227
|
size = UDim2.new(1, 0, 0, rem(2.6)),
|
|
217
228
|
textXAlignment = "Left",
|
package/dist/form/InputRow.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { IconName } from "@rbxts-ui/icons";
|
|
1
2
|
import React from "@rbxts/react";
|
|
2
3
|
export interface InputRowProps {
|
|
3
4
|
value: string;
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
icon: IconName;
|
|
6
|
+
iconColor: Color3;
|
|
6
7
|
placeholderText: string;
|
|
7
8
|
label: string;
|
|
8
9
|
onTextChanged: (value: string) => void;
|
|
@@ -10,5 +11,5 @@ export interface InputRowProps {
|
|
|
10
11
|
name?: string;
|
|
11
12
|
children?: React.ReactNode;
|
|
12
13
|
}
|
|
13
|
-
export declare function InputRow({ value,
|
|
14
|
+
export declare function InputRow({ value, icon, iconColor, placeholderText, label, onTextChanged, disabled, name, children, }: InputRowProps): JSX.Element;
|
|
14
15
|
//# sourceMappingURL=InputRow.d.ts.map
|
package/dist/form/InputRow.luau
CHANGED
|
@@ -5,8 +5,8 @@ local FormRow = TS.import(script, script.Parent, "FormRow").FormRow
|
|
|
5
5
|
local InputRound = TS.import(script, script.Parent, "InputRound").InputRound
|
|
6
6
|
local function InputRow(_param)
|
|
7
7
|
local value = _param.value
|
|
8
|
-
local
|
|
9
|
-
local
|
|
8
|
+
local icon = _param.icon
|
|
9
|
+
local iconColor = _param.iconColor
|
|
10
10
|
local placeholderText = _param.placeholderText
|
|
11
11
|
local label = _param.label
|
|
12
12
|
local onTextChanged = _param.onTextChanged
|
|
@@ -19,9 +19,9 @@ local function InputRow(_param)
|
|
|
19
19
|
name = name,
|
|
20
20
|
}, React.createElement(InputRound, {
|
|
21
21
|
value = value,
|
|
22
|
-
|
|
22
|
+
icon = icon,
|
|
23
23
|
placeholderText = placeholderText,
|
|
24
|
-
primary =
|
|
24
|
+
primary = iconColor,
|
|
25
25
|
order = 0,
|
|
26
26
|
onTextChanged = onTextChanged,
|
|
27
27
|
disabled = disabled,
|
package/dist/form/Radio.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
2
|
+
declare const useRadioStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
3
|
+
boxColor: "surface";
|
|
4
|
+
ringColor: "mark";
|
|
5
|
+
selectedColor: "accent";
|
|
6
|
+
labelColor: "textPrimary";
|
|
7
|
+
mutedColor: "textMuted";
|
|
8
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
9
|
+
boxColor: "surface";
|
|
10
|
+
ringColor: "mark";
|
|
11
|
+
selectedColor: "accent";
|
|
12
|
+
labelColor: "textPrimary";
|
|
13
|
+
mutedColor: "textMuted";
|
|
14
|
+
}>;
|
|
15
|
+
export type RadioStyle = StyleProps<typeof useRadioStyle>;
|
|
1
16
|
interface RadioProps {
|
|
2
17
|
checked: boolean;
|
|
3
18
|
onChecked: (checked: boolean) => void;
|
|
@@ -5,7 +20,8 @@ interface RadioProps {
|
|
|
5
20
|
variant?: "default" | "large" | "small";
|
|
6
21
|
position?: UDim2;
|
|
7
22
|
disabled?: boolean;
|
|
23
|
+
style?: RadioStyle;
|
|
8
24
|
}
|
|
9
|
-
export declare function Radio({ checked, onChecked, text, variant, position, disabled }: RadioProps): JSX.Element;
|
|
25
|
+
export declare function Radio({ checked, onChecked, text, variant, position, disabled, style: styleOverride, }: RadioProps): JSX.Element;
|
|
10
26
|
export type { RadioProps };
|
|
11
27
|
//# sourceMappingURL=Radio.d.ts.map
|
package/dist/form/Radio.luau
CHANGED
|
@@ -11,7 +11,14 @@ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").
|
|
|
11
11
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
12
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
|
|
14
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
15
|
+
local useRadioStyle = makeStyle({
|
|
16
|
+
boxColor = "surface",
|
|
17
|
+
ringColor = "mark",
|
|
18
|
+
selectedColor = "accent",
|
|
19
|
+
labelColor = "textPrimary",
|
|
20
|
+
mutedColor = "textMuted",
|
|
21
|
+
})
|
|
15
22
|
local function Radio(_param)
|
|
16
23
|
local checked = _param.checked
|
|
17
24
|
local onChecked = _param.onChecked
|
|
@@ -25,7 +32,8 @@ local function Radio(_param)
|
|
|
25
32
|
if disabled == nil then
|
|
26
33
|
disabled = false
|
|
27
34
|
end
|
|
28
|
-
local
|
|
35
|
+
local styleOverride = _param.style
|
|
36
|
+
local style = useRadioStyle(styleOverride)
|
|
29
37
|
local rem = useRem()
|
|
30
38
|
local hover, hoverMotion = useMotion(0)
|
|
31
39
|
local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
|
|
@@ -44,8 +52,8 @@ local function Radio(_param)
|
|
|
44
52
|
end)
|
|
45
53
|
end, { rem })
|
|
46
54
|
local cornerRadius = UDim.new(1, 0)
|
|
47
|
-
local mainColor = if disabled then
|
|
48
|
-
local textColor = if disabled then
|
|
55
|
+
local mainColor = if disabled then style.mutedColor else style.ringColor
|
|
56
|
+
local textColor = if disabled then style.mutedColor else style.labelColor
|
|
49
57
|
return React.createElement(ReactiveButton, {
|
|
50
58
|
backgroundTransparency = 1,
|
|
51
59
|
size = size,
|
|
@@ -64,7 +72,7 @@ local function Radio(_param)
|
|
|
64
72
|
backgroundTransparency = 1,
|
|
65
73
|
size = buttonSize,
|
|
66
74
|
}, React.createElement(Frame, {
|
|
67
|
-
backgroundColor =
|
|
75
|
+
backgroundColor = style.boxColor,
|
|
68
76
|
cornerRadius = cornerRadius,
|
|
69
77
|
size = UDim2.new(1, 0, 1, 0),
|
|
70
78
|
}, React.createElement("uigradient", {
|
|
@@ -79,7 +87,7 @@ local function Radio(_param)
|
|
|
79
87
|
outerTransparency = 1,
|
|
80
88
|
innerThickness = 2,
|
|
81
89
|
}), if checked then (React.createElement(Frame, {
|
|
82
|
-
backgroundColor =
|
|
90
|
+
backgroundColor = style.selectedColor,
|
|
83
91
|
backgroundTransparency = 0,
|
|
84
92
|
size = UDim2.new(0.7, 0, 0.7, 0),
|
|
85
93
|
position = UDim2.new(0.5, 0, 0.5, 0),
|
package/dist/form/RadioRow.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
2
|
+
declare const useRadioRowStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
3
|
+
labelColor: "textPrimary";
|
|
4
|
+
mutedColor: "textMuted";
|
|
5
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
6
|
+
labelColor: "textPrimary";
|
|
7
|
+
mutedColor: "textMuted";
|
|
8
|
+
}>;
|
|
9
|
+
export type RadioRowStyle = StyleProps<typeof useRadioRowStyle>;
|
|
1
10
|
export interface RadioRowProps {
|
|
2
11
|
label: string;
|
|
3
12
|
checked: boolean;
|
|
4
13
|
onChecked: () => void;
|
|
5
14
|
disabled?: boolean;
|
|
15
|
+
style?: RadioRowStyle;
|
|
6
16
|
}
|
|
7
|
-
export declare function RadioRow({ label, checked, onChecked, disabled }: RadioRowProps): JSX.Element;
|
|
17
|
+
export declare function RadioRow({ label, checked, onChecked, disabled, style: styleOverride }: RadioRowProps): JSX.Element;
|
|
18
|
+
export {};
|
|
8
19
|
//# sourceMappingURL=RadioRow.d.ts.map
|
package/dist/form/RadioRow.luau
CHANGED
|
@@ -3,16 +3,21 @@ 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
5
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
6
|
-
local
|
|
6
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
7
7
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
8
8
|
local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
|
|
9
9
|
local Radio = TS.import(script, script.Parent, "Radio").Radio
|
|
10
|
+
local useRadioRowStyle = makeStyle({
|
|
11
|
+
labelColor = "textPrimary",
|
|
12
|
+
mutedColor = "textMuted",
|
|
13
|
+
})
|
|
10
14
|
local function RadioRow(_param)
|
|
11
15
|
local label = _param.label
|
|
12
16
|
local checked = _param.checked
|
|
13
17
|
local onChecked = _param.onChecked
|
|
14
18
|
local disabled = _param.disabled
|
|
15
|
-
local
|
|
19
|
+
local styleOverride = _param.style
|
|
20
|
+
local style = useRadioRowStyle(styleOverride)
|
|
16
21
|
local rem = useRem()
|
|
17
22
|
local textSize = rem(3)
|
|
18
23
|
return React.createElement(HStack, {
|
|
@@ -32,7 +37,7 @@ local function RadioRow(_param)
|
|
|
32
37
|
text = label,
|
|
33
38
|
textSize = textSize,
|
|
34
39
|
textScaled = true,
|
|
35
|
-
textColor = if disabled then
|
|
40
|
+
textColor = if disabled then style.mutedColor else style.labelColor,
|
|
36
41
|
size = UDim2.new(0.8, 0, 0, rem(4)),
|
|
37
42
|
textXAlignment = "Left",
|
|
38
43
|
}, React.createElement("uiflexitem", {
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
3
|
+
declare const useSegmentedToggleStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
labelColor: "textPrimary";
|
|
5
|
+
mutedColor: "textMuted";
|
|
6
|
+
trackColor: "surfaceSunken";
|
|
7
|
+
borderColor: "textMuted";
|
|
8
|
+
selectedColor: "accent";
|
|
9
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
10
|
+
labelColor: "textPrimary";
|
|
11
|
+
mutedColor: "textMuted";
|
|
12
|
+
trackColor: "surfaceSunken";
|
|
13
|
+
borderColor: "textMuted";
|
|
14
|
+
selectedColor: "accent";
|
|
15
|
+
}>;
|
|
16
|
+
export type SegmentedToggleStyle = StyleProps<typeof useSegmentedToggleStyle>;
|
|
2
17
|
export interface SegmentedToggleOption<T extends string> {
|
|
3
18
|
id: T;
|
|
4
19
|
label: string;
|
|
@@ -12,6 +27,8 @@ export interface SegmentedToggleProps<T extends string> {
|
|
|
12
27
|
size?: "default" | "small";
|
|
13
28
|
label?: string;
|
|
14
29
|
children?: React.ReactNode;
|
|
30
|
+
style?: SegmentedToggleStyle;
|
|
15
31
|
}
|
|
16
|
-
export declare function SegmentedToggle<T extends string>({ options, value, onChange, disabled, size, label, children, }: SegmentedToggleProps<T>): JSX.Element;
|
|
32
|
+
export declare function SegmentedToggle<T extends string>({ options, value, onChange, disabled, size, label, children, style: styleOverride, }: SegmentedToggleProps<T>): JSX.Element;
|
|
33
|
+
export {};
|
|
17
34
|
//# sourceMappingURL=SegmentedToggle.d.ts.map
|
|
@@ -8,7 +8,14 @@ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").d
|
|
|
8
8
|
local _layout = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist)
|
|
9
9
|
local HStack = _layout.HStack
|
|
10
10
|
local VStack = _layout.VStack
|
|
11
|
-
local
|
|
11
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
12
|
+
local useSegmentedToggleStyle = makeStyle({
|
|
13
|
+
labelColor = "textPrimary",
|
|
14
|
+
mutedColor = "textMuted",
|
|
15
|
+
trackColor = "surfaceSunken",
|
|
16
|
+
borderColor = "textMuted",
|
|
17
|
+
selectedColor = "accent",
|
|
18
|
+
})
|
|
12
19
|
local function SegmentedToggle(_param)
|
|
13
20
|
local options = _param.options
|
|
14
21
|
local value = _param.value
|
|
@@ -23,7 +30,8 @@ local function SegmentedToggle(_param)
|
|
|
23
30
|
end
|
|
24
31
|
local label = _param.label
|
|
25
32
|
local children = _param.children
|
|
26
|
-
local
|
|
33
|
+
local styleOverride = _param.style
|
|
34
|
+
local style = useSegmentedToggleStyle(styleOverride)
|
|
27
35
|
local rem = useRem()
|
|
28
36
|
local count = #options
|
|
29
37
|
if count == 0 then
|
|
@@ -47,7 +55,7 @@ local function SegmentedToggle(_param)
|
|
|
47
55
|
end
|
|
48
56
|
local showLabel = label ~= nil and label ~= ""
|
|
49
57
|
local containerHeight = if showLabel then height + rem(3.5) else height
|
|
50
|
-
local labelColor = if disabled then
|
|
58
|
+
local labelColor = if disabled then style.mutedColor else style.labelColor
|
|
51
59
|
local _exp = showLabel and (React.createElement(Text, {
|
|
52
60
|
text = label,
|
|
53
61
|
textSize = rem(3),
|
|
@@ -57,7 +65,7 @@ local function SegmentedToggle(_param)
|
|
|
57
65
|
textXAlignment = "Left",
|
|
58
66
|
}))
|
|
59
67
|
local _exp_1 = React.createElement("uistroke", {
|
|
60
|
-
Color =
|
|
68
|
+
Color = style.borderColor,
|
|
61
69
|
Transparency = if disabled then 0.6 else 0.3,
|
|
62
70
|
Thickness = 1,
|
|
63
71
|
})
|
|
@@ -72,7 +80,7 @@ local function SegmentedToggle(_param)
|
|
|
72
80
|
local _callback = function(option, index)
|
|
73
81
|
local isSelected = option.id == value
|
|
74
82
|
local optionDisabled = disabled or option.disabled
|
|
75
|
-
local backgroundColor =
|
|
83
|
+
local backgroundColor = style.selectedColor
|
|
76
84
|
return React.createElement(Button, {
|
|
77
85
|
key = `segmented-toggle-{option.id}-{index}`,
|
|
78
86
|
size = buttonSize,
|
|
@@ -88,7 +96,7 @@ local function SegmentedToggle(_param)
|
|
|
88
96
|
text = option.label,
|
|
89
97
|
textSize = rem(3),
|
|
90
98
|
textScaled = true,
|
|
91
|
-
textColor =
|
|
99
|
+
textColor = style.labelColor,
|
|
92
100
|
textXAlignment = "Center",
|
|
93
101
|
textYAlignment = "Center",
|
|
94
102
|
padding = 0.5,
|
|
@@ -105,7 +113,7 @@ local function SegmentedToggle(_param)
|
|
|
105
113
|
automaticSize = Enum.AutomaticSize.Y,
|
|
106
114
|
}, _exp, React.createElement(Frame, {
|
|
107
115
|
size = UDim2.new(1, 0, 0, height),
|
|
108
|
-
backgroundColor =
|
|
116
|
+
backgroundColor = style.trackColor,
|
|
109
117
|
backgroundTransparency = 1,
|
|
110
118
|
cornerRadius = UDim.new(0, rem(3)),
|
|
111
119
|
}, _exp_1, React.createElement(HStack, {
|
package/dist/icons/InfoIcon.luau
CHANGED
|
@@ -4,19 +4,24 @@ local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primiti
|
|
|
4
4
|
local Frame = _primitives.Frame
|
|
5
5
|
local Text = _primitives.Text
|
|
6
6
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
7
|
-
local
|
|
7
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
8
8
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
9
9
|
local React = _react
|
|
10
10
|
local useEffect = _react.useEffect
|
|
11
11
|
local useRef = _react.useRef
|
|
12
12
|
local useState = _react.useState
|
|
13
13
|
local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
|
|
14
|
+
local useInfoIconStyle = makeStyle({
|
|
15
|
+
bgColor = "textMuted",
|
|
16
|
+
textColor = "textInverse",
|
|
17
|
+
})
|
|
14
18
|
local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
|
|
15
19
|
local Tooltip = TS.import(script, script.Parent.Parent, "tooltip", "Tooltip").Tooltip
|
|
16
20
|
local function InfoIcon(_param)
|
|
17
21
|
local tooltipText = _param.tooltipText
|
|
18
22
|
local portalRef = _param.portalRef
|
|
19
23
|
local rem = useRem()
|
|
24
|
+
local style = useInfoIconStyle()
|
|
20
25
|
local showTooltip, setShowTooltip = useState(false)
|
|
21
26
|
local iconRef = useRef()
|
|
22
27
|
local tooltipPos, setTooltipPos = useState()
|
|
@@ -38,14 +43,14 @@ local function InfoIcon(_param)
|
|
|
38
43
|
onMouseLeave = function()
|
|
39
44
|
return setShowTooltip(false)
|
|
40
45
|
end,
|
|
41
|
-
backgroundColor =
|
|
46
|
+
backgroundColor = style.bgColor,
|
|
42
47
|
backgroundTransparency = 0.5,
|
|
43
48
|
cornerRadius = UDim.new(0.5, 0),
|
|
44
49
|
}, React.createElement(Text, {
|
|
45
50
|
text = "?",
|
|
46
51
|
textSize = rem(3),
|
|
47
52
|
textScaled = true,
|
|
48
|
-
textColor =
|
|
53
|
+
textColor = style.textColor,
|
|
49
54
|
size = UDim2.new(1, 0, 1, 0),
|
|
50
55
|
textXAlignment = "Center",
|
|
51
56
|
textYAlignment = "Center",
|
|
@@ -4,7 +4,11 @@ local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primiti
|
|
|
4
4
|
local Frame = _primitives.Frame
|
|
5
5
|
local Text = _primitives.Text
|
|
6
6
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
7
|
-
local
|
|
7
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
8
|
+
local useWarningIconStyle = makeStyle({
|
|
9
|
+
bgColor = "surface",
|
|
10
|
+
textColor = "textInverse",
|
|
11
|
+
})
|
|
8
12
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
9
13
|
local React = _react
|
|
10
14
|
local useEffect = _react.useEffect
|
|
@@ -17,6 +21,7 @@ local function WarningIcon(_param)
|
|
|
17
21
|
local tooltipText = _param.tooltipText
|
|
18
22
|
local portalRef = _param.portalRef
|
|
19
23
|
local rem = useRem()
|
|
24
|
+
local style = useWarningIconStyle()
|
|
20
25
|
local _condition = tooltipText
|
|
21
26
|
if _condition == nil then
|
|
22
27
|
_condition = "Warning"
|
|
@@ -43,14 +48,14 @@ local function WarningIcon(_param)
|
|
|
43
48
|
onMouseLeave = function()
|
|
44
49
|
return setShowTooltip(false)
|
|
45
50
|
end,
|
|
46
|
-
backgroundColor =
|
|
51
|
+
backgroundColor = style.bgColor,
|
|
47
52
|
backgroundTransparency = 0.5,
|
|
48
53
|
cornerRadius = UDim.new(0.5, 0),
|
|
49
54
|
}, React.createElement(Text, {
|
|
50
55
|
text = "⚠️",
|
|
51
56
|
textSize = rem(3),
|
|
52
57
|
textScaled = true,
|
|
53
|
-
textColor =
|
|
58
|
+
textColor = style.textColor,
|
|
54
59
|
size = UDim2.new(1, 0, 1, 0),
|
|
55
60
|
textXAlignment = "Center",
|
|
56
61
|
textYAlignment = "Center",
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { Outline, type OutlineProps } from "./utils/Outline";
|
|
|
19
19
|
export { Checkbox, type CheckboxProps } from "./form/Checkbox";
|
|
20
20
|
export { Radio, type RadioProps } from "./form/Radio";
|
|
21
21
|
export { IconRoundButton, type IconRoundButtonProps } from "./buttons/IconRoundButton";
|
|
22
|
+
export { IconTextButton, type IconTextButtonProps } from "./buttons/IconTextButton";
|
|
22
23
|
export { IconTileButton, type IconTileButtonProps } from "./buttons/IconTileButton";
|
|
23
24
|
export { PrimaryButton, type PrimaryButtonProps } from "./buttons/PrimaryButton";
|
|
24
25
|
export { TextButton, TextButtonVariant, type TextButtonProps } from "./buttons/TextButton";
|
|
@@ -48,6 +49,7 @@ export { InfoIcon } from "./icons/InfoIcon";
|
|
|
48
49
|
export { WarningIcon } from "./icons/WarningIcon";
|
|
49
50
|
export { validateAngle, validateNumber, validateNumberBounds, validatePosNumber } from "./form/validation";
|
|
50
51
|
export { InputRound, type InputRoundProps } from "./form/InputRound";
|
|
52
|
+
export { IconChip, type IconChipProps } from "./form/IconChip";
|
|
51
53
|
export { RoundEmoji, type RoundEmojiProps } from "./form/RoundEmoji";
|
|
52
54
|
export { DynamicWindow, type ExtendableFrameProps } from "./DynamicWindow/DynamicWindow";
|
|
53
55
|
export { clampViewportPosition, getInputViewportPos, getMouseViewportPos, resolveWindowSpawnPosition, type Mode, type ResizeCorner, type WindowSpawnOptions } from "./DynamicWindow/DynamicWindow.utils";
|
package/dist/init.luau
CHANGED
|
@@ -29,6 +29,7 @@ exports.Checkbox = TS.import(script, script, "form", "Checkbox").Checkbox
|
|
|
29
29
|
exports.Radio = TS.import(script, script, "form", "Radio").Radio
|
|
30
30
|
-- Buttons
|
|
31
31
|
exports.IconRoundButton = TS.import(script, script, "buttons", "IconRoundButton").IconRoundButton
|
|
32
|
+
exports.IconTextButton = TS.import(script, script, "buttons", "IconTextButton").IconTextButton
|
|
32
33
|
exports.IconTileButton = TS.import(script, script, "buttons", "IconTileButton").IconTileButton
|
|
33
34
|
exports.PrimaryButton = TS.import(script, script, "buttons", "PrimaryButton").PrimaryButton
|
|
34
35
|
local _TextButton = TS.import(script, script, "buttons", "TextButton")
|
|
@@ -71,6 +72,7 @@ exports.validateNumberBounds = _validation.validateNumberBounds
|
|
|
71
72
|
exports.validatePosNumber = _validation.validatePosNumber
|
|
72
73
|
-- Form Input Components
|
|
73
74
|
exports.InputRound = TS.import(script, script, "form", "InputRound").InputRound
|
|
75
|
+
exports.IconChip = TS.import(script, script, "form", "IconChip").IconChip
|
|
74
76
|
exports.RoundEmoji = TS.import(script, script, "form", "RoundEmoji").RoundEmoji
|
|
75
77
|
-- DynamicWindow
|
|
76
78
|
exports.DynamicWindow = TS.import(script, script, "DynamicWindow", "DynamicWindow").DynamicWindow
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
2
|
+
declare const useAccordionStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
3
|
+
defaultBg: "info";
|
|
4
|
+
titleColor: "textPrimary";
|
|
5
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
6
|
+
defaultBg: "info";
|
|
7
|
+
titleColor: "textPrimary";
|
|
8
|
+
}>;
|
|
9
|
+
export type AccordionStyle = StyleProps<typeof useAccordionStyle>;
|
|
1
10
|
import React from "@rbxts/react";
|
|
2
11
|
interface AccordionProps {
|
|
3
12
|
title: string;
|
|
@@ -5,7 +5,13 @@ local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primiti
|
|
|
5
5
|
local Frame = _primitives.Frame
|
|
6
6
|
local Text = _primitives.Text
|
|
7
7
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
8
|
-
local
|
|
8
|
+
local _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
|
|
9
|
+
local defaultTheme = _theme.defaultTheme
|
|
10
|
+
local makeStyle = _theme.makeStyle
|
|
11
|
+
local useAccordionStyle = makeStyle({
|
|
12
|
+
defaultBg = "info",
|
|
13
|
+
titleColor = "textPrimary",
|
|
14
|
+
})
|
|
9
15
|
local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
|
|
10
16
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
11
17
|
local React = _react
|
|
@@ -32,6 +38,7 @@ local function Accordion(_param)
|
|
|
32
38
|
local isExpanded = _param.isExpanded
|
|
33
39
|
local onExpandedChange = _param.onExpandedChange
|
|
34
40
|
local theme = defaultTheme
|
|
41
|
+
local style = useAccordionStyle()
|
|
35
42
|
local rem = useRem()
|
|
36
43
|
local contentHeight, setContentHeight = useState(0)
|
|
37
44
|
-- Header visual height must match the header button height below (rem(5))
|
|
@@ -39,7 +46,7 @@ local function Accordion(_param)
|
|
|
39
46
|
local size, sizeMotion = useMotion(UDim2.new(1, 0, 0, headerHeight))
|
|
40
47
|
local contentSize, contentSizeMotion = useMotion(UDim2.new(1, 0, 0, if isExpanded then contentHeight else 0))
|
|
41
48
|
local textSize = rem(3.5)
|
|
42
|
-
local defaultBgColor = backgroundColor or
|
|
49
|
+
local defaultBgColor = backgroundColor or style.defaultBg
|
|
43
50
|
useEffect(function()
|
|
44
51
|
local target = if isExpanded then contentHeight else 0
|
|
45
52
|
contentSizeMotion:spring(UDim2.new(1, 0, 0, target), theme.springs.gentle)
|
|
@@ -57,7 +64,7 @@ local function Accordion(_param)
|
|
|
57
64
|
textSize = textSize,
|
|
58
65
|
font = theme.fonts.roboto.light,
|
|
59
66
|
textScaled = true,
|
|
60
|
-
textColor =
|
|
67
|
+
textColor = style.titleColor,
|
|
61
68
|
size = UDim2.new(1, 0, 1, 0),
|
|
62
69
|
textYAlignment = "Center",
|
|
63
70
|
}, React.createElement("uiflexitem", {
|
|
@@ -66,7 +73,7 @@ local function Accordion(_param)
|
|
|
66
73
|
text = if isExpanded then "×" else "+",
|
|
67
74
|
textSize = rem(4),
|
|
68
75
|
textScaled = true,
|
|
69
|
-
textColor =
|
|
76
|
+
textColor = style.titleColor,
|
|
70
77
|
size = UDim2.new(0, rem(5), 1, 0),
|
|
71
78
|
textYAlignment = "Center",
|
|
72
79
|
position = UDim2.new(1, 0, 0, 0),
|
package/dist/layout/Section.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
3
|
+
declare const useSectionStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
titleColor: "textPrimary";
|
|
5
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
6
|
+
titleColor: "textPrimary";
|
|
7
|
+
}>;
|
|
8
|
+
export type SectionStyle = StyleProps<typeof useSectionStyle>;
|
|
2
9
|
interface SectionProps {
|
|
3
10
|
title: string;
|
|
4
11
|
children: React.ReactNode;
|
|
5
12
|
cornerRadius?: number;
|
|
6
13
|
sortOrder?: Enum.SortOrder;
|
|
14
|
+
style?: SectionStyle;
|
|
7
15
|
}
|
|
8
|
-
export declare function Section({ title, children, cornerRadius, sortOrder, }: SectionProps): JSX.Element;
|
|
16
|
+
export declare function Section({ title, children, cornerRadius, sortOrder, style: styleOverride, }: SectionProps): JSX.Element;
|
|
9
17
|
export type { SectionProps };
|
|
10
18
|
//# sourceMappingURL=Section.d.ts.map
|
package/dist/layout/Section.luau
CHANGED
|
@@ -4,7 +4,10 @@ local VStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dis
|
|
|
4
4
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
5
5
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
6
6
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
-
local
|
|
7
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
8
|
+
local useSectionStyle = makeStyle({
|
|
9
|
+
titleColor = "textPrimary",
|
|
10
|
+
})
|
|
8
11
|
local function Section(_param)
|
|
9
12
|
local title = _param.title
|
|
10
13
|
local children = _param.children
|
|
@@ -16,7 +19,8 @@ local function Section(_param)
|
|
|
16
19
|
if sortOrder == nil then
|
|
17
20
|
sortOrder = Enum.SortOrder.Name
|
|
18
21
|
end
|
|
19
|
-
local
|
|
22
|
+
local styleOverride = _param.style
|
|
23
|
+
local style = useSectionStyle(styleOverride)
|
|
20
24
|
local rem = useRem()
|
|
21
25
|
local textSize = rem(3.5)
|
|
22
26
|
return React.createElement(VStack, {
|
|
@@ -33,7 +37,7 @@ local function Section(_param)
|
|
|
33
37
|
textSize = rem(3),
|
|
34
38
|
textScaled = true,
|
|
35
39
|
richText = true,
|
|
36
|
-
textColor =
|
|
40
|
+
textColor = style.titleColor,
|
|
37
41
|
size = UDim2.new(1, 0, 1, 0),
|
|
38
42
|
textYAlignment = "Center",
|
|
39
43
|
textXAlignment = "Left",
|