@rbxts-ui/components 2.1.0 → 3.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 (125) 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/{DropdownButton.d.ts → buttons/DropdownButton.d.ts} +1 -3
  10. package/dist/{DropdownButton.luau → buttons/DropdownButton.luau} +4 -9
  11. package/dist/{DropdownOptionButton.d.ts → buttons/DropdownOptionButton.d.ts} +1 -3
  12. package/dist/{DropdownOptionButton.luau → buttons/DropdownOptionButton.luau} +3 -7
  13. package/dist/{IconRoundButton.d.ts → buttons/IconRoundButton.d.ts} +1 -3
  14. package/dist/{IconRoundButton.luau → buttons/IconRoundButton.luau} +4 -8
  15. package/dist/{IconTileButton.d.ts → buttons/IconTileButton.d.ts} +1 -3
  16. package/dist/{IconTileButton.luau → buttons/IconTileButton.luau} +8 -11
  17. package/dist/{PrimaryButton.d.ts → buttons/PrimaryButton.d.ts} +1 -3
  18. package/dist/{PrimaryButton.luau → buttons/PrimaryButton.luau} +4 -9
  19. package/dist/{ReactiveButton.d.ts → buttons/ReactiveButton.d.ts} +1 -3
  20. package/dist/{ReactiveButton.luau → buttons/ReactiveButton.luau} +5 -10
  21. package/dist/{TextButton.d.ts → buttons/TextButton.d.ts} +1 -3
  22. package/dist/{TextButton.luau → buttons/TextButton.luau} +7 -11
  23. package/dist/display/AlertBox.d.ts +11 -0
  24. package/dist/display/AlertBox.luau +56 -0
  25. package/dist/display/AlertBox.story.d.ts +12 -0
  26. package/dist/display/AlertBox.story.luau +37 -0
  27. package/dist/{Checkmark.luau → display/Checkmark.luau} +1 -1
  28. package/dist/{Legend.luau → display/Legend.luau} +1 -1
  29. package/dist/{PillText.d.ts → display/PillText.d.ts} +0 -2
  30. package/dist/{PillText.luau → display/PillText.luau} +6 -10
  31. package/dist/error-handler/ErrorHandler.d.ts +3 -0
  32. package/dist/error-handler/ErrorHandler.luau +18 -0
  33. package/dist/error-handler/ErrorPage.d.ts +6 -0
  34. package/dist/error-handler/ErrorPage.luau +144 -0
  35. package/dist/error-handler/index.d.ts +3 -0
  36. package/dist/error-handler/init.luau +6 -0
  37. package/dist/{Checkbox.d.ts → form/Checkbox.d.ts} +1 -3
  38. package/dist/{Checkbox.luau → form/Checkbox.luau} +5 -10
  39. package/dist/{CheckboxRow.d.ts → form/CheckboxRow.d.ts} +1 -3
  40. package/dist/{CheckboxRow.luau → form/CheckboxRow.luau} +4 -8
  41. package/dist/{Dropdown.d.ts → form/Dropdown.d.ts} +0 -2
  42. package/dist/{Dropdown.luau → form/Dropdown.luau} +7 -12
  43. package/dist/form/DropdownRow.d.ts +18 -0
  44. package/dist/form/DropdownRow.luau +28 -0
  45. package/dist/form/FormRow.d.ts +9 -0
  46. package/dist/{FormRow.luau → form/FormRow.luau} +3 -6
  47. package/dist/form/InputRound.d.ts +18 -0
  48. package/dist/form/InputRound.luau +218 -0
  49. package/dist/form/InputRow.d.ts +13 -0
  50. package/dist/form/InputRow.luau +32 -0
  51. package/dist/{Radio.d.ts → form/Radio.d.ts} +1 -3
  52. package/dist/{Radio.luau → form/Radio.luau} +5 -10
  53. package/dist/{RadioRow.d.ts → form/RadioRow.d.ts} +1 -3
  54. package/dist/{RadioRow.luau → form/RadioRow.luau} +4 -8
  55. package/dist/form/RoundEmoji.d.ts +8 -0
  56. package/dist/form/RoundEmoji.luau +40 -0
  57. package/dist/form/TextBox.d.ts +24 -0
  58. package/dist/form/TextBox.luau +57 -0
  59. package/dist/{TextField.d.ts → form/TextField.d.ts} +1 -1
  60. package/dist/{TextField.luau → form/TextField.luau} +4 -2
  61. package/dist/form/validation.d.ts +13 -0
  62. package/dist/form/validation.luau +80 -0
  63. package/dist/{use-button-animation.d.ts → hooks/use-button-animation.d.ts} +1 -3
  64. package/dist/{use-button-animation.luau → hooks/use-button-animation.luau} +3 -6
  65. package/dist/icons/InfoIcon.d.ts +8 -0
  66. package/dist/icons/InfoIcon.luau +80 -0
  67. package/dist/icons/WarningIcon.d.ts +8 -0
  68. package/dist/icons/WarningIcon.luau +85 -0
  69. package/dist/icons/WarningIcon.story.d.ts +16 -0
  70. package/dist/icons/WarningIcon.story.luau +60 -0
  71. package/dist/index.d.ts +52 -32
  72. package/dist/init.luau +68 -34
  73. package/dist/{Accordion.d.ts → layout/Accordion.d.ts} +1 -3
  74. package/dist/{Accordion.luau → layout/Accordion.luau} +4 -8
  75. package/dist/{Divider.luau → layout/Divider.luau} +1 -1
  76. package/dist/{Section.d.ts → layout/Section.d.ts} +1 -3
  77. package/dist/{Section.luau → layout/Section.luau} +4 -7
  78. package/dist/{SegmentedToggle.d.ts → layout/SegmentedToggle.d.ts} +1 -3
  79. package/dist/{SegmentedToggle.luau → layout/SegmentedToggle.luau} +4 -7
  80. package/dist/layout/SegmentedToggle.story.d.ts +10 -0
  81. package/dist/layout/SegmentedToggle.story.luau +72 -0
  82. package/dist/table/ExampleTable.d.ts +2 -0
  83. package/dist/table/ExampleTable.luau +46 -0
  84. package/dist/table/Table.d.ts +10 -0
  85. package/dist/table/Table.luau +26 -0
  86. package/dist/table/TableCell.d.ts +9 -0
  87. package/dist/table/TableCell.luau +26 -0
  88. package/dist/table/TableFooter.d.ts +9 -0
  89. package/dist/table/TableFooter.luau +12 -0
  90. package/dist/table/TableHeader.d.ts +9 -0
  91. package/dist/table/TableHeader.luau +12 -0
  92. package/dist/table/TableRow.d.ts +9 -0
  93. package/dist/table/TableRow.luau +24 -0
  94. package/dist/tooltip/Tooltip.d.ts +14 -0
  95. package/dist/tooltip/Tooltip.luau +65 -0
  96. package/dist/tooltip/useTooltip.d.ts +12 -0
  97. package/dist/tooltip/useTooltip.luau +40 -0
  98. package/dist/tsconfig.tsbuildinfo +1 -1
  99. package/dist/utils/InputCapture.d.ts +14 -0
  100. package/dist/utils/InputCapture.luau +217 -0
  101. package/dist/{Outline.d.ts → utils/Outline.d.ts} +1 -3
  102. package/dist/{Outline.luau → utils/Outline.luau} +3 -6
  103. package/package.json +12 -9
  104. package/dist/FormRow.d.ts +0 -11
  105. package/dist/theme.d.ts +0 -41
  106. package/dist/theme.luau +0 -58
  107. /package/dist/{Button.d.ts → buttons/Button.d.ts} +0 -0
  108. /package/dist/{Button.luau → buttons/Button.luau} +0 -0
  109. /package/dist/{Checkmark.d.ts → display/Checkmark.d.ts} +0 -0
  110. /package/dist/{Legend.d.ts → display/Legend.d.ts} +0 -0
  111. /package/dist/{TimeAgo.d.ts → display/TimeAgo.d.ts} +0 -0
  112. /package/dist/{TimeAgo.luau → display/TimeAgo.luau} +0 -0
  113. /package/dist/{use-button-state.d.ts → hooks/use-button-state.d.ts} +0 -0
  114. /package/dist/{use-button-state.luau → hooks/use-button-state.luau} +0 -0
  115. /package/dist/{use-input-device.d.ts → hooks/use-input-device.d.ts} +0 -0
  116. /package/dist/{use-input-device.luau → hooks/use-input-device.luau} +0 -0
  117. /package/dist/{Divider.d.ts → layout/Divider.d.ts} +0 -0
  118. /package/dist/{Padding.d.ts → layout/Padding.d.ts} +0 -0
  119. /package/dist/{Padding.luau → layout/Padding.luau} +0 -0
  120. /package/dist/{ClickOutsideOverlay.d.ts → utils/ClickOutsideOverlay.d.ts} +0 -0
  121. /package/dist/{ClickOutsideOverlay.luau → utils/ClickOutsideOverlay.luau} +0 -0
  122. /package/dist/{DelayRender.d.ts → utils/DelayRender.d.ts} +0 -0
  123. /package/dist/{DelayRender.luau → utils/DelayRender.luau} +0 -0
  124. /package/dist/{ErrorBoundary.d.ts → utils/ErrorBoundary.d.ts} +0 -0
  125. /package/dist/{ErrorBoundary.luau → utils/ErrorBoundary.luau} +0 -0
