@rbxts/react-clean-ui 1.0.5

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 (134) hide show
  1. package/README.md +3 -0
  2. package/out/Components/Decorator/BoxShadow.d.ts +10 -0
  3. package/out/Components/Decorator/BoxShadow.luau +41 -0
  4. package/out/Components/Decorator/Corners.d.ts +7 -0
  5. package/out/Components/Decorator/Corners.luau +15 -0
  6. package/out/Components/Decorator/Padding.d.ts +3 -0
  7. package/out/Components/Decorator/Padding.luau +18 -0
  8. package/out/Components/Decorator/index.d.ts +3 -0
  9. package/out/Components/Decorator/init.luau +13 -0
  10. package/out/Components/Input/Button.d.ts +24 -0
  11. package/out/Components/Input/Button.luau +159 -0
  12. package/out/Components/Input/Checkbox.d.ts +12 -0
  13. package/out/Components/Input/Checkbox.luau +79 -0
  14. package/out/Components/Input/HoverButton.d.ts +16 -0
  15. package/out/Components/Input/HoverButton.luau +127 -0
  16. package/out/Components/Input/Input.d.ts +12 -0
  17. package/out/Components/Input/Input.luau +92 -0
  18. package/out/Components/Input/Select.d.ts +30 -0
  19. package/out/Components/Input/Select.luau +288 -0
  20. package/out/Components/Input/Slider.d.ts +51 -0
  21. package/out/Components/Input/Slider.luau +415 -0
  22. package/out/Components/Input/index.d.ts +6 -0
  23. package/out/Components/Input/init.luau +22 -0
  24. package/out/Components/Layout/Column.d.ts +13 -0
  25. package/out/Components/Layout/Column.luau +60 -0
  26. package/out/Components/Layout/Container.d.ts +6 -0
  27. package/out/Components/Layout/Container.luau +73 -0
  28. package/out/Components/Layout/Draggable.d.ts +46 -0
  29. package/out/Components/Layout/Draggable.luau +315 -0
  30. package/out/Components/Layout/Droppable.d.ts +10 -0
  31. package/out/Components/Layout/Droppable.luau +34 -0
  32. package/out/Components/Layout/Fieldset.d.ts +34 -0
  33. package/out/Components/Layout/Fieldset.luau +130 -0
  34. package/out/Components/Layout/FlexItem.d.ts +11 -0
  35. package/out/Components/Layout/FlexItem.luau +20 -0
  36. package/out/Components/Layout/Group.d.ts +34 -0
  37. package/out/Components/Layout/Group.luau +168 -0
  38. package/out/Components/Layout/HStack.d.ts +12 -0
  39. package/out/Components/Layout/HStack.luau +21 -0
  40. package/out/Components/Layout/Row.d.ts +15 -0
  41. package/out/Components/Layout/Row.luau +87 -0
  42. package/out/Components/Layout/Scroller.d.ts +7 -0
  43. package/out/Components/Layout/Scroller.luau +54 -0
  44. package/out/Components/Layout/Tabs.d.ts +31 -0
  45. package/out/Components/Layout/Tabs.luau +189 -0
  46. package/out/Components/Layout/VStack.d.ts +11 -0
  47. package/out/Components/Layout/VStack.luau +21 -0
  48. package/out/Components/Layout/index.d.ts +12 -0
  49. package/out/Components/Layout/init.luau +40 -0
  50. package/out/Components/Navigation/Menu.d.ts +19 -0
  51. package/out/Components/Navigation/Menu.luau +91 -0
  52. package/out/Components/Navigation/index.d.ts +1 -0
  53. package/out/Components/Navigation/init.luau +7 -0
  54. package/out/Components/Surface/Box.d.ts +7 -0
  55. package/out/Components/Surface/Box.luau +50 -0
  56. package/out/Components/Surface/Card.d.ts +25 -0
  57. package/out/Components/Surface/Card.luau +138 -0
  58. package/out/Components/Surface/Icon.d.ts +10 -0
  59. package/out/Components/Surface/Icon.luau +64 -0
  60. package/out/Components/Surface/Panel.d.ts +4 -0
  61. package/out/Components/Surface/Panel.luau +33 -0
  62. package/out/Components/Surface/index.d.ts +4 -0
  63. package/out/Components/Surface/init.luau +16 -0
  64. package/out/Components/Typography/Text.d.ts +18 -0
  65. package/out/Components/Typography/Text.luau +48 -0
  66. package/out/Components/Typography/index.d.ts +1 -0
  67. package/out/Components/Typography/init.luau +7 -0
  68. package/out/Components/index.d.ts +8 -0
  69. package/out/Components/init.luau +28 -0
  70. package/out/Contexts/draggable.context.d.ts +8 -0
  71. package/out/Contexts/draggable.context.luau +7 -0
  72. package/out/Contexts/droppable.context.d.ts +6 -0
  73. package/out/Contexts/droppable.context.luau +7 -0
  74. package/out/Contexts/index.d.ts +6 -0
  75. package/out/Contexts/init.luau +22 -0
  76. package/out/Contexts/navigation.context.d.ts +5 -0
  77. package/out/Contexts/navigation.context.luau +9 -0
  78. package/out/Contexts/overlay.context.d.ts +13 -0
  79. package/out/Contexts/overlay.context.luau +17 -0
  80. package/out/Contexts/row.context.d.ts +9 -0
  81. package/out/Contexts/row.context.luau +12 -0
  82. package/out/Contexts/theme.context.d.ts +3 -0
  83. package/out/Contexts/theme.context.luau +8 -0
  84. package/out/Helpers/breakpoint.helper.d.ts +7 -0
  85. package/out/Helpers/breakpoint.helper.luau +124 -0
  86. package/out/Helpers/color.helper.d.ts +5 -0
  87. package/out/Helpers/color.helper.luau +101 -0
  88. package/out/Helpers/create-ui-story.d.ts +16 -0
  89. package/out/Helpers/create-ui-story.luau +38 -0
  90. package/out/Helpers/css.helper.d.ts +12 -0
  91. package/out/Helpers/css.helper.luau +114 -0
  92. package/out/Helpers/gui.helper.d.ts +10 -0
  93. package/out/Helpers/gui.helper.luau +134 -0
  94. package/out/Helpers/index.d.ts +8 -0
  95. package/out/Helpers/init.luau +28 -0
  96. package/out/Helpers/size.helper.d.ts +14 -0
  97. package/out/Helpers/size.helper.luau +162 -0
  98. package/out/Helpers/spacing.helper.d.ts +7 -0
  99. package/out/Helpers/spacing.helper.luau +57 -0
  100. package/out/Helpers/typography.helper.d.ts +7 -0
  101. package/out/Helpers/typography.helper.luau +91 -0
  102. package/out/Interfaces/clean.element.props.d.ts +109 -0
  103. package/out/Interfaces/clean.element.props.luau +5 -0
  104. package/out/Interfaces/icon.d.ts +2 -0
  105. package/out/Interfaces/icon.luau +2 -0
  106. package/out/Interfaces/index.d.ts +3 -0
  107. package/out/Interfaces/init.luau +13 -0
  108. package/out/Interfaces/userinput.d.ts +22 -0
  109. package/out/Interfaces/userinput.luau +8 -0
  110. package/out/Providers/index.d.ts +3 -0
  111. package/out/Providers/init.luau +13 -0
  112. package/out/Providers/overlay.provider.d.ts +3 -0
  113. package/out/Providers/overlay.provider.luau +25 -0
  114. package/out/Providers/registry.provider.d.ts +33 -0
  115. package/out/Providers/registry.provider.luau +119 -0
  116. package/out/Providers/theme.provider.d.ts +8 -0
  117. package/out/Providers/theme.provider.luau +12 -0
  118. package/out/Theme/CleanTheme.d.ts +169 -0
  119. package/out/Theme/CleanTheme.luau +2 -0
  120. package/out/Theme/DefaultIcons.d.ts +2 -0
  121. package/out/Theme/DefaultIcons.luau +791 -0
  122. package/out/Theme/index.d.ts +3 -0
  123. package/out/Theme/init.luau +13 -0
  124. package/out/Theme/themes/dark.theme.d.ts +2 -0
  125. package/out/Theme/themes/dark.theme.luau +345 -0
  126. package/out/Theme/themes/default.theme.d.ts +2 -0
  127. package/out/Theme/themes/default.theme.luau +403 -0
  128. package/out/Theme/themes/index.d.ts +3 -0
  129. package/out/Theme/themes/init.luau +13 -0
  130. package/out/Theme/themes/sandstone.theme.d.ts +2 -0
  131. package/out/Theme/themes/sandstone.theme.luau +345 -0
  132. package/out/index.d.ts +6 -0
  133. package/out/init.luau +22 -0
  134. package/package.json +43 -0
