@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.
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 -35
  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 +10 -9
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/dist/utils/Outline.luau +8 -4
  52. package/package.json +11 -9
@@ -1,3 +1,22 @@
1
+ import { type StyleProps } from "@rbxts-ui/theme";
2
+ declare const useDynamicWindowStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
3
+ titlebar: "titlebar";
4
+ bgColor: "surface";
5
+ borderColor: "surfaceHover";
6
+ windowClose: "windowClose";
7
+ windowMinimize: "windowMinimize";
8
+ windowMaximize: "windowMaximize";
9
+ titleColor: "textPrimary";
10
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
11
+ titlebar: "titlebar";
12
+ bgColor: "surface";
13
+ borderColor: "surfaceHover";
14
+ windowClose: "windowClose";
15
+ windowMinimize: "windowMinimize";
16
+ windowMaximize: "windowMaximize";
17
+ titleColor: "textPrimary";
18
+ }>;
19
+ export type DynamicWindowStyle = StyleProps<typeof useDynamicWindowStyle>;
1
20
  import React from "@rbxts/react";
2
21
  export interface ExtendableFrameProps extends React.PropsWithChildren {
3
22
  readonly size?: UDim2 | React.Binding<UDim2>;
@@ -16,4 +35,5 @@ export interface ExtendableFrameProps extends React.PropsWithChildren {
16
35
  readonly resizeEnabled?: boolean;
17
36
  }
18
37
  export declare function DynamicWindow({ children, size, position, backgroundColor, backgroundTransparency, clipsDescendants, initialSize, initialPosition, title, resizeEnabled, onClose, onPositionChange, onSizeChange, active, zIndex, }: ExtendableFrameProps): JSX.Element;
38
+ export {};
19
39
  //# sourceMappingURL=DynamicWindow.d.ts.map
@@ -5,7 +5,16 @@ 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 defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
+ local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
9
+ local useDynamicWindowStyle = makeStyle({
10
+ titlebar = "titlebar",
11
+ bgColor = "surface",
12
+ borderColor = "surfaceHover",
13
+ windowClose = "windowClose",
14
+ windowMinimize = "windowMinimize",
15
+ windowMaximize = "windowMaximize",
16
+ titleColor = "textPrimary",
17
+ })
9
18
  local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
10
19
  local useEventListener = _pretty_react_hooks.useEventListener
11
20
  local useLatest = _pretty_react_hooks.useLatest
@@ -53,12 +62,12 @@ local function DynamicWindow(_param)
53
62
  local active = _param.active
54
63
  local zIndex = _param.zIndex
55
64
  local rem = useRem()
56
- local theme = defaultTheme
65
+ local style = useDynamicWindowStyle()
57
66
  local titleBarHeight = rem(7)
58
67
  local titleBarPadding = rem(1)
59
68
  local trafficLightSize = rem(2.5)
60
69
  local titleFontSize = rem(3.2)
61
- local titleBarColor = theme.palette.lightblue
70
+ local titleBarColor = style.titlebar
62
71
  local corner = UDim.new(0, rem(1.5))
63
72
  -- Defaults: fixed offset size/position so move/resize make sense immediately
64
73
  local fallbackPosition = UDim2.new(0, 0, 0, ROBLOX_TOOLBAR_HEIGHT)
@@ -211,9 +220,9 @@ local function DynamicWindow(_param)
211
220
  stopInteraction = stopInteraction,
212
221
  visible = resizeEnabled and not minimized,
213
222
  }
214
- local defaultBackgroundColor = backgroundColor or theme.palette.white
223
+ local defaultBackgroundColor = backgroundColor or style.bgColor
215
224
  local _exp = React.createElement("uistroke", {
216
- Color = theme.palette.offwhite,
225
+ Color = style.borderColor,
217
226
  Transparency = 0.5,
218
227
  Thickness = 1,
219
228
  }, children)
