@rbxts/react-clean-ui 1.1.0 → 1.2.2

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 (89) 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 -5
  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/Padding.d.ts +3 -1
  10. package/out/Components/Decorator/Padding.luau +11 -6
  11. package/out/Components/Input/Button.d.ts +1 -0
  12. package/out/Components/Input/Button.luau +44 -33
  13. package/out/Components/Input/Checkbox.d.ts +1 -0
  14. package/out/Components/Input/Checkbox.luau +22 -16
  15. package/out/Components/Input/HoverButton.d.ts +1 -0
  16. package/out/Components/Input/HoverButton.luau +44 -40
  17. package/out/Components/Input/Increment.d.ts +1 -0
  18. package/out/Components/Input/Increment.luau +10 -3
  19. package/out/Components/Input/Input.d.ts +3 -1
  20. package/out/Components/Input/Input.luau +85 -66
  21. package/out/Components/Input/Select.d.ts +9 -0
  22. package/out/Components/Input/Select.luau +311 -34
  23. package/out/Components/Input/Slider.luau +44 -29
  24. package/out/Components/Input/Switch.d.ts +9 -0
  25. package/out/Components/Input/Switch.luau +147 -0
  26. package/out/Components/Input/index.d.ts +1 -0
  27. package/out/Components/Input/init.luau +3 -0
  28. package/out/Components/Interaction/Modal.d.ts +14 -0
  29. package/out/Components/Interaction/Modal.luau +276 -0
  30. package/out/Components/Interaction/Toast.d.ts +2 -1
  31. package/out/Components/Interaction/Toast.luau +53 -28
  32. package/out/Components/Interaction/Tooltip.luau +36 -24
  33. package/out/Components/Interaction/index.d.ts +1 -0
  34. package/out/Components/Interaction/init.luau +3 -0
  35. package/out/Components/Layout/Accordion.d.ts +1 -0
  36. package/out/Components/Layout/Accordion.luau +51 -55
  37. package/out/Components/Layout/Column.d.ts +1 -0
  38. package/out/Components/Layout/Column.luau +11 -6
  39. package/out/Components/Layout/Container.d.ts +1 -0
  40. package/out/Components/Layout/Container.luau +22 -16
  41. package/out/Components/Layout/Draggable.luau +25 -3
  42. package/out/Components/Layout/Fieldset.d.ts +1 -0
  43. package/out/Components/Layout/Fieldset.luau +14 -42
  44. package/out/Components/Layout/FlexItem.luau +7 -0
  45. package/out/Components/Layout/Group.d.ts +1 -0
  46. package/out/Components/Layout/Group.luau +16 -33
  47. package/out/Components/Layout/HStack.d.ts +4 -0
  48. package/out/Components/Layout/HStack.luau +17 -10
  49. package/out/Components/Layout/Pagination.d.ts +32 -0
  50. package/out/Components/Layout/Pagination.luau +405 -0
  51. package/out/Components/Layout/Row.d.ts +1 -0
  52. package/out/Components/Layout/Row.luau +20 -48
  53. package/out/Components/Layout/Scroller.d.ts +1 -0
  54. package/out/Components/Layout/Scroller.luau +26 -34
  55. package/out/Components/Layout/Table.d.ts +31 -0
  56. package/out/Components/Layout/Table.luau +342 -0
  57. package/out/Components/Layout/Tabs.d.ts +18 -9
  58. package/out/Components/Layout/Tabs.luau +134 -119
  59. package/out/Components/Layout/VStack.d.ts +3 -0
  60. package/out/Components/Layout/VStack.luau +17 -10
  61. package/out/Components/Layout/index.d.ts +2 -0
  62. package/out/Components/Layout/init.luau +6 -0
  63. package/out/Components/Navigation/Menu.d.ts +1 -0
  64. package/out/Components/Navigation/Menu.luau +12 -3
  65. package/out/Components/Surface/Box.d.ts +1 -0
  66. package/out/Components/Surface/Box.luau +12 -4
  67. package/out/Components/Surface/Card.d.ts +1 -0
  68. package/out/Components/Surface/Card.luau +54 -51
  69. package/out/Components/Surface/Icon.d.ts +1 -0
  70. package/out/Components/Surface/Icon.luau +25 -16
  71. package/out/Components/Typography/Text.d.ts +1 -0
  72. package/out/Components/Typography/Text.luau +57 -47
  73. package/out/Contexts/index.d.ts +1 -0
  74. package/out/Contexts/init.luau +3 -0
  75. package/out/Contexts/modal.context.d.ts +15 -0
  76. package/out/Contexts/modal.context.luau +26 -0
  77. package/out/Contexts/toast.context.d.ts +1 -0
  78. package/out/Providers/app.provider.luau +2 -1
  79. package/out/Providers/index.d.ts +1 -0
  80. package/out/Providers/init.luau +3 -0
  81. package/out/Providers/modal.provider.d.ts +6 -0
  82. package/out/Providers/modal.provider.luau +86 -0
  83. package/out/Providers/overlay.provider.luau +1 -0
  84. package/out/Theme/theme.template.d.ts +85 -0
  85. package/out/Theme/themes/dark.theme.luau +103 -0
  86. package/out/Theme/themes/default.theme.luau +130 -0
  87. package/out/Theme/themes/sandstone.theme.luau +103 -0
  88. package/out/Theme/themes/wooden.theme.luau +122 -0
  89. package/package.json +1 -1
