@rbxts-ui/components 2.0.0 → 2.1.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 (56) hide show
  1. package/dist/Accordion.d.ts +16 -0
  2. package/dist/Accordion.luau +105 -0
  3. package/dist/Button.d.ts +15 -0
  4. package/dist/Button.luau +66 -0
  5. package/dist/Checkbox.d.ts +13 -0
  6. package/dist/Checkbox.luau +113 -0
  7. package/dist/CheckboxRow.d.ts +14 -0
  8. package/dist/CheckboxRow.luau +52 -0
  9. package/dist/ClickOutsideOverlay.d.ts +11 -0
  10. package/dist/ClickOutsideOverlay.luau +35 -0
  11. package/dist/Dropdown.d.ts +18 -0
  12. package/dist/Dropdown.luau +160 -0
  13. package/dist/DropdownButton.d.ts +22 -0
  14. package/dist/DropdownButton.luau +111 -0
  15. package/dist/DropdownOptionButton.d.ts +13 -0
  16. package/dist/DropdownOptionButton.luau +70 -0
  17. package/dist/FormRow.d.ts +11 -0
  18. package/dist/FormRow.luau +39 -0
  19. package/dist/IconRoundButton.d.ts +23 -0
  20. package/dist/IconRoundButton.luau +149 -0
  21. package/dist/IconTileButton.d.ts +14 -0
  22. package/dist/IconTileButton.luau +89 -0
  23. package/dist/Legend.d.ts +11 -0
  24. package/dist/Legend.luau +54 -0
  25. package/dist/Outline.d.ts +16 -0
  26. package/dist/Outline.luau +102 -0
  27. package/dist/PillText.d.ts +8 -0
  28. package/dist/PillText.luau +69 -0
  29. package/dist/PrimaryButton.d.ts +25 -0
  30. package/dist/PrimaryButton.luau +89 -0
  31. package/dist/Radio.d.ts +13 -0
  32. package/dist/Radio.luau +110 -0
  33. package/dist/RadioRow.d.ts +10 -0
  34. package/dist/RadioRow.luau +50 -0
  35. package/dist/ReactiveButton.d.ts +34 -0
  36. package/dist/ReactiveButton.luau +168 -0
  37. package/dist/Section.d.ts +12 -0
  38. package/dist/Section.luau +54 -0
  39. package/dist/SegmentedToggle.d.ts +19 -0
  40. package/dist/SegmentedToggle.luau +120 -0
  41. package/dist/TextButton.d.ts +32 -0
  42. package/dist/TextButton.luau +125 -0
  43. package/dist/TimeAgo.d.ts +8 -0
  44. package/dist/TimeAgo.luau +48 -0
  45. package/dist/index.d.ts +26 -0
  46. package/dist/init.luau +37 -0
  47. package/dist/theme.d.ts +41 -0
  48. package/dist/theme.luau +58 -0
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/dist/use-button-animation.d.ts +38 -0
  51. package/dist/use-button-animation.luau +83 -0
  52. package/dist/use-button-state.d.ts +13 -0
  53. package/dist/use-button-state.luau +81 -0
  54. package/dist/use-input-device.d.ts +7 -0
  55. package/dist/use-input-device.luau +38 -0
  56. package/package.json +13 -3