@@ -240,28 +249,28 @@ local function DynamicWindow(_param)
240
249
  horizontalAlignment = Enum.HorizontalAlignment.Left,
241
250
  spacing = rem(0.75),
242
251
  }, React.createElement(TrafficLightButton, {
243
- color = theme.palette.macRed,
252
+ color = style.windowClose,
244
253
  size = trafficLightSize,
245
254
  onClick = handleClose,
246
255
  }), resizeEnabled and (React.createElement(React.Fragment, nil, React.createElement(TrafficLightButton, {
247
- color = theme.palette.macYellow,
256
+ color = style.windowMinimize,
248
257
  size = trafficLightSize,
249
258
  onClick = toggleMinimize,
250
259
  }), React.createElement(TrafficLightButton, {
251
- color = theme.palette.macGreen,
260
+ color = style.windowMaximize,
252
261
  size = trafficLightSize,
253
262
  onClick = maximize,
254
263
  })))), React.createElement(Text, {
255
264
  text = title,
256
265
  textSize = titleFontSize,
257
- textColor = theme.palette.crust,
266
+ textColor = style.titleColor,
258
267
  anchorPoint = Vector2.new(0.5, 0.5),
259
268
  position = UDim2.new(0.5, 0, 0.5, 0),
260
269
  }))
261
270
  local _exp_2 = React.createElement(Divider, {
262
271
  zIndex = 2,
263
272
  position = UDim2.new(0, 0, 0, titleBarHeight),
264
- color = theme.palette.offwhite,
273
+ color = style.borderColor,
265
274
  thickness = 1,
266
275
  })
267
276
  local _exp_3 = React.createElement(Frame, {
@@ -1,10 +1,13 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
4
- local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
4
+ local makeStyle = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).makeStyle
5
5
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
6
6
  local Button = TS.import(script, script.Parent.Parent, "buttons", "Button").Button
7
7
  local getMouseViewportPos = TS.import(script, script.Parent, "DynamicWindow.utils").getMouseViewportPos
8
+ local useResizeCornerStyle = makeStyle({
9
+ gripColor = "surfaceRaised",
10
+ })
8
11
  local function ResizeCornerButton(_param)
9
12
  local size = _param.size
10
13
  local handleCorner = _param.handleCorner
@@ -14,7 +17,7 @@ local function ResizeCornerButton(_param)
14
17
  local stopInteraction = _param.stopInteraction
15
18
  local visible = _param.visible
16
19
  local rem = useRem()
17
- local theme = defaultTheme
20
+ local style = useResizeCornerStyle()
18
21
  local isHovering, setIsHovering = React.useState(false)
19
22
  local handleMouseEnter = function()
20
23
  return setIsHovering(true)
@@ -28,7 +31,7 @@ local function ResizeCornerButton(_param)
28
31
  position = position,
29
32
  anchorPoint = anchorPoint,
30
33
  visible = visible,
31
- backgroundColor = theme.palette.surface2,
34
+ backgroundColor = style.gripColor,
32
35
  backgroundTransparency = if isHovering then 0.65 else 1,
33
36
  cornerRadius = UDim.new(0, rem(1.5)),
34
37
  selectable = false,
@@ -1,4 +1,15 @@
1
1
  import React from "@rbxts/react";
2
+ import { type StyleProps } from "@rbxts-ui/theme";
3
+ declare const useDropdownButtonStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
4
+ textColor: "textPrimary";
5
+ bgColor: "surface";
6
+ borderColor: "border";
7
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
8
+ textColor: "textPrimary";
9
+ bgColor: "surface";
10
+ borderColor: "border";
11
+ }>;
12
+ export type DropdownButtonStyle = StyleProps<typeof useDropdownButtonStyle>;
2
13
  interface DropdownButtonProps extends React.PropsWithChildren {
3
14
  readonly text: string;
4
15
  readonly onClick?: () => void;
@@ -14,7 +25,8 @@ interface DropdownButtonProps extends React.PropsWithChildren {
14
25
  readonly hasShadow?: boolean;
15
26
  readonly padding?: number;
16
27
  readonly radius?: number;
28
+ readonly style?: DropdownButtonStyle;
17
29
  }
18
- export declare function DropdownButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, isDisabled, size, padding, radius, }: DropdownButtonProps): JSX.Element;
30
+ export declare function DropdownButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, isDisabled, size, padding, radius, style: styleOverride, }: DropdownButtonProps): JSX.Element;
19
31
  export type { DropdownButtonProps };