@@ -165,6 +165,7 @@ local CardHeader = React.forwardRef(function(props, ref)
165
165
  local overlay = _binding.overlay
166
166
  local positionProps = _binding.positionProps
167
167
  local _attributes = {
168
+ name = "CardHeader",
168
169
  ref = ref,
169
170
  }
170
171
  for _k, _v in props do
@@ -190,7 +191,9 @@ local CardHeader = React.forwardRef(function(props, ref)
190
191
  local _exp = React.createElement(Padding, {
191
192
  resolvedPadding = padding,
192
193
  })
193
- local _attributes_1 = {}
194
+ local _attributes_1 = {
195
+ key = "Stroke",
196
+ }
194
197
  local _condition = theme.components.card.header.borderThickness
195
198
  if _condition == nil then
196
199
  _condition = theme.components.card.borderThickness
@@ -199,6 +202,7 @@ local CardHeader = React.forwardRef(function(props, ref)
199
202
  _attributes_1.Color = intent.borderColor
200
203
  _attributes_1.BorderStrokePosition = Enum.BorderStrokePosition.Inner
201
204
  return React.createElement(Container, _attributes, _exp, React.createElement("uistroke", _attributes_1), React.createElement("uicorner", {
205
+ key = "Corners",
202
206
  TopLeftRadius = corners,
203
207
  TopRightRadius = corners,
204
208
  BottomLeftRadius = UDim.new(0, 0),
@@ -217,6 +221,7 @@ local CardBody = React.forwardRef(function(props, ref)
217
221
  -- against `theme.components.card.body`'s own tiers.
218
222
  local paddingSourceProps = props
219
223
  local _attributes = {
224
+ name = "CardBody",
220
225
  ref = ref,
221
226
  Size = SizeHelper:GetSize(props, UDim2.fromScale(0, 0)),
222
227
  }
@@ -246,6 +251,7 @@ local CardFooter = React.forwardRef(function(props, ref)
246
251
  local overlay = _binding.overlay
247
252
  local positionProps = _binding.positionProps
248
253
  local _attributes = {
254
+ name = "CardFooter",
249
255
  ref = ref,
250
256
  }
251
257
  for _k, _v in props do
@@ -271,7 +277,9 @@ local CardFooter = React.forwardRef(function(props, ref)
271
277
  local _exp = React.createElement(Padding, {
272
278
  resolvedPadding = padding,
273
279
  })
274
- local _attributes_1 = {}
280
+ local _attributes_1 = {
281
+ key = "Stroke",
282
+ }
275
283
  local _condition = theme.components.card.footer.borderThickness
276
284
  if _condition == nil then
277
285
  _condition = theme.components.card.borderThickness
@@ -280,6 +288,7 @@ local CardFooter = React.forwardRef(function(props, ref)
280
288
  _attributes_1.Color = intent.borderColor
281
289
  _attributes_1.BorderStrokePosition = Enum.BorderStrokePosition.Inner
282
290
  return React.createElement(Container, _attributes, _exp, React.createElement("uistroke", _attributes_1), React.createElement("uicorner", {
291
+ key = "Corners",
283
292
  TopLeftRadius = UDim.new(0, 0),
284
293
  TopRightRadius = UDim.new(0, 0),
285
294
  BottomLeftRadius = corners,
@@ -337,8 +346,11 @@ local Card = React.forwardRef(function(props, ref)
337
346
  if child == nil then
338
347
  return nil
339
348
  end
340
- if React.isValidElement(child) and child.type == CardHeader and header == nil then
341
- local headerElement = child
349
+ local directHeader = if React.isValidElement(child) and child.type == CardHeader then child else nil
350
+ local wrappedChild = if React.isValidElement(child) then (child.props).children else nil
351
+ local wrappedHeader = if React.isValidElement(wrappedChild) and wrappedChild.type == CardHeader then wrappedChild else nil
352
+ local headerElement = directHeader or wrappedHeader
353
+ if headerElement ~= nil and header == nil then
342
354
  local _condition = headerElement.props.overlay
343
355
  if _condition == nil then
344
356
  local _result = theme.components.card.header.position
@@ -348,7 +360,7 @@ local Card = React.forwardRef(function(props, ref)
348
360
  _condition = (_result == "absolute")
349
361
  end
350
362
  if _condition then
351
- header = headerElement
363
+ header = child
352
364
  return nil
353
365
  end
354
366
  end
@@ -380,41 +392,6 @@ local Card = React.forwardRef(function(props, ref)
380
392
  local overlayHeader = _binding.overlayHeader
381
393
  local overlayFooter = _binding.overlayFooter
382
394
  local hasOverlay = overlayHeader ~= nil or overlayFooter ~= nil
383
- React.useEffect(function()
384
- if not hasOverlay then
385
- return nil
386
- end
387
- local frame = overlayWrapperRef.current
388
- if not frame then
389
- return nil
390
- end
391
- -- Some renderers (e.g. the browser-based Loom scene preview) don't
392
- -- back this ref with an instance that supports property-changed
393
- -- signals, so guard the subscription instead of throwing and
394
- -- losing overlay clearance tracking.
395
- local positionConn
396
- local sizeConn
397
- pcall(function()
398
- positionConn = frame:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
399
- return setWrapperAbsoluteY(frame.AbsolutePosition.Y)
400
- end)
401
- end)
402
- pcall(function()
403
- sizeConn = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
404
- return setWrapperAbsoluteSize(frame.AbsoluteSize)
405
- end)
406
- end)
407
- return function()
408
- local _result = positionConn
409
- if _result ~= nil then
410
- _result:Disconnect()
411
- end
412
- local _result_1 = sizeConn
413
- if _result_1 ~= nil then
414
- _result_1:Disconnect()
415
- end
416
- end
417
- end, { hasOverlay })
418
395
  -- How far the overlay header's bottom edge extends past the
419
396
  -- wrapper's (i.e. the Box's) top edge — 0 when there's no overlap
420
397
  -- (e.g. a small/no theme offset) or nothing has been measured yet.
@@ -497,6 +474,11 @@ local Card = React.forwardRef(function(props, ref)
497
474
  local boxPropsWithOverlayClearance = _result_2
498
475
  local _attributes = table.clone(boxPropsWithOverlayClearance)
499
476
  setmetatable(_attributes, nil)
477
+ local _condition = props.name
478
+ if _condition == nil then
479
+ _condition = "Card"
480
+ end
481
+ _attributes.name = _condition
500
482
  _attributes.ref = ref
501
483
  _attributes.center = nil
502
484
  _attributes.spacing = "None"
@@ -525,25 +507,46 @@ local Card = React.forwardRef(function(props, ref)
525
507
  setmetatable(_object, nil)
526
508
  _object.center = nil
527
509
  local wrapperPositionProps = _object
528
- local boxWithOverlay = if hasOverlay then (React.createElement("frame", {
529
- ref = overlayWrapperRef,
530
- BackgroundTransparency = 1,
531
- ClipsDescendants = false,
532
- Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 1)),
533
- AutomaticSize = SizeHelper:GetAutoSize(props),
534
- Position = SizeHelper:GetPosition(wrapperPositionProps),
535
- AnchorPoint = SizeHelper:GetAnchor(wrapperPositionProps),
536
- ZIndex = props.ZIndex,
537
- LayoutOrder = props.LayoutOrder,
538
- }, cardBox, overlayHeader, overlayFooter)) else cardBox
510
+ local _result_3
511
+ if hasOverlay then
512
+ local _attributes_1 = {}
513
+ local _condition_1 = props.name
514
+ if _condition_1 == nil then
515
+ _condition_1 = "CardOverlayWrapper"
516
+ end
517
+ _attributes_1.key = _condition_1
518
+ _attributes_1.ref = overlayWrapperRef
519
+ _attributes_1.BackgroundTransparency = 1
520
+ _attributes_1.ClipsDescendants = false
521
+ _attributes_1.Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 1))
522
+ _attributes_1.AutomaticSize = SizeHelper:GetAutoSize(props)
523
+ _attributes_1.Position = SizeHelper:GetPosition(wrapperPositionProps)
524
+ _attributes_1.AnchorPoint = SizeHelper:GetAnchor(wrapperPositionProps)
525
+ _attributes_1.ZIndex = props.ZIndex
526
+ _attributes_1.LayoutOrder = props.LayoutOrder
527
+ _attributes_1.Change = {
528
+ AbsolutePosition = function(instance)
529
+ return setWrapperAbsoluteY(instance.AbsolutePosition.Y)
530
+ end,
531
+ AbsoluteSize = function(instance)
532
+ return setWrapperAbsoluteSize(instance.AbsoluteSize)
533
+ end,
534
+ }
535
+ _result_3 = (React.createElement("frame", _attributes_1, cardBox, overlayHeader, overlayFooter))
536
+ else
537
+ _result_3 = cardBox
538
+ end
539
+ local boxWithOverlay = _result_3
539
540
  local isCentered = props.center == true and props.Position == nil and props.AnchorPoint == nil
540
541
  return React.createElement(CardContext.Provider, {
541
542
  value = contextValue,
542
543
  }, if isCentered then (React.createElement(Container, {
544
+ name = "CardCenterWrapper",
543
545
  Size = UDim2.fromScale(1, 1),
544
546
  ZIndex = props.ZIndex,
545
547
  LayoutOrder = props.LayoutOrder,
546
548
  }, React.createElement("uilistlayout", {
549
+ key = "CenterLayout",
547
550
  FillDirection = Enum.FillDirection.Horizontal,
548
551
  HorizontalAlignment = Enum.HorizontalAlignment.Center,
549
552
  VerticalAlignment = Enum.VerticalAlignment.Center,
@@ -6,5 +6,6 @@ export interface IconProps extends IconElementProps, ScalableElementProps, React
6
6
  spinning?: boolean;
7
7
  speed?: number;
8
8
  Rotation?: number | Binding<number>;
9
+ name?: string;
9
10
  }
10
11
  export declare function Icon(props: IconProps): React.JSX.Element;
@@ -20,11 +20,16 @@ local function SpinningIcon(props)
20
20
  tween:setGoal(360)
21
21
  tween:start()
22
22
  end)
23
- return React.createElement("frame", {
24
- BackgroundTransparency = 1,
25
- Size = UDim2.fromOffset(0, 0),
26
- AutomaticSize = Enum.AutomaticSize.XY,
27
- }, React.createElement(Icon, {
23
+ local _attributes = {}
24
+ local _condition_1 = props.name
25
+ if _condition_1 == nil then
26
+ _condition_1 = "Icon"
27
+ end
28
+ _attributes.key = _condition_1
29
+ _attributes.BackgroundTransparency = 1
30
+ _attributes.Size = UDim2.fromOffset(0, 0)
31
+ _attributes.AutomaticSize = Enum.AutomaticSize.XY
32
+ return React.createElement("frame", _attributes, React.createElement(Icon, {
28
33
  Size = props.Size,
29
34
  color = props.color,
30
35
  icon = props.icon,
@@ -51,19 +56,23 @@ function Icon(props)
51
56
  setmetatable(_attributes, nil)
52
57
  return React.createElement(SpinningIcon, _attributes)
53
58
  end
54
- local _attributes = {
55
- AnchorPoint = props.AnchorPoint,
56
- Rotation = props.Rotation,
57
- Size = props.Size or UDim2.fromOffset(size, size),
58
- Position = props.Position,
59
- LayoutOrder = props.LayoutOrder,
60
- Image = if iconId == nil then nil else `rbxassetid://{iconId}`,
61
- }
62
- local _condition = props.BackgroundTransparency
59
+ local _attributes = {}
60
+ local _condition = props.name
63
61
  if _condition == nil then
64
- _condition = 1
62
+ _condition = "Icon"
63
+ end
64
+ _attributes.key = _condition
65
+ _attributes.AnchorPoint = props.AnchorPoint
66
+ _attributes.Rotation = props.Rotation
67
+ _attributes.Size = props.Size or UDim2.fromOffset(size, size)
68
+ _attributes.Position = props.Position
69
+ _attributes.LayoutOrder = props.LayoutOrder
70
+ _attributes.Image = if iconId == nil then nil else `rbxassetid://{iconId}`
71
+ local _condition_1 = props.BackgroundTransparency
72
+ if _condition_1 == nil then
73
+ _condition_1 = 1
65
74
  end
66
- _attributes.BackgroundTransparency = _condition
75
+ _attributes.BackgroundTransparency = _condition_1
67
76
  _attributes.ImageColor3 = props.color or theme.colors.intents.primary.default.textColor
68
77
  _attributes.ZIndex = props.ZIndex
69
78
  _attributes.Visible = props.Visible
@@ -9,6 +9,7 @@ interface TextProps extends React.InstanceProps<TextLabel> {
9
9
  align?: "Left" | "Right" | "Center";
10
10
  TextWrap?: boolean;
11
11
  letterSpacing?: number;
12
+ name?: string;
12
13
  }
13
14
  export declare const Text: React.ForwardRefExoticComponent<Omit<TextProps, "ref"> & React.RefAttributes<TextLabel>>;
14
15
  export {};
@@ -27,7 +27,23 @@ local Text = React.forwardRef(function(props, ref)
27
27
  local _arg0_1 = string.sub(_text, _arg0, _arg1)
28
28
  table.insert(characters, _arg0_1)
29
29
  end
30
+ local _attributes = {}
31
+ local _condition_1 = props.name
32
+ if _condition_1 == nil then
33
+ _condition_1 = "Text"
34
+ end
35
+ _attributes.key = _condition_1
36
+ _attributes.Size = UDim2.fromScale(0, 0)
37
+ _attributes.AutomaticSize = Enum.AutomaticSize.XY
38
+ _attributes.AnchorPoint = props.AnchorPoint
39
+ _attributes.BackgroundTransparency = 1
40
+ _attributes.Position = props.Position
41
+ _attributes.ZIndex = props.ZIndex
42
+ _attributes.LayoutOrder = props.LayoutOrder
43
+ _attributes.Visible = props.Visible
44
+ _attributes.Rotation = props.Rotation
30
45
  local _exp = React.createElement("uilistlayout", {
46
+ key = "LetterSpacing",
31
47
  FillDirection = Enum.FillDirection.Horizontal,
32
48
  SortOrder = Enum.SortOrder.LayoutOrder,
33
49
  Padding = UDim.new(0, letterSpacing),
@@ -37,7 +53,7 @@ local Text = React.forwardRef(function(props, ref)
37
53
  -- ▼ ReadonlyArray.map ▼
38
54
  local _newValue = table.create(#characters)
39
55
  local _callback = function(character, index)
40
- local _attributes = {
56
+ local _attributes_1 = {
41
57
  key = index,
42
58
  LayoutOrder = index,
43
59
  Size = UDim2.fromScale(0, 0),
@@ -46,56 +62,50 @@ local Text = React.forwardRef(function(props, ref)
46
62
  TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor,
47
63
  Text = character,
48
64
  }
49
- local _condition_1 = props.LineHeight
50
- if _condition_1 == nil then
51
- _condition_1 = style.lineHeight
52
- end
53
- _attributes.LineHeight = _condition_1
54
- _attributes.FontFace = Font.fromName(style.font.Name, weight)
55
- _attributes.FontSize = style.size
56
- _attributes.RichText = false
57
- local _condition_2 = props.TextScaled
65
+ local _condition_2 = props.LineHeight
58
66
  if _condition_2 == nil then
59
- _condition_2 = false
67
+ _condition_2 = style.lineHeight
60
68
  end
61
- _attributes.TextScaled = _condition_2
62
- _attributes.TextStrokeColor3 = props.TextStrokeColor3
63
- _attributes.TextStrokeTransparency = props.TextStrokeTransparency
64
- _attributes.TextTransparency = props.TextTransparency
65
- return React.createElement("textlabel", _attributes)
69
+ _attributes_1.LineHeight = _condition_2
70
+ _attributes_1.FontFace = Font.fromName(style.font.Name, weight)
71
+ _attributes_1.FontSize = style.size
72
+ _attributes_1.RichText = false
73
+ local _condition_3 = props.TextScaled
74
+ if _condition_3 == nil then
75
+ _condition_3 = false
76
+ end
77
+ _attributes_1.TextScaled = _condition_3
78
+ _attributes_1.TextStrokeColor3 = props.TextStrokeColor3
79
+ _attributes_1.TextStrokeTransparency = props.TextStrokeTransparency
80
+ _attributes_1.TextTransparency = props.TextTransparency
81
+ return React.createElement("textlabel", _attributes_1)
66
82
  end
67
83
  for _k, _v in characters do
68
84
  _newValue[_k] = _callback(_v, _k - 1, characters)
69
85
  end
70
86
  -- ▲ ReadonlyArray.map ▲
71
- return React.createElement("frame", {
72
- Size = UDim2.fromScale(0, 0),
73
- AutomaticSize = Enum.AutomaticSize.XY,
74
- AnchorPoint = props.AnchorPoint,
75
- BackgroundTransparency = 1,
76
- Position = props.Position,
77
- ZIndex = props.ZIndex,
78
- LayoutOrder = props.LayoutOrder,
79
- Visible = props.Visible,
80
- Rotation = props.Rotation,
81
- }, _exp, _newValue)
87
+ return React.createElement("frame", _attributes, _exp, _newValue)
82
88
  end
83
- local _attributes = {
84
- ref = ref,
85
- Size = UDim2.fromScale(0, 0),
86
- AutomaticSize = Enum.AutomaticSize.XY,
87
- AnchorPoint = props.AnchorPoint,
88
- }
89
- local _condition_1 = props.LineHeight
89
+ local _attributes = {}
90
+ local _condition_1 = props.name
90
91
  if _condition_1 == nil then
91
- _condition_1 = style.lineHeight
92
+ _condition_1 = "Text"
92
93
  end
93
- _attributes.LineHeight = _condition_1
94
- local _condition_2 = props.BackgroundTransparency
94
+ _attributes.key = _condition_1
95
+ _attributes.ref = ref
96
+ _attributes.Size = UDim2.fromScale(0, 0)
97
+ _attributes.AutomaticSize = Enum.AutomaticSize.XY
98
+ _attributes.AnchorPoint = props.AnchorPoint
99
+ local _condition_2 = props.LineHeight
95
100
  if _condition_2 == nil then
96
- _condition_2 = 1
101
+ _condition_2 = style.lineHeight
102
+ end
103
+ _attributes.LineHeight = _condition_2
104
+ local _condition_3 = props.BackgroundTransparency
105
+ if _condition_3 == nil then
106
+ _condition_3 = 1
97
107
  end
98
- _attributes.BackgroundTransparency = _condition_2
108
+ _attributes.BackgroundTransparency = _condition_3
99
109
  _attributes.TextXAlignment = props.align or (props.TextXAlignment or Enum.TextXAlignment.Left)
100
110
  _attributes.TextColor3 = props.TextColor3 or theme.colors.intents.primary.default.textColor
101
111
  _attributes.Text = props.text
@@ -104,16 +114,16 @@ local Text = React.forwardRef(function(props, ref)
104
114
  _attributes.TextWrapped = textwrapped
105
115
  _attributes.FontFace = Font.fromName(style.font.Name, weight)
106
116
  _attributes.FontSize = style.size
107
- local _condition_3 = props.RichText
108
- if _condition_3 == nil then
109
- _condition_3 = true
110
- end
111
- _attributes.RichText = _condition_3
112
- local _condition_4 = props.TextScaled
117
+ local _condition_4 = props.RichText
113
118
  if _condition_4 == nil then
114
- _condition_4 = false
119
+ _condition_4 = true
120
+ end
121
+ _attributes.RichText = _condition_4
122
+ local _condition_5 = props.TextScaled
123
+ if _condition_5 == nil then
124
+ _condition_5 = false
115
125
  end
116
- _attributes.TextScaled = _condition_4
126
+ _attributes.TextScaled = _condition_5
117
127
  _attributes.ZIndex = props.ZIndex
118
128
  _attributes.LayoutOrder = props.LayoutOrder
119
129
  _attributes.Visible = props.Visible
@@ -1,5 +1,6 @@
1
1
  export * from './draggable.context';
2
2
  export * from './droppable.context';
3
+ export * from './modal.context';
3
4
  export * from './navigation.context';
4
5
  export * from './overlay.context';
5
6
  export * from './row.context';
@@ -7,6 +7,9 @@ end
7
7
  for _k, _v in TS.import(script, script, "droppable.context") or {} do
8
8
  exports[_k] = _v
9
9
  end
10
+ for _k, _v in TS.import(script, script, "modal.context") or {} do
11
+ exports[_k] = _v
12
+ end
10
13
  for _k, _v in TS.import(script, script, "navigation.context") or {} do
11
14
  exports[_k] = _v
12
15
  end
@@ -0,0 +1,15 @@
1
+ import React from "@rbxts/react";
2
+ export interface ModalStackLayer {
3
+ id: string;
4
+ closeOnEscape: () => boolean;
5
+ requestClose: () => void;
6
+ }
7
+ export interface ModalStackContextValue {
8
+ register: (layer: ModalStackLayer) => void;
9
+ unregister: (id: string) => void;
10
+ getLayerIndex: (id: string) => number;
11
+ }
12
+ export declare const ModalStackContext: React.Context<ModalStackContextValue | undefined>;
13
+ export declare function useModalStack(): ModalStackContextValue;
14
+ export declare const ModalCloseContext: React.Context<(() => void) | undefined>;
15
+ export declare function useModalClose(): () => void;
@@ -0,0 +1,26 @@
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 ModalStackContext = React.createContext(nil)
5
+ local function useModalStack()
6
+ local context = React.useContext(ModalStackContext)
7
+ local _arg0 = context ~= nil
8
+ assert(_arg0, "ModalProvider is missing.")
9
+ return context
10
+ end
11
+ -- Per-instance, provided by each <Modal> around its own children so a
12
+ -- header close button or footer button can close the nearest modal
13
+ -- without the consumer threading their own handler down manually.
14
+ local ModalCloseContext = React.createContext(nil)
15
+ local function useModalClose()
16
+ local context = React.useContext(ModalCloseContext)
17
+ local _arg0 = context ~= nil
18
+ assert(_arg0, "useModalClose must be used inside a Modal.")
19
+ return context
20
+ end
21
+ return {
22
+ useModalStack = useModalStack,
23
+ useModalClose = useModalClose,
24
+ ModalStackContext = ModalStackContext,
25
+ ModalCloseContext = ModalCloseContext,
26
+ }
@@ -9,6 +9,7 @@ export interface ToastOptions {
9
9
  duration?: number;
10
10
  dismissible?: boolean;
11
11
  children?: React.ReactNode;
12
+ name?: string;
12
13
  }
13
14
  export interface ToastRecord extends ToastOptions {
14
15
  id: string;
@@ -5,6 +5,7 @@ local ToastContainer = TS.import(script, script.Parent.Parent, "Components", "In
5
5
  local RegistryProvider = TS.import(script, script.Parent, "registry.provider").RegistryProvider
6
6
  local ThemeProvider = TS.import(script, script.Parent, "theme.provider").ThemeProvider
7
7
  local OverlayProvider = TS.import(script, script.Parent, "overlay.provider").OverlayProvider
8
+ local ModalProvider = TS.import(script, script.Parent, "modal.provider").ModalProvider
8
9
  local ToastProvider = TS.import(script, script.Parent, "toast.provider").ToastProvider
9
10
  local function CleanUiProvider(_param)
10
11
  local children = _param.children
@@ -15,7 +16,7 @@ local function CleanUiProvider(_param)
15
16
  end
16
17
  return React.createElement(RegistryProvider, nil, React.createElement(ThemeProvider, {
17
18
  theme = theme,
18
- }, React.createElement(OverlayProvider, nil, React.createElement(ToastProvider, nil, children, toasts and React.createElement(ToastContainer)))))
19
+ }, React.createElement(OverlayProvider, nil, React.createElement(ModalProvider, nil, React.createElement(ToastProvider, nil, children, toasts and React.createElement(ToastContainer))))))
19
20
  end
20
21
  return {
21
22
  CleanUiProvider = CleanUiProvider,
@@ -1,3 +1,4 @@
1
+ export * from './modal.provider';
1
2
  export * from './overlay.provider';
2
3
  export * from './registry.provider';
3
4
  export * from './theme.provider';
@@ -1,6 +1,9 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
+ for _k, _v in TS.import(script, script, "modal.provider") or {} do
5
+ exports[_k] = _v
6
+ end
4
7
  for _k, _v in TS.import(script, script, "overlay.provider") or {} do
5
8
  exports[_k] = _v
6
9
  end
@@ -0,0 +1,6 @@
1
+ import React from "@rbxts/react";
2
+ interface ModalProviderProps {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare function ModalProvider(props: ModalProviderProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,86 @@
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 ModalStackContext = TS.import(script, script.Parent.Parent, "Contexts", "modal.context").ModalStackContext
5
+ local CustomInputService = TS.import(script, script.Parent.Parent, "Helpers", "input.helper").CustomInputService
6
+ local function ModalProvider(props)
7
+ local stack, setStack = React.useState({})
8
+ local stackRef = React.useRef(stack)
9
+ React.useEffect(function()
10
+ stackRef.current = stack
11
+ end, { stack })
12
+ local register = React.useCallback(function(layer)
13
+ setStack(function(current)
14
+ local _array = {}
15
+ local _length = #_array
16
+ local _currentLength = #current
17
+ table.move(current, 1, _currentLength, _length + 1, _array)
18
+ _length += _currentLength
19
+ _array[_length + 1] = layer
20
+ return _array
21
+ end)
22
+ end, {})
23
+ local unregister = React.useCallback(function(id)
24
+ setStack(function(current)
25
+ -- ▼ ReadonlyArray.filter ▼
26
+ local _newValue = {}
27
+ local _callback = function(layer)
28
+ return layer.id ~= id
29
+ end
30
+ local _length = 0
31
+ for _k, _v in current do
32
+ if _callback(_v, _k - 1, current) == true then
33
+ _length += 1
34
+ _newValue[_length] = _v
35
+ end
36
+ end
37
+ -- ▲ ReadonlyArray.filter ▲
38
+ return _newValue
39
+ end)
40
+ end, {})
41
+ local getLayerIndex = React.useCallback(function(id)
42
+ -- ▼ ReadonlyArray.findIndex ▼
43
+ local _callback = function(layer)
44
+ return layer.id == id
45
+ end
46
+ local _result = -1
47
+ for _i, _v in stack do
48
+ if _callback(_v, _i - 1, stack) == true then
49
+ _result = _i - 1
50
+ break
51
+ end
52
+ end
53
+ -- ▲ ReadonlyArray.findIndex ▲
54
+ return _result
55
+ end, { stack })
56
+ React.useEffect(function()
57
+ local connection = CustomInputService.InputBegan:Connect(function(input, gameProcessed)
58
+ if gameProcessed then
59
+ return nil
60
+ end
61
+ if input.KeyCode ~= Enum.KeyCode.Escape and input.KeyCode ~= Enum.KeyCode.ButtonB then
62
+ return nil
63
+ end
64
+ local top = stackRef.current[#stackRef.current]
65
+ if top ~= nil and top.closeOnEscape() then
66
+ top.requestClose()
67
+ end
68
+ end)
69
+ return function()
70
+ connection:Disconnect()
71
+ end
72
+ end, {})
73
+ local value = React.useMemo(function()
74
+ return {
75
+ register = register,
76
+ unregister = unregister,
77
+ getLayerIndex = getLayerIndex,
78
+ }
79
+ end, { register, unregister, getLayerIndex })
80
+ return React.createElement(ModalStackContext.Provider, {
81
+ value = value,
82
+ }, props.children)
83
+ end
84
+ return {
85
+ ModalProvider = ModalProvider,
86
+ }
@@ -11,6 +11,7 @@ local function OverlayProvider(props)
11
11
  overlay = overlay,
12
12
  },
13
13
  }, props.children, React.createElement("frame", {
14
+ key = "OverlayProvider",
14
15
  ref = function(instance)
15
16
  setOverlay(instance)
16
17
  end,