@rbxts/react-clean-ui 1.1.0 → 1.2.4

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/out/Components/Chart/BarChart.d.ts +1 -0
  2. package/out/Components/Chart/BarChart.luau +149 -112
  3. package/out/Components/Chart/Pie.d.ts +1 -0
  4. package/out/Components/Chart/Pie.luau +21 -6
  5. package/out/Components/Decorator/BoxShadow.d.ts +1 -0
  6. package/out/Components/Decorator/BoxShadow.luau +12 -5
  7. package/out/Components/Decorator/Corners.d.ts +1 -0
  8. package/out/Components/Decorator/Corners.luau +8 -3
  9. package/out/Components/Decorator/Gradient.d.ts +8 -0
  10. package/out/Components/Decorator/Gradient.luau +23 -0
  11. package/out/Components/Decorator/Padding.d.ts +3 -1
  12. package/out/Components/Decorator/Padding.luau +11 -6
  13. package/out/Components/Decorator/index.d.ts +1 -0
  14. package/out/Components/Decorator/init.luau +3 -0
  15. package/out/Components/Input/Button.d.ts +1 -0
  16. package/out/Components/Input/Button.luau +49 -34
  17. package/out/Components/Input/Checkbox.d.ts +1 -0
  18. package/out/Components/Input/Checkbox.luau +28 -18
  19. package/out/Components/Input/HoverButton.d.ts +1 -0
  20. package/out/Components/Input/HoverButton.luau +44 -42
  21. package/out/Components/Input/Increment.d.ts +1 -0
  22. package/out/Components/Input/Increment.luau +10 -3
  23. package/out/Components/Input/Input.d.ts +3 -1
  24. package/out/Components/Input/Input.luau +89 -68
  25. package/out/Components/Input/Select.d.ts +11 -1
  26. package/out/Components/Input/Select.luau +315 -39
  27. package/out/Components/Input/Slider.luau +44 -53
  28. package/out/Components/Input/Switch.d.ts +9 -0
  29. package/out/Components/Input/Switch.luau +145 -0
  30. package/out/Components/Input/index.d.ts +1 -0
  31. package/out/Components/Input/init.luau +3 -0
  32. package/out/Components/Interaction/Modal.d.ts +14 -0
  33. package/out/Components/Interaction/Modal.luau +262 -0
  34. package/out/Components/Interaction/Toast.d.ts +2 -1
  35. package/out/Components/Interaction/Toast.luau +53 -28
  36. package/out/Components/Interaction/Tooltip.luau +36 -25
  37. package/out/Components/Interaction/index.d.ts +1 -0
  38. package/out/Components/Interaction/init.luau +3 -0
  39. package/out/Components/Layout/Accordion.d.ts +1 -0
  40. package/out/Components/Layout/Accordion.luau +51 -55
  41. package/out/Components/Layout/Column.d.ts +1 -0
  42. package/out/Components/Layout/Column.luau +11 -6
  43. package/out/Components/Layout/Container.d.ts +3 -0
  44. package/out/Components/Layout/Container.luau +26 -17
  45. package/out/Components/Layout/Draggable.luau +25 -3
  46. package/out/Components/Layout/Fieldset.d.ts +1 -0
  47. package/out/Components/Layout/Fieldset.luau +14 -42
  48. package/out/Components/Layout/FlexItem.luau +7 -0
  49. package/out/Components/Layout/Grid.d.ts +10 -0
  50. package/out/Components/Layout/Grid.luau +172 -0
  51. package/out/Components/Layout/Group.d.ts +1 -0
  52. package/out/Components/Layout/Group.luau +48 -60
  53. package/out/Components/Layout/HStack.d.ts +4 -0
  54. package/out/Components/Layout/HStack.luau +17 -10
  55. package/out/Components/Layout/Pagination.d.ts +32 -0
  56. package/out/Components/Layout/Pagination.luau +400 -0
  57. package/out/Components/Layout/Row.d.ts +1 -0
  58. package/out/Components/Layout/Row.luau +20 -48
  59. package/out/Components/Layout/Scroller.d.ts +1 -0
  60. package/out/Components/Layout/Scroller.luau +26 -34
  61. package/out/Components/Layout/Table.d.ts +31 -0
  62. package/out/Components/Layout/Table.luau +342 -0
  63. package/out/Components/Layout/Tabs.d.ts +20 -10
  64. package/out/Components/Layout/Tabs.luau +113 -119
  65. package/out/Components/Layout/VStack.d.ts +3 -0
  66. package/out/Components/Layout/VStack.luau +17 -10
  67. package/out/Components/Layout/index.d.ts +3 -0
  68. package/out/Components/Layout/init.luau +9 -0
  69. package/out/Components/Navigation/Menu.d.ts +1 -0
  70. package/out/Components/Navigation/Menu.luau +12 -3
  71. package/out/Components/Surface/Box.d.ts +3 -1
  72. package/out/Components/Surface/Box.luau +15 -4
  73. package/out/Components/Surface/Card.d.ts +1 -0
  74. package/out/Components/Surface/Card.luau +56 -154
  75. package/out/Components/Surface/Icon.d.ts +1 -0
  76. package/out/Components/Surface/Icon.luau +25 -16
  77. package/out/Components/Surface/ProgressBar.d.ts +14 -0
  78. package/out/Components/Surface/ProgressBar.luau +230 -0
  79. package/out/Components/Surface/index.d.ts +1 -0
  80. package/out/Components/Surface/init.luau +3 -0
  81. package/out/Components/Typography/Text.d.ts +1 -0
  82. package/out/Components/Typography/Text.luau +57 -53
  83. package/out/Contexts/index.d.ts +1 -0
  84. package/out/Contexts/init.luau +3 -0
  85. package/out/Contexts/modal.context.d.ts +15 -0
  86. package/out/Contexts/modal.context.luau +23 -0
  87. package/out/Contexts/toast.context.d.ts +1 -0
  88. package/out/Helpers/color.helper.luau +28 -0
  89. package/out/Helpers/css.helper.d.ts +4 -1
  90. package/out/Helpers/css.helper.luau +76 -6
  91. package/out/Helpers/gui.helper.luau +0 -3
  92. package/out/Helpers/size.helper.luau +0 -2
  93. package/out/Helpers/spacing.helper.luau +0 -3
  94. package/out/Helpers/typography.helper.luau +0 -2
  95. package/out/Interfaces/css.types.d.ts +7 -0
  96. package/out/Interfaces/css.types.luau +0 -20
  97. package/out/Providers/app.provider.luau +2 -1
  98. package/out/Providers/index.d.ts +1 -0
  99. package/out/Providers/init.luau +3 -0
  100. package/out/Providers/modal.provider.d.ts +6 -0
  101. package/out/Providers/modal.provider.luau +86 -0
  102. package/out/Providers/overlay.provider.luau +1 -0
  103. package/out/Providers/registry.provider.luau +0 -2
  104. package/out/Theme/theme.style.d.ts +2 -1
  105. package/out/Theme/theme.template.d.ts +126 -1
  106. package/out/Theme/themes/dark.theme.luau +225 -0
  107. package/out/Theme/themes/default.theme.luau +210 -0
  108. package/out/Theme/themes/sandstone.theme.luau +173 -0
  109. package/out/Theme/themes/wooden.theme.luau +195 -0
  110. package/package.json +1 -1
