@rbxts-ui/components 2.0.0 → 3.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 (110) hide show
  1. package/dist/DynamicWindow/DynamicWindow.d.ts +19 -0
  2. package/dist/DynamicWindow/DynamicWindow.luau +327 -0
  3. package/dist/DynamicWindow/DynamicWindow.utils.d.ts +13 -0
  4. package/dist/DynamicWindow/DynamicWindow.utils.luau +46 -0
  5. package/dist/DynamicWindow/ResizeCornerButton.d.ts +13 -0
  6. package/dist/DynamicWindow/ResizeCornerButton.luau +47 -0
  7. package/dist/DynamicWindow/TrafficLightButton.d.ts +8 -0
  8. package/dist/DynamicWindow/TrafficLightButton.luau +26 -0
  9. package/dist/buttons/Button.d.ts +15 -0
  10. package/dist/buttons/Button.luau +66 -0
  11. package/dist/buttons/DropdownButton.d.ts +20 -0
  12. package/dist/buttons/DropdownButton.luau +106 -0
  13. package/dist/buttons/DropdownOptionButton.d.ts +11 -0
  14. package/dist/buttons/DropdownOptionButton.luau +66 -0
  15. package/dist/buttons/IconRoundButton.d.ts +21 -0
  16. package/dist/buttons/IconRoundButton.luau +145 -0
  17. package/dist/buttons/IconTileButton.d.ts +12 -0
  18. package/dist/buttons/IconTileButton.luau +86 -0
  19. package/dist/buttons/PrimaryButton.d.ts +23 -0
  20. package/dist/buttons/PrimaryButton.luau +84 -0
  21. package/dist/buttons/ReactiveButton.d.ts +32 -0
  22. package/dist/buttons/ReactiveButton.luau +163 -0
  23. package/dist/buttons/TextButton.d.ts +30 -0
  24. package/dist/buttons/TextButton.luau +121 -0
  25. package/dist/{Checkmark.luau → display/Checkmark.luau} +1 -1
  26. package/dist/display/Legend.d.ts +11 -0
  27. package/dist/display/Legend.luau +54 -0
  28. package/dist/display/PillText.d.ts +6 -0
  29. package/dist/display/PillText.luau +65 -0
  30. package/dist/display/TimeAgo.d.ts +8 -0
  31. package/dist/display/TimeAgo.luau +48 -0
  32. package/dist/error-handler/ErrorHandler.d.ts +3 -0
  33. package/dist/error-handler/ErrorHandler.luau +18 -0
  34. package/dist/error-handler/ErrorPage.d.ts +6 -0
  35. package/dist/error-handler/ErrorPage.luau +144 -0
  36. package/dist/error-handler/index.d.ts +3 -0
  37. package/dist/error-handler/init.luau +6 -0
  38. package/dist/form/Checkbox.d.ts +11 -0
  39. package/dist/form/Checkbox.luau +108 -0
  40. package/dist/form/CheckboxRow.d.ts +12 -0
  41. package/dist/form/CheckboxRow.luau +48 -0
  42. package/dist/form/Dropdown.d.ts +16 -0
  43. package/dist/form/Dropdown.luau +155 -0
  44. package/dist/form/DropdownRow.d.ts +18 -0
  45. package/dist/form/DropdownRow.luau +28 -0
  46. package/dist/form/FormRow.d.ts +9 -0
  47. package/dist/form/FormRow.luau +36 -0
  48. package/dist/form/InputRound.d.ts +18 -0
  49. package/dist/form/InputRound.luau +218 -0
  50. package/dist/form/InputRow.d.ts +13 -0
  51. package/dist/form/InputRow.luau +32 -0
  52. package/dist/form/Radio.d.ts +11 -0
  53. package/dist/form/Radio.luau +105 -0
  54. package/dist/form/RadioRow.d.ts +8 -0
  55. package/dist/form/RadioRow.luau +46 -0
  56. package/dist/form/RoundEmoji.d.ts +8 -0
  57. package/dist/form/RoundEmoji.luau +40 -0
  58. package/dist/form/TextBox.d.ts +24 -0
  59. package/dist/form/TextBox.luau +57 -0
  60. package/dist/{TextField.d.ts → form/TextField.d.ts} +1 -1
  61. package/dist/{TextField.luau → form/TextField.luau} +4 -2
  62. package/dist/form/validation.d.ts +13 -0
  63. package/dist/form/validation.luau +80 -0
  64. package/dist/hooks/use-button-animation.d.ts +36 -0
  65. package/dist/hooks/use-button-animation.luau +80 -0
  66. package/dist/hooks/use-button-state.d.ts +13 -0
  67. package/dist/hooks/use-button-state.luau +81 -0
  68. package/dist/hooks/use-input-device.d.ts +7 -0
  69. package/dist/hooks/use-input-device.luau +38 -0
  70. package/dist/index.d.ts +48 -6
  71. package/dist/init.luau +72 -6
  72. package/dist/layout/Accordion.d.ts +14 -0
  73. package/dist/layout/Accordion.luau +101 -0
  74. package/dist/{Divider.luau → layout/Divider.luau} +1 -1
  75. package/dist/layout/Section.d.ts +10 -0
  76. package/dist/layout/Section.luau +51 -0
  77. package/dist/layout/SegmentedToggle.d.ts +17 -0
  78. package/dist/layout/SegmentedToggle.luau +117 -0
  79. package/dist/layout/SegmentedToggle.story.d.ts +10 -0
  80. package/dist/layout/SegmentedToggle.story.luau +72 -0
  81. package/dist/table/ExampleTable.d.ts +2 -0
  82. package/dist/table/ExampleTable.luau +46 -0
  83. package/dist/table/Table.d.ts +10 -0
  84. package/dist/table/Table.luau +26 -0
  85. package/dist/table/TableCell.d.ts +9 -0
  86. package/dist/table/TableCell.luau +26 -0
  87. package/dist/table/TableFooter.d.ts +9 -0
  88. package/dist/table/TableFooter.luau +12 -0
  89. package/dist/table/TableHeader.d.ts +9 -0
  90. package/dist/table/TableHeader.luau +12 -0
  91. package/dist/table/TableRow.d.ts +9 -0
  92. package/dist/table/TableRow.luau +24 -0
  93. package/dist/tooltip/Tooltip.d.ts +14 -0
  94. package/dist/tooltip/Tooltip.luau +65 -0
  95. package/dist/tooltip/useTooltip.d.ts +12 -0
  96. package/dist/tooltip/useTooltip.luau +40 -0
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/dist/utils/ClickOutsideOverlay.d.ts +11 -0
  99. package/dist/utils/ClickOutsideOverlay.luau +35 -0
  100. package/dist/utils/Outline.d.ts +14 -0
  101. package/dist/utils/Outline.luau +99 -0
  102. package/package.json +19 -7
  103. /package/dist/{Checkmark.d.ts → display/Checkmark.d.ts} +0 -0
  104. /package/dist/{Divider.d.ts → layout/Divider.d.ts} +0 -0
  105. /package/dist/{Padding.d.ts → layout/Padding.d.ts} +0 -0
  106. /package/dist/{Padding.luau → layout/Padding.luau} +0 -0
  107. /package/dist/{DelayRender.d.ts → utils/DelayRender.d.ts} +0 -0
  108. /package/dist/{DelayRender.luau → utils/DelayRender.luau} +0 -0
  109. /package/dist/{ErrorBoundary.d.ts → utils/ErrorBoundary.d.ts} +0 -0
  110. /package/dist/{ErrorBoundary.luau → utils/ErrorBoundary.luau} +0 -0