@@ -0,0 +1,40 @@
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 Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
5
+ local Group = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Group
6
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
7
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
8
+ local function RoundEmoji(_param)
9
+ local emoji = _param.emoji
10
+ local primary = _param.primary
11
+ local height = _param.height
12
+ if height == nil then
13
+ height = 4
14
+ end
15
+ local rem = useRem()
16
+ local fullRound = UDim.new(1, 0)
17
+ local CIRCLE_SIZE = height
18
+ local EMOJI_SIZE = CIRCLE_SIZE / 1.5
19
+ return React.createElement(Group, {
20
+ size = UDim2.new(0, rem(CIRCLE_SIZE), 0, rem(CIRCLE_SIZE)),
21
+ }, React.createElement(Frame, {
22
+ backgroundColor = primary,
23
+ backgroundTransparency = 0.8,
24
+ cornerRadius = fullRound,
25
+ anchorPoint = Vector2.new(0.5, 0.5),
26
+ position = UDim2.new(0.5, 0, 0.5, 0),
27
+ size = UDim2.new(1, 0, 1, 0),
28
+ }), React.createElement(Text, {
29
+ text = emoji,
30
+ textScaled = true,
31
+ anchorPoint = Vector2.new(0.5, 0.5),
32
+ position = UDim2.new(0.5, 0, 0.5, 0),
33
+ size = UDim2.new(0, rem(EMOJI_SIZE), 0, rem(EMOJI_SIZE)),
34
+ textXAlignment = "Center",
35
+ textYAlignment = "Center",
36
+ }))
37
+ end
38
+ return {
39
+ RoundEmoji = RoundEmoji,
40
+ }
@@ -0,0 +1,24 @@
1
+ import { FrameProps } from "@rbxts-ui/primitives";
2
+ import React from "@rbxts/react";
3
+ export interface TextBoxProps<T extends Instance = TextBox> extends FrameProps<T> {
4
+ font?: Font;
5
+ text?: string | React.Binding<string>;
6
+ textColor?: Color3 | React.Binding<Color3>;
7
+ textSize?: number | React.Binding<number>;
8
+ textTransparency?: number | React.Binding<number>;
9
+ textWrapped?: boolean | React.Binding<boolean>;
10
+ textXAlignment?: React.InferEnumNames<Enum.TextXAlignment>;
11
+ textYAlignment?: React.InferEnumNames<Enum.TextYAlignment>;
12
+ textTruncate?: React.InferEnumNames<Enum.TextTruncate>;
13
+ textScaled?: boolean | React.Binding<boolean>;
14
+ textHeight?: number | React.Binding<number>;
15
+ textAutoResize?: "X" | "Y" | "XY";
16
+ richText?: boolean | React.Binding<boolean>;
17
+ maxVisibleGraphemes?: number | React.Binding<number>;
18
+ lineHeight?: number | React.Binding<number>;
19
+ clearTextOnFocus?: boolean;
20
+ placeholderText?: string;
21
+ textEditable?: boolean | React.Binding<boolean>;
22
+ }
23
+ export declare const TextBox: React.ForwardRefExoticComponent<Omit<TextBoxProps<TextBox>, "ref"> & React.RefAttributes<TextBox>>;
24
+ //# sourceMappingURL=TextBox.d.ts.map
@@ -0,0 +1,57 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local fonts = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).fonts
4
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
5
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
6
+ local React = _react
7
+ local forwardRef = _react.forwardRef
8
+ local TextBox = forwardRef(function(props, ref)
9
+ local rem = useRem()
10
+ local _attributes = {
11
+ ref = ref,
12
+ Font = Enum.Font.Arial,
13
+ FontFace = props.font or fonts.inter.regular,
14
+ Text = props.text,
15
+ TextColor3 = props.textColor,
16
+ }
17
+ local _condition = props.textSize
18
+ if _condition == nil then
19
+ _condition = rem(1)
20
+ end
21
+ _attributes.TextSize = _condition
22
+ _attributes.TextTransparency = props.textTransparency
23
+ _attributes.TextWrapped = props.textWrapped
24
+ _attributes.TextXAlignment = props.textXAlignment
25
+ _attributes.TextYAlignment = props.textYAlignment
26
+ _attributes.TextTruncate = props.textTruncate
27
+ _attributes.TextScaled = props.textScaled
28
+ _attributes.LineHeight = props.lineHeight
29
+ _attributes.RichText = props.richText
30
+ _attributes.MaxVisibleGraphemes = props.maxVisibleGraphemes
31
+ _attributes.Size = props.size
32
+ _attributes.AutomaticSize = props.textAutoResize or props.automaticSize
33
+ _attributes.Position = props.position
34
+ _attributes.AnchorPoint = props.anchorPoint
35
+ _attributes.BackgroundColor3 = props.backgroundColor
36
+ local _condition_1 = props.backgroundTransparency
37
+ if _condition_1 == nil then
38
+ _condition_1 = 1
39
+ end
40
+ _attributes.BackgroundTransparency = _condition_1
41
+ _attributes.ClipsDescendants = props.clipsDescendants
42
+ _attributes.Visible = props.visible
43
+ _attributes.ZIndex = props.zIndex
44
+ _attributes.LayoutOrder = props.layoutOrder
45
+ _attributes.Change = props.change
46
+ _attributes.Event = props.event
47
+ _attributes.Rotation = props.rotation
48
+ _attributes.ClearTextOnFocus = props.clearTextOnFocus
49
+ _attributes.PlaceholderText = props.placeholderText
50
+ _attributes.TextEditable = props.textEditable
51
+ return React.createElement("textbox", _attributes, props.children, props.cornerRadius and React.createElement("uicorner", {
52
+ CornerRadius = props.cornerRadius,
53
+ }))
54
+ end)
55
+ return {
56
+ TextBox = TextBox,
57
+ }
@@ -8,5 +8,5 @@ export interface TextFieldProps extends TextProps<TextBox> {
8
8
  multiLine?: boolean | React.Binding<boolean>;
9
9
  textEditable?: boolean | React.Binding<boolean>;
10
10
  }