@@ -0,0 +1,145 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple").src).useTween
5
+ local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
6
+ local FieldsetContext = TS.import(script, script.Parent.Parent, "Layout").FieldsetContext
7
+ local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
8
+ local Corners = _Decorator.Corners
9
+ local BoxShadow = _Decorator.BoxShadow
10
+ local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
11
+ local ColorHelper = _Helpers.ColorHelper
12
+ local SizeHelper = _Helpers.SizeHelper
13
+ local function lerpUDim(from, to, alpha)
14
+ return UDim.new(from.Scale + (to.Scale - from.Scale) * alpha, from.Offset + (to.Offset - from.Offset) * alpha)
15
+ end
16
+ local function Switch(props)
17
+ local theme = React.useContext(CleanThemeContext)
18
+ local fieldset = React.useContext(FieldsetContext)
19
+ local switchTheme = theme.components.switch
20
+ local _condition = props.checked
21
+ if _condition == nil then
22
+ _condition = false
23
+ end
24
+ local checked, setChecked = React.useState(_condition)
25
+ React.useEffect(function()
26
+ if not fieldset then
27
+ return nil
28
+ end
29
+ local _connection = fieldset.labelActivated
30
+ if _connection ~= nil then
31
+ _connection = _connection.Event:Connect(function()
32
+ if props.disabled then
33
+ return nil
34
+ end
35
+ setChecked(function(current)
36
+ return not current
37
+ end)
38
+ end)
39
+ end
40
+ local connection = _connection
41
+ return function()
42
+ local _result = connection
43
+ if _result ~= nil then
44
+ _result:Disconnect()
45
+ end
46
+ end
47
+ end, { fieldset, props.disabled })
48
+ React.useEffect(function()
49
+ local _result = props.onChange
50
+ if _result ~= nil then
51
+ _result(checked)
52
+ end
53
+ end, { checked })
54
+ local duration = switchTheme.animation.duration
55
+ local progress, progressTween = useTween(if checked then 1 else 0, {
56
+ duration = duration,
57
+ })
58
+ React.useEffect(function()
59
+ local goal = if checked then 1 else 0
60
+ progressTween:setGoal(goal, {
61
+ duration = duration,
62
+ })
63
+ if duration == 0 then
64
+ progressTween:setPosition(goal)
65
+ end
66
+ progressTween:start()
67
+ end, { checked, duration, progressTween })
68
+ local onColors = ColorHelper:getIntentColors(theme, props.intent, if props.disabled then "disabled" else "default", switchTheme.track.intents)
69
+ local offBackgroundColor = switchTheme.track.backgroundColor
70
+ local offBorderColor = switchTheme.track.borderColor
71
+ local trackBackgroundColor = progress:map(function(value)
72
+ return offBackgroundColor:Lerp(onColors.backgroundColor, value)
73
+ end)
74
+ local trackBorderColor = progress:map(function(value)
75
+ return offBorderColor:Lerp(onColors.borderColor, value)
76
+ end)
77
+ local trackWidth = SizeHelper:toUDim(switchTheme.width)
78
+ local trackHeight = SizeHelper:toUDim(switchTheme.height)
79
+ local inset = SizeHelper:toUDim(switchTheme.thumb.inset)
80
+ local insetDoubled = inset + inset
81
+ local thumbDiameter = trackHeight - insetDoubled
82
+ local thumbOffX = inset
83
+ local thumbOnX = trackWidth - inset - thumbDiameter
84
+ local thumbPosition = progress:map(function(value)
85
+ return UDim2.new(lerpUDim(thumbOffX, thumbOnX, value), UDim.new(0.5, 0))
86
+ end)
87
+ local _attributes = {}
88
+ local _condition_1 = props.name
89
+ if _condition_1 == nil then
90
+ _condition_1 = "Switch"
91
+ end
92
+ _attributes.key = _condition_1
93
+ _attributes.Active = not props.disabled
94
+ _attributes.Selectable = not props.disabled
95
+ _attributes.AutoButtonColor = false
96
+ _attributes.Size = UDim2.new(trackWidth, trackHeight)
97
+ _attributes.ZIndex = props.ZIndex
98
+ _attributes.BackgroundColor3 = trackBackgroundColor
99
+ local _result
100
+ if props.disabled then
101
+ _result = switchTheme.disabledTransparency
102
+ else
103
+ local _condition_2 = props.BackgroundTransparency
104
+ if _condition_2 == nil then
105
+ _condition_2 = switchTheme.track.backgroundTransparency
106
+ end
107
+ _result = _condition_2
108
+ end
109
+ _attributes.BackgroundTransparency = _result
110
+ _attributes.Event = {
111
+ Activated = function()
112
+ if props.disabled then
113
+ return nil
114
+ end
115
+ setChecked(not checked)
116
+ end,
117
+ }
118
+ return React.createElement("imagebutton", _attributes, React.createElement(Corners, {
119
+ radius = switchTheme.cornerRadius,
120
+ }), React.createElement("uistroke", {
121
+ key = "TrackStroke",
122
+ Thickness = switchTheme.borderThickness,
123
+ BorderStrokePosition = Enum.BorderStrokePosition.Inner,
124
+ Color = trackBorderColor,
125
+ }), React.createElement("frame", {
126
+ key = "Thumb",
127
+ Position = thumbPosition,
128
+ AnchorPoint = Vector2.new(0, 0.5),
129
+ Size = UDim2.new(thumbDiameter, thumbDiameter),
130
+ BackgroundColor3 = switchTheme.thumb.backgroundColor,
131
+ BackgroundTransparency = if props.disabled then switchTheme.disabledTransparency else switchTheme.thumb.backgroundTransparency,
132
+ BorderSizePixel = 0,
133
+ }, React.createElement("uistroke", {
134
+ key = "ThumbStroke",
135
+ Thickness = switchTheme.thumb.borderThickness,
136
+ Color = switchTheme.thumb.borderColor,
137
+ }), React.createElement(Corners, {
138
+ radius = switchTheme.thumb.cornerRadius,
139
+ }), React.createElement(BoxShadow, {
140
+ ["box-shadow"] = switchTheme.thumb.boxShadow,
141
+ })))
142
+ end
143
+ return {
144
+ Switch = Switch,
145
+ }
@@ -5,3 +5,4 @@ export * from './Increment';
5
5
  export * from './Input';