@@ -0,0 +1,111 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
4
+ local lerpBinding = _pretty_react_hooks.lerpBinding
5
+ local useMotion = _pretty_react_hooks.useMotion
6
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
8
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
+ local Outline = TS.import(script, script.Parent, "Outline").Outline
10
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
11
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
12
+ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
13
+ local function DropdownButton(_param)
14
+ local text = _param.text
15
+ local onClick = _param.onClick
16
+ local onHover = _param.onHover
17
+ local position = _param.position
18
+ local anchorPoint = _param.anchorPoint
19
+ local layoutOrder = _param.layoutOrder
20
+ local isDisabled = _param.isDisabled
21
+ local size = _param.size
22
+ local padding = _param.padding
23
+ local radius = _param.radius
24
+ local theme = _param.theme
25
+ if theme == nil then
26
+ theme = defaultTheme
27
+ end
28
+ local rem = useRem()
29
+ local hover, hoverMotion = useMotion(0)
30
+ local textColor = theme.palette.crust
31
+ local backgroundColor = theme.palette.white
32
+ local _condition = radius
33
+ if _condition == nil then
34
+ _condition = 1
35
+ end
36
+ local cornerRadius = UDim.new(_condition, 0)
37
+ local _exp = React.createElement(Frame, {
38
+ backgroundColor = backgroundColor,
39
+ backgroundTransparency = if isDisabled then 0.7 else 0,
40
+ cornerRadius = cornerRadius,
41
+ size = UDim2.new(1, 0, 1, 0),
42
+ }, React.createElement("uigradient", {
43
+ Offset = lerpBinding(hover, Vector2.new(), Vector2.new(0, 1)),
44
+ Rotation = 90,
45
+ Transparency = NumberSequence.new(0, 0.1),
46
+ }))
47
+ local _exp_1 = React.createElement(Outline, {
48
+ cornerRadius = cornerRadius,
49
+ innerColor = theme.palette.crust,
50
+ innerTransparency = 0,
51
+ outerColor = theme.palette.white,
52
+ outerTransparency = 0,
53
+ outerThickness = 1,
54
+ theme = theme,
55
+ })
56
+ local _attributes = {
57
+ key = "mainText",
58
+ size = UDim2.new(1, 0, 1, 0),
59
+ text = text,
60
+ font = theme.fonts.inter.medium,
61
+ textSize = rem(3.5),
62
+ textColor = textColor,
63
+ textXAlignment = "Center",
64
+ textYAlignment = "Center",
65
+ layoutOrder = 2,
66
+ }
67
+ local _condition_1 = padding
68
+ if _condition_1 == nil then
69
+ _condition_1 = 1
70
+ end
71
+ _attributes.padding = _condition_1
72
+ _attributes.rem = rem
73
+ local _exp_2 = React.createElement(Text, _attributes)
74
+ local _attributes_1 = {
75
+ key = "arrow",
76
+ size = UDim2.new(1, 0, 1, 0),
77
+ text = "▼",
78
+ font = theme.fonts.inter.medium,
79
+ textSize = rem(3.5),
80
+ textColor = textColor,
81
+ textXAlignment = "Center",
82
+ textYAlignment = "Center",
83
+ layoutOrder = 2,
84
+ }
85
+ local _condition_2 = padding
86
+ if _condition_2 == nil then
87
+ _condition_2 = 1
88
+ end
89
+ _attributes_1.padding = _condition_2
90
+ _attributes_1.position = UDim2.new(0.5, -rem(3), 0, 0)
91
+ _attributes_1.rem = rem
92
+ return React.createElement(ReactiveButton, {
93
+ onClick = onClick,
94
+ onHover = function(hovered)
95
+ hoverMotion:spring(if hovered then 1 else 0)
96
+ local _result = onHover
97
+ if _result ~= nil then
98
+ _result(hovered)
99
+ end
100
+ end,
101
+ backgroundTransparency = 1,
102
+ anchorPoint = anchorPoint,
103
+ size = size or UDim2.new(0, rem(10), 0, rem(4)),
104
+ position = position,
105
+ layoutOrder = layoutOrder,
106
+ theme = theme,
107
+ }, _exp, _exp_1, _exp_2, React.createElement(Text, _attributes_1))
108
+ end
109
+ return {
110
+ DropdownButton = DropdownButton,
111
+ }
@@ -0,0 +1,13 @@
1
+ import React from "@rbxts/react";
2
+ import { type Theme } from "./theme";
3
+ interface DropdownOptionButtonProps extends React.PropsWithChildren {
4
+ readonly text: string;
5
+ readonly onClick?: () => void;
6
+ readonly onHover?: (hovered: boolean) => void;
7
+ readonly size?: UDim2;
8
+ readonly padding?: number;
9
+ readonly theme?: Theme;
10
+ }
11
+ export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children, theme, }: DropdownOptionButtonProps): JSX.Element;
12
+ export type { DropdownOptionButtonProps };
13
+ //# sourceMappingURL=DropdownOptionButton.d.ts.map
@@ -0,0 +1,70 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
4
+ local lerpBinding = _pretty_react_hooks.lerpBinding
5
+ local useMotion = _pretty_react_hooks.useMotion
6
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
8
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
10
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
11
+ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
12
+ local function DropdownOptionButton(_param)
13
+ local text = _param.text
14
+ local onClick = _param.onClick
15
+ local onHover = _param.onHover
16
+ local size = _param.size
17
+ local padding = _param.padding
18
+ local children = _param.children
19
+ local theme = _param.theme
20
+ if theme == nil then
21
+ theme = defaultTheme
22
+ end
23
+ local rem = useRem()
24
+ local hover, hoverMotion = useMotion(0)
25
+ local textColor = theme.palette.crust
26
+ local _exp = React.createElement(Frame, {
27
+ backgroundColor = theme.palette.overlay0,
28
+ backgroundTransparency = lerpBinding(hover, 1, 0.8),
29
+ size = UDim2.new(1, 0, 1, 0),
30
+ })
31
+ local _result
32
+ if children then
33
+ _result = children
34
+ else
35
+ local _attributes = {
36
+ key = "mainText",
37
+ size = UDim2.new(1, 0, 1, 0),
38
+ text = text,
39
+ font = theme.fonts.inter.medium,
40
+ textSize = rem(3.5),
41
+ textColor = textColor,
42
+ textXAlignment = "Center",
43
+ textYAlignment = "Center",
44
+ layoutOrder = 2,
45
+ }
46
+ local _condition = padding
47
+ if _condition == nil then
48
+ _condition = 1
49
+ end
50
+ _attributes.padding = _condition
51
+ _attributes.rem = rem
52
+ _result = (React.createElement(Text, _attributes))
53
+ end
54
+ return React.createElement(ReactiveButton, {
55
+ onClick = onClick,
56
+ onHover = function(hovered)
57
+ hoverMotion:spring(if hovered then 1 else 0)
58
+ local _result_1 = onHover
59
+ if _result_1 ~= nil then
60
+ _result_1(hovered)
61
+ end
62
+ end,
63
+ backgroundTransparency = 1,
64
+ size = size or UDim2.new(0, rem(10), 0, rem(4)),
65
+ theme = theme,
66
+ }, _exp, _result)
67
+ end
68
+ return {
69
+ DropdownOptionButton = DropdownOptionButton,
70
+ }
@@ -0,0 +1,11 @@
1
+ import React from "@rbxts/react";
2
+ import { type Theme } from "./theme";
3
+ interface FormRowProps {
4
+ label: string;
5
+ children: React.ReactNode;
6
+ disabled?: boolean;
7
+ theme?: Theme;
8
+ }
9
+ export declare function FormRow({ label, children, disabled, theme }: FormRowProps): JSX.Element;
10
+ export type { FormRowProps };
11
+ //# sourceMappingURL=FormRow.d.ts.map
@@ -0,0 +1,39 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
5
+ local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
6
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
7
+ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
8
+ local INPUT_HEIGHT = 5
9
+ local function FormRow(_param)
10
+ local label = _param.label
11
+ local children = _param.children
12
+ local disabled = _param.disabled
13
+ local theme = _param.theme
14
+ if theme == nil then
15
+ theme = defaultTheme
16
+ end
17
+ local rem = useRem()
18
+ local textSize = rem(3)
19
+ local labelWidth = rem(20)
20
+ return React.createElement(HStack, {
21
+ size = UDim2.new(1, 0, 0, 0),
22
+ automaticSize = Enum.AutomaticSize.Y,
23
+ }, React.createElement(Text, {
24
+ text = label,
25
+ textSize = textSize,
26
+ textScaled = true,
27
+ textColor = if disabled then theme.palette.disabled else theme.palette.crust,
28
+ size = UDim2.new(0.3, 0, 0, rem(INPUT_HEIGHT)),
29
+ textXAlignment = "Left",
30
+ }, React.createElement("uisizeconstraint", {
31
+ MaxSize = Vector2.new(labelWidth, math.huge),
32
+ })), React.createElement(HStack, {
33
+ size = UDim2.new(0.7, 0, 0, rem(INPUT_HEIGHT)),
34
+ spacing = rem(2),
35
+ }, children))
36
+ end
37
+ return {
38
+ FormRow = FormRow,
39
+ }
@@ -0,0 +1,23 @@
1
+ import React from "@rbxts/react";
2
+ import { type Theme } from "./theme";
3
+ interface IconRoundButtonProps {
4
+ readonly onClick?: () => void;
5
+ readonly emoji?: string;
6
+ readonly label?: string;
7
+ readonly primaryColor: Color3;
8
+ readonly enabled: boolean;
9
+ readonly order: number;
10
+ readonly circleSize?: number;
11
+ readonly addShadow?: boolean;
12
+ readonly width?: number;
13
+ readonly emojiSize?: number;
14
+ readonly tooltipText?: string;
15
+ readonly tooltipComponent?: React.ReactNode;
16
+ readonly position?: UDim2;
17
+ readonly onMouseDown?: () => void;
18
+ readonly onMouseUp?: () => void;
19
+ readonly theme?: Theme;
20
+ }
21
+ export declare function IconRoundButton({ onClick, emoji, label, primaryColor, enabled, order, circleSize, width, addShadow, emojiSize, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp, theme, }: IconRoundButtonProps): JSX.Element;
22
+ export type { IconRoundButtonProps };
23
+ //# sourceMappingURL=IconRoundButton.d.ts.map
@@ -0,0 +1,149 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local React = _react
5
+ local useEffect = _react.useEffect
6
+ local useState = _react.useState
7
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
8
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
+ local Group = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Group
10
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
11
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
12
+ local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
13
+ local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
14
+ local Padding = TS.import(script, script.Parent, "Padding").Padding
15
+ local Transition = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).Transition
16
+ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
17
+ local MARGIN_Y = 0
18
+ local PADDING_LEFT = 2
19
+ local PADDING_RIGHT = 2
20
+ local INTERNAL_PADDING = 1
21
+ local function IconRoundButton(_param)
22
+ local onClick = _param.onClick
23
+ local emoji = _param.emoji
24
+ local label = _param.label
25
+ local primaryColor = _param.primaryColor
26
+ local enabled = _param.enabled
27
+ local order = _param.order
28
+ local circleSize = _param.circleSize
29
+ if circleSize == nil then
30
+ circleSize = 6
31
+ end
32
+ local width = _param.width
33
+ if width == nil then
34
+ width = 0
35
+ end
36
+ local addShadow = _param.addShadow
37
+ if addShadow == nil then
38
+ addShadow = false
39
+ end
40
+ local emojiSize = _param.emojiSize
41
+ if emojiSize == nil then
42
+ emojiSize = 2.5
43
+ end
44
+ local tooltipText = _param.tooltipText
45
+ local tooltipComponent = _param.tooltipComponent
46
+ local position = _param.position
47
+ local onMouseDown = _param.onMouseDown
48
+ local onMouseUp = _param.onMouseUp
49
+ local theme = _param.theme
50
+ if theme == nil then
51
+ theme = defaultTheme
52
+ end
53
+ local rem = useRem()
54
+ local CIRCLE_SIZE = circleSize
55
+ local EMOJI_SIZE = CIRCLE_SIZE / emojiSize
56
+ local isRound = emoji ~= nil
57
+ local HEIGHT = rem(CIRCLE_SIZE)
58
+ local WIDTH = if isRound then HEIGHT else HEIGHT + rem(width)
59
+ local transparency, transparencyMotion = useMotion(1)
60
+ useEffect(function()
61
+ transparencyMotion:spring(if enabled then 0 else 0.75, theme.springs.slow or {
62
+ tension = 250,
63
+ friction = 30,
64
+ })
65
+ end, { enabled })
66
+ local fullRound = UDim.new(1, 0)
67
+ local showTooltip, setShowTooltip = useState(false)
68
+ local _condition = tooltipText
69
+ if not (_condition ~= "" and _condition) then
70
+ _condition = tooltipComponent
71
+ end
72
+ local _condition_1 = _condition
73
+ if _condition_1 ~= "" and _condition_1 then
74
+ _condition_1 = showTooltip
75
+ end
76
+ local _result
77
+ if _condition_1 ~= "" and _condition_1 then
78
+ local _condition_2 = tooltipComponent
79
+ if _condition_2 == nil then
80
+ _condition_2 = nil
81
+ end
82
+ _result = _condition_2
83
+ else
84
+ _result = nil
85
+ end
86
+ return React.createElement(ReactiveButton, {
87
+ onClick = onClick,
88
+ backgroundTransparency = 1,
89
+ size = UDim2.new(0, WIDTH, 0, HEIGHT),
90
+ layoutOrder = order,
91
+ onMouseEnter = function()
92
+ return setShowTooltip(true)
93
+ end,
94
+ onMouseLeave = function()
95
+ return setShowTooltip(false)
96
+ end,
97
+ position = position,
98
+ onMouseDown = onMouseDown,
99
+ onMouseUp = onMouseUp,
100
+ theme = theme,
101
+ }, React.createElement(Transition, {
102
+ groupTransparency = transparency,
103
+ size = UDim2.new(1, 0, 1, rem(2 * MARGIN_Y)),
104
+ position = UDim2.new(0, 0, 0, rem(-MARGIN_Y)),
105
+ }, _result, React.createElement(Padding, {
106
+ paddingY = rem(MARGIN_Y),
107
+ }), React.createElement(Frame, {
108
+ backgroundTransparency = 0,
109
+ backgroundColor = primaryColor,
110
+ cornerRadius = fullRound,
111
+ size = UDim2.new(1, 0, 1, 0),
112
+ }), React.createElement(HStack, {
113
+ spacing = rem(INTERNAL_PADDING),
114
+ clipsDescendants = false,
115
+ }, if emoji ~= "" and emoji then (React.createElement(Group, {
116
+ size = UDim2.new(0, rem(CIRCLE_SIZE), 0, rem(CIRCLE_SIZE)),
117
+ }, React.createElement(Frame, {
118
+ backgroundColor = theme.palette.white,
119
+ backgroundTransparency = 0.7,
120
+ cornerRadius = fullRound,
121
+ anchorPoint = Vector2.new(0.5, 0.5),
122
+ position = UDim2.new(0.5, 0, 0.5, 0),
123
+ size = UDim2.new(1, 0, 1, 0),
124
+ }, React.createElement("uistroke", {
125
+ Color = theme.palette.white,
126
+ Transparency = 0.7,
127
+ Thickness = 0.5,
128
+ })), React.createElement(Text, {
129
+ text = emoji,
130
+ textScaled = true,
131
+ anchorPoint = Vector2.new(0.5, 0.5),
132
+ size = UDim2.new(0, rem(EMOJI_SIZE), 0, rem(EMOJI_SIZE)),
133
+ position = UDim2.new(0.5, 0, 0.5, 0),
134
+ }))) else nil, if label ~= "" and label then (React.createElement(Text, {
135
+ text = label,
136
+ anchorPoint = Vector2.new(0.5, 0.5),
137
+ size = UDim2.new(1, 0, 1, 0),
138
+ position = UDim2.new(0.5, 0, 0.5, 0),
139
+ font = theme.fonts.inter.bold,
140
+ textColor = theme.palette.text,
141
+ textSize = rem(1.5),
142
+ textXAlignment = "Center",
143
+ textYAlignment = "Center",
144
+ richText = true,
145
+ })) else nil)))
146
+ end
147
+ return {
148
+ IconRoundButton = IconRoundButton,
149
+ }
@@ -0,0 +1,14 @@
1
+ import { type Theme } from "./theme";
2
+ interface IconTileButtonProps {
3
+ readonly icon?: string;
4
+ readonly emoji?: string;
5
+ readonly onClick: () => void;
6
+ readonly label?: string;
7
+ readonly selected?: boolean;
8
+ readonly size?: UDim2;
9
+ readonly enabled?: boolean;
10
+ readonly theme?: Theme;
11
+ }
12
+ export declare function IconTileButton({ icon, emoji, onClick, label, selected, size, enabled, theme, }: IconTileButtonProps): JSX.Element;
13
+ export type { IconTileButtonProps };
14
+ //# sourceMappingURL=IconTileButton.d.ts.map
@@ -0,0 +1,89 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
4
+ local lerpBinding = _pretty_react_hooks.lerpBinding
5
+ local useMotion = _pretty_react_hooks.useMotion
6
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
8
+ local Image = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Image
9
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
10
+ local Group = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Group
11
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
12
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
13
+ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
14
+ local function IconTileButton(_param)
15
+ local icon = _param.icon
16
+ local emoji = _param.emoji
17
+ local onClick = _param.onClick
18
+ local label = _param.label
19
+ local selected = _param.selected
20
+ local size = _param.size
21
+ local enabled = _param.enabled
22
+ if enabled == nil then
23
+ enabled = true
24
+ end
25
+ local theme = _param.theme
26
+ if theme == nil then
27
+ theme = defaultTheme
28
+ end
29
+ local rem = useRem()
30
+ local hover, hoverMotion = useMotion(0)
31
+ local roundness = rem(1)
32
+ local bgColor = if selected then theme.palette.blue else theme.palette.white
33
+ local backgroundColor = lerpBinding(hover, bgColor, theme.palette.offwhite)
34
+ local side = 45
35
+ local tileSize = size or UDim2.new(0, side, 0, side)
36
+ local imageSize = 0.6
37
+ return React.createElement(ReactiveButton, {
38
+ onClick = onClick,
39
+ onHover = function(hovered)
40
+ return hoverMotion:spring(if hovered then 1 else 0)
41
+ end,
42
+ backgroundTransparency = 1,
43
+ size = tileSize,
44
+ enabled = enabled,
45
+ theme = theme,
46
+ }, React.createElement(Frame, {
47
+ backgroundTransparency = 1,
48
+ size = UDim2.new(1, 0, 1, 0),
49
+ }, React.createElement("uiaspectratioconstraint", {
50
+ AspectRatio = 1,
51
+ }), React.createElement(Frame, {
52
+ backgroundColor = backgroundColor,
53
+ backgroundTransparency = 0,
54
+ cornerRadius = UDim.new(0, roundness),
55
+ size = UDim2.new(1, 0, 1, 0),
56
+ }), if icon ~= "" and icon then (React.createElement(Image, {
57
+ image = icon,
58
+ anchorPoint = Vector2.new(0.5, 0.5),
59
+ size = UDim2.new(imageSize, 0, imageSize, 0),
60
+ position = UDim2.new(0.5, 0, if label ~= "" and label then 0.45 else 0.5, 0),
61
+ imageTransparency = if enabled then 0 else 0.7,
62
+ }, React.createElement("uicorner", {
63
+ CornerRadius = UDim.new(0, roundness),
64
+ }))) else nil, if emoji ~= "" and emoji then (React.createElement(Text, {
65
+ text = emoji,
66
+ textSize = rem(3),
67
+ textScaled = true,
68
+ textColor = theme.palette.white,
69
+ size = UDim2.new(1, 0, 1, 0),
70
+ textXAlignment = "Center",
71
+ textYAlignment = "Center",
72
+ textTransparency = if enabled then 0 else 0.7,
73
+ })) else nil, if label ~= nil and label ~= "" then (React.createElement(Group, {
74
+ anchorPoint = Vector2.new(0.5, 1),
75
+ size = UDim2.new(1, 0, 0, rem(3)),
76
+ position = UDim2.new(0.5, 0, 1, rem(2.7)),
77
+ }, React.createElement(Text, {
78
+ font = theme.fonts.inter.medium,
79
+ text = string.upper(label),
80
+ textSize = rem(1.5),
81
+ textColor = theme.palette.black,
82
+ textYAlignment = "Center",
83
+ textXAlignment = "Center",
84
+ size = UDim2.new(1, 0, 1, 0),
85
+ }))) else nil))
86
+ end
87
+ return {
88
+ IconTileButton = IconTileButton,
89
+ }
@@ -0,0 +1,11 @@
1
+ interface LegendProps {
2
+ items: Array<{
3
+ color: Color3;
4
+ label: string;
5
+ }>;
6
+ position?: UDim2;
7
+ size?: UDim2;
8
+ }
9
+ export declare function Legend({ items, position, size }: LegendProps): JSX.Element;
10
+ export type { LegendProps };
11
+ //# sourceMappingURL=Legend.d.ts.map
@@ -0,0 +1,54 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
5
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
6
+ local _layout = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist)
7
+ local HStack = _layout.HStack
8
+ local VStack = _layout.VStack
9
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
10
+ local function Legend(_param)
11
+ local items = _param.items
12
+ local position = _param.position
13
+ local size = _param.size
14
+ local rem = useRem()
15
+ local defaultPosition = UDim2.new(0, rem(2), 0, rem(2))
16
+ local defaultSize = UDim2.new(0, rem(20), 0, 1)
17
+ -- ▼ ReadonlyArray.map ▼
18
+ local _newValue = table.create(#items)
19
+ local _callback = function(item, index)
20
+ return React.createElement(HStack, {
21
+ key = `legend-{index}`,
22
+ spacing = rem(1),
23
+ verticalAlignment = Enum.VerticalAlignment.Center,
24
+ size = UDim2.new(1, 0, 0, rem(4)),
25
+ }, React.createElement(Frame, {
26
+ size = UDim2.new(0, rem(2), 0, rem(2)),
27
+ backgroundColor = item.color,
28
+ backgroundTransparency = 0,
29
+ cornerRadius = UDim.new(0, rem(0.5)),
30
+ }), React.createElement(Text, {
31
+ text = item.label,
32
+ textSize = rem(2),
33
+ textColor = Color3.fromRGB(255, 255, 255),
34
+ automaticSize = Enum.AutomaticSize.X,
35
+ }))
36
+ end
37
+ for _k, _v in items do
38
+ _newValue[_k] = _callback(_v, _k - 1, items)
39
+ end
40
+ -- ▲ ReadonlyArray.map ▲
41
+ return React.createElement(VStack, {
42
+ position = position or defaultPosition,
43
+ size = size or defaultSize,
44
+ spacing = rem(0.5),
45
+ cornerRadius = UDim.new(0, rem(2)),
46
+ backgroundColor = Color3.fromRGB(0, 0, 0),
47
+ backgroundTransparency = 0.3,
48
+ padding = rem(1),
49
+ automaticSize = Enum.AutomaticSize.Y,
50
+ }, _newValue)
51
+ end
52
+ return {
53
+ Legend = Legend,
54
+ }
@@ -0,0 +1,16 @@
1
+ import React from "@rbxts/react";
2
+ import { type Theme } from "./theme";
3
+ interface OutlineProps extends React.PropsWithChildren {
4
+ readonly outlineTransparency?: number | React.Binding<number>;
5
+ readonly innerColor?: Color3 | React.Binding<Color3>;
6
+ readonly outerColor?: Color3 | React.Binding<Color3>;
7
+ readonly innerTransparency?: number | React.Binding<number>;
8
+ readonly outerTransparency?: number | React.Binding<number>;
9
+ readonly innerThickness?: number | React.Binding<number>;
10
+ readonly outerThickness?: number | React.Binding<number>;
11
+ readonly cornerRadius?: UDim | React.Binding<UDim>;
12
+ readonly theme?: Theme;
13
+ }
14
+ export declare function Outline({ outlineTransparency, innerColor, outerColor, innerTransparency, outerTransparency, innerThickness, outerThickness, cornerRadius, children, theme, }: OutlineProps): JSX.Element;
15
+ export type { OutlineProps };
16
+ //# sourceMappingURL=Outline.d.ts.map