20
32
  //# sourceMappingURL=DropdownButton.d.ts.map
@@ -9,7 +9,14 @@ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").
9
9
  local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
10
10
  local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
11
11
  local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
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 useDropdownButtonStyle = makeStyle({
16
+ textColor = "textPrimary",
17
+ bgColor = "surface",
18
+ borderColor = "border",
19
+ })
13
20
  local function DropdownButton(_param)
14
21
  local text = _param.text
15
22
  local onClick = _param.onClick
@@ -21,11 +28,13 @@ local function DropdownButton(_param)
21
28
  local size = _param.size
22
29
  local padding = _param.padding
23
30
  local radius = _param.radius
31
+ local styleOverride = _param.style
24
32
  local theme = defaultTheme
33
+ local style = useDropdownButtonStyle(styleOverride)
25
34
  local rem = useRem()
26
35
  local hover, hoverMotion = useMotion(0)
27
- local textColor = theme.palette.crust
28
- local backgroundColor = theme.palette.white
36
+ local textColor = style.textColor
37
+ local backgroundColor = style.bgColor
29
38
  local _condition = radius
30
39
  if _condition == nil then
31
40
  _condition = 1
@@ -43,9 +52,9 @@ local function DropdownButton(_param)
43
52
  }))
44
53
  local _exp_1 = React.createElement(Outline, {
45
54
  cornerRadius = cornerRadius,
46
- innerColor = theme.palette.crust,
55
+ innerColor = style.borderColor,
47
56
  innerTransparency = 0,
48
- outerColor = theme.palette.white,
57
+ outerColor = style.bgColor,
49
58
  outerTransparency = 0,
50
59
  outerThickness = 1,
51
60
  })
@@ -1,11 +1,21 @@
1
1
  import React from "@rbxts/react";
2
+ import { type StyleProps } from "@rbxts-ui/theme";
3
+ declare const useDropdownOptionStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
4
+ textColor: "textPrimary";
5
+ hoverColor: "surfaceHover";
6
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
7
+ textColor: "textPrimary";
8
+ hoverColor: "surfaceHover";
9
+ }>;
10
+ export type DropdownOptionButtonStyle = StyleProps<typeof useDropdownOptionStyle>;
2
11
  interface DropdownOptionButtonProps extends React.PropsWithChildren {
3
12
  readonly text: string;
4
13
  readonly onClick?: () => void;
5
14
  readonly onHover?: (hovered: boolean) => void;
6
15
  readonly size?: UDim2;
7
16
  readonly padding?: number;
17
+ readonly style?: DropdownOptionButtonStyle;
8
18
  }
9
- export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children, }: DropdownOptionButtonProps): JSX.Element;
19
+ export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children, style: styleOverride, }: DropdownOptionButtonProps): JSX.Element;
10
20
  export type { DropdownOptionButtonProps };
11
21
  //# sourceMappingURL=DropdownOptionButton.d.ts.map
@@ -8,7 +8,13 @@ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).
8
8
  local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
9
  local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
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 _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
12
+ local defaultTheme = _theme.defaultTheme
13
+ local makeStyle = _theme.makeStyle
14
+ local useDropdownOptionStyle = makeStyle({
15
+ textColor = "textPrimary",
16
+ hoverColor = "surfaceHover",
17
+ })
12
18
  local function DropdownOptionButton(_param)
13
19
  local text = _param.text
14
20
  local onClick = _param.onClick