@@ -0,0 +1,315 @@
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 Component = _react.Component
6
+ local ReactComponent = _react.ReactComponent
7
+ local useContext = _react.useContext
8
+ local GuiHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").GuiHelper
9
+ local _Providers = TS.import(script, script.Parent.Parent.Parent, "Providers")
10
+ local DraggableRegistryKey = _Providers.DraggableRegistryKey
11
+ local DroppableRegistryKey = _Providers.DroppableRegistryKey
12
+ local RegistryContext = _Providers.RegistryContext
13
+ local _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
14
+ local CleanThemeContext = _Contexts.CleanThemeContext
15
+ local DraggableContext = _Contexts.DraggableContext
16
+ local OverlayConsumer = _Contexts.OverlayConsumer
17
+ local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
18
+ local Corners = TS.import(script, script.Parent.Parent, "Decorator").Corners
19
+ local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "Interfaces").CustomInputService
20
+ local function DragHandle(_param)
21
+ local children = _param.children
22
+ local draggable = React.useContext(DraggableContext)
23
+ local _arg0 = draggable ~= nil
24
+ assert(_arg0, "Draggable.Handle must be used inside a Draggable component")
25
+ local childEvents = children.props.Event
26
+ React.useEffect(function()
27
+ local inputChangedListener = CustomInputService.InputChanged:Connect(function(input)
28
+ if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
29
+ draggable.updateDrag(input)
30
+ end
31
+ end)
32
+ local inputEndedListener = CustomInputService.InputEnded:Connect(function(input)
33
+ if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
34
+ draggable.endDrag(input)
35
+ end
36
+ end)
37
+ return function()
38
+ inputChangedListener:Disconnect()
39
+ inputEndedListener:Disconnect()
40
+ end
41
+ end, { draggable })
42
+ local _object = {
43
+ Active = true,
44
+ }
45
+ local _left = "Event"
46
+ local _object_1 = {}
47
+ if childEvents then
48
+ for _k, _v in childEvents do
49
+ _object_1[_k] = _v
50
+ end
51
+ end
52
+ _object_1.InputBegan = function(instance, input)
53
+ local _result = childEvents
54
+ if _result ~= nil then
55
+ _result = _result.InputBegan
56
+ if _result ~= nil then
57
+ _result(instance, input)
58
+ end
59
+ end
60
+ if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
61
+ draggable.beginDrag(input, instance)
62
+ end
63
+ end
64
+ _object[_left] = _object_1
65
+ return React.cloneElement(children, _object)
66
+ end
67
+ local function Placeholder(props)
68
+ local theme = useContext(CleanThemeContext)
69
+ local _attributes = table.clone(props)
70
+ setmetatable(_attributes, nil)
71
+ _attributes.BackgroundTransparency = theme.components.draggable.placeholder.backgroundTransparency
72
+ _attributes.BackgroundColor3 = theme.components.draggable.placeholder.backgroundColor
73
+ return React.createElement("frame", _attributes, React.createElement("uistroke", {
74
+ Thickness = theme.components.draggable.placeholder.borderThickness,
75
+ BorderStrokePosition = Enum.BorderStrokePosition.Inner,
76
+ Color = theme.components.draggable.placeholder.borderColor,
77
+ }), React.createElement(Corners, {
78
+ radius = theme.components.draggable.placeholder.cornerRadius,
79
+ }))
80
+ end
81
+ local Draggable
82
+ do
83
+ local super = Component
84
+ Draggable = setmetatable({}, {
85
+ __tostring = function()
86
+ return "Draggable"
87
+ end,
88
+ __index = super,
89
+ })
90
+ Draggable.__index = Draggable
91
+ function Draggable.new(...)
92
+ local self = setmetatable({}, Draggable)
93
+ return self:constructor(...) or self
94
+ end
95
+ function Draggable:constructor(...)
96
+ super.constructor(self, ...)
97
+ self.state = {
98
+ dragging = false,
99
+ overlayPosition = Vector2.zero,
100
+ overlaySize = Vector2.zero,
101
+ placeholderPosition = UDim2.fromOffset(0, 0),
102
+ placeholderAnchorPoint = Vector2.zero,
103
+ placeholderLayoutOrder = 0,
104
+ placeholderZIndex = 1,
105
+ }
106
+ self.rootRef = React.createRef()
107
+ self.placeholderRef = React.createRef()
108
+ local _condition = self.props.placeholder
109
+ if _condition == nil then
110
+ _condition = true
111
+ end
112
+ self.usePlaceholder = _condition
113
+ self.beginDrag = function(input, handle)
114
+ local root = self.rootRef.current
115
+ if root == nil then
116
+ return nil
117
+ end
118
+ local _allDraggables = self.context
119
+ if _allDraggables ~= nil then
120
+ _allDraggables = _allDraggables.getAll(DraggableRegistryKey)
121
+ end
122
+ local allDraggables = _allDraggables
123
+ local _result = allDraggables
124
+ if _result ~= nil then
125
+ -- ▼ ReadonlyArray.some ▼
126
+ local _result_1 = false
127
+ local _callback = function(registration)
128
+ return registration.draggable.isDragging
129
+ end
130
+ for _k, _v in _result do
131
+ if _callback(_v, _k - 1, _result) then
132
+ _result_1 = true
133
+ break
134
+ end
135
+ end
136
+ -- ▲ ReadonlyArray.some ▲
137
+ _result = _result_1
138
+ end
139
+ if _result then
140
+ return nil
141
+ end
142
+ if self.registration ~= nil then
143
+ self.registration.draggable.isDragging = true
144
+ end
145
+ self.dragInformation = {
146
+ input = input,
147
+ inputStart = Vector2.new(input.Position.X, input.Position.Y),
148
+ absolutePositionStart = root.AbsolutePosition,
149
+ positionStart = root.Position,
150
+ }
151
+ local _result_1 = self.props.onStartDrag
152
+ if _result_1 ~= nil then
153
+ _result_1()
154
+ end
155
+ self:setState({
156
+ dragging = true,
157
+ overlayPosition = root.AbsolutePosition,
158
+ overlaySize = root.AbsoluteSize,
159
+ placeholderPosition = root.Position,
160
+ placeholderAnchorPoint = root.AnchorPoint,
161
+ placeholderLayoutOrder = root.LayoutOrder,
162
+ placeholderZIndex = root.ZIndex,
163
+ })
164
+ end
165
+ self.updateDrag = function(input)
166
+ local root = self.rootRef.current
167
+ local drag = self.dragInformation
168
+ if root == nil or drag == nil then
169
+ return nil
170
+ end
171
+ local inputPosition = Vector2.new(input.Position.X, input.Position.Y)
172
+ local _inputStart = drag.inputStart
173
+ local delta = inputPosition - _inputStart
174
+ local overlayPosition = drag.absolutePositionStart + delta
175
+ local dropRegisteration = self:findDroppable(root, Vector2.new(input.Position.X, input.Position.Y))
176
+ local _result = self.props.onDragged
177
+ if _result ~= nil then
178
+ _result(dropRegisteration)
179
+ end
180
+ self:setState({
181
+ overlayPosition = overlayPosition,
182
+ })
183
+ end
184
+ self.endDrag = function(input)
185
+ local root = self.rootRef.current
186
+ local drag = self.dragInformation
187
+ if root == nil or drag == nil then
188
+ return nil
189
+ end
190
+ if self.registration then
191
+ self.registration.draggable.isDragging = false
192
+ end
193
+ local dropRegisteration = self:findDroppable(root, Vector2.new(input.Position.X, input.Position.Y))
194
+ self.dragInformation = nil
195
+ local _result = self.props.onDropped
196
+ if _result ~= nil then
197
+ _result(dropRegisteration)
198
+ end
199
+ if self.props.retainPosition then
200
+ local parent = root.Parent
201
+ local _result_1 = parent
202
+ if _result_1 ~= nil then
203
+ _result_1 = _result_1:IsA("GuiObject")
204
+ end
205
+ if _result_1 then
206
+ local _overlayPosition = self.state.overlayPosition
207
+ local _absolutePosition = parent.AbsolutePosition
208
+ local localTopLeft = _overlayPosition - _absolutePosition
209
+ local _absoluteSize = root.AbsoluteSize
210
+ local _anchorPoint = root.AnchorPoint
211
+ local anchorOffset = _absoluteSize * _anchorPoint
212
+ root.Position = UDim2.fromOffset(localTopLeft.X + anchorOffset.X, localTopLeft.Y + anchorOffset.Y)
213
+ end
214
+ end
215
+ self:setState({
216
+ dragging = false,
217
+ })
218
+ end
219
+ self.contextValue = {
220
+ isDragging = false,
221
+ beginDrag = self.beginDrag,
222
+ updateDrag = self.updateDrag,
223
+ endDrag = self.endDrag,
224
+ }
225
+ end
226
+ function Draggable:componentDidMount()
227
+ local registry = self.context
228
+ local root = self.rootRef.current
229
+ if registry == nil or root == nil then
230
+ return nil
231
+ end
232
+ local registration = {
233
+ guiObject = root,
234
+ id = self.props.id,
235
+ draggable = self.contextValue,
236
+ }
237
+ self.registration = registration
238
+ registry.register(root, DraggableRegistryKey, registration)
239
+ end
240
+ function Draggable:componentWillUnmount()
241
+ local registry = self.context
242
+ local registration = self.registration
243
+ if registry == nil or registration == nil then
244
+ return nil
245
+ end
246
+ registry.unregister(registration.guiObject, DraggableRegistryKey)
247
+ self.registration = nil
248
+ end
249
+ function Draggable:findDroppable(instance, position)
250
+ local result
251
+ local _exp = GuiHelper:getGuiObjectsAtPosition(instance, position)
252
+ -- ▼ ReadonlyArray.forEach ▼
253
+ local _callback = function(guiObject)
254
+ local _registryEntry = self.context
255
+ if _registryEntry ~= nil then
256
+ _registryEntry = _registryEntry.get(guiObject, DroppableRegistryKey)
257
+ end
258
+ local registryEntry = _registryEntry
259
+ if registryEntry then
260
+ local _result = registryEntry
261
+ if _result ~= nil then
262
+ _result.drop(instance)
263
+ end
264
+ result = registryEntry
265
+ end
266
+ end
267
+ for _k, _v in _exp do
268
+ _callback(_v, _k - 1, _exp)
269
+ end
270
+ -- ▲ ReadonlyArray.forEach ▲
271
+ return result
272
+ end
273
+ function Draggable:render()
274
+ local original = React.cloneElement(self.props.children, {
275
+ ref = self.rootRef,
276
+ Visible = not self.state.dragging,
277
+ })
278
+ local placeholder = (React.createElement(Placeholder, {
279
+ ref = self.placeholderRef,
280
+ Position = self.state.placeholderPosition,
281
+ AnchorPoint = self.state.placeholderAnchorPoint,
282
+ Size = UDim2.fromOffset(self.state.overlaySize.X, self.state.overlaySize.Y),
283
+ AutomaticSize = Enum.AutomaticSize.None,
284
+ BackgroundTransparency = 0.3,
285
+ LayoutOrder = self.state.placeholderLayoutOrder,
286
+ ZIndex = self.state.placeholderZIndex,
287
+ }))
288
+ return React.createElement(DraggableContext.Provider, {
289
+ value = self.contextValue,
290
+ }, self.usePlaceholder and self.state.dragging and placeholder, original, React.createElement(OverlayConsumer, {
291
+ render = function(overlay)
292
+ if not self.state.dragging or overlay == nil then
293
+ return nil
294
+ end
295
+ local _overlayPosition = self.state.overlayPosition
296
+ local _absolutePosition = overlay.AbsolutePosition
297
+ local localPosition = _overlayPosition - _absolutePosition
298
+ return createPortal(React.cloneElement(self.props.children, {
299
+ Position = UDim2.fromOffset(localPosition.X, localPosition.Y),
300
+ Size = UDim2.fromOffset(self.state.overlaySize.X, self.state.overlaySize.Y),
301
+ AnchorPoint = Vector2.zero,
302
+ AutomaticSize = Enum.AutomaticSize.None,
303
+ Visible = true,
304
+ ZIndex = 100001,
305
+ }), overlay)
306
+ end,
307
+ }))
308
+ end
309
+ Draggable.Handle = DragHandle
310
+ Draggable.contextType = RegistryContext
311
+ Draggable = ReactComponent(Draggable) or Draggable
312
+ end
313
+ return {
314
+ Draggable = Draggable,
315
+ }
@@ -0,0 +1,10 @@
1
+ import React from "@rbxts/react";
2
+ type GuiObjectProps = React.InstanceProps<GuiObject>;
3
+ type GuiElement = React.ReactElement<GuiObjectProps>;
4
+ interface DroppableProps {
5
+ id?: string;
6
+ children: GuiElement;
7
+ onDrop?: (draggedObject: GuiObject) => void;
8
+ }
9
+ export declare function Droppable(props: DroppableProps): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,34 @@
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 _ = TS.import(script, script.Parent.Parent.Parent, "Providers")
5
+ local DroppableRegistryKey = _.DroppableRegistryKey
6
+ local useRegistryRegistration = _.useRegistryRegistration
7
+ local DroppableContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").DroppableContext
8
+ local function Droppable(props)
9
+ local _binding = useRegistryRegistration(DroppableRegistryKey, function(guiObject)
10
+ return {
11
+ guiObject = guiObject,
12
+ id = props.id,
13
+ drop = function(draggedObject)
14
+ local _result = props.onDrop
15
+ if _result ~= nil then
16
+ _result(draggedObject)
17
+ end
18
+ end,
19
+ }
20
+ end, { props.id, props.onDrop })
21
+ local ref = _binding.ref
22
+ local registration = _binding.registration
23
+ local child = React.cloneElement(props.children, {
24
+ ref = ref,
25
+ })
26
+ return React.createElement(DroppableContext.Provider, {
27
+ value = {
28
+ registration = registration,
29
+ },
30
+ }, child)
31
+ end
32
+ return {
33
+ Droppable = Droppable,
34
+ }
@@ -0,0 +1,34 @@
1
+ import React, { Component } from "@rbxts/react";
2
+ import { CleanThemeContext } from "../../Contexts";
3
+ import { Breakpoint, BreakPointElementProps } from "../../Interfaces";
4
+ export interface FieldsetContextValue {
5
+ disabled: boolean;
6
+ checkbox: boolean;
7
+ labelActivated?: BindableEvent;
8
+ }
9
+ export declare const FieldsetContext: React.Context<FieldsetContextValue | undefined>;
10
+ interface FieldsetProps extends BreakPointElementProps {
11
+ disabled?: boolean;
12
+ checkbox?: boolean;
13
+ wrap?: Breakpoint;
14
+ }
15
+ interface FieldsetSlotProps {
16
+ children?: React.ReactNode;
17
+ }
18
+ declare function FieldsetLabel(props: FieldsetSlotProps): React.JSX.Element;
19
+ declare function FieldsetControl(props: FieldsetSlotProps): React.JSX.Element;
20
+ interface FieldsetState {
21
+ width: number;
22
+ }
23
+ export declare class Fieldset extends Component<FieldsetProps, FieldsetState> {
24
+ static Label: typeof FieldsetLabel;
25
+ static Control: typeof FieldsetControl;
26
+ static contextType: React.Context<import("../..").CleanTheme>;
27
+ context: React.ContextType<typeof CleanThemeContext>;
28
+ private readonly labelActivated;
29
+ private fieldsetContext;
30
+ private getFieldsetContext;
31
+ componentWillUnmount(): void;
32
+ render(): React.JSX.Element;
33
+ }
34
+ export {};
@@ -0,0 +1,130 @@
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 Component = _react.Component
6
+ local ReactComponent = _react.ReactComponent
7
+ local FlexItem = TS.import(script, script.Parent, "FlexItem").FlexItem
8
+ local Container = TS.import(script, script.Parent, "Container").Container
9
+ local HStack = TS.import(script, script.Parent, "HStack").HStack
10
+ local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
11
+ local BreakpointHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").BreakpointHelper
12
+ local FieldsetContext = React.createContext(nil)
13
+ local function FieldsetLabel(props)
14
+ local context = React.useContext(FieldsetContext)
15
+ local _arg0 = context ~= nil
16
+ assert(_arg0, "Fieldset.Label must be used inside a Fieldset")
17
+ return React.createElement(FlexItem, {
18
+ mode = "Custom",
19
+ ShrinkRatio = 0,
20
+ GrowRatio = 0,
21
+ }, React.createElement("imagebutton", {
22
+ Size = UDim2.fromOffset(0, 0),
23
+ BackgroundTransparency = 1,
24
+ AutomaticSize = Enum.AutomaticSize.XY,
25
+ Event = {
26
+ Activated = function()
27
+ local _result = context.labelActivated
28
+ if _result ~= nil then
29
+ _result:Fire()
30
+ end
31
+ end,
32
+ },
33
+ }, props.children))
34
+ end
35
+ local function FieldsetControl(props)
36
+ local context = React.useContext(FieldsetContext)
37
+ local _arg0 = context ~= nil
38
+ assert(_arg0, "Fieldset.Control must be used inside a Fieldset")
39
+ return React.createElement(FlexItem, {
40
+ mode = "Custom",
41
+ ShrinkRatio = if context.checkbox then 0 else 1,
42
+ GrowRatio = if context.checkbox then 0 else 1,
43
+ }, props.children)
44
+ end
45
+ local Fieldset
46
+ do
47
+ local super = Component
48
+ Fieldset = setmetatable({}, {
49
+ __tostring = function()
50
+ return "Fieldset"
51
+ end,
52
+ __index = super,
53
+ })
54
+ Fieldset.__index = Fieldset
55
+ function Fieldset.new(...)
56
+ local self = setmetatable({}, Fieldset)
57
+ return self:constructor(...) or self
58
+ end
59
+ function Fieldset:constructor(...)
60
+ super.constructor(self, ...)
61
+ self.labelActivated = Instance.new("BindableEvent")
62
+ self.fieldsetContext = {
63
+ disabled = false,
64
+ checkbox = false,
65
+ labelActivated = self.labelActivated,
66
+ }
67
+ end
68
+ function Fieldset:getFieldsetContext()
69
+ local _condition = self.props.disabled
70
+ if _condition == nil then
71
+ _condition = false
72
+ end
73
+ local disabled = _condition
74
+ local _condition_1 = self.props.checkbox
75
+ if _condition_1 == nil then
76
+ _condition_1 = false
77
+ end
78
+ local checkbox = _condition_1
79
+ if self.fieldsetContext.disabled ~= disabled or self.fieldsetContext.checkbox ~= checkbox then
80
+ self.fieldsetContext = {
81
+ disabled = disabled,
82
+ checkbox = checkbox,
83
+ labelActivated = self.labelActivated,
84
+ }
85
+ end
86
+ return self.fieldsetContext
87
+ end
88
+ function Fieldset:componentWillUnmount()
89
+ self.labelActivated:Destroy()
90
+ end
91
+ function Fieldset:render()
92
+ local context = self:getFieldsetContext()
93
+ local wrap = false
94
+ local breakpoints = (if self.props.breakpoints ~= nil then self.props.breakpoints else self.context.breakpoints)
95
+ local _condition = self.state.width
96
+ if _condition == nil then
97
+ _condition = 0
98
+ end
99
+ local breakpoint = BreakpointHelper:getBreakpoint(_condition, breakpoints)
100
+ if BreakpointHelper:compare(breakpoint, "<=", self.props.wrap or "lg") then
101
+ wrap = true
102
+ end
103
+ return React.createElement(FieldsetContext.Provider, {
104
+ value = context,
105
+ }, React.createElement(Container, {
106
+ Change = {
107
+ AbsoluteSize = function(instance)
108
+ local width = instance.AbsoluteSize.X
109
+ if width ~= self.state.width then
110
+ self:setState({
111
+ width = width,
112
+ })
113
+ end
114
+ end,
115
+ },
116
+ }, React.createElement(HStack, {
117
+ Wraps = wrap,
118
+ valign = "Center",
119
+ HorizontalFlex = Enum.UIFlexAlignment.Fill,
120
+ }, self.props.children)))
121
+ end
122
+ Fieldset.Label = FieldsetLabel
123
+ Fieldset.Control = FieldsetControl
124
+ Fieldset.contextType = CleanThemeContext
125
+ Fieldset = ReactComponent(Fieldset) or Fieldset
126
+ end
127
+ return {
128
+ FieldsetContext = FieldsetContext,
129
+ Fieldset = Fieldset,
130
+ }
@@ -0,0 +1,11 @@
1
+ import React, { Binding } from "@rbxts/react";
2
+ import { ContainerProps } from "./Container";
3
+ interface FlexItemProps extends ContainerProps {
4
+ children?: React.ReactNode;
5
+ align?: Enum.HorizontalAlignment | "Right" | "Left" | "Center" | React.Binding<Enum.HorizontalAlignment>;
6
+ mode?: Enum.UIFlexMode | "Grow" | "None" | "Shrink" | "Fill" | "Custom" | Binding<Enum.UIFlexMode>;
7
+ GrowRatio?: number;
8
+ ShrinkRatio?: number;
9
+ }
10
+ export declare const FlexItem: React.ForwardRefExoticComponent<Omit<FlexItemProps, "ref"> & React.RefAttributes<Frame>>;
11
+ export {};
@@ -0,0 +1,20 @@
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 Container = TS.import(script, script.Parent, "Container").Container
5
+ local FlexItem = React.forwardRef(function(props, ref)
6
+ local _attributes = table.clone(props)
7
+ setmetatable(_attributes, nil)
8
+ _attributes.ref = ref
9
+ return React.createElement(Container, _attributes, React.createElement("uiflexitem", {
10
+ FlexMode = props.mode or "Grow",
11
+ GrowRatio = props.GrowRatio,
12
+ ShrinkRatio = props.ShrinkRatio,
13
+ }), React.createElement("uilistlayout", {
14
+ FillDirection = Enum.FillDirection.Horizontal,
15
+ HorizontalAlignment = props.align,
16
+ }), props.children)
17
+ end)
18
+ return {
19
+ FlexItem = FlexItem,
20
+ }
@@ -0,0 +1,34 @@
1
+ import React, { Component } from "@rbxts/react";
2
+ import { ResolvedPadding } from "../../Interfaces";
3
+ interface GroupContextValue {
4
+ size: Vector2;
5
+ sizes: Map<string, Vector2>;
6
+ reportSize: (id: string, size: Vector2) => void;
7
+ removeElement: (id: string) => void;
8
+ }
9
+ export declare const GroupContext: React.Context<GroupContextValue | undefined>;
10
+ interface GroupElementProps {
11
+ enabled?: boolean;
12
+ padding?: ResolvedPadding;
13
+ children?: React.ReactNode;
14
+ }
15
+ declare function GroupElement(props: GroupElementProps): boolean | ReadonlyMap<React.Key, React.ReactNode> | {
16
+ readonly [key: string]: React.ReactNode;
17
+ readonly [key: number]: React.ReactNode;
18
+ } | readonly React.ReactNode[] | React.JSX.Element | undefined;
19
+ interface Group2Props {
20
+ children?: React.ReactNode;
21
+ BackgroundTransparency?: number;
22
+ }
23
+ interface GroupState {
24
+ size: Vector2;
25
+ sizes: Map<string, Vector2>;
26
+ }
27
+ export declare class Group extends Component<Group2Props, GroupState> {
28
+ static Element: typeof GroupElement;
29
+ static contextType: React.Context<GroupContextValue | undefined>;
30
+ state: GroupState;
31
+ context: React.ContextType<typeof GroupContext>;
32
+ render(): React.ReactNode;
33
+ }
34
+ export {};