@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.
Files changed (52) hide show
  1. package/dist/DynamicWindow/DynamicWindow.d.ts +20 -0
  2. package/dist/DynamicWindow/DynamicWindow.luau +19 -10
  3. package/dist/DynamicWindow/ResizeCornerButton.luau +6 -3
  4. package/dist/buttons/DropdownButton.d.ts +13 -1
  5. package/dist/buttons/DropdownButton.luau +14 -5
  6. package/dist/buttons/DropdownOptionButton.d.ts +11 -1
  7. package/dist/buttons/DropdownOptionButton.luau +11 -3
  8. package/dist/buttons/IconRoundButton.d.ts +13 -3
  9. package/dist/buttons/IconRoundButton.luau +23 -15
  10. package/dist/buttons/IconTextButton.d.ts +24 -0
  11. package/dist/buttons/IconTextButton.luau +92 -0
  12. package/dist/buttons/IconTileButton.d.ts +17 -1
  13. package/dist/buttons/IconTileButton.luau +16 -5
  14. package/dist/buttons/PrimaryButton.luau +0 -2
  15. package/dist/buttons/TextButton.d.ts +23 -1
  16. package/dist/buttons/TextButton.luau +20 -9
  17. package/dist/display/AlertBox.luau +9 -3
  18. package/dist/display/PillText.d.ts +9 -0
  19. package/dist/display/PillText.luau +10 -6
  20. package/dist/error-handler/ErrorPage.luau +20 -10
  21. package/dist/form/Checkbox.d.ts +15 -1
  22. package/dist/form/Checkbox.luau +52 -20
  23. package/dist/form/CheckboxRow.d.ts +11 -1
  24. package/dist/form/CheckboxRow.luau +8 -3
  25. package/dist/form/Dropdown.d.ts +10 -0
  26. package/dist/form/Dropdown.luau +9 -5
  27. package/dist/form/FormRow.d.ts +11 -1
  28. package/dist/form/FormRow.luau +8 -3
  29. package/dist/form/IconChip.d.ts +15 -0
  30. package/dist/form/IconChip.luau +47 -0
  31. package/dist/form/InputRound.d.ts +18 -1
  32. package/dist/form/InputRound.luau +21 -10
  33. package/dist/form/InputRow.d.ts +4 -3
  34. package/dist/form/InputRow.luau +4 -4
  35. package/dist/form/Radio.d.ts +17 -1
  36. package/dist/form/Radio.luau +14 -6
  37. package/dist/form/RadioRow.d.ts +12 -1
  38. package/dist/form/RadioRow.luau +8 -3
  39. package/dist/form/SegmentedToggle.d.ts +18 -1
  40. package/dist/form/SegmentedToggle.luau +15 -7
  41. package/dist/icons/InfoIcon.luau +8 -3
  42. package/dist/icons/WarningIcon.luau +8 -3
  43. package/dist/index.d.ts +2 -0
  44. package/dist/init.luau +2 -0
  45. package/dist/layout/Accordion.d.ts +9 -0
  46. package/dist/layout/Accordion.luau +11 -4
  47. package/dist/layout/Section.d.ts +9 -1
  48. package/dist/layout/Section.luau +7 -3
  49. package/dist/tooltip/Tooltip.luau +12 -9
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/dist/utils/Outline.luau +8 -4
  52. 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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 theme = defaultTheme
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] = theme.palette.green,
60
- [TextButtonVariant.Red] = theme.palette.red,
61
- [TextButtonVariant.Blue] = theme.palette.blue,
62
- [TextButtonVariant.Black] = theme.palette.black,
63
- [TextButtonVariant.DarkGray] = theme.palette.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 theme.palette.white else theme.palette.crust
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 = theme.palette.offwhite,
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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 variantColor = if props.variant == "warning" then defaultTheme.palette.yellow else defaultTheme.palette.blue
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 = defaultTheme.palette.crust,
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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 theme = defaultTheme
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 = theme.palette.black,
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 = theme.palette.black,
40
+ innerColor = style.pillColor,
37
41
  outerTransparency = 0,
38
- outerColor = theme.palette.black,
42
+ outerColor = style.pillColor,
39
43
  })
40
44
  local _attributes = {
41
45
  text = `{text}`,
42
46
  textSize = rem(1),
43
- textColor = textColor or theme.palette.text,
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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 = defaultTheme.palette.text,
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 = defaultTheme.palette.text,
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 = defaultTheme.palette.text,
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 = defaultTheme.palette.red,
101
+ textColor = style.errorColor,
92
102
  textSize = rem(1.5),
93
103
  textAutoResize = "XY",
94
104
  textXAlignment = "Left",
95
105
  maxVisibleGraphemes = 512,
96
- backgroundColor = defaultTheme.palette.crust,
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 = defaultTheme.palette.red,
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(defaultTheme.palette.blue, defaultTheme.palette.blueishColor),
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 = defaultTheme.palette.crust,
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 = defaultTheme.palette.text,
147
+ textColor = style.textColor,
138
148
  textSize = rem(1.5),
139
149
  size = UDim2.new(1, 0, 1, 0),
140
150
  }))))
@@ -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
@@ -4,7 +4,7 @@ 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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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
@@ -13,6 +13,45 @@ local React = _react
13
13
  local useMemo = _react.useMemo
14
14
  local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
15
15
  local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