@@ -16,12 +22,14 @@ local function DropdownOptionButton(_param)
16
22
  local size = _param.size
17
23
  local padding = _param.padding
18
24
  local children = _param.children
25
+ local styleOverride = _param.style
19
26
  local theme = defaultTheme
27
+ local style = useDropdownOptionStyle(styleOverride)
20
28
  local rem = useRem()
21
29
  local hover, hoverMotion = useMotion(0)
22
- local textColor = theme.palette.crust
30
+ local textColor = style.textColor
23
31
  local _exp = React.createElement(Frame, {
24
- backgroundColor = theme.palette.overlay0,
32
+ backgroundColor = style.hoverColor,
25
33
  backgroundTransparency = lerpBinding(hover, 1, 0.8),
26
34
  size = UDim2.new(1, 0, 1, 0),
27
35
  })
@@ -1,7 +1,17 @@
1
+ import { type IconName } from "@rbxts-ui/icons";
2
+ import { type StyleProps } from "@rbxts-ui/theme";
1
3
  import React from "@rbxts/react";
4
+ declare const useIconRoundButtonStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
5
+ chipColor: "textInverse";
6
+ labelColor: "textPrimary";
7
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
8
+ chipColor: "textInverse";
9
+ labelColor: "textPrimary";
10
+ }>;
11
+ export type IconRoundButtonStyle = StyleProps<typeof useIconRoundButtonStyle>;
2
12
  interface IconRoundButtonProps {
3
13
  readonly onClick?: () => void;
4
- readonly emoji?: string;
14
+ readonly icon?: IconName;
5
15
  readonly label?: string;
6
16
  readonly primaryColor: Color3;
7
17
  readonly enabled: boolean;
@@ -9,13 +19,13 @@ interface IconRoundButtonProps {
9
19
  readonly circleSize?: number;
10
20
  readonly addShadow?: boolean;
11
21
  readonly width?: number;
12
- readonly emojiSize?: number;
22
+ readonly iconScale?: number;
13
23
  readonly tooltipText?: string;
14
24
  readonly tooltipComponent?: React.ReactNode;
15
25
  readonly position?: UDim2;
16
26
  readonly onMouseDown?: () => void;
17
27
  readonly onMouseUp?: () => void;
18
28
  }
19
- export declare function IconRoundButton({ onClick, emoji, label, primaryColor, enabled, order, circleSize, width, addShadow, emojiSize, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp, }: IconRoundButtonProps): JSX.Element;
29
+ export declare function IconRoundButton({ onClick, icon, label, primaryColor, enabled, order, circleSize, width, addShadow, iconScale, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp, }: IconRoundButtonProps): JSX.Element;
20
30
  export type { IconRoundButtonProps };
21
31
  //# sourceMappingURL=IconRoundButton.d.ts.map
@@ -1,5 +1,6 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
+ local Icon = TS.import(script, TS.getModule(script, "@rbxts-ui", "icons").dist).Icon
3
4
  local _layout = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist)
4
5
  local HStack = _layout.HStack
5
6
  local Transition = _layout.Transition
@@ -8,7 +9,9 @@ local Frame = _primitives.Frame
8
9
  local Group = _primitives.Group
9
10
  local Text = _primitives.Text
10
11
  local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
11
- 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
12
15
  local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
13
16
  local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
14
17
  local React = _react
@@ -16,13 +19,17 @@ local useEffect = _react.useEffect
16
19
  local useState = _react.useState
17
20
  local Padding = TS.import(script, script.Parent.Parent, "layout", "Padding").Padding
18
21
  local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
22
+ local useIconRoundButtonStyle = makeStyle({
23
+ chipColor = "textInverse",
24
+ labelColor = "textPrimary",
25
+ })
19
26
  local MARGIN_Y = 0
20
27
  local PADDING_LEFT = 2
21
28
  local PADDING_RIGHT = 2
22
29
  local INTERNAL_PADDING = 1
23
30
  local function IconRoundButton(_param)