6
6
  export * from './Select';
7
7
  export * from './Slider';
8
+ export * from './Switch';
@@ -22,4 +22,7 @@ end
22
22
  for _k, _v in TS.import(script, script, "Slider") or {} do
23
23
  exports[_k] = _v
24
24
  end
25
+ for _k, _v in TS.import(script, script, "Switch") or {} do
26
+ exports[_k] = _v
27
+ end
25
28
  return exports
@@ -0,0 +1,14 @@
1
+ import React from "@rbxts/react";
2
+ import { IntentElementProps } from "../../Interfaces";
3
+ import { BoxProps } from "../Surface";
4
+ export interface ModalProps extends BoxProps, IntentElementProps {
5
+ open?: boolean;
6
+ defaultOpen?: boolean;
7
+ onOpenChange?: (open: boolean) => void;
8
+ closeOnBackdropClick?: boolean;
9
+ closeOnEscape?: boolean;
10
+ draggable?: boolean;
11
+ initialFocus?: React.RefObject<GuiObject>;
12
+ children?: React.ReactNode;
13
+ }
14
+ export declare function Modal(props: ModalProps): React.JSX.Element | undefined;
@@ -0,0 +1,262 @@
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 GuiService = TS.import(script, TS.getModule(script, "@rbxts", "services")).GuiService
6
+ local useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple").src).useTween
7
+ local _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
8
+ local CleanThemeContext = _Contexts.CleanThemeContext
9
+ local OverlayConsumer = _Contexts.OverlayConsumer
10
+ local _modal_context = TS.import(script, script.Parent.Parent.Parent, "Contexts", "modal.context")
11
+ local ModalCloseContext = _modal_context.ModalCloseContext
12
+ local useModalStack = _modal_context.useModalStack
13
+ local SizeHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SizeHelper
14
+ local Draggable = TS.import(script, script.Parent.Parent, "Layout").Draggable
15
+ local Card = TS.import(script, script.Parent.Parent, "Surface").Card
16
+ local nextModalId = 0
17
+ local function generateModalId()
18
+ nextModalId += 1
19
+ return `modal-{nextModalId}`
20
+ end
21
+ local function trySetSelectedObject(target)
22
+ pcall(function()
23
+ GuiService.SelectedObject = target
24
+ end)
25
+ end
26
+ local function getPanelContentSize(automaticSize)
27
+ local autoWidth = automaticSize == Enum.AutomaticSize.X or automaticSize == Enum.AutomaticSize.XY or automaticSize == "X" or automaticSize == "XY"
28
+ local autoHeight = automaticSize == Enum.AutomaticSize.Y or automaticSize == Enum.AutomaticSize.XY or automaticSize == "Y" or automaticSize == "XY"
29
+ return UDim2.fromScale(if autoWidth then 0 else 1, if autoHeight then 0 else 1)
30
+ end
31
+ local function Modal(props)
32
+ local theme = React.useContext(CleanThemeContext)
33
+ local stack = useModalStack()
34
+ local idRef = React.useRef()
35
+ if idRef.current == nil then
36
+ idRef.current = generateModalId()
37
+ end
38
+ local id = idRef.current
39
+ local _condition = props.closeOnBackdropClick
40
+ if _condition == nil then
41
+ _condition = true
42
+ end
43
+ local closeOnBackdropClick = _condition
44
+ local _condition_1 = props.closeOnEscape
45
+ if _condition_1 == nil then
46
+ _condition_1 = true
47
+ end
48
+ local closeOnEscape = _condition_1
49
+ local isControlled = props.open ~= nil
50
+ local _condition_2 = props.defaultOpen
51
+ if _condition_2 == nil then
52
+ _condition_2 = false
53
+ end
54
+ local uncontrolledOpen, setUncontrolledOpen = React.useState(_condition_2)
55
+ local _condition_3 = props.open
56
+ if _condition_3 == nil then
57
+ _condition_3 = uncontrolledOpen
58
+ end
59
+ local open = _condition_3
60
+ local shouldRender, setShouldRender = React.useState(open)
61
+ local dismissingRef = React.useRef(false)
62
+ local fadeThreadRef = React.useRef()
63
+ local panelRef = React.useRef()
64
+ local previousSelectionRef = React.useRef()
65
+ local onOpenChangeRef = React.useRef(props.onOpenChange)
66
+ React.useEffect(function()
67
+ onOpenChangeRef.current = props.onOpenChange
68
+ end, { props.onOpenChange })
69
+ local requestClose = React.useCallback(function()
70
+ if not isControlled then
71
+ setUncontrolledOpen(false)
72
+ end
73
+ local _result = onOpenChangeRef.current
74
+ if _result ~= nil then
75
+ _result(false)
76
+ end
77
+ end, { isControlled })
78
+ local requestCloseRef = React.useRef(requestClose)
79
+ React.useEffect(function()
80
+ requestCloseRef.current = requestClose
81
+ end, { requestClose })
82
+ local closeOnEscapeRef = React.useRef(closeOnEscape)
83
+ React.useEffect(function()
84
+ closeOnEscapeRef.current = closeOnEscape
85
+ end, { closeOnEscape })
86
+ local fadeDuration = theme.components.modal.fadeDuration
87
+ local backdropGoalTransparency = theme.components.modal.backdrop.backgroundTransparency
88
+ local backdropTransparency, backdropTween = useTween(1, {
89
+ duration = fadeDuration,
90
+ easing = "quadOut",
91
+ })
92
+ local panelTransparency, panelTween = useTween(1, {
93
+ duration = fadeDuration,
94
+ easing = "quadOut",
95
+ })
96
+ local beginExit = React.useCallback(function()
97
+ if dismissingRef.current then
98
+ return nil
99
+ end
100
+ dismissingRef.current = true
101
+ if fadeDuration <= 0 then
102
+ setShouldRender(false)
103
+ return nil
104
+ end
105
+ fadeThreadRef.current = task.delay(fadeDuration, function()
106
+ fadeThreadRef.current = nil
107
+ setShouldRender(false)
108
+ end)
109
+ end, { fadeDuration })
110
+ React.useEffect(function()
111
+ if open then
112
+ local fadeThread = fadeThreadRef.current
113
+ if fadeThread ~= nil then
114
+ task.cancel(fadeThread)
115
+ fadeThreadRef.current = nil
116
+ end
117
+ dismissingRef.current = false
118
+ setShouldRender(true)
119
+ elseif shouldRender then
120
+ beginExit()
121
+ end
122
+ end, { open })
123
+ React.useEffect(function()
124
+ if not shouldRender then
125
+ return nil
126
+ end
127
+ backdropTween:setGoal(if open then backdropGoalTransparency else 1)
128
+ panelTween:setGoal(if open then 0 else 1)
129
+ end, { open, shouldRender, backdropGoalTransparency })
130
+ React.useEffect(function()
131
+ return function()
132
+ local fadeThread = fadeThreadRef.current
133
+ if fadeThread ~= nil then
134
+ task.cancel(fadeThread)
135
+ end
136
+ end
137
+ end, {})
138
+ React.useEffect(function()
139
+ if not shouldRender then
140
+ return nil
141
+ end
142
+ stack.register({
143
+ id = id,
144
+ closeOnEscape = function()
145
+ return closeOnEscapeRef.current
146
+ end,
147
+ requestClose = function()
148
+ return requestCloseRef.current()
149
+ end,
150
+ })
151
+ return function()
152
+ stack.unregister(id)
153
+ end
154
+ end, { shouldRender })
155
+ React.useEffect(function()
156
+ if not shouldRender then
157
+ return nil
158
+ end
159
+ previousSelectionRef.current = GuiService.SelectedObject
160
+ local _result = props.initialFocus
161
+ if _result ~= nil then
162
+ _result = _result.current
163
+ end
164
+ local _condition_4 = _result
165
+ if _condition_4 == nil then
166
+ _condition_4 = panelRef.current
167
+ end
168
+ trySetSelectedObject(_condition_4)
169
+ return function()
170
+ trySetSelectedObject(previousSelectionRef.current)
171
+ end
172
+ end, { shouldRender })
173
+ if not shouldRender then
174
+ return nil
175
+ end
176
+ local layerIndex = stack.getLayerIndex(id)
177
+ local backdropZIndex = theme.components.modal.baseZIndex + layerIndex * theme.components.modal.zIndexStep
178
+ return React.createElement(OverlayConsumer, {
179
+ render = function(overlay)
180
+ if overlay == nil then
181
+ return nil
182
+ end
183
+ local panelChildren = if props.draggable then React.Children.map(props.children, function(child)
184
+ return if React.isValidElement(child) and child.type == Card.Header then React.createElement(Draggable.Handle, nil, child) else child
185
+ end) else props.children
186
+ local _object = table.clone(props)
187
+ setmetatable(_object, nil)
188
+ local _left = "width"
189
+ local _condition_4 = props.width
190
+ if _condition_4 == nil then
191
+ _condition_4 = theme.components.modal.width
192
+ end
193
+ _object[_left] = _condition_4
194
+ local panelSizingProps = _object
195
+ local panelSize = SizeHelper:GetSize(panelSizingProps)
196
+ local panelAutomaticSize = SizeHelper:GetAutoSize(panelSizingProps)
197
+ local panelContentSize = if type(panelAutomaticSize) == "table" and panelAutomaticSize.map ~= nil then panelAutomaticSize:map(getPanelContentSize) else getPanelContentSize(panelAutomaticSize)
198
+ local _attributes = table.clone(props)
199
+ setmetatable(_attributes, nil)
200
+ local _condition_5 = props.name
201
+ if _condition_5 == nil then
202
+ _condition_5 = "Modal"
203
+ end
204
+ _attributes.name = _condition_5
205
+ _attributes.ref = panelRef
206
+ _attributes.Selectable = true
207
+ _attributes.Size = panelContentSize
208
+ _attributes.AutomaticSize = panelAutomaticSize
209
+ _attributes.width = nil
210
+ _attributes.height = nil
211
+ local panel = (React.createElement("imagebutton", {
212
+ key = "ModalPanelInputShield",
213
+ Active = true,
214
+ AnchorPoint = if props.draggable then Vector2.new(0.5, 0.5) else nil,
215
+ AutoButtonColor = false,
216
+ AutomaticSize = panelAutomaticSize,
217
+ BackgroundTransparency = 1,
218
+ ImageTransparency = 1,
219
+ Position = if props.draggable then UDim2.fromScale(0.5, 0.5) else nil,
220
+ Size = panelSize,
221
+ Event = {
222
+ Activated = function() end,
223
+ },
224
+ }, React.createElement(Card, _attributes, panelChildren)))
225
+ return ReactRoblox.createPortal(React.createElement("imagebutton", {
226
+ key = "ModalBackdrop",
227
+ Size = UDim2.fromScale(1, 1),
228
+ AutoButtonColor = false,
229
+ Active = true,
230
+ BackgroundColor3 = theme.components.modal.backdrop.backgroundColor,
231
+ BackgroundTransparency = backdropTransparency,
232
+ ZIndex = backdropZIndex,
233
+ Event = {
234
+ Activated = function()
235
+ if closeOnBackdropClick then
236
+ requestClose()
237
+ end
238
+ end,
239
+ },
240
+ }, React.createElement("canvasgroup", {
241
+ key = "ModalPanel",
242
+ Size = UDim2.fromScale(1, 1),
243
+ BackgroundTransparency = 1,
244
+ GroupTransparency = panelTransparency,
245
+ ZIndex = 2,
246
+ }, not props.draggable and (React.createElement("uilistlayout", {
247
+ key = "CenterLayout",
248
+ FillDirection = Enum.FillDirection.Horizontal,
249
+ HorizontalAlignment = Enum.HorizontalAlignment.Center,
250
+ VerticalAlignment = Enum.VerticalAlignment.Center,
251
+ })), React.createElement(ModalCloseContext.Provider, {
252
+ value = requestClose,
253
+ }, if props.draggable then (React.createElement(Draggable, {
254
+ placeholder = false,
255
+ retainPosition = true,
256
+ }, panel)) else panel))), overlay)
257
+ end,
258
+ })
259
+ end
260
+ return {
261
+ Modal = Modal,
262
+ }
@@ -4,8 +4,9 @@ import { ToastOptions } from "../../Contexts";
4
4
  interface ToastProps extends ToastOptions {
5
5
  onDismiss: () => void;
6
6
  }