16
+ local useCheckboxStyle = makeStyle({
17
+ boxColor = "surface",
18
+ markColor = "mark",
19
+ labelColor = "textPrimary",
20
+ mutedColor = "textMuted",
21
+ })
22
+ --[[
23
+ *
24
+ * The checkmark, drawn from two rotated rounded frames in `color`. Replaces the
25
+ * "✔" glyph, which Roblox renders with the fixed-color emoji font (ignores the
26
+ * theme — invisible on dark surfaces).
27
+
28
+ ]]
29
+ local function CheckGlyph(_param)
30
+ local color = _param.color
31
+ local cornerRadius = UDim.new(0.5, 0)
32
+ return React.createElement(Frame, {
33
+ anchorPoint = Vector2.new(0.5, 0.5),
34
+ position = UDim2.fromScale(0.5, 0.5),
35
+ size = UDim2.fromScale(0.7, 0.7),
36
+ backgroundTransparency = 1,
37
+ }, React.createElement(Frame, {
38
+ anchorPoint = Vector2.new(0.5, 0.5),
39
+ position = UDim2.fromScale(0.62, 0.5),
40
+ size = UDim2.fromScale(0.17, 0.8),
41
+ backgroundColor = color,
42
+ backgroundTransparency = 0,
43
+ rotation = 40,
44
+ cornerRadius = cornerRadius,
45
+ }), React.createElement(Frame, {
46
+ anchorPoint = Vector2.new(0.5, 0.5),
47
+ position = UDim2.fromScale(0.27, 0.67),
48
+ size = UDim2.fromScale(0.17, 0.45),
49
+ backgroundColor = color,
50
+ backgroundTransparency = 0,
51
+ rotation = -50,
52
+ cornerRadius = cornerRadius,
53
+ }))
54
+ end
16
55
  local function Checkbox(_param)
17
56
  local checked = _param.checked
18
57
  local onChecked = _param.onChecked
@@ -26,8 +65,9 @@ local function Checkbox(_param)
26
65
  if disabled == nil then
27
66
  disabled = false
28
67
  end
29
- local theme = defaultTheme
68
+ local styleOverride = _param.style
30
69
  local rem = useRem()
70
+ local style = useCheckboxStyle(styleOverride)
31
71
  local hover, hoverMotion = useMotion(0)
32
72
  local checkboxSize = if variant == "large" then 4 elseif variant == "small" then 1.7 else 3
33
73
  local buttonSize = UDim2.new(0, rem(checkboxSize), 0, rem(checkboxSize))
@@ -45,8 +85,8 @@ local function Checkbox(_param)
45
85
  end)
46
86
  end, { rem })
47
87
  local cornerRadius = UDim.new(0, rem(1))
48
- local mainColor = if disabled then theme.palette.overlay0 else theme.palette.black
49
- local textColor = if disabled then theme.palette.overlay0 else theme.palette.black
88
+ local markColor = if disabled then style.mutedColor else style.markColor
89
+ local labelColor = if disabled then style.mutedColor else style.labelColor
50
90
  return React.createElement(ReactiveButton, {
51
91
  backgroundTransparency = 1,
52
92
  size = size,
@@ -65,7 +105,8 @@ local function Checkbox(_param)
65
105
  backgroundTransparency = 1,
66
106
  size = buttonSize,
67
107
  }, React.createElement(Frame, {
68
- backgroundColor = theme.palette.white,
108
+ backgroundColor = style.boxColor,
109
+ backgroundTransparency = 0,
69
110
  cornerRadius = cornerRadius,
70
111
  size = UDim2.new(1, 0, 1, 0),
71
112
  }, React.createElement("uigradient", {
@@ -73,27 +114,18 @@ local function Checkbox(_param)
73
114
  Rotation = 90,
74
115
  Transparency = NumberSequence.new(0, 0.1),
75
116
  })), React.createElement(Outline, {
76
- outerColor = mainColor,
77
- innerColor = mainColor,
117
+ outerColor = markColor,
118
+ innerColor = markColor,
78
119
  cornerRadius = cornerRadius,
79
120
  innerTransparency = 0,
80
121
  outerTransparency = 1,
81
122
  innerThickness = 2,
82
- }), React.createElement(Text, {
83
- text = if checked then "✔" else "",
84
- textColor = mainColor,
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, {
123
+ }), if checked then React.createElement(CheckGlyph, {
124
+ color = markColor,
125
+ }) else nil), if text ~= "" and text then (React.createElement(Text, {
94
126
  text = text,
95
127
  size = UDim2.new(0, rem(2), 0, rem(2)),
96
- textColor = textColor,
128
+ textColor = labelColor,
97
129
  textXAlignment = "Left",
98
130
  change = {
99
131
  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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 theme = defaultTheme
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 theme.palette.overlay0 else theme.palette.crust,
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)
@@ -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 };
@@ -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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 theme = defaultTheme
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 = theme.palette.crust,
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 = theme.palette.white,
129
+ BackgroundColor3 = style.bgColor,
126
130
  BackgroundTransparency = 0,
127
131
  ClipsDescendants = true,
128
- BorderColor3 = theme.palette.crust,
132
+ BorderColor3 = style.borderColor,
129
133
  ZIndex = 2000,
130
134
  paddingBottom = rem(1),
131
135
  }, renderOptions())), container)
@@ -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
@@ -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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
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 theme = defaultTheme
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 theme.palette.disabled else theme.palette.crust,
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
+ }