@rbxts/uiblox 0.2.0-alpha.6 → 0.2.0-alpha.8

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 (60) hide show
  1. package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
  2. package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
  3. package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
  4. package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
  5. package/out/ui/packages/backdrop/index.d.ts +2 -0
  6. package/out/ui/packages/backdrop/init.luau +5 -0
  7. package/out/ui/packages/badge/components/Badge.styles.luau +6 -3
  8. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
  9. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +58 -24
  10. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
  11. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
  12. package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
  13. package/out/ui/packages/breadcrumbs/init.luau +3 -0
  14. package/out/ui/packages/chip/components/Chip.d.ts +2 -1
  15. package/out/ui/packages/chip/components/Chip.luau +2 -0
  16. package/out/ui/packages/chip/components/Chip.styles.d.ts +2 -0
  17. package/out/ui/packages/chip/components/Chip.styles.luau +13 -7
  18. package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
  19. package/out/ui/packages/dialog/components/Dialog.luau +27 -18
  20. package/out/ui/packages/fab/components/Fab.d.ts +1 -0
  21. package/out/ui/packages/fab/components/Fab.luau +57 -25
  22. package/out/ui/packages/fab/components/Fab.styles.d.ts +1 -0
  23. package/out/ui/packages/fab/components/Fab.styles.luau +26 -1
  24. package/out/ui/packages/fab/components/fabSize.d.ts +1 -0
  25. package/out/ui/packages/fab/components/fabSize.luau +4 -0
  26. package/out/ui/packages/fab/index.d.ts +1 -1
  27. package/out/ui/packages/fab/init.luau +1 -0
  28. package/out/ui/packages/index.d.ts +1 -0
  29. package/out/ui/packages/init.luau +3 -0
  30. package/out/ui/packages/layout/components/Container.d.ts +10 -0
  31. package/out/ui/packages/layout/components/Container.luau +54 -0
  32. package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
  33. package/out/ui/packages/layout/components/Container.styles.luau +41 -0
  34. package/out/ui/packages/layout/components/Grid.d.ts +1 -1
  35. package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
  36. package/out/ui/packages/layout/components/containerWidth.luau +17 -0
  37. package/out/ui/packages/layout/index.d.ts +3 -0
  38. package/out/ui/packages/layout/init.luau +2 -0
  39. package/out/ui/packages/modal/components/Modal.d.ts +1 -1
  40. package/out/ui/packages/modal/components/Modal.luau +55 -37
  41. package/out/ui/packages/pagination/components/Pagination.d.ts +2 -0
  42. package/out/ui/packages/pagination/components/Pagination.luau +37 -21
  43. package/out/ui/packages/pagination/components/Pagination.styles.luau +9 -0
  44. package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
  45. package/out/ui/packages/pagination/components/pageRange.luau +91 -8
  46. package/out/ui/packages/pagination/index.d.ts +1 -0
  47. package/out/ui/packages/pagination/init.luau +1 -0
  48. package/out/ui/packages/popup/index.d.ts +1 -0
  49. package/out/ui/packages/popup/init.luau +1 -0
  50. package/out/ui/packages/stateMatrix.luau +235 -149
  51. package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
  52. package/out/ui/packages/tabs/components/Tabs.luau +10 -3
  53. package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
  54. package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
  55. package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
  56. package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
  57. package/out/ui/packages/tabs/index.d.ts +1 -0
  58. package/out/ui/packages/tabs/init.luau +1 -0
  59. package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
  60. package/package.json +2 -2
