@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,80 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function validateAngle(val)
3
+ local _condition = tonumber(val)
4
+ if _condition == nil then
5
+ _condition = 0
6
+ end
7
+ local angle = _condition
8
+ local _value = tonumber(val)
9
+ if not (_value ~= 0 and _value == _value and _value) then
10
+ return "Please enter a valid number"
11
+ end
12
+ if angle < 0 then
13
+ return "Angle must be greater than 0"
14
+ end
15
+ if angle > 180 then
16
+ return "Angle must be less than 180"
17
+ end
18
+ return nil
19
+ end
20
+ local function validatePosNumber(val)
21
+ local _condition = tonumber(val)
22
+ if _condition == nil then
23
+ _condition = 0
24
+ end
25
+ local number = _condition
26
+ local _value = tonumber(val)
27
+ if not (_value ~= 0 and _value == _value and _value) then
28
+ return "Please enter a valid number"
29
+ end
30
+ if number < 0 then
31
+ return "Number must be greater than 0"
32
+ end
33
+ return nil
34
+ end
35
+ local function validateNumber(val)
36
+ local valParsed = tonumber(val)
37
+ if not (valParsed ~= 0 and valParsed == valParsed and valParsed) and valParsed ~= 0 then
38
+ return "Please enter a valid number"
39
+ end
40
+ return nil
41
+ end
42
+ --[[
43
+ *
44
+ * Validates that a number is within specified bounds
45
+ * @param val - String value to validate
46
+ * @param min - Minimum allowed value
47
+ * @param max - Maximum allowed value
48
+ * @param customErrorMsg - Optional custom error message for bounds error
49
+ * @returns Error message or undefined if valid
50
+
51
+ ]]
52
+ local function validateNumberBounds(val, min, max, customErrorMsg)
53
+ local _condition = tonumber(val)
54
+ if _condition == nil then
55
+ _condition = 0
56
+ end
57
+ local number = _condition
58
+ local _value = tonumber(val)
59
+ local _condition_1 = not (_value ~= 0 and _value == _value and _value)
60
+ if _condition_1 then
61
+ _condition_1 = number ~= 0
62
+ end
63
+ if _condition_1 then
64
+ return "Please enter a valid number"
65
+ end
66
+ if number < min or number > max then
67
+ local _condition_2 = customErrorMsg
68
+ if _condition_2 == nil then
69
+ _condition_2 = `Number must be between {min} and {max}`
70
+ end
71
+ return _condition_2
72
+ end
73
+ return nil
74
+ end
75
+ return {
76
+ validateAngle = validateAngle,
77
+ validatePosNumber = validatePosNumber,
78
+ validateNumber = validateNumber,
79
+ validateNumberBounds = validateNumberBounds,
80
+ }
@@ -0,0 +1,36 @@
1
+ import React from "@rbxts/react";
2
+ export interface ButtonAnimation {
3
+ /**
4
+ * An underdamped spring. `-1` is fully hovered, `0` is neutral, and `1` is
5
+ * fully pressed. Values outside of this range are possible.
6
+ */
7
+ readonly position: React.Binding<number>;
8
+ /**
9
+ * A critically damped spring that is `1` when the button is pressed.
10
+ */
11
+ readonly press: React.Binding<number>;
12
+ /**
13
+ * A critically damped spring that is `1` when the button is hovered.
14
+ */
15
+ readonly hover: React.Binding<number>;
16
+ /**
17
+ * Same as `hover`, but `pressed` must be `false`.
18
+ */
19
+ readonly hoverOnly: React.Binding<number>;
20
+ }
21
+ /**
22
+ * Returns a `ButtonAnimation` object that can be used to animate a button.
23
+ * The values provided by the object are:
24
+ *
25
+ * - `position`: An underdamped spring. `-1` is fully hovered, `0` is neutral,
26
+ * and `1` is fully pressed. Values outside of this range are possible.
27
+ * - `press`: A critically damped spring that is `1` when the button is pressed.
28
+ * - `hover`: A critically damped spring that is `1` when the button is hovered.
29
+ * - `hoverExclusive`: Same as `hover`, but `pressed` must also be `false`.
30
+ *
31
+ * @param pressedState Whether the button is pressed.
32
+ * @param hoveredState Whether the button is hovered.
33
+ * @returns A `ButtonAnimation` object.
34
+ */
35
+ export declare function useButtonAnimation(pressedState: boolean, hoveredState: boolean): ButtonAnimation;
36
+ //# sourceMappingURL=use-button-animation.d.ts.map
@@ -0,0 +1,80 @@
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 useMotion = _pretty_react_hooks.useMotion
5
+ local useUpdateEffect = _pretty_react_hooks.useUpdateEffect
6
+ local useMemo = TS.import(script, TS.getModule(script, "@rbxts", "react")).useMemo
7
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
+ --[[
9
+ *
10
+ * Returns a `ButtonAnimation` object that can be used to animate a button.
11
+ * The values provided by the object are:
12
+ *
13
+ * - `position`: An underdamped spring. `-1` is fully hovered, `0` is neutral,
14
+ * and `1` is fully pressed. Values outside of this range are possible.
15
+ * - `press`: A critically damped spring that is `1` when the button is pressed.
16
+ * - `hover`: A critically damped spring that is `1` when the button is hovered.
17
+ * - `hoverExclusive`: Same as `hover`, but `pressed` must also be `false`.
18
+ *
19
+ * @param pressedState Whether the button is pressed.
20
+ * @param hoveredState Whether the button is hovered.
21
+ * @returns A `ButtonAnimation` object.
22
+
23
+ ]]
24
+ local function useButtonAnimation(pressedState, hoveredState)
25
+ local theme = defaultTheme
26
+ local press, pressMotion = useMotion(0)
27
+ local hover, hoverMotion = useMotion(0)
28
+ local hoverExclusive, hoverExclusiveMotion = useMotion(0)
29
+ local position, positionMotion = useMotion(0)
30
+ useUpdateEffect(function()
31
+ pressMotion:spring(if pressedState then 1 else 0, theme.springs.responsive)
32
+ hoverExclusiveMotion:spring(if hoveredState and not pressedState then 1 else 0, theme.springs.responsive)
33
+ end, { pressedState, hoveredState })
34
+ useUpdateEffect(function()
35
+ hoverMotion:spring(if hoveredState then 1 else 0, theme.springs.responsive)
36
+ end, { hoveredState })
37
+ useUpdateEffect(function()
38
+ if pressedState then
39
+ -- hovered -> pressed
40
+ positionMotion:spring(1, theme.springs.responsive)
41
+ elseif hoveredState then
42
+ -- pressed -> hovered
43
+ local _exp = -1
44
+ local _object = table.clone(theme.springs.bubbly)
45
+ setmetatable(_object, nil)
46
+ _object.impulse = -0.1
47
+ positionMotion:spring(_exp, _object)
48
+ else
49
+ -- pressed -> unhovered, but 'hover' was not true
50
+ local _object = table.clone(theme.springs.bubbly)
51
+ setmetatable(_object, nil)
52
+ _object.impulse = -0.07
53
+ positionMotion:spring(0, _object)
54
+ end
55
+ end, { pressedState })
56
+ useUpdateEffect(function()
57
+ if hoveredState then
58
+ -- unhovered -> hovered
59
+ positionMotion:spring(-1, theme.springs.responsive)
60
+ else
61
+ -- hovered -> unhovered
62
+ positionMotion:spring(0, theme.springs.responsive)
63
+ end
64
+ end, { hoveredState })
65
+ return useMemo(function()
66
+ return {
67
+ press = press,
68
+ hover = hover:map(function(t)
69
+ return math.clamp(t, 0, 1)
70
+ end),
71
+ hoverOnly = hoverExclusive:map(function(t)
72
+ return math.clamp(t, 0, 1)
73
+ end),
74
+ position = position,
75
+ }
76
+ end, {})
77
+ end
78
+ return {
79
+ useButtonAnimation = useButtonAnimation,
80
+ }
@@ -0,0 +1,13 @@
1
+ export interface ButtonEvents {
2
+ onMouseDown: () => void;
3
+ onMouseUp: () => void;
4
+ onMouseEnter: () => void;
5
+ onMouseLeave: () => void;
6
+ }
7
+ /**
8
+ * Returns the current state of a button based on the events returned.
9
+ * @param enabled Whether the button is enabled or not.
10
+ * @returns The press state, hover state, and a `ButtonEvents` object.
11
+ */
12
+ export declare function useButtonState(enabled?: boolean): LuaTuple<[press: boolean, hover: boolean, events: ButtonEvents]>;
13
+ //# sourceMappingURL=use-button-state.d.ts.map
@@ -0,0 +1,81 @@
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 useEventListener = _pretty_react_hooks.useEventListener
5
+ local useLatest = _pretty_react_hooks.useLatest
6
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
+ local useMemo = _react.useMemo
8
+ local useState = _react.useState
9
+ local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
10
+ local setTimeout = TS.import(script, TS.getModule(script, "@rbxts", "set-timeout").out).setTimeout
11
+ local useInputDevice = TS.import(script, script.Parent, "use-input-device").useInputDevice
12
+ --[[
13
+ *
14
+ * Returns the current state of a button based on the events returned.
15
+ * @param enabled Whether the button is enabled or not.
16
+ * @returns The press state, hover state, and a `ButtonEvents` object.
17
+
18
+ ]]
19
+ local function useButtonState(enabled)
20
+ if enabled == nil then
21
+ enabled = true
22
+ end
23
+ local _binding, setState = useState({
24
+ press = false,
25
+ hover = false,
26
+ })
27
+ local press = _binding.press
28
+ local hover = _binding.hover
29
+ local on = useLatest(enabled)
30
+ local touch = useLatest(useInputDevice() == "touch")
31
+ local events = useMemo(function()
32
+ return {
33
+ onMouseDown = function()
34
+ return setState(function(state)
35
+ local _object = table.clone(state)
36
+ setmetatable(_object, nil)
37
+ _object.press = on.current
38
+ return _object
39
+ end)
40
+ end,
41
+ onMouseUp = function()
42
+ return setState(function(state)
43
+ local _object = table.clone(state)
44
+ setmetatable(_object, nil)
45
+ _object.press = false
46
+ return _object
47
+ end)
48
+ end,
49
+ onMouseEnter = function()
50
+ return setState(function(state)
51
+ local _object = table.clone(state)
52
+ setmetatable(_object, nil)
53
+ _object.hover = on.current and not touch.current
54
+ return _object
55
+ end)
56
+ end,
57
+ onMouseLeave = function()
58
+ return setState({
59
+ press = false,
60
+ hover = false,
61
+ })
62
+ end,
63
+ }
64
+ end, {})
65
+ -- Touch devices might not fire mouse leave events, so assume that all
66
+ -- releases are a mouse leave.
67
+ useEventListener(UserInputService.InputEnded, function(input)
68
+ if input.UserInputType == Enum.UserInputType.Touch then
69
+ setTimeout(function()
70
+ setState({
71
+ press = false,
72
+ hover = false,
73
+ })
74
+ end, 0)
75
+ end
76
+ end)
77
+ return press, hover, events
78
+ end
79
+ return {
80
+ useButtonState = useButtonState,
81
+ }
@@ -0,0 +1,7 @@
1
+ export type InputDevice = "keyboard" | "gamepad" | "touch";
2
+ /**
3
+ * Returns the current input device being used by the player.
4
+ * @returns An InputDevice string.
5
+ */
6
+ export declare function useInputDevice(): InputDevice;
7
+ //# sourceMappingURL=use-input-device.d.ts.map
@@ -0,0 +1,38 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local useEventListener = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useEventListener
4
+ local useState = TS.import(script, TS.getModule(script, "@rbxts", "react")).useState
5
+ local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
6
+ local getInputType = function(inputType)
7
+ if inputType == nil then
8
+ inputType = UserInputService:GetLastInputType()
9
+ end
10
+ if inputType == Enum.UserInputType.Keyboard or inputType == Enum.UserInputType.MouseMovement then
11
+ return "keyboard"
12
+ elseif inputType == Enum.UserInputType.Gamepad1 then
13
+ return "gamepad"
14
+ elseif inputType == Enum.UserInputType.Touch then
15
+ return "touch"
16
+ end
17
+ end
18
+ --[[
19
+ *
20
+ * Returns the current input device being used by the player.
21
+ * @returns An InputDevice string.
22
+
23
+ ]]
24
+ local function useInputDevice()
25
+ local device, setDevice = useState(function()
26
+ return getInputType() or "keyboard"
27
+ end)
28
+ useEventListener(UserInputService.LastInputTypeChanged, function(inputType)
29
+ local newDevice = getInputType(inputType)
30
+ if newDevice ~= nil then
31
+ setDevice(newDevice)
32
+ end
33
+ end)
34
+ return device
35
+ end
36
+ return {
37
+ useInputDevice = useInputDevice,
38
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,49 @@
1
- export { Padding, type PaddingProps } from "./Padding";
2
- export { Divider, type DividerProps } from "./Divider";
3
- export { Checkmark, type CheckmarkProps } from "./Checkmark";
4
- export { DelayRender, type DelayRenderProps } from "./DelayRender";
5
- export { ErrorBoundary, type ErrorBoundaryProps } from "./ErrorBoundary";
6
- export { TextField, type TextFieldProps } from "./TextField";
1
+ export { Checkmark, type CheckmarkProps } from "./display/Checkmark";
2
+ export { ErrorHandler, ErrorPage } from "./error-handler/index";
3
+ export { TextBox, type TextBoxProps } from "./form/TextBox";
4
+ export { TextField, type TextFieldProps } from "./form/TextField";
5
+ export { Divider, type DividerProps } from "./layout/Divider";
6
+ export { Padding, type PaddingProps } from "./layout/Padding";
7
+ export { DelayRender, type DelayRenderProps } from "./utils/DelayRender";
8
+ export { ErrorBoundary, type ErrorBoundaryProps } from "./utils/ErrorBoundary";
9
+ export { Button, type ButtonProps } from "./buttons/Button";
10
+ export { ReactiveButton, type ReactiveButtonProps } from "./buttons/ReactiveButton";
11
+ export { useButtonAnimation, type ButtonAnimation } from "./hooks/use-button-animation";
12
+ export { useButtonState, type ButtonEvents } from "./hooks/use-button-state";
13
+ export { useInputDevice, type InputDevice } from "./hooks/use-input-device";
14
+ export { useTooltip } from "./tooltip/useTooltip";
15
+ export { ClickOutsideLayer, ClickOutsideOverlay, type ClickOutsideLayerProps, type ClickOutsideOverlayProps, } from "./utils/ClickOutsideOverlay";
16
+ export { Outline, type OutlineProps } from "./utils/Outline";
17
+ export { Checkbox, type CheckboxProps } from "./form/Checkbox";
18
+ export { Radio, type RadioProps } from "./form/Radio";
19
+ export { IconRoundButton, type IconRoundButtonProps } from "./buttons/IconRoundButton";
20
+ export { IconTileButton, type IconTileButtonProps } from "./buttons/IconTileButton";
21
+ export { PrimaryButton, type PrimaryButtonProps } from "./buttons/PrimaryButton";
22
+ export { TextButton, TextButtonVariant, type TextButtonProps } from "./buttons/TextButton";
23
+ export { CheckboxRow, type CheckboxRowProps } from "./form/CheckboxRow";
24
+ export { DropdownRow, type DropdownRowProps } from "./form/DropdownRow";
25
+ export { FormRow, type FormRowProps } from "./form/FormRow";
26
+ export { InputRow, type InputRowProps } from "./form/InputRow";
27
+ export { RadioRow, type RadioRowProps } from "./form/RadioRow";
28
+ export { Accordion, type AccordionProps } from "./layout/Accordion";
29
+ export { Section, type SectionProps } from "./layout/Section";
30
+ export { SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps } from "./layout/SegmentedToggle";
31
+ export { ExampleTable } from "./table/ExampleTable";
32
+ export { Table, type TableProps } from "./table/Table";
33
+ export { TableCell, type TableCellProps } from "./table/TableCell";
34
+ export { TableFooter, type TableFooterProps } from "./table/TableFooter";
35
+ export { TableHeader, type TableHeaderProps } from "./table/TableHeader";
36
+ export { TableRow, type TableRowProps } from "./table/TableRow";
37
+ export { DropdownButton, type DropdownButtonProps } from "./buttons/DropdownButton";
38
+ export { DropdownOptionButton, type DropdownOptionButtonProps } from "./buttons/DropdownOptionButton";
39
+ export { Dropdown, type DropdownOption, type DropdownProps } from "./form/Dropdown";
40
+ export { Legend, type LegendProps } from "./display/Legend";
41
+ export { PillText, type PillTextProps } from "./display/PillText";
42
+ export { TimeAgo, type TimeAgoProps } from "./display/TimeAgo";
43
+ export { Tooltip, type TooltipProps } from "./tooltip/Tooltip";
44
+ export { validateAngle, validateNumber, validateNumberBounds, validatePosNumber } from "./form/validation";
45
+ export { InputRound, type InputRoundProps } from "./form/InputRound";
46
+ export { RoundEmoji, type RoundEmojiProps } from "./form/RoundEmoji";
47
+ export { DynamicWindow, type ExtendableFrameProps } from "./DynamicWindow/DynamicWindow";
48
+ export { clampViewportPosition, getInputViewportPos, getMouseViewportPos, resolveWindowSpawnPosition, type Mode, type ResizeCorner, type WindowSpawnOptions, } from "./DynamicWindow/DynamicWindow.utils";
7
49
  //# sourceMappingURL=index.d.ts.map
package/dist/init.luau CHANGED
@@ -1,10 +1,76 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
- exports.Padding = TS.import(script, script, "Padding").Padding
5
- exports.Divider = TS.import(script, script, "Divider").Divider
6
- exports.Checkmark = TS.import(script, script, "Checkmark").Checkmark
7
- exports.DelayRender = TS.import(script, script, "DelayRender").DelayRender
8
- exports.ErrorBoundary = TS.import(script, script, "ErrorBoundary").ErrorBoundary
9
- exports.TextField = TS.import(script, script, "TextField").TextField
4
+ exports.Checkmark = TS.import(script, script, "display", "Checkmark").Checkmark
5
+ local _error_handler = TS.import(script, script, "error-handler")
6
+ exports.ErrorHandler = _error_handler.ErrorHandler
7
+ exports.ErrorPage = _error_handler.ErrorPage
8
+ exports.TextBox = TS.import(script, script, "form", "TextBox").TextBox
9
+ exports.TextField = TS.import(script, script, "form", "TextField").TextField
10
+ exports.Divider = TS.import(script, script, "layout", "Divider").Divider
11
+ exports.Padding = TS.import(script, script, "layout", "Padding").Padding
12
+ exports.DelayRender = TS.import(script, script, "utils", "DelayRender").DelayRender
13
+ exports.ErrorBoundary = TS.import(script, script, "utils", "ErrorBoundary").ErrorBoundary
14
+ -- Utilities
15
+ exports.Button = TS.import(script, script, "buttons", "Button").Button
16
+ exports.ReactiveButton = TS.import(script, script, "buttons", "ReactiveButton").ReactiveButton
17
+ exports.useButtonAnimation = TS.import(script, script, "hooks", "use-button-animation").useButtonAnimation
18
+ exports.useButtonState = TS.import(script, script, "hooks", "use-button-state").useButtonState
19
+ exports.useInputDevice = TS.import(script, script, "hooks", "use-input-device").useInputDevice
20
+ exports.useTooltip = TS.import(script, script, "tooltip", "useTooltip").useTooltip
21
+ local _ClickOutsideOverlay = TS.import(script, script, "utils", "ClickOutsideOverlay")
22
+ exports.ClickOutsideLayer = _ClickOutsideOverlay.ClickOutsideLayer
23
+ exports.ClickOutsideOverlay = _ClickOutsideOverlay.ClickOutsideOverlay
24
+ exports.Outline = TS.import(script, script, "utils", "Outline").Outline
25
+ -- Form Inputs
26
+ exports.Checkbox = TS.import(script, script, "form", "Checkbox").Checkbox
27
+ exports.Radio = TS.import(script, script, "form", "Radio").Radio
28
+ -- Buttons
29
+ exports.IconRoundButton = TS.import(script, script, "buttons", "IconRoundButton").IconRoundButton
30
+ exports.IconTileButton = TS.import(script, script, "buttons", "IconTileButton").IconTileButton
31
+ exports.PrimaryButton = TS.import(script, script, "buttons", "PrimaryButton").PrimaryButton
32
+ local _TextButton = TS.import(script, script, "buttons", "TextButton")
33
+ exports.TextButton = _TextButton.TextButton
34
+ exports.TextButtonVariant = _TextButton.TextButtonVariant
35
+ -- Form Layout
36
+ exports.CheckboxRow = TS.import(script, script, "form", "CheckboxRow").CheckboxRow
37
+ exports.DropdownRow = TS.import(script, script, "form", "DropdownRow").DropdownRow
38
+ exports.FormRow = TS.import(script, script, "form", "FormRow").FormRow
39
+ exports.InputRow = TS.import(script, script, "form", "InputRow").InputRow
40
+ exports.RadioRow = TS.import(script, script, "form", "RadioRow").RadioRow
41
+ exports.Accordion = TS.import(script, script, "layout", "Accordion").Accordion
42
+ exports.Section = TS.import(script, script, "layout", "Section").Section
43
+ exports.SegmentedToggle = TS.import(script, script, "layout", "SegmentedToggle").SegmentedToggle
44
+ -- Table
45
+ exports.ExampleTable = TS.import(script, script, "table", "ExampleTable").ExampleTable
46
+ exports.Table = TS.import(script, script, "table", "Table").Table
47
+ exports.TableCell = TS.import(script, script, "table", "TableCell").TableCell
48
+ exports.TableFooter = TS.import(script, script, "table", "TableFooter").TableFooter
49
+ exports.TableHeader = TS.import(script, script, "table", "TableHeader").TableHeader
50
+ exports.TableRow = TS.import(script, script, "table", "TableRow").TableRow
51
+ -- Dropdown
52
+ exports.DropdownButton = TS.import(script, script, "buttons", "DropdownButton").DropdownButton
53
+ exports.DropdownOptionButton = TS.import(script, script, "buttons", "DropdownOptionButton").DropdownOptionButton
54
+ exports.Dropdown = TS.import(script, script, "form", "Dropdown").Dropdown
55
+ -- Display
56
+ exports.Legend = TS.import(script, script, "display", "Legend").Legend
57
+ exports.PillText = TS.import(script, script, "display", "PillText").PillText
58
+ exports.TimeAgo = TS.import(script, script, "display", "TimeAgo").TimeAgo
59
+ exports.Tooltip = TS.import(script, script, "tooltip", "Tooltip").Tooltip
60
+ -- Form Validation
61
+ local _validation = TS.import(script, script, "form", "validation")
62
+ exports.validateAngle = _validation.validateAngle
63
+ exports.validateNumber = _validation.validateNumber
64
+ exports.validateNumberBounds = _validation.validateNumberBounds
65
+ exports.validatePosNumber = _validation.validatePosNumber
66
+ -- Form Input Components
67
+ exports.InputRound = TS.import(script, script, "form", "InputRound").InputRound
68
+ exports.RoundEmoji = TS.import(script, script, "form", "RoundEmoji").RoundEmoji
69
+ -- DynamicWindow
70
+ exports.DynamicWindow = TS.import(script, script, "DynamicWindow", "DynamicWindow").DynamicWindow
71
+ local _DynamicWindow_utils = TS.import(script, script, "DynamicWindow", "DynamicWindow.utils")
72
+ exports.clampViewportPosition = _DynamicWindow_utils.clampViewportPosition
73
+ exports.getInputViewportPos = _DynamicWindow_utils.getInputViewportPos
74
+ exports.getMouseViewportPos = _DynamicWindow_utils.getMouseViewportPos
75
+ exports.resolveWindowSpawnPosition = _DynamicWindow_utils.resolveWindowSpawnPosition
10
76
  return exports
@@ -0,0 +1,14 @@
1
+ import React from "@rbxts/react";
2
+ interface AccordionProps {
3
+ title: string;
4
+ children: React.ReactNode;
5
+ isExpanded: boolean;
6
+ onExpandedChange: (expanded: boolean) => void;
7
+ backgroundColor?: Color3;
8
+ backgroundTransparency?: number;
9
+ cornerRadius?: number;
10
+ sortOrder?: Enum.SortOrder;
11
+ }
12
+ export declare function Accordion({ title, children, backgroundColor, backgroundTransparency, cornerRadius, sortOrder, isExpanded, onExpandedChange, }: AccordionProps): JSX.Element;
13
+ export type { AccordionProps };
14
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1,101 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local VStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).VStack
4
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
5
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
6
+ local useMotion = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useMotion
7
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
8
+ local React = _react
9
+ local useEffect = _react.useEffect
10
+ local useState = _react.useState
11
+ local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
12
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
13
+ local DEFAULT_EXPANDED = true
14
+ local function Accordion(_param)
15
+ local title = _param.title
16
+ local children = _param.children
17
+ local backgroundColor = _param.backgroundColor
18
+ local backgroundTransparency = _param.backgroundTransparency
19
+ if backgroundTransparency == nil then
20
+ backgroundTransparency = 0.8
21
+ end
22
+ local cornerRadius = _param.cornerRadius
23
+ if cornerRadius == nil then
24
+ cornerRadius = 2
25
+ end
26
+ local sortOrder = _param.sortOrder
27
+ if sortOrder == nil then
28
+ sortOrder = Enum.SortOrder.Name
29
+ end
30
+ local isExpanded = _param.isExpanded
31
+ local onExpandedChange = _param.onExpandedChange
32
+ local theme = defaultTheme
33
+ local rem = useRem()
34
+ local contentHeight, setContentHeight = useState(0)
35
+ -- Header visual height must match the header button height below (rem(5))
36
+ local headerHeight = rem(5)
37
+ local size, sizeMotion = useMotion(UDim2.new(1, 0, 0, headerHeight))
38
+ local contentSize, contentSizeMotion = useMotion(UDim2.new(1, 0, 0, if isExpanded then contentHeight else 0))
39
+ local textSize = rem(3.5)
40
+ local defaultBgColor = backgroundColor or theme.palette.blueishColor
41
+ useEffect(function()
42
+ local target = if isExpanded then contentHeight else 0
43
+ contentSizeMotion:spring(UDim2.new(1, 0, 0, target), theme.springs.gentle)
44
+ -- Keep outer size equal to header + animated content height for clipping
45
+ sizeMotion:spring(UDim2.new(1, 0, 0, headerHeight + target), theme.springs.gentle)
46
+ end, { isExpanded, contentHeight, headerHeight })
47
+ local handleToggle = function()
48
+ local nextExpanded = not isExpanded
49
+ onExpandedChange(nextExpanded)
50
+ end
51
+ return React.createElement(VStack, {
52
+ size = size,
53
+ backgroundTransparency = backgroundTransparency,
54
+ backgroundColor = defaultBgColor,
55
+ verticalAlignment = Enum.VerticalAlignment.Center,
56
+ clipsDescendants = true,
57
+ }, React.createElement("uicorner", {
58
+ CornerRadius = UDim.new(0, rem(cornerRadius)),
59
+ }), React.createElement(ReactiveButton, {
60
+ onClick = handleToggle,
61
+ backgroundTransparency = 1,
62
+ size = UDim2.new(1, 0, 0, rem(5)),
63
+ }, React.createElement(Text, {
64
+ text = title,
65
+ textSize = textSize,
66
+ font = theme.fonts.roboto.light,
67
+ textScaled = true,
68
+ textColor = theme.palette.crust,
69
+ size = UDim2.new(1, 0, 1, 0),
70
+ textYAlignment = "Center",
71
+ }, React.createElement("uiflexitem", {
72
+ FlexMode = Enum.UIFlexMode.Fill,
73
+ })), React.createElement(Text, {
74
+ text = if isExpanded then "×" else "+",
75
+ textSize = rem(4),
76
+ textScaled = true,
77
+ textColor = theme.palette.crust,
78
+ size = UDim2.new(0, rem(5), 1, 0),
79
+ textYAlignment = "Center",
80
+ position = UDim2.new(1, 0, 0, 0),
81
+ anchorPoint = Vector2.new(1, 0),
82
+ })), React.createElement("frame", {
83
+ Size = contentSize,
84
+ BackgroundTransparency = 1,
85
+ ClipsDescendants = true,
86
+ }, React.createElement(VStack, {
87
+ padding = rem(2),
88
+ spacing = rem(2),
89
+ size = UDim2.new(1, 0, 0, 0),
90
+ automaticSize = Enum.AutomaticSize.Y,
91
+ change = {
92
+ AbsoluteSize = function(rbx)
93
+ setContentHeight(rbx.AbsoluteSize.Y)
94
+ end,
95
+ },
96
+ sortOrder = sortOrder,
97
+ }, children)))
98
+ end
99
+ return {
100
+ Accordion = Accordion,
101
+ }
@@ -2,7 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
5
- local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "rem").dist).useRem
5
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
6
6
  local DEFAULT_COLOR = Color3.fromRGB(255, 255, 255)