7
- export declare function Toast({ title, description, icon, intent, duration, dismissible, children, onDismiss, }: ToastProps): React.JSX.Element;
7
+ export declare function Toast({ title, description, icon, intent, duration, dismissible, children, name, onDismiss, }: ToastProps): React.JSX.Element;
8
8
  interface ToastContainerProps extends SizeElementProps {
9
+ name?: string;
9
10
  }
10
11
  export declare function ToastContainer(props: ToastContainerProps): React.JSX.Element | undefined;
11
12
  export {};
@@ -49,6 +49,10 @@ local function Toast(_param)
49
49
  if children == nil then
50
50
  children = nil
51
51
  end
52
+ local name = _param.name
53
+ if name == nil then
54
+ name = nil
55
+ end
52
56
  local onDismiss = _param.onDismiss
53
57
  local theme = React.useContext(CleanThemeContext)
54
58
  local dismissRef = React.useRef(onDismiss)
@@ -109,53 +113,69 @@ local function Toast(_param)
109
113
  end
110
114
  end, {})
111
115
  local boxStyles = ColorHelper:getIntentColors(theme, intent, "default", theme.components.toast.intents)
112
- local _condition = children ~= nil and children
113
- if not _condition then
116
+ local _attributes = {}
117
+ local _condition = name
118
+ if _condition == nil then
119
+ _condition = "Toast"
120
+ end
121
+ _attributes.key = _condition
122
+ _attributes.Size = UDim2.fromScale(0, 0)
123
+ _attributes.AutomaticSize = Enum.AutomaticSize.XY
124
+ _attributes.BackgroundTransparency = 1
125
+ _attributes.GroupTransparency = groupTransparency
126
+ local _condition_1 = children ~= nil and children
127
+ if not _condition_1 then
114
128
  local _exp = icon ~= nil and React.createElement(Icon, {
129
+ name = "ToastIcon",
115
130
  icon = icon,
116
131
  scale = "sm",
117
132
  color = boxStyles.textColor,
118
133
  })
