@rbxts-ui/components 7.0.2 → 8.0.1
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 -35
- 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 +10 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/Outline.luau +8 -4
- package/package.json +11 -9
|
@@ -4,13 +4,23 @@ 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 _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
|
|
9
9
|
local lerpBinding = _pretty_react_hooks.lerpBinding
|
|
10
10
|
local useMotion = _pretty_react_hooks.useMotion
|
|
11
11
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
12
12
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
13
13
|
local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
|
|
14
|
+
local useTextButtonStyle = makeStyle({
|
|
15
|
+
bgColor = "surfaceHover",
|
|
16
|
+
green = "success",
|
|
17
|
+
red = "danger",
|
|
18
|
+
blue = "accent",
|
|
19
|
+
black = "mark",
|
|
20
|
+
darkGray = "neutralButton",
|
|
21
|
+
textDefault = "textPrimary",
|
|
22
|
+
textOnDark = "textInverse",
|
|
23
|
+
})
|
|
14
24
|
local TextButtonVariant
|
|
15
25
|
do
|
|
16
26
|
local _inverse = {}
|
|
@@ -52,25 +62,26 @@ local function TextButton(_param)
|
|
|
52
62
|
if hasOutline == nil then
|
|
53
63
|
hasOutline = true
|
|
54
64
|
end
|
|
55
|
-
local
|
|
65
|
+
local styleOverride = _param.style
|
|
56
66
|
local rem = useRem()
|
|
67
|
+
local style = useTextButtonStyle(styleOverride)
|
|
57
68
|
local hover, hoverMotion = useMotion(0)
|
|
58
69
|
local colorVariant = {
|
|
59
|
-
[TextButtonVariant.Green] =
|
|
60
|
-
[TextButtonVariant.Red] =
|
|
61
|
-
[TextButtonVariant.Blue] =
|
|
62
|
-
[TextButtonVariant.Black] =
|
|
63
|
-
[TextButtonVariant.DarkGray] =
|
|
70
|
+
[TextButtonVariant.Green] = style.green,
|
|
71
|
+
[TextButtonVariant.Red] = style.red,
|
|
72
|
+
[TextButtonVariant.Blue] = style.blue,
|
|
73
|
+
[TextButtonVariant.Black] = style.black,
|
|
74
|
+
[TextButtonVariant.DarkGray] = style.darkGray,
|
|
64
75
|
}
|
|
65
76
|
local color = colorVariant[variant]
|
|
66
|
-
local textColor = if variant == TextButtonVariant.Black then
|
|
77
|
+
local textColor = if variant == TextButtonVariant.Black then style.textOnDark else style.textDefault
|
|
67
78
|
local _condition = radius
|
|
68
79
|
if _condition == nil then
|
|
69
80
|
_condition = 1
|
|
70
81
|
end
|
|
71
82
|
local cornerRadius = UDim.new(_condition, 0)
|
|
72
83
|
local _exp = React.createElement(Frame, {
|
|
73
|
-
backgroundColor =
|
|
84
|
+
backgroundColor = style.bgColor,
|
|
74
85
|
backgroundTransparency = if isDisabled then 0.7 else 0,
|
|
75
86
|
cornerRadius = cornerRadius,
|
|
76
87
|
size = UDim2.new(1, 0, 1, 0),
|
|
@@ -6,13 +6,19 @@ local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primiti
|
|
|
6
6
|
local Frame = _primitives.Frame
|
|
7
7
|
local Text = _primitives.Text
|
|
8
8
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
9
|
-
local
|
|
9
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
10
|
+
local useAlertBoxStyle = makeStyle({
|
|
11
|
+
warning = "warning",
|
|
12
|
+
info = "accent",
|
|
13
|
+
textColor = "textPrimary",
|
|
14
|
+
})
|
|
10
15
|
local InfoIcon = TS.import(script, script.Parent.Parent, "icons", "InfoIcon").InfoIcon
|
|
11
16
|
local WarningIcon = TS.import(script, script.Parent.Parent, "icons", "WarningIcon").WarningIcon
|
|
12
17
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
13
18
|
local function AlertBox(props)
|
|
14
19
|
local rem = useRem()
|
|
15
|
-
local
|
|
20
|
+
local style = useAlertBoxStyle()
|
|
21
|
+
local variantColor = if props.variant == "warning" then style.warning else style.info
|
|
16
22
|
local containerPadding = rem(2)
|
|
17
23
|
return React.createElement(Frame, {
|
|
18
24
|
name = props.name,
|
|
@@ -40,7 +46,7 @@ local function AlertBox(props)
|
|
|
40
46
|
portalRef = nil,
|
|
41
47
|
})), React.createElement(Text, {
|
|
42
48
|
text = props.text,
|
|
43
|
-
textColor =
|
|
49
|
+
textColor = style.textColor,
|
|
44
50
|
textSize = rem(3),
|
|
45
51
|
size = UDim2.new(0, 0, 0, 0),
|
|
46
52
|
textWrapped = true,
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { type TextProps } from "@rbxts-ui/primitives";
|
|
2
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
3
|
+
declare const usePillTextStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
pillColor: "mark";
|
|
5
|
+
textColor: "textInverse";
|
|
6
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
7
|
+
pillColor: "mark";
|
|
8
|
+
textColor: "textInverse";
|
|
9
|
+
}>;
|
|
10
|
+
export type PillTextStyle = StyleProps<typeof usePillTextStyle>;
|
|
2
11
|
interface PillTextProps extends TextProps {
|
|
3
12
|
}
|
|
4
13
|
export declare function PillText(props: PillTextProps): JSX.Element;
|
|
@@ -8,7 +8,11 @@ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").
|
|
|
8
8
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
9
9
|
local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
|
|
10
10
|
local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
|
|
11
|
-
local
|
|
11
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
12
|
+
local usePillTextStyle = makeStyle({
|
|
13
|
+
pillColor = "mark",
|
|
14
|
+
textColor = "textInverse",
|
|
15
|
+
})
|
|
12
16
|
local WIDTH = 3
|
|
13
17
|
local HEIGHT = 2
|
|
14
18
|
local function PillText(props)
|
|
@@ -19,12 +23,12 @@ local function PillText(props)
|
|
|
19
23
|
local name = _binding.name
|
|
20
24
|
local zIndex = _binding.zIndex
|
|
21
25
|
local anchorPoint = _binding.anchorPoint
|
|
22
|
-
local
|
|
26
|
+
local style = usePillTextStyle()
|
|
23
27
|
local textProps = Object.assign({}, omit(props, { "position", "name", "text", "textColor", "zIndex", "anchorPoint" }))
|
|
24
28
|
local rem = useRem()
|
|
25
29
|
local cornerRadius = UDim.new(0, rem(3))
|
|
26
30
|
local _exp = React.createElement(Frame, {
|
|
27
|
-
backgroundColor =
|
|
31
|
+
backgroundColor = style.pillColor,
|
|
28
32
|
backgroundTransparency = 0.3,
|
|
29
33
|
cornerRadius = cornerRadius,
|
|
30
34
|
size = UDim2.new(1, 0, 1, 0),
|
|
@@ -33,14 +37,14 @@ local function PillText(props)
|
|
|
33
37
|
local _exp_1 = React.createElement(Outline, {
|
|
34
38
|
cornerRadius = cornerRadius,
|
|
35
39
|
innerTransparency = 1,
|
|
36
|
-
innerColor =
|
|
40
|
+
innerColor = style.pillColor,
|
|
37
41
|
outerTransparency = 0,
|
|
38
|
-
outerColor =
|
|
42
|
+
outerColor = style.pillColor,
|
|
39
43
|
})
|
|
40
44
|
local _attributes = {
|
|
41
45
|
text = `{text}`,
|
|
42
46
|
textSize = rem(1),
|
|
43
|
-
textColor = textColor or
|
|
47
|
+
textColor = textColor or style.textColor,
|
|
44
48
|
richText = true,
|
|
45
49
|
automaticSize = Enum.AutomaticSize.XY,
|
|
46
50
|
rem = rem,
|
|
@@ -9,10 +9,20 @@ local Text = _primitives.Text
|
|
|
9
9
|
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
10
10
|
local PrimaryButton = TS.import(script, script.Parent.Parent, "buttons", "PrimaryButton").PrimaryButton
|
|
11
11
|
local TextField = TS.import(script, script.Parent.Parent, "form", "TextField").TextField
|
|
12
|
-
local
|
|
12
|
+
local _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
|
|
13
|
+
local defaultTheme = _theme.defaultTheme
|
|
14
|
+
local makeStyle = _theme.makeStyle
|
|
15
|
+
local useErrorPageStyle = makeStyle({
|
|
16
|
+
panelColor = "textPrimary",
|
|
17
|
+
textColor = "surface",
|
|
18
|
+
errorColor = "danger",
|
|
19
|
+
accent = "accent",
|
|
20
|
+
info = "info",
|
|
21
|
+
})
|
|
13
22
|
local function ErrorPage(_param)
|
|
14
23
|
local message = _param.message
|
|
15
24
|
local rem = useRem()
|
|
25
|
+
local style = useErrorPageStyle()
|
|
16
26
|
local index = 0
|
|
17
27
|
local _exp = React.createElement("uilistlayout", {
|
|
18
28
|
FillDirection = "Vertical",
|
|
@@ -32,7 +42,7 @@ local function ErrorPage(_param)
|
|
|
32
42
|
local _attributes_1 = {
|
|
33
43
|
font = defaultTheme.fonts.inter.bold,
|
|
34
44
|
text = "Oh Noes!",
|
|
35
|
-
textColor =
|
|
45
|
+
textColor = style.textColor,
|
|
36
46
|
textSize = rem(3),
|
|
37
47
|
textAutoResize = "XY",
|
|
38
48
|
}
|
|
@@ -50,7 +60,7 @@ local function ErrorPage(_param)
|
|
|
50
60
|
local _attributes_3 = {
|
|
51
61
|
font = defaultTheme.fonts.inter.regular,
|
|
52
62
|
text = "Something went wrong, and we were unable to recover.",
|
|
53
|
-
textColor =
|
|
63
|
+
textColor = style.textColor,
|
|
54
64
|
textSize = rem(1.5),
|
|
55
65
|
textAutoResize = "XY",
|
|
56
66
|
}
|
|
@@ -68,7 +78,7 @@ local function ErrorPage(_param)
|
|
|
68
78
|
local _attributes_5 = {
|
|
69
79
|
font = defaultTheme.fonts.inter.regular,
|
|
70
80
|
text = "Please send this error to the developers, and try reconnecting:",
|
|
71
|
-
textColor =
|
|
81
|
+
textColor = style.textColor,
|
|
72
82
|
textSize = rem(1.5),
|
|
73
83
|
textAutoResize = "XY",
|
|
74
84
|
}
|
|
@@ -88,12 +98,12 @@ local function ErrorPage(_param)
|
|
|
88
98
|
textEditable = false,
|
|
89
99
|
font = defaultTheme.fonts.roboto.regular,
|
|
90
100
|
text = `{message}`,
|
|
91
|
-
textColor =
|
|
101
|
+
textColor = style.errorColor,
|
|
92
102
|
textSize = rem(1.5),
|
|
93
103
|
textAutoResize = "XY",
|
|
94
104
|
textXAlignment = "Left",
|
|
95
105
|
maxVisibleGraphemes = 512,
|
|
96
|
-
backgroundColor =
|
|
106
|
+
backgroundColor = style.panelColor,
|
|
97
107
|
backgroundTransparency = 0,
|
|
98
108
|
cornerRadius = UDim.new(0, rem(1.5)),
|
|
99
109
|
}
|
|
@@ -106,7 +116,7 @@ local function ErrorPage(_param)
|
|
|
106
116
|
PaddingTop = UDim.new(0, rem(2)),
|
|
107
117
|
PaddingBottom = UDim.new(0, rem(2)),
|
|
108
118
|
}), React.createElement("uistroke", {
|
|
109
|
-
Color =
|
|
119
|
+
Color = style.errorColor,
|
|
110
120
|
Transparency = 0.3,
|
|
111
121
|
Thickness = 1,
|
|
112
122
|
ApplyStrokeMode = "Border",
|
|
@@ -122,19 +132,19 @@ local function ErrorPage(_param)
|
|
|
122
132
|
onClick = TS.async(function()
|
|
123
133
|
warn("Reconnecting...")
|
|
124
134
|
end),
|
|
125
|
-
overlayGradient = ColorSequence.new(
|
|
135
|
+
overlayGradient = ColorSequence.new(style.accent, style.info),
|
|
126
136
|
size = UDim2.new(0, rem(12), 0, rem(5)),
|
|
127
137
|
}
|
|
128
138
|
local _original_9 = index
|
|
129
139
|
index += 1
|
|
130
140
|
_attributes_9.layoutOrder = _original_9
|
|
131
141
|
return React.createElement(Layer, nil, React.createElement(Frame, {
|
|
132
|
-
backgroundColor =
|
|
142
|
+
backgroundColor = style.panelColor,
|
|
133
143
|
size = UDim2.new(1, 0, 1, 0),
|
|
134
144
|
}, _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
145
|
font = defaultTheme.fonts.inter.medium,
|
|
136
146
|
text = "Reconnect →",
|
|
137
|
-
textColor =
|
|
147
|
+
textColor = style.textColor,
|
|
138
148
|
textSize = rem(1.5),
|
|
139
149
|
size = UDim2.new(1, 0, 1, 0),
|
|
140
150
|
}))))
|
package/dist/form/Checkbox.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
2
|
+
declare const useCheckboxStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
3
|
+
boxColor: "surface";
|
|
4
|
+
markColor: "mark";
|
|
5
|
+
labelColor: "textPrimary";
|
|
6
|
+
mutedColor: "textMuted";
|
|
7
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
8
|
+
boxColor: "surface";
|
|
9
|
+
markColor: "mark";
|
|
10
|
+
labelColor: "textPrimary";
|
|
11
|
+
mutedColor: "textMuted";
|
|
12
|
+
}>;
|
|
13
|
+
export type CheckboxStyle = StyleProps<typeof useCheckboxStyle>;
|
|
1
14
|
interface CheckboxProps {
|
|
2
15
|
checked: boolean;
|
|
3
16
|
onChecked: (checked: boolean) => void;
|
|
@@ -5,7 +18,8 @@ interface CheckboxProps {
|
|
|
5
18
|
variant?: "default" | "large" | "small";
|
|
6
19
|
position?: UDim2;
|
|
7
20
|
disabled?: boolean;
|
|
21
|
+
style?: CheckboxStyle;
|
|
8
22
|
}
|
|
9
|
-
export declare function Checkbox({ checked, onChecked, text, variant, position, disabled }: CheckboxProps): JSX.Element;
|
|
23
|
+
export declare function Checkbox({ checked, onChecked, text, variant, position, disabled, style: styleOverride, }: CheckboxProps): JSX.Element;
|
|
10
24
|
export type { CheckboxProps };
|
|
11
25
|
//# sourceMappingURL=Checkbox.d.ts.map
|
package/dist/form/Checkbox.luau
CHANGED
|
@@ -4,15 +4,52 @@ 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
|
|
8
|
-
local
|
|
9
|
-
local lerpBinding = _pretty_react_hooks.lerpBinding
|
|
10
|
-
local useMotion = _pretty_react_hooks.useMotion
|
|
7
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
8
|
+
local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
|
|
11
9
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
12
10
|
local React = _react
|
|
13
11
|
local useMemo = _react.useMemo
|
|
14
12
|
local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
|
|
15
13
|
local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
|
|
14
|
+
local useCheckboxStyle = makeStyle({
|
|
15
|
+
boxColor = "surface",
|
|
16
|
+
markColor = "mark",
|
|
17
|
+
labelColor = "textPrimary",
|
|
18
|
+
mutedColor = "textMuted",
|
|
19
|
+
})
|
|
20
|
+
--[[
|
|
21
|
+
*
|
|
22
|
+
* The checkmark, drawn from two rotated rounded frames in `color`. Replaces the
|
|
23
|
+
* "✔" glyph, which Roblox renders with the fixed-color emoji font (ignores the
|
|
24
|
+
* theme — invisible on dark surfaces).
|
|
25
|
+
|
|
26
|
+
]]
|
|
27
|
+
local function CheckGlyph(_param)
|
|
28
|
+
local color = _param.color
|
|
29
|
+
local cornerRadius = UDim.new(0.5, 0)
|
|
30
|
+
return React.createElement(Frame, {
|
|
31
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
32
|
+
position = UDim2.fromScale(0.5, 0.5),
|
|
33
|
+
size = UDim2.fromScale(0.7, 0.7),
|
|
34
|
+
backgroundTransparency = 1,
|
|
35
|
+
}, React.createElement(Frame, {
|
|
36
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
37
|
+
position = UDim2.fromScale(0.62, 0.5),
|
|
38
|
+
size = UDim2.fromScale(0.17, 0.8),
|
|
39
|
+
backgroundColor = color,
|
|
40
|
+
backgroundTransparency = 0,
|
|
41
|
+
rotation = 40,
|
|
42
|
+
cornerRadius = cornerRadius,
|
|
43
|
+
}), React.createElement(Frame, {
|
|
44
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
45
|
+
position = UDim2.fromScale(0.27, 0.67),
|
|
46
|
+
size = UDim2.fromScale(0.17, 0.45),
|
|
47
|
+
backgroundColor = color,
|
|
48
|
+
backgroundTransparency = 0,
|
|
49
|
+
rotation = -50,
|
|
50
|
+
cornerRadius = cornerRadius,
|
|
51
|
+
}))
|
|
52
|
+
end
|
|
16
53
|
local function Checkbox(_param)
|
|
17
54
|
local checked = _param.checked
|
|
18
55
|
local onChecked = _param.onChecked
|
|
@@ -26,9 +63,9 @@ local function Checkbox(_param)
|
|
|
26
63
|
if disabled == nil then
|
|
27
64
|
disabled = false
|
|
28
65
|
end
|
|
29
|
-
local
|
|
66
|
+
local styleOverride = _param.style
|
|
30
67
|
local rem = useRem()
|
|
31
|
-
local
|
|
68
|
+
local style = useCheckboxStyle(styleOverride)
|
|
32
69
|
local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
|
|
33
70
|
local buttonSize = UDim2.new(0, rem(checkboxSize), 0, rem(checkboxSize))
|
|
34
71
|
local textWidth, textWidthMotion = useMotion({
|
|
@@ -45,8 +82,8 @@ local function Checkbox(_param)
|
|
|
45
82
|
end)
|
|
46
83
|
end, { rem })
|
|
47
84
|
local cornerRadius = UDim.new(0, rem(1))
|
|
48
|
-
local
|
|
49
|
-
local
|
|
85
|
+
local markColor = if disabled then style.mutedColor else style.markColor
|
|
86
|
+
local labelColor = if disabled then style.mutedColor else style.labelColor
|
|
50
87
|
return React.createElement(ReactiveButton, {
|
|
51
88
|
backgroundTransparency = 1,
|
|
52
89
|
size = size,
|
|
@@ -54,9 +91,6 @@ local function Checkbox(_param)
|
|
|
54
91
|
onClick = function()
|
|
55
92
|
return not disabled and onChecked(not checked)
|
|
56
93
|
end,
|
|
57
|
-
onHover = function(hovered)
|
|
58
|
-
return hoverMotion:spring(if hovered then 1 else 0)
|
|
59
|
-
end,
|
|
60
94
|
}, React.createElement("uilistlayout", {
|
|
61
95
|
FillDirection = "Horizontal",
|
|
62
96
|
VerticalAlignment = "Center",
|
|
@@ -64,36 +98,19 @@ local function Checkbox(_param)
|
|
|
64
98
|
}), React.createElement(Frame, {
|
|
65
99
|
backgroundTransparency = 1,
|
|
66
100
|
size = buttonSize,
|
|
67
|
-
}, React.createElement(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
size = UDim2.new(1, 0, 1, 0),
|
|
71
|
-
}, React.createElement("uigradient", {
|
|
72
|
-
Offset = lerpBinding(hover, Vector2.new(), Vector2.new(0, 1)),
|
|
73
|
-
Rotation = 90,
|
|
74
|
-
Transparency = NumberSequence.new(0, 0.1),
|
|
75
|
-
})), React.createElement(Outline, {
|
|
76
|
-
outerColor = mainColor,
|
|
77
|
-
innerColor = mainColor,
|
|
101
|
+
}, React.createElement(Outline, {
|
|
102
|
+
outerColor = markColor,
|
|
103
|
+
innerColor = markColor,
|
|
78
104
|
cornerRadius = cornerRadius,
|
|
79
105
|
innerTransparency = 0,
|
|
80
106
|
outerTransparency = 1,
|
|
81
107
|
innerThickness = 2,
|
|
82
|
-
}), React.createElement(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
textScaled = true,
|
|
86
|
-
size = UDim2.new(1, 0, 1, 0),
|
|
87
|
-
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
88
|
-
anchorPoint = Vector2.new(0.5, 0.5),
|
|
89
|
-
textXAlignment = "Center",
|
|
90
|
-
textYAlignment = "Center",
|
|
91
|
-
padding = 0.9,
|
|
92
|
-
rem = rem,
|
|
93
|
-
})), if text ~= "" and text then (React.createElement(Text, {
|
|
108
|
+
}), if checked then React.createElement(CheckGlyph, {
|
|
109
|
+
color = markColor,
|
|
110
|
+
}) else nil), if text ~= "" and text then (React.createElement(Text, {
|
|
94
111
|
text = text,
|
|
95
112
|
size = UDim2.new(0, rem(2), 0, rem(2)),
|
|
96
|
-
textColor =
|
|
113
|
+
textColor = labelColor,
|
|
97
114
|
textXAlignment = "Left",
|
|
98
115
|
change = {
|
|
99
116
|
TextBounds = function(rbx)
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
3
|
+
declare const useCheckboxRowStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
labelColor: "textPrimary";
|
|
5
|
+
mutedColor: "textMuted";
|
|
6
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
7
|
+
labelColor: "textPrimary";
|
|
8
|
+
mutedColor: "textMuted";
|
|
9
|
+
}>;
|
|
10
|
+
export type CheckboxRowStyle = StyleProps<typeof useCheckboxRowStyle>;
|
|
2
11
|
interface CheckboxRowProps {
|
|
3
12
|
label: string;
|
|
4
13
|
checked: boolean;
|
|
@@ -6,7 +15,8 @@ interface CheckboxRowProps {
|
|
|
6
15
|
disabled?: boolean;
|
|
7
16
|
name?: string;
|
|
8
17
|
children?: React.ReactNode;
|
|
18
|
+
style?: CheckboxRowStyle;
|
|
9
19
|
}
|
|
10
|
-
export declare function CheckboxRow({ label, checked, onChecked, disabled, name, children, }: CheckboxRowProps): JSX.Element;
|
|
20
|
+
export declare function CheckboxRow({ label, checked, onChecked, disabled, name, children, style: styleOverride, }: CheckboxRowProps): JSX.Element;
|
|
11
21
|
export type { CheckboxRowProps };
|
|
12
22
|
//# sourceMappingURL=CheckboxRow.d.ts.map
|
|
@@ -6,7 +6,11 @@ local Checkbox = TS.import(script, script.Parent, "Checkbox").Checkbox
|
|
|
6
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
|
|
9
|
+
local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
|
|
10
|
+
local useCheckboxRowStyle = makeStyle({
|
|
11
|
+
labelColor = "textPrimary",
|
|
12
|
+
mutedColor = "textMuted",
|
|
13
|
+
})
|
|
10
14
|
local function CheckboxRow(_param)
|
|
11
15
|
local label = _param.label
|
|
12
16
|
local checked = _param.checked
|
|
@@ -17,7 +21,8 @@ local function CheckboxRow(_param)
|
|
|
17
21
|
end
|
|
18
22
|
local name = _param.name
|
|
19
23
|
local children = _param.children
|
|
20
|
-
local
|
|
24
|
+
local styleOverride = _param.style
|
|
25
|
+
local style = useCheckboxRowStyle(styleOverride)
|
|
21
26
|
local rem = useRem()
|
|
22
27
|
local textSize = rem(3)
|
|
23
28
|
return React.createElement(HStack, {
|
|
@@ -38,7 +43,7 @@ local function CheckboxRow(_param)
|
|
|
38
43
|
text = label,
|
|
39
44
|
textSize = textSize,
|
|
40
45
|
textScaled = true,
|
|
41
|
-
textColor = if disabled then
|
|
46
|
+
textColor = if disabled then style.mutedColor else style.labelColor,
|
|
42
47
|
size = UDim2.new(1, 0, 1, 0),
|
|
43
48
|
textXAlignment = "Left",
|
|
44
49
|
})), children)
|
package/dist/form/Dropdown.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
1
2
|
import React from "@rbxts/react";
|
|
3
|
+
declare const useDropdownStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
bgColor: "surface";
|
|
5
|
+
borderColor: "border";
|
|
6
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
7
|
+
bgColor: "surface";
|
|
8
|
+
borderColor: "border";
|
|
9
|
+
}>;
|
|
10
|
+
export type DropdownStyle = StyleProps<typeof useDropdownStyle>;
|
|
2
11
|
interface DropdownOption<T> {
|
|
3
12
|
label: string;
|
|
4
13
|
value: T;
|
|
@@ -10,6 +19,7 @@ interface DropdownProps<T> {
|
|
|
10
19
|
size?: UDim2;
|
|
11
20
|
renderOption?: (option: DropdownOption<T>) => React.ReactNode;
|
|
12
21
|
portalRef?: React.RefObject<GuiObject>;
|
|
22
|
+
style?: DropdownStyle;
|
|
13
23
|
}
|
|
14
24
|
export declare function Dropdown<T>(props: DropdownProps<T>): JSX.Element;
|
|
15
25
|
export type { DropdownOption, DropdownProps };
|
package/dist/form/Dropdown.luau
CHANGED
|
@@ -3,7 +3,7 @@ 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
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 React = _react
|
|
9
9
|
local useEffect = _react.useEffect
|
|
@@ -13,6 +13,10 @@ local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-rob
|
|
|
13
13
|
local DropdownButton = TS.import(script, script.Parent.Parent, "buttons", "DropdownButton").DropdownButton
|
|
14
14
|
local DropdownOptionButton = TS.import(script, script.Parent.Parent, "buttons", "DropdownOptionButton").DropdownOptionButton
|
|
15
15
|
local ClickOutsideLayer = TS.import(script, script.Parent.Parent, "utils", "ClickOutsideOverlay").ClickOutsideLayer
|
|
16
|
+
local useDropdownStyle = makeStyle({
|
|
17
|
+
bgColor = "surface",
|
|
18
|
+
borderColor = "border",
|
|
19
|
+
})
|
|
16
20
|
local function Dropdown(props)
|
|
17
21
|
local _binding = props
|
|
18
22
|
local options = _binding.options
|
|
@@ -21,7 +25,7 @@ local function Dropdown(props)
|
|
|
21
25
|
local size = _binding.size
|
|
22
26
|
local renderOption = _binding.renderOption
|
|
23
27
|
local portalRef = _binding.portalRef
|
|
24
|
-
local
|
|
28
|
+
local style = useDropdownStyle(props.style)
|
|
25
29
|
local isOpen, setIsOpen = useState(false)
|
|
26
30
|
local dropdownBounds, setDropdownBounds = useState()
|
|
27
31
|
local dropdownRef = useRef()
|
|
@@ -71,7 +75,7 @@ local function Dropdown(props)
|
|
|
71
75
|
CornerRadius = cornerRadius,
|
|
72
76
|
})
|
|
73
77
|
local _exp_1 = React.createElement("uistroke", {
|
|
74
|
-
Color =
|
|
78
|
+
Color = style.borderColor,
|
|
75
79
|
Transparency = 0.5,
|
|
76
80
|
Thickness = 1,
|
|
77
81
|
})
|
|
@@ -122,10 +126,10 @@ local function Dropdown(props)
|
|
|
122
126
|
}, React.createElement(VStackScrolling, {
|
|
123
127
|
Position = UDim2.new(0, relativePosition.X, 0, dropdownY),
|
|
124
128
|
Size = UDim2.new(0, dropdownBounds.size.X, 0, dropdownHeight),
|
|
125
|
-
BackgroundColor3 =
|
|
129
|
+
BackgroundColor3 = style.bgColor,
|
|
126
130
|
BackgroundTransparency = 0,
|
|
127
131
|
ClipsDescendants = true,
|
|
128
|
-
BorderColor3 =
|
|
132
|
+
BorderColor3 = style.borderColor,
|
|
129
133
|
ZIndex = 2000,
|
|
130
134
|
paddingBottom = rem(1),
|
|
131
135
|
}, renderOptions())), container)
|
package/dist/form/FormRow.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { type StyleProps } from "@rbxts-ui/theme";
|
|
1
2
|
import React from "@rbxts/react";
|
|
3
|
+
declare const useFormRowStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
|
|
4
|
+
labelColor: "textPrimary";
|
|
5
|
+
mutedColor: "textMuted";
|
|
6
|
+
}>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
|
|
7
|
+
labelColor: "textPrimary";
|
|
8
|
+
mutedColor: "textMuted";
|
|
9
|
+
}>;
|
|
10
|
+
export type FormRowStyle = StyleProps<typeof useFormRowStyle>;
|
|
2
11
|
interface FormRowProps {
|
|
3
12
|
label: string;
|
|
4
13
|
children: React.ReactNode;
|
|
5
14
|
disabled?: boolean;
|
|
6
15
|
name?: string;
|
|
16
|
+
style?: FormRowStyle;
|
|
7
17
|
}
|
|
8
|
-
export declare function FormRow({ label, children, disabled, name }: FormRowProps): JSX.Element;
|
|
18
|
+
export declare function FormRow({ label, children, disabled, name, style: styleOverride }: FormRowProps): JSX.Element;
|
|
9
19
|
export type { FormRowProps };
|
|
10
20
|
//# sourceMappingURL=FormRow.d.ts.map
|
package/dist/form/FormRow.luau
CHANGED
|
@@ -3,15 +3,20 @@ 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
|
+
local useFormRowStyle = makeStyle({
|
|
9
|
+
labelColor = "textPrimary",
|
|
10
|
+
mutedColor = "textMuted",
|
|
11
|
+
})
|
|
8
12
|
local INPUT_HEIGHT = 5
|
|
9
13
|
local function FormRow(_param)
|
|
10
14
|
local label = _param.label
|
|
11
15
|
local children = _param.children
|
|
12
16
|
local disabled = _param.disabled
|
|
13
17
|
local name = _param.name
|
|
14
|
-
local
|
|
18
|
+
local styleOverride = _param.style
|
|
19
|
+
local style = useFormRowStyle(styleOverride)
|
|
15
20
|
local rem = useRem()
|
|
16
21
|
local textSize = rem(3)
|
|
17
22
|
local labelWidth = rem(20)
|
|
@@ -23,7 +28,7 @@ local function FormRow(_param)
|
|
|
23
28
|
text = label,
|
|
24
29
|
textSize = textSize,
|
|
25
30
|
textScaled = true,
|
|
26
|
-
textColor = if disabled then
|
|
31
|
+
textColor = if disabled then style.mutedColor else style.labelColor,
|
|
27
32
|
size = UDim2.new(0.3, 0, 0, rem(INPUT_HEIGHT)),
|
|
28
33
|
textXAlignment = "Left",
|
|
29
34
|
}, React.createElement("uisizeconstraint", {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type IconName } from "@rbxts-ui/icons";
|
|
2
|
+
interface IconChipProps {
|
|
3
|
+
readonly icon: IconName;
|
|
4
|
+
/** Tint of the icon and its circular backing. */
|
|
5
|
+
readonly primary: Color3;
|
|
6
|
+
readonly height?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Circular tinted icon used as the leading affordance of an input row. Replaces
|
|
10
|
+
* the old emoji chip (emoji ignore color and read inconsistently). Call sites pick
|
|
11
|
+
* `primary` for the light theme, so on dark we lift it toward white to stay legible.
|
|
12
|
+
*/
|
|
13
|
+
export declare function IconChip({ icon, primary, height }: IconChipProps): JSX.Element;
|
|
14
|
+
export type { IconChipProps };
|
|
15
|
+
//# sourceMappingURL=IconChip.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local Icon = TS.import(script, TS.getModule(script, "@rbxts-ui", "icons").dist).Icon
|
|
4
|
+
local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
|
|
5
|
+
local Frame = _primitives.Frame
|
|
6
|
+
local Group = _primitives.Group
|
|
7
|
+
local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
|
|
8
|
+
local pickTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).pickTheme
|
|
9
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
10
|
+
--[[
|
|
11
|
+
*
|
|
12
|
+
* Circular tinted icon used as the leading affordance of an input row. Replaces
|
|
13
|
+
* the old emoji chip (emoji ignore color and read inconsistently). Call sites pick
|
|
14
|
+
* `primary` for the light theme, so on dark we lift it toward white to stay legible.
|
|
15
|
+
|
|
16
|
+
]]
|
|
17
|
+
local function IconChip(_param)
|
|
18
|
+
local icon = _param.icon
|
|
19
|
+
local primary = _param.primary
|
|
20
|
+
local height = _param.height
|
|
21
|
+
if height == nil then
|
|
22
|
+
height = 4
|
|
23
|
+
end
|
|
24
|
+
local rem = useRem()
|
|
25
|
+
local fullRound = UDim.new(1, 0)
|
|
26
|
+
local iconSize = rem(height / 1.6)
|
|
27
|
+
local tint = pickTheme(primary, primary:Lerp(Color3.new(1, 1, 1), 0.55))
|
|
28
|
+
return React.createElement(Group, {
|
|
29
|
+
size = UDim2.new(0, rem(height), 0, rem(height)),
|
|
30
|
+
}, React.createElement(Frame, {
|
|
31
|
+
backgroundColor = tint,
|
|
32
|
+
backgroundTransparency = pickTheme(0.8, 0.85),
|
|
33
|
+
cornerRadius = fullRound,
|
|
34
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
35
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
36
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
37
|
+
}), React.createElement(Icon, {
|
|
38
|
+
icon = icon,
|
|
39
|
+
color = tint,
|
|
40
|
+
size = UDim2.new(0, iconSize, 0, iconSize),
|
|
41
|
+
anchorPoint = Vector2.new(0.5, 0.5),
|
|
42
|
+
position = UDim2.new(0.5, 0, 0.5, 0),
|
|
43
|
+
}))
|
|
44
|
+
end
|
|
45
|
+
return {
|
|
46
|
+
IconChip = IconChip,
|
|
47
|
+
}
|