11
- export declare function TextField(props: TextFieldProps): JSX.Element;
11
+ export declare const TextField: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & React.RefAttributes<TextBox>>;
12
12
  //# sourceMappingURL=TextField.d.ts.map
@@ -2,12 +2,13 @@
2
2
  local TS = _G[script]
3
3
  local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local React = _react
5
+ local forwardRef = _react.forwardRef
5
6
  local useEffect = _react.useEffect
6
7
  local useState = _react.useState
7
8
  local _primitives = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist)
8
9
  local fonts = _primitives.fonts
9
10
  local Group = _primitives.Group
10
- local function TextField(props)
11
+ local TextField = forwardRef(function(props, ref)
11
12
  local childRef, setChildRef = useState(nil)
12
13
  useEffect(function()
13
14
  local _condition = childRef
@@ -27,6 +28,7 @@ local function TextField(props)
27
28
  end
28
29
  end, { childRef, props.text })
29
30
  local _attributes = {
31
+ ref = ref,
30
32
  PlaceholderText = props.placeholderText,
31
33
  PlaceholderColor3 = props.placeholderColor,
32
34
  ClearTextOnFocus = props.clearTextOnFocus,
@@ -65,7 +67,7 @@ local function TextField(props)
65
67
  }), React.createElement(Group, {
66
68
  ref = setChildRef,
67
69
  }))