24
31
  local onClick = _param.onClick
25
- local emoji = _param.emoji
32
+ local icon = _param.icon
26
33
  local label = _param.label
27
34
  local primaryColor = _param.primaryColor
28
35
  local enabled = _param.enabled
@@ -39,9 +46,9 @@ local function IconRoundButton(_param)
39
46
  if addShadow == nil then
40
47
  addShadow = false
41
48
  end
42
- local emojiSize = _param.emojiSize
43
- if emojiSize == nil then
44
- emojiSize = 2.5
49
+ local iconScale = _param.iconScale
50
+ if iconScale == nil then
51
+ iconScale = 2.5
45
52
  end
46
53
  local tooltipText = _param.tooltipText
47
54
  local tooltipComponent = _param.tooltipComponent
@@ -49,10 +56,11 @@ local function IconRoundButton(_param)
49
56
  local onMouseDown = _param.onMouseDown
50
57
  local onMouseUp = _param.onMouseUp
51
58
  local theme = defaultTheme
59
+ local style = useIconRoundButtonStyle()
52
60
  local rem = useRem()
53
61
  local CIRCLE_SIZE = circleSize
54
- local EMOJI_SIZE = CIRCLE_SIZE / emojiSize
55
- local isRound = emoji ~= nil
62
+ local ICON_SIZE = CIRCLE_SIZE / iconScale
63
+ local isRound = icon ~= nil
56
64
  local HEIGHT = rem(CIRCLE_SIZE)
57
65
  local WIDTH = if isRound then HEIGHT else HEIGHT + rem(width)
58
66
  local transparency, transparencyMotion = useMotion(1)