@@ -0,0 +1,10 @@
1
+ import React from "@rbxts/react";
2
+ import { CustomizedProps } from "../../../../theme/index";
3
+ export interface BackdropProps {
4
+ open?: boolean;
5
+ invisible?: boolean;
6
+ onClick?: () => void;
7
+ children?: React.ReactNode;
8
+ }
9
+ declare function Backdrop(props: CustomizedProps<TextButton, BackdropProps>): JSX.Element | undefined;
10
+ export default Backdrop;
@@ -0,0 +1,58 @@
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 useBackdropStyles = TS.import(script, script.Parent, "Backdrop.styles").default
5
+ local function Backdrop(props)
6
+ local _binding = props
7
+ local open = _binding.open
8
+ if open == nil then
9
+ open = true
10
+ end
11
+ local invisible = _binding.invisible
12
+ local onClick = _binding.onClick
13
+ local children = _binding.children
14
+ local className = _binding.className
15
+ local sx = _binding.sx
16
+ local id = _binding.id
17
+ local ref = _binding.ref
18
+ local styles = useBackdropStyles({
19
+ invisible = invisible,
20
+ })
21
+ if open ~= true then
22
+ return nil
23
+ end
24
+ local _attributes = {}
25
+ local _condition = id
26
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
27
+ _condition = "Backdrop"
28
+ end
29
+ _attributes.key = _condition
30
+ _attributes.ref = ref
31
+ for _k, _v in styles.root do
32
+ _attributes[_k] = _v
33
+ end
34
+ if className then
35
+ for _k, _v in className do
36
+ _attributes[_k] = _v
37
+ end
38
+ end
39
+ if sx then
40
+ for _k, _v in sx do
41
+ _attributes[_k] = _v
42
+ end
43
+ end
44
+ _attributes.Event = {
45
+ Activated = function()
46
+ local _result = onClick
47
+ if _result ~= nil then
48
+ _result = _result()
49
+ end
50
+ return _result
51
+ end,
52
+ }
53
+ return React.createElement("textbutton", _attributes, children)
54
+ end
55
+ local default = Backdrop
56
+ return {
57
+ default = default,
58
+ }
@@ -0,0 +1,4 @@
1
+ declare const useBackdropStyles: (props: {
2
+ invisible?: boolean;
3
+ }) => import("../../../../theme/index").ClassNameMap<string>;
4
+ export default useBackdropStyles;
@@ -0,0 +1,24 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
+ local componentStyles = _theme.componentStyles
5
+ local createStyles = _theme.createStyles
6
+ local useBackdropStyles = componentStyles("Backdrop", function(theme, _param)
7
+ local invisible = _param.invisible
8
+ return createStyles({
9
+ root = {
10
+ Size = UDim2.fromScale(1, 1),
11
+ BackgroundColor3 = theme.palette.backdrop,
12
+ BackgroundTransparency = if invisible == true then 1 else 0.45,
13
+ BorderSizePixel = 0,
14
+ Text = "",
15
+ AutoButtonColor = false,
16
+ Selectable = false,
17
+ ZIndex = 30000,
18
+ },
19
+ })
20
+ end)
21
+ local default = useBackdropStyles
22
+ return {
23
+ default = default,
24
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Backdrop } from "./components/Backdrop";
2
+ export { BackdropProps } from "./components/Backdrop";
@@ -0,0 +1,5 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ exports.Backdrop = TS.import(script, script, "components", "Backdrop").default
5
+ return exports
@@ -4,6 +4,7 @@ local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "the
4
4
  local componentStyles = _theme.componentStyles
5
5
  local createStyles = _theme.createStyles