@@ -0,0 +1,106 @@
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", "@rbxts-ui/rem")).useRem
8
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
+ local Outline = TS.import(script, script.Parent.Parent, "utils", "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, TS.getModule(script, "@rbxts-ui", "theme").dist).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 = defaultTheme
25
+ local rem = useRem()
26
+ local hover, hoverMotion = useMotion(0)
27
+ local textColor = theme.palette.crust
28
+ local backgroundColor = theme.palette.white
29
+ local _condition = radius
30
+ if _condition == nil then
31
+ _condition = 1
32
+ end
33
+ local cornerRadius = UDim.new(_condition, 0)
34
+ local _exp = React.createElement(Frame, {
35
+ backgroundColor = backgroundColor,
36
+ backgroundTransparency = if isDisabled then 0.7 else 0,
37
+ cornerRadius = cornerRadius,
38
+ size = UDim2.new(1, 0, 1, 0),
39
+ }, React.createElement("uigradient", {
40
+ Offset = lerpBinding(hover, Vector2.new(), Vector2.new(0, 1)),
41
+ Rotation = 90,
42
+ Transparency = NumberSequence.new(0, 0.1),
43
+ }))
44
+ local _exp_1 = React.createElement(Outline, {
45
+ cornerRadius = cornerRadius,
46
+ innerColor = theme.palette.crust,
47
+ innerTransparency = 0,
48
+ outerColor = theme.palette.white,
49
+ outerTransparency = 0,
50
+ outerThickness = 1,
51
+ })
52
+ local _attributes = {
53
+ key = "mainText",
54
+ size = UDim2.new(1, 0, 1, 0),
55
+ text = text,
56
+ font = theme.fonts.inter.medium,
57
+ textSize = rem(3.5),
58
+ textColor = textColor,
59
+ textXAlignment = "Center",
60
+ textYAlignment = "Center",
61
+ layoutOrder = 2,
62
+ }
63
+ local _condition_1 = padding
64
+ if _condition_1 == nil then
65
+ _condition_1 = 1
66
+ end
67
+ _attributes.padding = _condition_1
68
+ _attributes.rem = rem
69
+ local _exp_2 = React.createElement(Text, _attributes)
70
+ local _attributes_1 = {
71
+ key = "arrow",
72
+ size = UDim2.new(1, 0, 1, 0),
73
+ text = "▼",
74
+ font = theme.fonts.inter.medium,
75
+ textSize = rem(3.5),
76
+ textColor = textColor,
77
+ textXAlignment = "Center",
78
+ textYAlignment = "Center",
79
+ layoutOrder = 2,
80
+ }
81
+ local _condition_2 = padding
82
+ if _condition_2 == nil then
83
+ _condition_2 = 1
84
+ end
85
+ _attributes_1.padding = _condition_2
86
+ _attributes_1.position = UDim2.new(0.5, -rem(3), 0, 0)
87
+ _attributes_1.rem = rem
88
+ return React.createElement(ReactiveButton, {
89
+ onClick = onClick,
90
+ onHover = function(hovered)
91
+ hoverMotion:spring(if hovered then 1 else 0)
92
+ local _result = onHover
93
+ if _result ~= nil then
94
+ _result(hovered)
95
+ end
96
+ end,
97
+ backgroundTransparency = 1,
98
+ anchorPoint = anchorPoint,
99
+ size = size or UDim2.new(0, rem(10), 0, rem(4)),
100
+ position = position,
101
+ layoutOrder = layoutOrder,
102
+ }, _exp, _exp_1, _exp_2, React.createElement(Text, _attributes_1))
103
+ end
104
+ return {
105
+ DropdownButton = DropdownButton,
106
+ }
@@ -0,0 +1,11 @@
1
+ import React from "@rbxts/react";
2
+ interface DropdownOptionButtonProps extends React.PropsWithChildren {
3
+ readonly text: string;
4
+ readonly onClick?: () => void;
5
+ readonly onHover?: (hovered: boolean) => void;
6
+ readonly size?: UDim2;
7
+ readonly padding?: number;
8
+ }
9
+ export declare function DropdownOptionButton({ text, onClick, onHover, size, padding, children, }: DropdownOptionButtonProps): JSX.Element;
10
+ export type { DropdownOptionButtonProps };
11
+ //# sourceMappingURL=DropdownOptionButton.d.ts.map
@@ -0,0 +1,66 @@
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", "@rbxts-ui/rem")).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, TS.getModule(script, "@rbxts-ui", "theme").dist).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 = defaultTheme
20
+ local rem = useRem()
21
+ local hover, hoverMotion = useMotion(0)
22
+ local textColor = theme.palette.crust
23
+ local _exp = React.createElement(Frame, {
24
+ backgroundColor = theme.palette.overlay0,
25
+ backgroundTransparency = lerpBinding(hover, 1, 0.8),
26
+ size = UDim2.new(1, 0, 1, 0),
27
+ })
28
+ local _result
29
+ if children then
30
+ _result = children
31
+ else
32
+ local _attributes = {
33
+ key = "mainText",
34
+ size = UDim2.new(1, 0, 1, 0),
35
+ text = text,
36
+ font = theme.fonts.inter.medium,
37
+ textSize = rem(3.5),
38
+ textColor = textColor,
39
+ textXAlignment = "Center",
40
+ textYAlignment = "Center",
41
+ layoutOrder = 2,
42
+ }
43
+ local _condition = padding
44
+ if _condition == nil then
45
+ _condition = 1
46
+ end
47
+ _attributes.padding = _condition
48
+ _attributes.rem = rem
49
+ _result = (React.createElement(Text, _attributes))
50
+ end
51
+ return React.createElement(ReactiveButton, {
52
+ onClick = onClick,
53
+ onHover = function(hovered)
54
+ hoverMotion:spring(if hovered then 1 else 0)
55
+ local _result_1 = onHover
56
+ if _result_1 ~= nil then
57
+ _result_1(hovered)
58
+ end
59
+ end,
60
+ backgroundTransparency = 1,
61
+ size = size or UDim2.new(0, rem(10), 0, rem(4)),
62
+ }, _exp, _result)
63
+ end
64
+ return {
65
+ DropdownOptionButton = DropdownOptionButton,
66
+ }
@@ -0,0 +1,21 @@
1
+ import React from "@rbxts/react";
2
+ interface IconRoundButtonProps {
3
+ readonly onClick?: () => void;
4
+ readonly emoji?: string;
5
+ readonly label?: string;
6
+ readonly primaryColor: Color3;
7
+ readonly enabled: boolean;
8
+ readonly order: number;
9
+ readonly circleSize?: number;
10
+ readonly addShadow?: boolean;
11
+ readonly width?: number;
12
+ readonly emojiSize?: number;
13
+ readonly tooltipText?: string;
14
+ readonly tooltipComponent?: React.ReactNode;
15
+ readonly position?: UDim2;
16
+ readonly onMouseDown?: () => void;
17
+ readonly onMouseUp?: () => void;
18
+ }
19
+ export declare function IconRoundButton({ onClick, emoji, label, primaryColor, enabled, order, circleSize, width, addShadow, emojiSize, tooltipText, tooltipComponent, position, onMouseDown, onMouseUp, }: IconRoundButtonProps): JSX.Element;
20
+ export type { IconRoundButtonProps };
21
+ //# sourceMappingURL=IconRoundButton.d.ts.map
@@ -0,0 +1,145 @@
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", "@rbxts-ui/rem")).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.Parent, "layout", "Padding").Padding
15
+ local Transition = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).Transition
16
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).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 = defaultTheme
50
+ local rem = useRem()
51
+ local CIRCLE_SIZE = circleSize
52
+ local EMOJI_SIZE = CIRCLE_SIZE / emojiSize
53
+ local isRound = emoji ~= nil
54
+ local HEIGHT = rem(CIRCLE_SIZE)
55
+ local WIDTH = if isRound then HEIGHT else HEIGHT + rem(width)
56
+ local transparency, transparencyMotion = useMotion(1)
57
+ useEffect(function()
58
+ transparencyMotion:spring(if enabled then 0 else 0.75, theme.springs.slow or {
59
+ tension = 250,
60
+ friction = 30,
61
+ })
62
+ end, { enabled })
63
+ local fullRound = UDim.new(1, 0)
64
+ local showTooltip, setShowTooltip = useState(false)
65
+ local _condition = tooltipText
66
+ if not (_condition ~= "" and _condition) then
67
+ _condition = tooltipComponent
68
+ end
69
+ local _condition_1 = _condition
70
+ if _condition_1 ~= "" and _condition_1 then
71
+ _condition_1 = showTooltip
72
+ end
73
+ local _result
74
+ if _condition_1 ~= "" and _condition_1 then
75
+ local _condition_2 = tooltipComponent
76
+ if _condition_2 == nil then
77
+ _condition_2 = nil
78
+ end
79
+ _result = _condition_2
80
+ else
81
+ _result = nil
82
+ end
83
+ return React.createElement(ReactiveButton, {
84
+ onClick = onClick,
85
+ backgroundTransparency = 1,
86
+ size = UDim2.new(0, WIDTH, 0, HEIGHT),
87
+ layoutOrder = order,
88
+ onMouseEnter = function()
89
+ return setShowTooltip(true)
90
+ end,
91
+ onMouseLeave = function()
92
+ return setShowTooltip(false)
93
+ end,
94
+ position = position,
95
+ onMouseDown = onMouseDown,
96
+ onMouseUp = onMouseUp,
97
+ }, React.createElement(Transition, {
98
+ groupTransparency = transparency,
99
+ size = UDim2.new(1, 0, 1, rem(2 * MARGIN_Y)),
100
+ position = UDim2.new(0, 0, 0, rem(-MARGIN_Y)),
101
+ }, _result, React.createElement(Padding, {
102
+ paddingY = rem(MARGIN_Y),
103
+ }), React.createElement(Frame, {
104
+ backgroundTransparency = 0,
105
+ backgroundColor = primaryColor,
106
+ cornerRadius = fullRound,
107
+ size = UDim2.new(1, 0, 1, 0),
108
+ }), React.createElement(HStack, {
109
+ spacing = rem(INTERNAL_PADDING),
110
+ clipsDescendants = false,
111
+ }, if emoji ~= "" and emoji then (React.createElement(Group, {
112
+ size = UDim2.new(0, rem(CIRCLE_SIZE), 0, rem(CIRCLE_SIZE)),
113
+ }, React.createElement(Frame, {
114
+ backgroundColor = theme.palette.white,
115
+ backgroundTransparency = 0.7,
116
+ cornerRadius = fullRound,
117
+ anchorPoint = Vector2.new(0.5, 0.5),
118
+ position = UDim2.new(0.5, 0, 0.5, 0),
119
+ size = UDim2.new(1, 0, 1, 0),
120
+ }, React.createElement("uistroke", {
121
+ Color = theme.palette.white,
122
+ Transparency = 0.7,
123
+ Thickness = 0.5,
124
+ })), React.createElement(Text, {
125
+ text = emoji,
126
+ textScaled = true,
127
+ anchorPoint = Vector2.new(0.5, 0.5),
128
+ size = UDim2.new(0, rem(EMOJI_SIZE), 0, rem(EMOJI_SIZE)),
129
+ position = UDim2.new(0.5, 0, 0.5, 0),
130
+ }))) else nil, if label ~= "" and label then (React.createElement(Text, {
131
+ text = label,
132
+ anchorPoint = Vector2.new(0.5, 0.5),
133
+ size = UDim2.new(1, 0, 1, 0),
134
+ position = UDim2.new(0.5, 0, 0.5, 0),
135
+ font = theme.fonts.inter.bold,
136
+ textColor = theme.palette.text,
137
+ textSize = rem(1.5),
138
+ textXAlignment = "Center",
139
+ textYAlignment = "Center",
140
+ richText = true,
141
+ })) else nil)))
142
+ end
143
+ return {
144
+ IconRoundButton = IconRoundButton,
145
+ }
@@ -0,0 +1,12 @@
1
+ interface IconTileButtonProps {
2
+ readonly icon?: string;
3
+ readonly emoji?: string;
4
+ readonly onClick: () => void;
5
+ readonly label?: string;
6
+ readonly selected?: boolean;
7
+ readonly size?: UDim2;
8
+ readonly enabled?: boolean;
9
+ }
10
+ export declare function IconTileButton({ icon, emoji, onClick, label, selected, size, enabled, }: IconTileButtonProps): JSX.Element;
11
+ export type { IconTileButtonProps };
12
+ //# sourceMappingURL=IconTileButton.d.ts.map
@@ -0,0 +1,86 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
4
+ local Frame = _primitives.Frame
5
+ local Group = _primitives.Group
6
+ local Image = _primitives.Image
7
+ local Text = _primitives.Text
8
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
9
+ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
10
+ local lerpBinding = _pretty_react_hooks.lerpBinding
11
+ local useMotion = _pretty_react_hooks.useMotion
12
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
13
+ local ReactiveButton = TS.import(script, script.Parent, "ReactiveButton").ReactiveButton
14
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
15
+ local function IconTileButton(_param)
16
+ local icon = _param.icon
17
+ local emoji = _param.emoji
18
+ local onClick = _param.onClick
19
+ local label = _param.label
20
+ local selected = _param.selected
21
+ local size = _param.size
22
+ local enabled = _param.enabled
23
+ if enabled == nil then
24
+ enabled = true
25
+ end
26
+ local theme = defaultTheme
27
+ local rem = useRem()
28
+ local hover, hoverMotion = useMotion(0)
29
+ 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)
32
+ local side = 45
33
+ local tileSize = size or UDim2.new(0, side, 0, side)
34
+ local imageSize = 0.6
35
+ return React.createElement(ReactiveButton, {
36
+ onClick = onClick,
37
+ onHover = function(hovered)
38
+ return hoverMotion:spring(if hovered then 1 else 0)
39
+ end,
40
+ backgroundTransparency = 1,
41
+ size = tileSize,
42
+ enabled = enabled,
43
+ }, React.createElement(Frame, {
44
+ backgroundTransparency = 1,
45
+ size = UDim2.new(1, 0, 1, 0),
46
+ }, React.createElement("uiaspectratioconstraint", {
47
+ AspectRatio = 1,
48
+ }), React.createElement(Frame, {
49
+ backgroundColor = backgroundColor,
50
+ backgroundTransparency = 0,
51
+ cornerRadius = UDim.new(0, roundness),
52
+ size = UDim2.new(1, 0, 1, 0),
53
+ }), if icon ~= "" and icon then (React.createElement(Image, {
54
+ image = icon,
55
+ anchorPoint = Vector2.new(0.5, 0.5),
56
+ size = UDim2.new(imageSize, 0, imageSize, 0),
57
+ position = UDim2.new(0.5, 0, if label ~= "" and label then 0.45 else 0.5, 0),
58
+ imageTransparency = if enabled then 0 else 0.7,
59
+ }, React.createElement("uicorner", {
60
+ CornerRadius = UDim.new(0, roundness),
61
+ }))) else nil, if emoji ~= "" and emoji then (React.createElement(Text, {
62
+ text = emoji,
63
+ textSize = rem(3),
64
+ textScaled = true,
65
+ textColor = theme.palette.white,
66
+ size = UDim2.new(1, 0, 1, 0),
67
+ textXAlignment = "Center",
68
+ textYAlignment = "Center",
69
+ textTransparency = if enabled then 0 else 0.7,
70
+ })) else nil, if label ~= nil and label ~= "" then (React.createElement(Group, {
71
+ anchorPoint = Vector2.new(0.5, 1),
72
+ size = UDim2.new(1, 0, 0, rem(3)),
73
+ position = UDim2.new(0.5, 0, 1, rem(2.7)),
74
+ }, React.createElement(Text, {
75
+ font = theme.fonts.inter.medium,
76
+ text = string.upper(label),
77
+ textSize = rem(1.5),
78
+ textColor = theme.palette.black,
79
+ textYAlignment = "Center",
80
+ textXAlignment = "Center",
81
+ size = UDim2.new(1, 0, 1, 0),
82
+ }))) else nil))
83
+ end
84
+ return {
85
+ IconTileButton = IconTileButton,
86
+ }
@@ -0,0 +1,23 @@
1
+ import React from "@rbxts/react";
2
+ interface PrimaryButtonProps extends React.PropsWithChildren {
3
+ name?: string;
4
+ readonly onClick?: () => void;
5
+ readonly onHover?: (hovered: boolean) => void;
6
+ readonly size?: UDim2 | React.Binding<UDim2>;
7
+ readonly position?: UDim2 | React.Binding<UDim2>;
8
+ readonly anchorPoint?: Vector2 | React.Binding<Vector2>;
9
+ readonly backgroundColor?: Color3 | React.Binding<Color3>;
10
+ readonly backgroundTransparency?: number | React.Binding<number>;
11
+ readonly overlayGradient?: ColorSequence | React.Binding<ColorSequence>;
12
+ readonly overlayTransparency?: number | React.Binding<number>;
13
+ readonly overlayRotation?: number | React.Binding<number>;
14
+ readonly layoutOrder?: number | React.Binding<number>;
15
+ readonly hasShadow?: boolean;
16
+ readonly hasOutline?: boolean;
17
+ readonly hasGlow?: boolean;
18
+ readonly hasBackground?: boolean;
19
+ readonly automaticSize?: Enum.AutomaticSize;
20
+ }
21
+ export declare function PrimaryButton({ name, onClick, onHover, size, position, anchorPoint, backgroundColor, backgroundTransparency, hasBackground, overlayGradient, overlayTransparency, overlayRotation, layoutOrder, hasShadow, hasOutline, hasGlow, automaticSize, children, }: PrimaryButtonProps): JSX.Element;
22
+ export type { PrimaryButtonProps };
23
+ //# sourceMappingURL=PrimaryButton.d.ts.map
@@ -0,0 +1,84 @@
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", "@rbxts-ui/rem")).useRem
8
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
9
+ local Outline = TS.import(script, script.Parent.Parent, "utils", "Outline").Outline
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
+ local function PrimaryButton(_param)
13
+ local name = _param.name
14
+ local onClick = _param.onClick
15
+ local onHover = _param.onHover
16
+ local size = _param.size
17
+ local position = _param.position
18
+ local anchorPoint = _param.anchorPoint
19
+ local backgroundColor = _param.backgroundColor
20
+ local backgroundTransparency = _param.backgroundTransparency
21
+ if backgroundTransparency == nil then
22
+ backgroundTransparency = 0
23
+ end
24
+ local hasBackground = _param.hasBackground
25
+ if hasBackground == nil then
26
+ hasBackground = true
27
+ end
28
+ local overlayGradient = _param.overlayGradient
29
+ local overlayTransparency = _param.overlayTransparency
30
+ if overlayTransparency == nil then
31
+ overlayTransparency = 0
32
+ end
33
+ local overlayRotation = _param.overlayRotation
34
+ local layoutOrder = _param.layoutOrder
35
+ local hasShadow = _param.hasShadow
36
+ if hasShadow == nil then
37
+ hasShadow = true
38
+ end
39
+ local hasOutline = _param.hasOutline
40
+ if hasOutline == nil then
41
+ hasOutline = true
42
+ end
43
+ local hasGlow = _param.hasGlow
44
+ if hasGlow == nil then
45
+ hasGlow = true
46
+ end
47
+ local automaticSize = _param.automaticSize
48
+ local children = _param.children
49
+ local theme = defaultTheme
50
+ local rem = useRem()
51
+ local hover, hoverMotion = useMotion(0)
52
+ return React.createElement(ReactiveButton, {
53
+ automaticSize = automaticSize,
54
+ name = name,
55
+ onClick = onClick,
56
+ onHover = function(hovered)
57
+ hoverMotion:spring(if hovered then 1 else 0)
58
+ local _result = onHover
59
+ if _result ~= nil then
60
+ _result(hovered)
61
+ end
62
+ end,
63
+ backgroundTransparency = 1,
64
+ anchorPoint = anchorPoint,
65
+ size = size,
66
+ position = position,
67
+ layoutOrder = layoutOrder,
68
+ }, if hasBackground then (React.createElement(Frame, {
69
+ backgroundColor = backgroundColor,
70
+ cornerRadius = UDim.new(0, rem(1)),
71
+ size = UDim2.new(1, 0, 1, 0),
72
+ backgroundTransparency = backgroundTransparency,
73
+ }, React.createElement("uigradient", {
74
+ Offset = lerpBinding(hover, Vector2.new(), Vector2.new(0, 1)),
75
+ Rotation = 90,
76
+ Transparency = NumberSequence.new(0, 0.1),
77
+ }))) else nil, if hasOutline then React.createElement(Outline, {
78
+ cornerRadius = UDim.new(0, rem(1)),
79
+ innerTransparency = 0,
80
+ }) else nil, children)
81
+ end
82
+ return {
83
+ PrimaryButton = PrimaryButton,
84
+ }
@@ -0,0 +1,32 @@
1
+ import React from "@rbxts/react";
2
+ interface ReactiveButtonProps extends React.PropsWithChildren {
3
+ name?: string;
4
+ onClick?: () => void;
5
+ onMouseDown?: () => void;
6
+ onMouseUp?: () => void;
7
+ onMouseEnter?: () => void;
8
+ onMouseLeave?: () => void;
9
+ onHover?: (hovered: boolean) => void;
10
+ onPress?: (pressed: boolean) => void;
11
+ enabled?: boolean;
12
+ size?: UDim2 | React.Binding<UDim2>;
13
+ position?: UDim2 | React.Binding<UDim2>;
14
+ anchorPoint?: Vector2 | React.Binding<Vector2>;
15
+ backgroundColor?: Color3 | React.Binding<Color3>;
16
+ backgroundTransparency?: number | React.Binding<number>;
17
+ cornerRadius?: UDim | React.Binding<UDim>;
18
+ layoutOrder?: number | React.Binding<number>;
19
+ animatePosition?: boolean;
20
+ animatePositionStrength?: number;
21
+ animatePositionDirection?: Vector2;
22
+ animateSize?: boolean;
23
+ animateSizeStrength?: number;
24
+ zIndex?: number | React.Binding<number>;
25
+ event?: React.InstanceEvent<TextButton>;
26
+ change?: React.InstanceChangeEvent<TextButton>;
27
+ fill?: boolean;
28
+ automaticSize?: Enum.AutomaticSize;
29
+ }
30
+ export declare function ReactiveButton({ name, onClick, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onHover, onPress, enabled, size, position, anchorPoint, backgroundColor, backgroundTransparency, cornerRadius, layoutOrder, zIndex, animatePosition, animatePositionStrength, animatePositionDirection, animateSize, animateSizeStrength, event, change, children, fill, automaticSize, }: ReactiveButtonProps): JSX.Element;
31
+ export type { ReactiveButtonProps };
32
+ //# sourceMappingURL=ReactiveButton.d.ts.map