119
- local _attributes = {
134
+ local _attributes_1 = {
135
+ name = "ToastTitle",
120
136
  TextColor3 = boxStyles.textColor,
121
137
  }
122
- local _condition_1 = title
123
- if _condition_1 == nil then
124
- _condition_1 = ""
138
+ local _condition_2 = title
139
+ if _condition_2 == nil then
140
+ _condition_2 = ""
125
141
  end
126
- _attributes.text = _condition_1
127
- _attributes.typography = TypographyHelper:getTypography(theme, nil, theme.components.toast.header.typography)
128
- _condition = React.createElement(VStack, {
142
+ _attributes_1.text = _condition_2
143
+ _attributes_1.typography = TypographyHelper:getTypography(theme, nil, theme.components.toast.header.typography)
144
+ _condition_1 = React.createElement(VStack, {
129
145
  spacing = "None",
130
- }, React.createElement(Container, nil, React.createElement(HStack, {
146
+ }, React.createElement(Container, {
147
+ name = "ToastHeader",
148
+ }, React.createElement(HStack, {
131
149
  valign = "Center",
132
- }, _exp, React.createElement(Text, _attributes), dismissible and (React.createElement(FlexItem, {
150
+ }, _exp, React.createElement(Text, _attributes_1), dismissible and (React.createElement(FlexItem, {
133
151
  align = "Right",
134
152
  }, React.createElement(Button, {
153
+ name = "ToastDismissButton",
135
154
  intent = intent,
136
155
  spacing = "xs",
137
156
  Event = {
138
157
  Activated = beginDismiss,
139
158
  },
140
159
  }, React.createElement(Button.Icon, {
160
+ name = "ToastDismissIcon",
141
161
  intent = intent,
142
162
  icon = "times",
143
163
  scale = "sm",
144
- })))))), description ~= nil and (React.createElement(Container, nil, React.createElement(Text, {
164
+ })))))), description ~= nil and (React.createElement(Container, {
165
+ name = "ToastDescriptionContainer",
166
+ }, React.createElement(Text, {
167
+ name = "ToastDescription",
145
168
  text = description,
146
169
  TextColor3 = boxStyles.textColor,
147
170
  }))))
148
171
  end
149
- return React.createElement("canvasgroup", {
150
- Size = UDim2.fromScale(0, 0),
151
- AutomaticSize = Enum.AutomaticSize.XY,
152
- BackgroundTransparency = 1,
153
- GroupTransparency = groupTransparency,
154
- }, React.createElement(Box, {
172
+ return React.createElement("canvasgroup", _attributes, React.createElement(Box, {
173
+ name = "ToastBox",
155
174
  ["border-color"] = boxStyles.borderColor,
156
175
  BackgroundColor3 = boxStyles.backgroundColor,
157
176
  BackgroundTransparency = boxStyles.backgroundTransparency,
158
- }, _condition), statusBarTheme ~= nil and React.createElement(React.Fragment, nil, React.createElement("frame", {
177
+ }, _condition_1), statusBarTheme ~= nil and React.createElement(React.Fragment, nil, React.createElement("frame", {
178
+ key = "StatusBar",
159
179
  Size = progress:map(function(value)
160
180
  return UDim2.new(UDim.new(value, 0), SizeHelper:toUDim(statusBarTheme.height))
161
181
  end),
@@ -179,29 +199,34 @@ local function ToastContainer(props)
179
199
  end
180
200
  local position = if theme.components.toast.position then SizeHelper:GetPosition(theme.components.toast.position) else UDim2.fromOffset(5, 5)
181
201
  local anchor = if theme.components.toast.position then SizeHelper:GetAnchor(theme.components.toast.position) else Vector2.new(0, 0)
202
+ local _attributes = {}
203
+ local _condition = props.name
204
+ if _condition == nil then
205
+ _condition = "ToastContainer"
206
+ end
207
+ _attributes.name = _condition
208
+ _attributes.Size = SizeHelper:GetSize(props, UDim2.new(SizeHelper:toUDim(theme.components.toast.width), UDim.new(0, 0)))
209
+ _attributes.Position = position
210
+ _attributes.AnchorPoint = anchor
182
211
  -- ▼ ReadonlyArray.map ▼
183
212
  local _newValue = table.create(#toasts)
184
213
  local _callback = function(toast)
185
- local _attributes = {
214
+ local _attributes_1 = {
186
215
  key = toast.id,
187
216
  }
188
217
  for _k, _v in toast do
189
- _attributes[_k] = _v
218
+ _attributes_1[_k] = _v
190
219
  end
191
- _attributes.onDismiss = function()
220
+ _attributes_1.onDismiss = function()
192
221
  return dismiss(toast.id)
193
222
  end
194
- return React.createElement(Toast, _attributes)
223
+ return React.createElement(Toast, _attributes_1)
195
224
  end
196
225
  for _k, _v in toasts do
197
226
  _newValue[_k] = _callback(_v, _k - 1, toasts)
198
227
  end
199
228
  -- ▲ ReadonlyArray.map ▲
200
- return React.createElement(Container, {
201
- Size = SizeHelper:GetSize(props, UDim2.new(SizeHelper:toUDim(theme.components.toast.width), UDim.new(0, 0))),
202
- Position = position,
203
- AnchorPoint = anchor,
204
- }, React.createElement(VStack, {
229
+ return React.createElement(Container, _attributes, React.createElement(VStack, {
205
230
  spacing = "xs",
206
231
  }, _newValue))
207
232
  end