6
6
  local useBadgeStyles = componentStyles("Badge", function(theme)
7
+ local diameter = theme.spacing.calc(2) + theme.padding.calc(1)
7
8
  return createStyles({
8
9
  root = {
9
10
  AutomaticSize = Enum.AutomaticSize.XY,
@@ -14,13 +15,15 @@ local useBadgeStyles = componentStyles("Badge", function(theme)
14
15
  badge = {
15
16
  AnchorPoint = Vector2.new(0.5, 0.5),
16
17
  Position = UDim2.fromScale(1, 0),
17
- AutomaticSize = Enum.AutomaticSize.XY,
18
- Size = UDim2.fromOffset(theme.padding.calc(2), theme.padding.calc(2)),
18
+ AutomaticSize = Enum.AutomaticSize.X,
19
+ Size = UDim2.fromOffset(diameter, diameter),
19
20
  BackgroundColor3 = theme.palette.status.error.main,
20
21
  BorderSizePixel = 0,
21
22
  Font = theme.typography.fontFamilies.default,
22
23
  TextSize = theme.typography.fontSizes.caption,
23
24
  TextColor3 = theme.palette.text.inverse,
25
+ TextXAlignment = Enum.TextXAlignment.Center,
26
+ TextYAlignment = Enum.TextYAlignment.Center,
24
27
  ZIndex = 2,
25
28
  },
26
29
  padding = {
@@ -28,7 +31,7 @@ local useBadgeStyles = componentStyles("Badge", function(theme)
28
31
  PaddingRight = UDim.new(0, theme.padding.calc(0.5)),
29
32
  },
30
33
  corner = {
31
- CornerRadius = UDim.new(1, 0),
34
+ CornerRadius = UDim.new(0.5, 0),
32
35
  },
33
36
  })
34
37
  end)
@@ -6,6 +6,7 @@ export interface BreadcrumbItem {
6
6
  export interface BreadcrumbsProps {
7
7
  items: BreadcrumbItem[];
8
8
  separator?: string;
9
+ maxItems?: number;
9
10
  }
10
11
  declare function Breadcrumbs(props: CustomizedProps<Frame, BreadcrumbsProps>): JSX.Element;
11
12
  export default Breadcrumbs;
@@ -2,7 +2,9 @@
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
5
- local breadcrumbCurrent = TS.import(script, script.Parent, "breadcrumbItems").breadcrumbCurrent
5
+ local _breadcrumbItems = TS.import(script, script.Parent, "breadcrumbItems")
6
+ local breadcrumbCurrent = _breadcrumbItems.breadcrumbCurrent
7
+ local breadcrumbVisible = _breadcrumbItems.breadcrumbVisible
6
8
  local useBreadcrumbStyles = TS.import(script, script.Parent, "Breadcrumbs.styles").default
7
9
  local function Breadcrumbs(props)
8
10
  local _binding = props
@@ -11,11 +13,13 @@ local function Breadcrumbs(props)
11
13
  if separator == nil then
12
14
  separator = "/"
13
15
  end
16
+ local maxItems = _binding.maxItems
14
17
  local className = _binding.className
15
18
  local sx = _binding.sx
16
19
  local id = _binding.id
17
20
  local ref = _binding.ref
18
21
  local styles = useBreadcrumbStyles()
22
+ local visible = breadcrumbVisible(items, maxItems)
19
23
  local _attributes = {}
20
24
  local _condition = id
21
25
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -40,38 +44,68 @@ local function Breadcrumbs(props)
40
44
  setmetatable(_attributes_1, nil)
41
45
  local _exp = React.createElement("uilistlayout", _attributes_1)
42
46
  -- ▼ ReadonlyArray.map ▼
43
- local _newValue = table.create(#items)
44
- local _callback = function(item, index)
45
- local current = breadcrumbCurrent(index, #items)
46
- local _condition_1 = index > 0
47
+ local _newValue = table.create(#visible)
48
+ local _callback = function(entry, order)
49
+ local current = not entry.ellipsis and breadcrumbCurrent(entry.index, #items)
50
+ local item = if entry.ellipsis then nil else items[entry.index + 1]
51
+ local _condition_1 = order > 0
47
52
  if _condition_1 then
48
53
  local _attributes_2 = table.clone(styles.separator)
49
54
  setmetatable(_attributes_2, nil)
50
55
  _attributes_2.Text = separator
51
- _attributes_2.LayoutOrder = index * 2
56
+ _attributes_2.LayoutOrder = order * 2
52
57
  _condition_1 = React.createElement("textlabel", _attributes_2)
53
58
  end
54
- local _attributes_2 = table.clone(cx(styles.item, current and styles.current))
55
- setmetatable(_attributes_2, nil)
56
- _attributes_2.Text = item.label
57
- _attributes_2.LayoutOrder = index * 2 + 1
58
- _attributes_2.Active = not current and item.onActivated ~= nil
59
- _attributes_2.Selectable = not current and item.onActivated ~= nil
60
- _attributes_2.Event = {
61
- Activated = function()
62
- local _result = item.onActivated
63
- if _result ~= nil then
64
- _result = _result()
59
+ local _result
60
+ if entry.ellipsis then
61
+ local _attributes_2 = table.clone(styles.separator)
62
+ setmetatable(_attributes_2, nil)
63
+ _attributes_2.Text = "…"
64
+ _attributes_2.LayoutOrder = order * 2 + 1
65
+ _result = (React.createElement("textlabel", _attributes_2))
66
+ else
67
+ local _attributes_2 = table.clone(cx(styles.item, current and styles.current))
68
+ setmetatable(_attributes_2, nil)
69
+ _attributes_2.Text = entry.label
70
+ _attributes_2.LayoutOrder = order * 2 + 1
71
+ local _condition_2 = not current
72
+ if _condition_2 then
73
+ local _result_1 = item
74
+ if _result_1 ~= nil then
75
+ _result_1 = _result_1.onActivated
65
76
  end
66
- return _result
67
- end,
68
- }
77
+ _condition_2 = _result_1 ~= nil
78
+ end
79
+ _attributes_2.Active = _condition_2
80
+ local _condition_3 = not current
81
+ if _condition_3 then
82
+ local _result_1 = item
83
+ if _result_1 ~= nil then
84
+ _result_1 = _result_1.onActivated
85
+ end
86
+ _condition_3 = _result_1 ~= nil
87
+ end
88
+ _attributes_2.Selectable = _condition_3
89
+ _attributes_2.Event = {
90
+ Activated = function()
91
+ local _result_1 = item
92
+ if _result_1 ~= nil then
93
+ _result_1 = _result_1.onActivated
94
+ if _result_1 ~= nil then
95
+ _result_1 = _result_1()
96
+ end
97
+ end
98
+ return _result_1
99
+ end,
100
+ }
101
+ _result = (React.createElement("textbutton", _attributes_2))
102
+ end
69
103
  return React.createElement(React.Fragment, {
70
- key = `{item.label}-{index}`,
71
- }, _condition_1, React.createElement("textbutton", _attributes_2))
104
+ key = `{entry.label}-{order}`,
105
+ }, _condition_1, _result)
72
106
  end
73
- for _k, _v in items do
74
- _newValue[_k] = _callback(_v, _k - 1, items)
107
+ for _k, _v in visible do
108
+ _newValue[_k] = _callback(_v, _k - 1, visible)
75
109
  end
76
110
  -- ▲ ReadonlyArray.map ▲
77
111
  return React.createElement("frame", _attributes, _exp, _newValue)
@@ -1 +1,10 @@
1
1
  export declare function breadcrumbCurrent(index: number, count: number): boolean;
2
+ export interface BreadcrumbSlice {
3
+ label: string;
4
+ index: number;
5
+ ellipsis?: boolean;
6
+ }
7
+ /** Collapse middle items when over maxItems (keep ends). */
8
+ export declare function breadcrumbVisible<T extends {
9
+ label: string;
10
+ }>(items: T[], maxItems?: number): BreadcrumbSlice[];
@@ -2,6 +2,74 @@
2
2
  local function breadcrumbCurrent(index, count)
3
3
  return count > 0 and index == count - 1
4
4
  end
5
+ --* Collapse middle items when over maxItems (keep ends).
6
+ local function breadcrumbVisible(items, maxItems)
7
+ local count = #items
8
+ if maxItems == nil or maxItems < 1 or count <= maxItems then
9
+ local out = {}
10
+ do
11
+ local i = 0
12
+ local _shouldIncrement = false
13
+ while true do
14
+ if _shouldIncrement then
15
+ i += 1
16
+ else
17
+ _shouldIncrement = true
18
+ end
19
+ if not (i < count) then
20
+ break
21
+ end
22
+ local _arg0 = {
23
+ label = items[i + 1].label,
24
+ index = i,
25
+ }
26
+ table.insert(out, _arg0)
27
+ end
28
+ end
29
+ return out
30
+ end
31
+ if maxItems == 1 then
32
+ return { {
33
+ label = items[count].label,
34
+ index = count - 1,
35
+ } }
36
+ end
37
+ local keepEnd = 1
38
+ local rawStart = maxItems - keepEnd - 1
39
+ local keepStart = if rawStart < 1 then 1 else rawStart
40
+ local out = {}
41
+ do
42
+ local i = 0
43
+ local _shouldIncrement = false
44
+ while true do
45
+ if _shouldIncrement then
46
+ i += 1
47
+ else
48
+ _shouldIncrement = true
49
+ end
50
+ if not (i < keepStart) then
51
+ break
52
+ end
53
+ local _arg0 = {
54
+ label = items[i + 1].label,
55
+ index = i,
56
+ }
57
+ table.insert(out, _arg0)
58
+ end
59
+ end
60
+ table.insert(out, {
61
+ label = "…",
62
+ index = -1,
63
+ ellipsis = true,
64
+ })
65
+ local _arg0 = {
66
+ label = items[count].label,
67
+ index = count - 1,
68
+ }
69
+ table.insert(out, _arg0)
70
+ return out
71
+ end
5
72
  return {
6
73
  breadcrumbCurrent = breadcrumbCurrent,
74
+ breadcrumbVisible = breadcrumbVisible,
7
75
  }
@@ -1,2 +1,3 @@
1
1
  export { default as Breadcrumbs } from "./components/Breadcrumbs";
2
2
  export { BreadcrumbItem, BreadcrumbsProps } from "./components/Breadcrumbs";
3
+ export { breadcrumbCurrent, breadcrumbVisible } from "./components/breadcrumbItems";
@@ -2,4 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
4
  exports.Breadcrumbs = TS.import(script, script, "components", "Breadcrumbs").default
5
+ local _breadcrumbItems = TS.import(script, script, "components", "breadcrumbItems")
6
+ exports.breadcrumbCurrent = _breadcrumbItems.breadcrumbCurrent
7
+ exports.breadcrumbVisible = _breadcrumbItems.breadcrumbVisible
5
8
  return exports
@@ -1,8 +1,9 @@
1
- import { CustomizedProps } from "../../../../theme/index";
1
+ import { ControlSize, CustomizedProps } from "../../../../theme/index";
2
2
  export interface ChipProps {
3
3
  label: string;
4
4
  selected?: boolean;
5
5
  disabled?: boolean;
6
+ size?: ControlSize;
6
7
  onActivated?: () => void;
7
8
  onDelete?: () => void;
8
9
  }
@@ -8,6 +8,7 @@ local function Chip(props)
8
8
  local label = _binding.label
9
9
  local selected = _binding.selected
10
10
  local disabled = _binding.disabled
11
+ local size = _binding.size
11
12
  local onActivated = _binding.onActivated
12
13
  local onDelete = _binding.onDelete
13
14
  local className = _binding.className
@@ -19,6 +20,7 @@ local function Chip(props)
19
20
  selected = selected,
20
21
  disabled = disabled,
21
22
  deletable = deletable,
23
+ size = size,
22
24
  })
23
25
  local _attributes = {}
24
26
  local _condition = id
@@ -1,6 +1,8 @@
1
+ import { ControlSize } from "../../../../theme/index";
1
2
  declare const useChipStyles: (props: {
2
3
  selected?: boolean;
3
4
  disabled?: boolean;
4
5
  deletable?: boolean;
6
+ size?: ControlSize;
5
7
  }) => import("../../../../theme/index").ClassNameMap<string>;
6
8
  export default useChipStyles;
@@ -2,6 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
4
  local componentStyles = _theme.componentStyles
5
+ local controlMetrics = _theme.controlMetrics
5
6
  local createStyles = _theme.createStyles
6
7
  local useChipStyles = componentStyles("Chip", function(theme, _param)
7
8
  local selected = _param.selected
@@ -16,6 +17,11 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
16
17
  if deletable == nil then
17
18
  deletable = false
18
19
  end
20
+ local size = _param.size
21
+ local metrics = controlMetrics(theme.density, size)
22
+ local padY = if size == "small" then 0.25 elseif size == "large" then 0.75 else 0.5
23
+ local padX = if size == "small" then 1 elseif size == "large" then 2 else 1.5
24
+ local deletePx = metrics.icon
19
25
  return createStyles({
20
26
  root = {
21
27
  AutomaticSize = Enum.AutomaticSize.XY,
@@ -27,13 +33,13 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
27
33
  Selectable = not disabled,
28
34
  TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
29
35
  Font = theme.typography.fontFamilies.default,
30
- TextSize = theme.typography.fontSizes.body,
36
+ TextSize = metrics.font,
31
37
  },
32
38
  padding = {
33
- PaddingTop = UDim.new(0, theme.padding.calc(0.5)),
34
- PaddingBottom = UDim.new(0, theme.padding.calc(0.5)),
35
- PaddingLeft = UDim.new(0, theme.padding.calc(1.5)),
36
- PaddingRight = UDim.new(0, theme.padding.calc(if deletable then 0.5 else 1.5)),
39
+ PaddingTop = UDim.new(0, theme.padding.calc(padY)),
40
+ PaddingBottom = UDim.new(0, theme.padding.calc(padY)),
41
+ PaddingLeft = UDim.new(0, theme.padding.calc(padX)),
42
+ PaddingRight = UDim.new(0, theme.padding.calc(if deletable then 0.5 else padX)),
37
43
  },
38
44
  corner = {
39
45
  CornerRadius = UDim.new(theme.shape.pillScale, 0),
@@ -56,11 +62,11 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
56
62
  BorderSizePixel = 0,
57
63
  TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
58
64
  Font = theme.typography.fontFamilies.default,
59
- TextSize = theme.typography.fontSizes.body,
65
+ TextSize = metrics.font,
60
66
  LayoutOrder = 1,
61
67
  },
62
68
  delete = {
63
- Size = UDim2.fromOffset(theme.spacing.calc(2), theme.spacing.calc(2)),
69
+ Size = UDim2.fromOffset(deletePx, deletePx),
64
70
  BackgroundTransparency = 1,
65
71
  BorderSizePixel = 0,
66
72
  AutoButtonColor = false,
@@ -2,7 +2,7 @@ import React from "@rbxts/react";
2
2
  export interface DialogProps {
3
3
  host?: Instance;
4
4
  open: boolean;
5
- title: string;
5
+ title?: string;
6
6
  onClose: () => void;
7
7
  children?: React.ReactNode;
8
8
  actions?: React.ReactNode;
@@ -12,6 +12,8 @@ local function Dialog(props)
12
12
  local children = _binding.children
13
13
  local actions = _binding.actions
14
14
  local styles = useDialogStyles()
15
+ local hasTitle = title ~= nil and title ~= ""
16
+ local hasActions = actions ~= nil
15
17
  local _attributes = {
16
18
  key = "Column",
17
19
  }
@@ -21,34 +23,41 @@ local function Dialog(props)
21
23
  local _attributes_1 = table.clone(styles.columnList)
22
24
  setmetatable(_attributes_1, nil)
23
25
  local _exp = React.createElement("uilistlayout", _attributes_1)
24
- local _attributes_2 = {
25
- key = "Title",
26
- }
27
- for _k, _v in styles.title do
28
- _attributes_2[_k] = _v
26
+ local _condition = hasTitle
27
+ if _condition then
28
+ local _attributes_2 = {
29
+ key = "Title",
30
+ }
31
+ for _k, _v in styles.title do
32
+ _attributes_2[_k] = _v
33
+ end
34
+ _attributes_2.Text = title
35
+ _condition = React.createElement("textlabel", _attributes_2)
29
36
  end
30
- _attributes_2.Text = title
31
- local _exp_1 = React.createElement("textlabel", _attributes_2)
32
- local _attributes_3 = {
37
+ local _attributes_2 = {
33
38
  key = "Body",
34
39
  }
35
40
  for _k, _v in styles.body do
36
- _attributes_3[_k] = _v
41
+ _attributes_2[_k] = _v
37
42
  end
38
- local _exp_2 = React.createElement("frame", _attributes_3, children)
39
- local _attributes_4 = {
40
- key = "Actions",
41
- }
42
- for _k, _v in styles.actions do
43
- _attributes_4[_k] = _v
43
+ local _exp_1 = React.createElement("frame", _attributes_2, children)
44
+ local _condition_1 = hasActions
45
+ if _condition_1 then
46
+ local _attributes_3 = {
47
+ key = "Actions",
48
+ }
49
+ for _k, _v in styles.actions do
50
+ _attributes_3[_k] = _v
51
+ end
52
+ local _attributes_4 = table.clone(styles.actionList)
53
+ setmetatable(_attributes_4, nil)
54
+ _condition_1 = (React.createElement("frame", _attributes_3, React.createElement("uilistlayout", _attributes_4), actions))
44
55
  end
45
- local _attributes_5 = table.clone(styles.actionList)
46
- setmetatable(_attributes_5, nil)
47
56
  return React.createElement(Modal, {
48
57
  host = host,
49
58
  open = open,
50
59
  onClose = onClose,
51
- }, React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, React.createElement("frame", _attributes_4, React.createElement("uilistlayout", _attributes_5), actions)))
60
+ }, React.createElement("frame", _attributes, _exp, _condition, _exp_1, _condition_1))
52
61
  end
53
62
  local default = Dialog
54
63
  return {
@@ -3,6 +3,7 @@ import { Icons } from "../../../enums/index";
3
3
  import { FabSize } from "./fabSize";
4
4
  export interface FabProps {
5
5
  icon: Icons;
6
+ label?: string;
6
7
  size?: FabSize;
7
8
  disabled?: boolean;
8
9
  loading?: boolean;
@@ -8,11 +8,14 @@ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "t
8
8
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
9
9
  local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
10
10
  local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
11
- local fabIconPixels = TS.import(script, script.Parent, "fabSize").fabIconPixels
11
+ local _fabSize = TS.import(script, script.Parent, "fabSize")
12
+ local fabExtended = _fabSize.fabExtended
13
+ local fabIconPixels = _fabSize.fabIconPixels
12
14
  local useFabStyles = TS.import(script, script.Parent, "Fab.styles").default
13
15
  local function Fab(props)
14
16
  local _binding = props
15
17
  local icon = _binding.icon
18
+ local label = _binding.label
16
19
  local size = _binding.size
17
20
  if size == nil then
18
21
  size = "medium"
@@ -29,9 +32,11 @@ local function Fab(props)
29
32
  local id = _binding.id
30
33
  local ref = _binding.ref
31
34
  local active = canActivate(disabled, loading)
35
+ local extended = fabExtended(label)
32
36
  local styles = useFabStyles({
33
37
  size = size,
34
38
  disabled = not active,
39
+ extended = extended,
35
40
  })
36
41
  local _binding_1 = useTheme()
37
42
  local theme = _binding_1.theme
@@ -45,6 +50,34 @@ local function Fab(props)
45
50
  setHovering(false)
46
51
  setFocused(false)
47
52
  end, { active })
53
+ local _result
54
+ if loading then
55
+ _result = (React.createElement(CircularProgress, {
56
+ size = iconPx,
57
+ thickness = 2,
58
+ color = theme.palette.primary.on,
59
+ reducedMotion = reducedMotion,
60
+ className = if extended then {
61
+ LayoutOrder = 1,
62
+ } else {
63
+ AnchorPoint = Vector2.new(0.5, 0.5),
64
+ Position = UDim2.fromScale(0.5, 0.5),
65
+ },
66
+ }))
67
+ else
68
+ local _attributes = {
69
+ key = "Icon",
70
+ }
71
+ for _k, _v in styles.icon do
72
+ _attributes[_k] = _v
73
+ end
74
+ _attributes.Size = UDim2.fromOffset(iconPx, iconPx)
75
+ _attributes.AnchorPoint = if extended then Vector2.new(0, 0) else Vector2.new(0.5, 0.5)
76
+ _attributes.Position = if extended then UDim2.fromScale(0, 0) else UDim2.fromScale(0.5, 0.5)
77
+ _attributes.Image = tostring(icon)
78
+ _result = (React.createElement("imagelabel", _attributes))
79
+ end
80
+ local iconEl = _result
48
81
  local _attributes = {}
49
82
  local _condition = id
50
83
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -95,32 +128,31 @@ local function Fab(props)
95
128
  setmetatable(_attributes_1, nil)
96
129
  local _exp = React.createElement("uicorner", _attributes_1)
97
130
  local _exp_1 = React.createElement(Shadow)
98
- local _result
99
- if loading then
100
- _result = (React.createElement(CircularProgress, {
101
- size = iconPx,
102
- thickness = 2,
103
- color = theme.palette.primary.on,
104
- reducedMotion = reducedMotion,
105
- className = {
106
- AnchorPoint = Vector2.new(0.5, 0.5),
107
- Position = UDim2.fromScale(0.5, 0.5),
108
- },
109
- }))
110
- else
111
- local _attributes_2 = {
112
- key = "Icon",
113
- }
114
- for _k, _v in styles.icon do
115
- _attributes_2[_k] = _v
131
+ local _result_1
132
+ if extended then
133
+ local _attributes_2 = table.clone(styles.padding)
134
+ setmetatable(_attributes_2, nil)
135
+ local _exp_2 = React.createElement("uipadding", _attributes_2)
136
+ local _attributes_3 = table.clone(styles.row)
137
+ setmetatable(_attributes_3, nil)
138
+ local _exp_3 = React.createElement("uilistlayout", _attributes_3)
139
+ local _exp_4 = iconEl
140
+ local _condition_1 = not loading
141
+ if _condition_1 then
142
+ local _attributes_4 = {
143
+ key = "Label",
144
+ }
145
+ for _k, _v in styles.label do
146
+ _attributes_4[_k] = _v
147
+ end
148
+ _attributes_4.Text = label
149
+ _condition_1 = React.createElement("textlabel", _attributes_4)
116
150
  end
117
- _attributes_2.Size = UDim2.fromOffset(iconPx, iconPx)
118
- _attributes_2.AnchorPoint = Vector2.new(0.5, 0.5)
119
- _attributes_2.Position = UDim2.fromScale(0.5, 0.5)
120
- _attributes_2.Image = tostring(icon)
121
- _result = (React.createElement("imagelabel", _attributes_2))
151
+ _result_1 = (React.createElement(React.Fragment, nil, _exp_2, _exp_3, _exp_4, _condition_1))
152
+ else
153
+ _result_1 = iconEl
122
154
  end
123
- return React.createElement("textbutton", _attributes, _exp, _exp_1, _result)
155
+ return React.createElement("textbutton", _attributes, _exp, _exp_1, _result_1)
124
156
  end
125
157
  local default = Fab
126
158
  return {