7
7
  local function Divider(_param)
8
8
  local orientation = _param.orientation
@@ -0,0 +1,10 @@
1
+ import React from "@rbxts/react";
2
+ interface SectionProps {
3
+ title: string;
4
+ children: React.ReactNode;
5
+ cornerRadius?: number;
6
+ sortOrder?: Enum.SortOrder;
7
+ }
8
+ export declare function Section({ title, children, cornerRadius, sortOrder, }: SectionProps): JSX.Element;
9
+ export type { SectionProps };
10
+ //# sourceMappingURL=Section.d.ts.map
@@ -0,0 +1,51 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local VStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).VStack
4
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
5
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
6
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
+ local function Section(_param)
9
+ local title = _param.title
10
+ local children = _param.children
11
+ local cornerRadius = _param.cornerRadius
12
+ if cornerRadius == nil then
13
+ cornerRadius = 2
14
+ end
15
+ local sortOrder = _param.sortOrder
16
+ if sortOrder == nil then
17
+ sortOrder = Enum.SortOrder.Name
18
+ end
19
+ local theme = defaultTheme
20
+ local rem = useRem()
21
+ local textSize = rem(3.5)
22
+ return React.createElement(VStack, {
23
+ size = UDim2.new(1, 0, 0, 0),
24
+ automaticSize = Enum.AutomaticSize.Y,
25
+ verticalAlignment = Enum.VerticalAlignment.Top,
26
+ }, React.createElement("uicorner", {
27
+ CornerRadius = UDim.new(0, rem(cornerRadius)),
28
+ }), React.createElement(VStack, {
29
+ size = UDim2.new(1, 0, 0, rem(8)),
30
+ backgroundTransparency = 1,
31
+ }, React.createElement(Text, {
32
+ text = title,
33
+ textSize = rem(3),
34
+ textScaled = true,
35
+ richText = true,
36
+ textColor = theme.palette.crust,
37
+ size = UDim2.new(1, 0, 1, 0),
38
+ textYAlignment = "Center",
39
+ textXAlignment = "Left",
40
+ }, React.createElement("uiflexitem", {
41
+ FlexMode = Enum.UIFlexMode.Fill,
42
+ }))), React.createElement(VStack, {
43
+ spacing = rem(2),
44
+ size = UDim2.new(1, 0, 0, 0),
45
+ automaticSize = Enum.AutomaticSize.Y,
46
+ sortOrder = sortOrder,
47
+ }, children))
48
+ end
49
+ return {
50
+ Section = Section,
51
+ }