68
- end
70
+ end)
69
71
  return {
70
72
  TextField = TextField,
71
73
  }
@@ -0,0 +1,13 @@
1
+ export declare function validateAngle(val: string): "Please enter a valid number" | "Angle must be greater than 0" | "Angle must be less than 180" | undefined;
2
+ export declare function validatePosNumber(val: string): "Please enter a valid number" | "Number must be greater than 0" | undefined;
3
+ export declare function validateNumber(val: string): "Please enter a valid number" | undefined;
4
+ /**
5
+ * Validates that a number is within specified bounds
6
+ * @param val - String value to validate
7
+ * @param min - Minimum allowed value
8
+ * @param max - Maximum allowed value
9
+ * @param customErrorMsg - Optional custom error message for bounds error
10
+ * @returns Error message or undefined if valid
11
+ */
12
+ export declare function validateNumberBounds(val: string, min: number, max: number, customErrorMsg?: string): string | undefined;
13
+ //# sourceMappingURL=validation.d.ts.map
@@ -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
+ }
@@ -1,5 +1,4 @@
1
1
  import React from "@rbxts/react";
2
- import { type Theme } from "./theme";
3
2
  export interface ButtonAnimation {
4
3
  /**
5
4
  * An underdamped spring. `-1` is fully hovered, `0` is neutral, and `1` is
@@ -31,8 +30,7 @@ export interface ButtonAnimation {
31
30
  *
32
31
  * @param pressedState Whether the button is pressed.
33
32
  * @param hoveredState Whether the button is hovered.
34
- * @param theme Optional theme for spring configs.
35
33
  * @returns A `ButtonAnimation` object.
36
34
  */
37
- export declare function useButtonAnimation(pressedState: boolean, hoveredState: boolean, theme?: Theme): ButtonAnimation;
35
+ export declare function useButtonAnimation(pressedState: boolean, hoveredState: boolean): ButtonAnimation;
38
36
  //# sourceMappingURL=use-button-animation.d.ts.map
@@ -4,7 +4,7 @@ local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pr
4
4
  local useMotion = _pretty_react_hooks.useMotion
5
5
  local useUpdateEffect = _pretty_react_hooks.useUpdateEffect
6
6
  local useMemo = TS.import(script, TS.getModule(script, "@rbxts", "react")).useMemo
7
- local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
7
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
8
  --[[
9
9
  *
10
10
  * Returns a `ButtonAnimation` object that can be used to animate a button.
@@ -18,14 +18,11 @@ local defaultTheme = TS.import(script, script.Parent, "theme").defaultTheme
18
18
  *
19
19
  * @param pressedState Whether the button is pressed.
20
20
  * @param hoveredState Whether the button is hovered.
21
- * @param theme Optional theme for spring configs.
22
21
  * @returns A `ButtonAnimation` object.
23
22
 
24
23
  ]]
25
- local function useButtonAnimation(pressedState, hoveredState, theme)
26
- if theme == nil then
27
- theme = defaultTheme
28
- end
24
+ local function useButtonAnimation(pressedState, hoveredState)
25
+ local theme = defaultTheme
29
26
  local press, pressMotion = useMotion(0)
30
27
  local hover, hoverMotion = useMotion(0)
31
28
  local hoverExclusive, hoverExclusiveMotion = useMotion(0)
@@ -0,0 +1,8 @@
1
+ import React from "@rbxts/react";
2
+ interface InfoIconProps {
3
+ tooltipText: string;
4
+ portalRef?: React.MutableRefObject<Frame | undefined>;
5
+ }
6
+ export declare function InfoIcon({ tooltipText, portalRef }: InfoIconProps): JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=InfoIcon.d.ts.map
@@ -0,0 +1,80 @@
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 Text = _primitives.Text
6
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
7
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
9
+ local React = _react
10
+ local useEffect = _react.useEffect
11
+ local useRef = _react.useRef
12
+ local useState = _react.useState
13
+ local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
14
+ local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
15
+ local Tooltip = TS.import(script, script.Parent.Parent, "tooltip", "Tooltip").Tooltip
16
+ local function InfoIcon(_param)
17
+ local tooltipText = _param.tooltipText
18
+ local portalRef = _param.portalRef
19
+ local rem = useRem()
20
+ local showTooltip, setShowTooltip = useState(false)
21
+ local iconRef = useRef()
22
+ local tooltipPos, setTooltipPos = useState()
23
+ local iconWidth = rem(4)
24
+ useEffect(function()
25
+ if showTooltip and iconRef.current then
26
+ local absPos = iconRef.current.AbsolutePosition
27
+ local absSize = iconRef.current.AbsoluteSize
28
+ local centerPos = UDim2.fromOffset(absPos.X + absSize.X / 2, absPos.Y + absSize.Y / 2)
29
+ setTooltipPos(centerPos)
30
+ end
31
+ end, { showTooltip })
32
+ local _exp = React.createElement(ReactiveButton, {
33
+ size = UDim2.new(1, 0, 1, 0),
34
+ position = UDim2.new(0, 0, 0, 0),
35
+ onMouseEnter = function()
36
+ return setShowTooltip(true)
37
+ end,
38
+ onMouseLeave = function()
39
+ return setShowTooltip(false)
40
+ end,
41
+ backgroundColor = defaultTheme.palette.overlay0,
42
+ backgroundTransparency = 0.5,
43
+ cornerRadius = UDim.new(0.5, 0),
44
+ }, React.createElement(Text, {
45
+ text = "?",
46
+ textSize = rem(3),
47
+ textScaled = true,
48
+ textColor = defaultTheme.palette.white,
49
+ size = UDim2.new(1, 0, 1, 0),
50
+ textXAlignment = "Center",
51
+ textYAlignment = "Center",
52
+ }))
53
+ local _condition = showTooltip
54
+ if _condition then
55
+ local _result = portalRef
56
+ if _result ~= nil then
57
+ _result = _result.current
58
+ end
59
+ _condition = _result
60
+ if _condition then
61
+ _condition = createPortal(React.createElement(Tooltip, {
62
+ text = tooltipText,
63
+ visible = true,
64
+ position = tooltipPos,
65
+ offsetX = rem(4),
66
+ offsetY = rem(-4),
67
+ maxWidth = 40,
68
+ anchorPoint = Vector2.new(1, 1),
69
+ }), portalRef.current)
70
+ end
71
+ end
72
+ return React.createElement(Frame, {
73
+ size = UDim2.new(0, iconWidth, 0, iconWidth),
74
+ backgroundTransparency = 1,
75
+ ref = iconRef,
76
+ }, _exp, _condition)
77
+ end
78
+ return {
79
+ InfoIcon = InfoIcon,
80
+ }
@@ -0,0 +1,8 @@
1
+ import React from "@rbxts/react";
2
+ interface WarningIconProps {
3
+ tooltipText?: string;
4
+ portalRef?: React.MutableRefObject<Frame | undefined>;
5
+ }
6
+ export declare function WarningIcon({ tooltipText, portalRef }: WarningIconProps): JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=WarningIcon.d.ts.map
@@ -0,0 +1,85 @@
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 Text = _primitives.Text
6
+ local useRem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem")).useRem
7
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
8
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
9
+ local React = _react
10
+ local useEffect = _react.useEffect
11
+ local useRef = _react.useRef
12
+ local useState = _react.useState
13
+ local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
14
+ local ReactiveButton = TS.import(script, script.Parent.Parent, "buttons", "ReactiveButton").ReactiveButton
15
+ local Tooltip = TS.import(script, script.Parent.Parent, "tooltip", "Tooltip").Tooltip
16
+ local function WarningIcon(_param)
17
+ local tooltipText = _param.tooltipText
18
+ local portalRef = _param.portalRef
19
+ local rem = useRem()
20
+ local _condition = tooltipText
21
+ if _condition == nil then
22
+ _condition = "Warning"
23
+ end
24
+ local warningText = _condition
25
+ local showTooltip, setShowTooltip = useState(false)
26
+ local iconRef = useRef()
27
+ local tooltipPos, setTooltipPos = useState()
28
+ local iconWidth = rem(6)
29
+ useEffect(function()
30
+ if showTooltip and iconRef.current then
31
+ local absPos = iconRef.current.AbsolutePosition
32
+ local absSize = iconRef.current.AbsoluteSize
33
+ local centerPos = UDim2.fromOffset(absPos.X + absSize.X / 2, absPos.Y + absSize.Y / 2)
34
+ setTooltipPos(centerPos)
35
+ end
36
+ end, { showTooltip })
37
+ local _exp = React.createElement(ReactiveButton, {
38
+ size = UDim2.new(1, 0, 1, 0),
39
+ position = UDim2.new(0, 0, 0, 0),
40
+ onMouseEnter = function()
41
+ return setShowTooltip(true)
42
+ end,
43
+ onMouseLeave = function()
44
+ return setShowTooltip(false)
45
+ end,
46
+ backgroundColor = defaultTheme.palette.white,
47
+ backgroundTransparency = 0.5,
48
+ cornerRadius = UDim.new(0.5, 0),
49
+ }, React.createElement(Text, {
50
+ text = "⚠️",
51
+ textSize = rem(3),
52
+ textScaled = true,
53
+ textColor = defaultTheme.palette.white,
54
+ size = UDim2.new(1, 0, 1, 0),
55
+ textXAlignment = "Center",
56
+ textYAlignment = "Center",
57
+ }))
58
+ local _condition_1 = showTooltip
59
+ if _condition_1 then
60
+ local _result = portalRef
61
+ if _result ~= nil then
62
+ _result = _result.current
63
+ end
64
+ _condition_1 = _result
65
+ if _condition_1 then
66
+ _condition_1 = createPortal(React.createElement(Tooltip, {
67
+ text = warningText,
68
+ visible = true,
69
+ position = tooltipPos,
70
+ offsetX = rem(4),
71
+ offsetY = rem(-4),
72
+ maxWidth = 35,
73
+ anchorPoint = Vector2.new(1, 1),
74
+ }), portalRef.current)
75
+ end
76
+ end
77
+ return React.createElement(Frame, {
78
+ size = UDim2.new(0, iconWidth, 0, iconWidth),
79
+ backgroundTransparency = 1,
80
+ ref = iconRef,
81
+ }, _exp, _condition_1)
82
+ end
83
+ return {
84
+ WarningIcon = WarningIcon,
85
+ }
@@ -0,0 +1,16 @@
1
+ import React from "@rbxts/react";
2
+ import ReactRoblox from "@rbxts/react-roblox";
3
+ import { InferFusionProps } from "@rbxts/ui-labs";
4
+ declare const controls: {
5
+ unionPartsCount: import("@rbxts/ui-labs/src/ControlTypings/Advanced").AdvancedTypes.Slider;
6
+ };
7
+ declare const story: {
8
+ react: typeof React;
9
+ reactRoblox: typeof ReactRoblox;
10
+ controls: {
11
+ unionPartsCount: import("@rbxts/ui-labs/src/ControlTypings/Advanced").AdvancedTypes.Slider;
12
+ };
13
+ story: (props: InferFusionProps<typeof controls>) => JSX.Element;
14
+ };
15
+ export = story;
16
+ //# sourceMappingURL=WarningIcon.story.d.ts.map
@@ -0,0 +1,60 @@
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 ReactRoblox = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox"))
5
+ local Slider = TS.import(script, TS.getModule(script, "@rbxts", "ui-labs").src).Slider
6
+ local _rem = TS.import(script, TS.getModule(script, "@rbxts-ui", "@rbxts-ui/rem"))
7
+ local useRem = _rem.useRem
8
+ local RemProvider = _rem.RemProvider
9
+ local WarningIcon = TS.import(script, script.Parent, "WarningIcon").WarningIcon
10
+ local HStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).HStack
11
+ local VStack = TS.import(script, TS.getModule(script, "@rbxts-ui", "layout").dist).VStack
12
+ local Text = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Text
13
+ local defaultTheme = TS.import(script, TS.getModule(script, "@rbxts-ui", "theme").dist).defaultTheme
14
+ local Frame = TS.import(script, TS.getModule(script, "@rbxts-ui", "primitives").dist).Frame
15
+ local useRef = TS.import(script, TS.getModule(script, "@rbxts", "react")).useRef
16
+ local StoryComponent = function(props)
17
+ local rem = useRem()
18
+ local portalRef = useRef()
19
+ return React.createElement(RemProvider, {
20
+ baseRem = 16,
21
+ maximumRem = 32,
22
+ }, React.createElement(Frame, {
23
+ size = UDim2.new(1, 0, 1, 0),
24
+ backgroundTransparency = 1,
25
+ ref = portalRef,
26
+ }, React.createElement(VStack, {
27
+ size = UDim2.new(1, 0, 1, 0),
28
+ spacing = rem(4),
29
+ verticalAlignment = Enum.VerticalAlignment.Center,
30
+ horizontalAlignment = Enum.HorizontalAlignment.Center,
31
+ }, React.createElement(Text, {
32
+ text = `Testing WarningIcon with {props.unionPartsCount} union parts`,
33
+ textSize = rem(4),
34
+ textColor = defaultTheme.palette.text,
35
+ }), React.createElement(HStack, {
36
+ spacing = rem(4),
37
+ horizontalAlignment = Enum.HorizontalAlignment.Center,
38
+ }, React.createElement(Text, {
39
+ text = "Warning Icon:",
40
+ textSize = rem(3),
41
+ textColor = defaultTheme.palette.text,
42
+ }), React.createElement(WarningIcon, {
43
+ tooltipText = `Selection contains {props.unionPartsCount} UnionOperation part(s). You should separate it unless you know what you are doing.`,
44
+ portalRef = portalRef,
45
+ })))))
46
+ end
47
+ local controls = {
48
+ unionPartsCount = Slider(1, 0, 20, 1),
49
+ }
50
+ local story = {
51
+ react = React,
52
+ reactRoblox = ReactRoblox,
53
+ controls = controls,
54
+ story = function(props)
55
+ return React.createElement(StoryComponent, {
56
+ unionPartsCount = props.controls.unionPartsCount,
57
+ })
58
+ end,
59
+ }
60
+ return story
package/dist/index.d.ts CHANGED
@@ -1,33 +1,53 @@
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";
7
- export { defaultTheme, type Theme } from "./theme";
8
- export { Outline, type OutlineProps } from "./Outline";
9
- export { Button, type ButtonProps } from "./Button";
10
- export { ReactiveButton, type ReactiveButtonProps } from "./ReactiveButton";
11
- export { ClickOutsideOverlay, ClickOutsideLayer, type ClickOutsideOverlayProps, type ClickOutsideLayerProps } from "./ClickOutsideOverlay";
12
- export { useInputDevice, type InputDevice } from "./use-input-device";
13
- export { useButtonState, type ButtonEvents } from "./use-button-state";
14
- export { useButtonAnimation, type ButtonAnimation } from "./use-button-animation";
15
- export { Checkbox, type CheckboxProps } from "./Checkbox";
16
- export { Radio, type RadioProps } from "./Radio";
17
- export { PrimaryButton, type PrimaryButtonProps } from "./PrimaryButton";
18
- export { TextButton, TextButtonVariant, type TextButtonProps } from "./TextButton";
19
- export { IconRoundButton, type IconRoundButtonProps } from "./IconRoundButton";
20
- export { IconTileButton, type IconTileButtonProps } from "./IconTileButton";
21
- export { FormRow, type FormRowProps } from "./FormRow";
22
- export { CheckboxRow, type CheckboxRowProps } from "./CheckboxRow";
23
- export { RadioRow, type RadioRowProps } from "./RadioRow";
24
- export { SegmentedToggle, type SegmentedToggleProps, type SegmentedToggleOption } from "./SegmentedToggle";
25
- export { Section, type SectionProps } from "./Section";
26
- export { Accordion, type AccordionProps } from "./Accordion";
27
- export { Dropdown, type DropdownProps, type DropdownOption } from "./Dropdown";
28
- export { DropdownButton, type DropdownButtonProps } from "./DropdownButton";
29
- export { DropdownOptionButton, type DropdownOptionButtonProps } from "./DropdownOptionButton";
30
- export { TimeAgo, type TimeAgoProps } from "./TimeAgo";
31
- export { Legend, type LegendProps } from "./Legend";
32
- export { PillText, type PillTextProps } from "./PillText";
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 { InputCapture, type InputCaptureProps } from "./utils/InputCapture";
17
+ export { Outline, type OutlineProps } from "./utils/Outline";
18
+ export { Checkbox, type CheckboxProps } from "./form/Checkbox";
19
+ export { Radio, type RadioProps } from "./form/Radio";
20
+ export { IconRoundButton, type IconRoundButtonProps } from "./buttons/IconRoundButton";
21
+ export { IconTileButton, type IconTileButtonProps } from "./buttons/IconTileButton";
22
+ export { PrimaryButton, type PrimaryButtonProps } from "./buttons/PrimaryButton";
23
+ export { TextButton, TextButtonVariant, type TextButtonProps } from "./buttons/TextButton";
24
+ export { CheckboxRow, type CheckboxRowProps } from "./form/CheckboxRow";
25
+ export { DropdownRow, type DropdownRowProps } from "./form/DropdownRow";
26
+ export { FormRow, type FormRowProps } from "./form/FormRow";
27
+ export { InputRow, type InputRowProps } from "./form/InputRow";
28
+ export { RadioRow, type RadioRowProps } from "./form/RadioRow";
29
+ export { Accordion, type AccordionProps } from "./layout/Accordion";
30
+ export { Section, type SectionProps } from "./layout/Section";
31
+ export { SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps } from "./layout/SegmentedToggle";
32
+ export { ExampleTable } from "./table/ExampleTable";
33
+ export { Table, type TableProps } from "./table/Table";
34
+ export { TableCell, type TableCellProps } from "./table/TableCell";
35
+ export { TableFooter, type TableFooterProps } from "./table/TableFooter";
36
+ export { TableHeader, type TableHeaderProps } from "./table/TableHeader";
37
+ export { TableRow, type TableRowProps } from "./table/TableRow";
38
+ export { DropdownButton, type DropdownButtonProps } from "./buttons/DropdownButton";
39
+ export { DropdownOptionButton, type DropdownOptionButtonProps } from "./buttons/DropdownOptionButton";
40
+ export { Dropdown, type DropdownOption, type DropdownProps } from "./form/Dropdown";
41
+ export { AlertBox, type AlertBoxVariant } from "./display/AlertBox";
42
+ export { Legend, type LegendProps } from "./display/Legend";
43
+ export { PillText, type PillTextProps } from "./display/PillText";
44
+ export { TimeAgo, type TimeAgoProps } from "./display/TimeAgo";
45
+ export { Tooltip, type TooltipProps } from "./tooltip/Tooltip";
46
+ export { InfoIcon } from "./icons/InfoIcon";
47
+ export { WarningIcon } from "./icons/WarningIcon";
48
+ export { validateAngle, validateNumber, validateNumberBounds, validatePosNumber } from "./form/validation";
49
+ export { InputRound, type InputRoundProps } from "./form/InputRound";
50
+ export { RoundEmoji, type RoundEmojiProps } from "./form/RoundEmoji";
51
+ export { DynamicWindow, type ExtendableFrameProps } from "./DynamicWindow/DynamicWindow";
52
+ export { clampViewportPosition, getInputViewportPos, getMouseViewportPos, resolveWindowSpawnPosition, type Mode, type ResizeCorner, type WindowSpawnOptions, } from "./DynamicWindow/DynamicWindow.utils";
33
53
  //# sourceMappingURL=index.d.ts.map