@@ -110,24 +118,24 @@ local function IconRoundButton(_param)
110
118
  }), React.createElement(HStack, {
111
119
  spacing = rem(INTERNAL_PADDING),
112
120
  clipsDescendants = false,
113
- }, if emoji ~= "" and emoji then (React.createElement(Group, {
121
+ }, if icon ~= nil then (React.createElement(Group, {
114
122
  size = UDim2.new(0, rem(CIRCLE_SIZE), 0, rem(CIRCLE_SIZE)),
115
123
  }, React.createElement(Frame, {
116
- backgroundColor = theme.palette.white,
124
+ backgroundColor = style.chipColor,
117
125
  backgroundTransparency = 0.7,
118
126
  cornerRadius = fullRound,
119
127
  anchorPoint = Vector2.new(0.5, 0.5),
120
128
  position = UDim2.new(0.5, 0, 0.5, 0),
121
129
  size = UDim2.new(1, 0, 1, 0),
122
130
  }, React.createElement("uistroke", {
123
- Color = theme.palette.white,
131
+ Color = style.chipColor,
124
132
  Transparency = 0.7,
125
133
  Thickness = 0.5,
126
- })), React.createElement(Text, {
127
- text = emoji,
128
- textScaled = true,
134
+ })), React.createElement(Icon, {
135
+ icon = icon,
136
+ color = style.labelColor,
129
137
  anchorPoint = Vector2.new(0.5, 0.5),
130
- size = UDim2.new(0, rem(EMOJI_SIZE), 0, rem(EMOJI_SIZE)),
138
+ size = UDim2.new(0, rem(ICON_SIZE), 0, rem(ICON_SIZE)),
131
139
  position = UDim2.new(0.5, 0, 0.5, 0),
132
140
  }))) else nil, if label ~= "" and label then (React.createElement(Text, {
133
141
  text = label,
@@ -135,7 +143,7 @@ local function IconRoundButton(_param)
135
143
  size = UDim2.new(1, 0, 1, 0),
136
144
  position = UDim2.new(0.5, 0, 0.5, 0),
137
145
  font = theme.fonts.inter.bold,
138
- textColor = theme.palette.text,
146
+ textColor = style.labelColor,
139
147
  textSize = rem(1.5),
140
148
  textXAlignment = "Center",
141
149
  textYAlignment = "Center",
@@ -0,0 +1,24 @@
1
+ import { type IconName } from "@rbxts-ui/icons";
2
+ interface IconTextButtonProps {
3
+ /** Omit for an icon-only button. */
4
+ readonly text?: string;
5
+ readonly icon: IconName;
6
+ /** Icon on the trailing side instead of leading. */
7
+ readonly iconAfter?: boolean;
8
+ /** Solid pill background; defaults to the neutral button color. */
9
+ readonly backgroundColor?: Color3;
10
+ /** Outlined style: theme surface fill + this outline color. */
11
+ readonly outlineColor?: Color3;
12
+ readonly textSize?: number;
13
+ readonly size?: UDim2;
14
+ readonly onClick?: () => void;
15
+ readonly layoutOrder?: number;
16
+ readonly disabled?: boolean;
17
+ }
18
+ /**
19
+ * Pill button with a Lucide icon beside an optional label. Outlined or solid.
20
+ * Replaces TextButton labels that embedded emoji glyphs.
21
+ */
22
+ export declare function IconTextButton({ text, icon, iconAfter, backgroundColor, outlineColor, textSize, size, onClick, layoutOrder, disabled, }: IconTextButtonProps): JSX.Element;
23
+ export type { IconTextButtonProps };
24
+ //# sourceMappingURL=IconTextButton.d.ts.map
@@ -0,0 +1,92 @@
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 HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
5
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
6
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
7
+ local _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
8
+ local defaultTheme = _theme.defaultTheme
9
+ local makeStyle = _theme.makeStyle
10
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
11
+ local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
12
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
13
+ local useIconTextButtonStyle = makeStyle({
14
+ labelColor = "textPrimary",
15
+ neutralBg = "neutralButton",
16
+ outlinedBg = "surfaceHover",
17
+ })
18
+ --[[
19
+ *
20
+ * Pill button with a Lucide icon beside an optional label. Outlined or solid.
21
+ * Replaces TextButton labels that embedded emoji glyphs.
22
+
23
+ ]]
24
+ local function IconTextButton(_param)
25
+ local text = _param.text
26
+ local icon = _param.icon
27
+ local iconAfter = _param.iconAfter
28
+ if iconAfter == nil then
29
+ iconAfter = false
30
+ end
31
+ local backgroundColor = _param.backgroundColor
32
+ local outlineColor = _param.outlineColor
33
+ local textSize = _param.textSize
34
+ local size = _param.size
35
+ local onClick = _param.onClick
36
+ local layoutOrder = _param.layoutOrder
37
+ local disabled = _param.disabled
38
+ if disabled == nil then
39
+ disabled = false
40
+ end
41
+ local rem = useRem()
42
+ local style = useIconTextButtonStyle()
43
+ local _condition = textSize
44
+ if _condition == nil then
45
+ _condition = rem(2.5)
46
+ end
47
+ local labelSize = _condition
48
+ local iconSize = labelSize * 0.9
49
+ local contentTransparency = if disabled then 0.6 else 0
50
+ local label = if text ~= nil and text ~= "" then (React.createElement(Text, {
51
+ key = "label",
52
+ text = text,
53
+ textSize = labelSize,
54
+ textColor = style.labelColor,
55
+ textTransparency = contentTransparency,
56
+ font = defaultTheme.fonts.inter.medium,
57
+ size = UDim2.new(0, 0, 1, 0),
58
+ automaticSize = Enum.AutomaticSize.X,
59
+ textXAlignment = "Center",
60
+ textYAlignment = "Center",
61
+ })) else nil
62
+ local glyph = (React.createElement(Icon, {
63
+ key = "icon",
64
+ icon = icon,
65
+ color = style.labelColor,
66
+ transparency = contentTransparency,
67
+ size = UDim2.new(0, iconSize, 0, iconSize),
68
+ }))
69
+ local cornerRadius = UDim.new(1, 0)
70
+ return React.createElement(ReactiveButton, {
71
+ backgroundColor = if outlineColor ~= nil then style.outlinedBg else (backgroundColor or style.neutralBg),
72
+ backgroundTransparency = if disabled then 0.4 else 0,
73
+ cornerRadius = cornerRadius,
74
+ size = size,
75
+ onClick = if disabled then nil else onClick,
76
+ layoutOrder = layoutOrder,
77
+ }, if outlineColor ~= nil then (React.createElement(Outline, {
78
+ cornerRadius = cornerRadius,
79
+ innerColor = outlineColor,
80
+ innerTransparency = if disabled then 0.5 else 0,
81
+ outerTransparency = 1,
82
+ innerThickness = 2,
83
+ })) else nil, React.createElement(HStack, {
84
+ size = UDim2.new(1, 0, 1, 0),
85
+ spacing = rem(0.75),
86
+ horizontalAlignment = Enum.HorizontalAlignment.Center,
87
+ verticalAlignment = Enum.VerticalAlignment.Center,
88
+ }, if iconAfter then { label, glyph } else { glyph, label }))
89
+ end
90
+ return {
91
+ IconTextButton = IconTextButton,
92
+ }
@@ -1,3 +1,18 @@
1
+ import { type StyleProps } from "@rbxts-ui/theme";
2
+ declare const useIconTileButtonStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
3
+ selectedBg: "accent";
4
+ bgColor: "surface";
5
+ hoverColor: "surfaceHover";
6
+ emojiColor: "textInverse";
7
+ labelColor: "textPrimary";
8
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
9
+ selectedBg: "accent";
10
+ bgColor: "surface";
11
+ hoverColor: "surfaceHover";
12
+ emojiColor: "textInverse";
13
+ labelColor: "textPrimary";
14
+ }>;
15
+ export type IconTileButtonStyle = StyleProps<typeof useIconTileButtonStyle>;
1
16
  interface IconTileButtonProps {
2
17
  readonly icon?: string;
3
18
  readonly emoji?: string;
@@ -6,7 +21,8 @@ interface IconTileButtonProps {
6
21
  readonly selected?: boolean;
7
22
  readonly size?: UDim2;
8
23
  readonly enabled?: boolean;
24
+ readonly style?: IconTileButtonStyle;
9
25
  }
10
- export declare function IconTileButton({ icon, emoji, onClick, label, selected, size, enabled, }: IconTileButtonProps): JSX.Element;
26
+ export declare function IconTileButton({ icon, emoji, onClick, label, selected, size, enabled, style: styleOverride, }: IconTileButtonProps): JSX.Element;
11
27
  export type { IconTileButtonProps };
12
28
  //# sourceMappingURL=IconTileButton.d.ts.map
@@ -11,7 +11,16 @@ local lerpBinding = _pretty_react_hooks.lerpBinding
11
11
  local useMotion = _pretty_react_hooks.useMotion
12
12
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
13
13
  local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
14
- local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
14
+ local _theme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist)
15
+ local defaultTheme = _theme.defaultTheme
16
+ local makeStyle = _theme.makeStyle
17
+ local useIconTileButtonStyle = makeStyle({
18
+ selectedBg = "accent",
19
+ bgColor = "surface",
20
+ hoverColor = "surfaceHover",
21
+ emojiColor = "textInverse",
22
+ labelColor = "textPrimary",
23
+ })
15
24
  local function IconTileButton(_param)
16
25
  local icon = _param.icon
17
26
  local emoji = _param.emoji
@@ -23,12 +32,14 @@ local function IconTileButton(_param)
23
32
  if enabled == nil then
24
33
  enabled = true
25
34
  end
35
+ local styleOverride = _param.style
26
36
  local theme = defaultTheme
37
+ local style = useIconTileButtonStyle(styleOverride)
27
38
  local rem = useRem()
28
39
  local hover, hoverMotion = useMotion(0)
29
40
  local roundness = rem(1)
30
- local bgColor = if selected then theme.palette.blue else theme.palette.white
31
- local backgroundColor = lerpBinding(hover, bgColor, theme.palette.offwhite)
41
+ local bgColor = if selected then style.selectedBg else style.bgColor
42
+ local backgroundColor = lerpBinding(hover, bgColor, style.hoverColor)
32
43
  local side = 45
33
44
  local tileSize = size or UDim2.new(0, side, 0, side)
34
45
  local imageSize = 0.6
@@ -62,7 +73,7 @@ local function IconTileButton(_param)
62
73
  text = emoji,
63
74
  textSize = rem(3),
64
75
  textScaled = true,
65
- textColor = theme.palette.white,
76
+ textColor = style.emojiColor,
66
77
  size = UDim2.new(1, 0, 1, 0),
67
78
  textXAlignment = "Center",
68
79
  textYAlignment = "Center",
@@ -75,7 +86,7 @@ local function IconTileButton(_param)
75
86
  font = theme.fonts.inter.medium,
76
87
  text = string.upper(label),
77
88
  textSize = rem(1.5),
78
- textColor = theme.palette.black,
89
+ textColor = style.labelColor,
79
90
  textYAlignment = "Center",
80
91
  textXAlignment = "Center",
81
92
  size = UDim2.new(1, 0, 1, 0),
@@ -8,7 +8,6 @@ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).
8
8
  local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
9
  local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
10
10
  local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
11
- local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
12
11
  local function PrimaryButton(_param)
13
12
  local name = _param.name
14
13
  local onClick = _param.onClick
@@ -46,7 +45,6 @@ local function PrimaryButton(_param)
46
45
  end
47
46
  local automaticSize = _param.automaticSize
48
47
  local children = _param.children
49
- local theme = defaultTheme
50
48
  local rem = useRem()
51
49
  local hover, hoverMotion = useMotion(0)
52
50
  return React.createElement(ReactiveButton, {
@@ -1,4 +1,25 @@
1
+ import { type StyleProps } from "@rbxts-ui/theme";
1
2
  import React from "@rbxts/react";
3
+ declare const useTextButtonStyle: (override?: Partial<import("@rbxts-ui/theme").ResolvedStyle<{
4
+ bgColor: "surfaceHover";
5
+ green: "success";
6
+ red: "danger";
7
+ blue: "accent";
8
+ black: "mark";
9
+ darkGray: "neutralButton";
10
+ textDefault: "textPrimary";
11
+ textOnDark: "textInverse";
12
+ }>> | undefined) => import("@rbxts-ui/theme").ResolvedStyle<{
13
+ bgColor: "surfaceHover";
14
+ green: "success";
15
+ red: "danger";
16
+ blue: "accent";
17
+ black: "mark";
18
+ darkGray: "neutralButton";
19
+ textDefault: "textPrimary";
20
+ textOnDark: "textInverse";
21
+ }>;
22
+ export type TextButtonStyle = StyleProps<typeof useTextButtonStyle>;
2
23
  export declare enum TextButtonVariant {
3
24
  Green = 0,
4
25
  Red = 1,
@@ -26,7 +47,8 @@ interface TextButtonProps extends React.PropsWithChildren {
26
47
  readonly textScaled?: boolean;
27
48
  readonly fill?: boolean;
28
49
  readonly hasOutline?: boolean;
50
+ readonly style?: TextButtonStyle;
29
51
  }
30
- export declare function TextButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, variant, isDisabled, hasShadow, size, padding, radius, children, textSize, textScaled, fill, hasOutline, }: TextButtonProps): JSX.Element;
52
+ export declare function TextButton({ text, onClick, onHover, position, anchorPoint, layoutOrder, variant, isDisabled, hasShadow, size, padding, radius, children, textSize, textScaled, fill, hasOutline, style: styleOverride, }: TextButtonProps): JSX.Element;
31
53
  export type { TextButtonProps };
32
54
  //# sourceMappingURL=TextButton.d.ts.map