@rbxts/uiblox 0.2.0-alpha.15 → 0.2.0-alpha.17

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 (27) hide show
  1. package/out/ui/packages/accordion/components/Accordion.luau +17 -6
  2. package/out/ui/packages/accordion/components/Accordion.styles.luau +12 -2
  3. package/out/ui/packages/accordion/components/accordionOpen.d.ts +1 -0
  4. package/out/ui/packages/accordion/components/accordionOpen.luau +4 -0
  5. package/out/ui/packages/badge/components/Badge.d.ts +2 -0
  6. package/out/ui/packages/badge/components/Badge.luau +5 -0
  7. package/out/ui/packages/badge/components/Badge.styles.d.ts +2 -0
  8. package/out/ui/packages/badge/components/Badge.styles.luau +7 -2
  9. package/out/ui/packages/fab/components/Fab.d.ts +2 -0
  10. package/out/ui/packages/fab/components/Fab.luau +5 -0
  11. package/out/ui/packages/fab/components/Fab.styles.d.ts +2 -0
  12. package/out/ui/packages/fab/components/Fab.styles.luau +8 -3
  13. package/out/ui/packages/paper/components/Paper.d.ts +1 -1
  14. package/out/ui/packages/paper/components/Paper.luau +7 -1
  15. package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
  16. package/out/ui/packages/paper/components/Paper.styles.luau +6 -0
  17. package/out/ui/packages/rating/components/Rating.d.ts +1 -0
  18. package/out/ui/packages/rating/components/Rating.luau +2 -1
  19. package/out/ui/packages/snackbar/components/Snackbar.d.ts +2 -0
  20. package/out/ui/packages/snackbar/components/Snackbar.luau +5 -0
  21. package/out/ui/packages/snackbar/components/snackbarAction.d.ts +1 -0
  22. package/out/ui/packages/snackbar/components/snackbarAction.luau +10 -0
  23. package/out/ui/packages/stateMatrix.luau +249 -212
  24. package/out/ui/packages/toast/components/Toast.d.ts +2 -0
  25. package/out/ui/packages/toast/components/Toast.luau +26 -1
  26. package/out/ui/packages/toast/components/Toast.styles.luau +21 -3
  27. package/package.json +1 -1
@@ -6,6 +6,8 @@ export interface ToastProps {
6
6
  duration?: number;
7
7
  variant?: ToastVariants;
8
8
  toggledAt?: number;
9
+ action?: string;
10
+ onAction?: () => void;
9
11
  }
10
12
  declare function Toast(props: CustomizedProps<Frame, ToastProps>): JSX.Element;
11
13
  export default Toast;
@@ -18,6 +18,8 @@ local function Toast(props)
18
18
  if duration == nil then
19
19
  duration = 4
20
20
  end
21
+ local action = _binding.action
22
+ local onAction = _binding.onAction
21
23
  local className = _binding.className
22
24
  local sx = _binding.sx
23
25
  local id = _binding.id
@@ -26,6 +28,7 @@ local function Toast(props)
26
28
  local container = _binding_1.container
27
29
  local label = _binding_1.label
28
30
  local close = _binding_1.close
31
+ local actionStyle = _binding_1.action
29
32
  local activePosition = _binding_1.activePosition
30
33
  local inActivePosition = _binding_1.inActivePosition
31
34
  local frameRef = useRef()
@@ -90,6 +93,28 @@ local function Toast(props)
90
93
  end
91
94
  _attributes_1.Text = text
92
95
  local _exp_2 = React.createElement("textlabel", _attributes_1)
96
+ local _condition_1 = action ~= nil and #action > 0
97
+ if _condition_1 then
98
+ local _attributes_2 = {
99
+ key = "Action",
100
+ }
101
+ for _k, _v in actionStyle do
102
+ _attributes_2[_k] = _v
103
+ end
104
+ _attributes_2.Text = action
105
+ _attributes_2.Event = {
106
+ Activated = function()
107
+ if onAction then
108
+ onAction()
109
+ end
110
+ tween(Directions.Out)
111
+ if onDismiss then
112
+ onDismiss()
113
+ end
114
+ end,
115
+ }
116
+ _condition_1 = (React.createElement("textbutton", _attributes_2))
117
+ end
93
118
  local _attributes_2 = {
94
119
  key = "Close",
95
120
  }
@@ -104,7 +129,7 @@ local function Toast(props)
104
129
  end
105
130
  end,
106
131
  }
107
- return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, React.createElement("imagebutton", _attributes_2))
132
+ return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _condition_1, React.createElement("imagebutton", _attributes_2))
108
133
  end
109
134
  local default = Toast
110
135
  return {
@@ -11,6 +11,7 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
11
11
  if variant == nil then
12
12
  variant = ToastVariants.default
13
13
  end
14
+ local action = _param.action
14
15
  local getToastColors = function()
15
16
  repeat
16
17
  if variant == (ToastVariants.success) then
@@ -38,6 +39,8 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
38
39
  until true
39
40
  end
40
41
  local toastColors = getToastColors()
42
+ local hasAction = action ~= nil and #action > 0
43
+ local actionSlot = if hasAction then theme.spacing.calc(8) else 0
41
44
  local ACTIVE_POSITION = UDim2.new(0.5, 0, 1, -DEFAULT_THEME.padding.calc(2))
42
45
  local INACTIVE_POSITION = UDim2.new(0.5, 0, 1, DEFAULT_THEME.spacing.calc(20) + DEFAULT_THEME.padding.calc(2))
43
46
  return createStyles({
@@ -50,17 +53,32 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
50
53
  ZIndex = 50000,
51
54
  },
52
55
  label = {
53
- Size = UDim2.new(1, -theme.padding.calc(4), 1, -theme.padding.calc(4)),
54
- Position = UDim2.new(0.5, 0, 0.5, 0),
55
- AnchorPoint = Vector2.new(0.5, 0.5),
56
+ Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot), 1, -theme.padding.calc(4)),
57
+ Position = if hasAction then UDim2.new(0, theme.padding.calc(2), 0.5, 0) else UDim2.new(0.5, 0, 0.5, 0),
58
+ AnchorPoint = if hasAction then Vector2.new(0, 0.5) else Vector2.new(0.5, 0.5),
56
59
  BackgroundTransparency = 1,
57
60
  BorderSizePixel = 0,
58
61
  TextSize = theme.typography.fontSizes.body,
59
62
  TextColor3 = toastColors.content,
60
63
  Font = theme.typography.fontFamilies.default,
64
+ TextXAlignment = if hasAction then Enum.TextXAlignment.Left else Enum.TextXAlignment.Center,
65
+ TextTruncate = Enum.TextTruncate.AtEnd,
61
66
  TextScaled = false,
62
67
  ZIndex = 50001,
63
68
  },
69
+ action = {
70
+ AutomaticSize = Enum.AutomaticSize.X,
71
+ Size = UDim2.new(0, 0, 0, theme.spacing.calc(3)),
72
+ Position = UDim2.new(1, -(theme.padding.calc(2) + theme.options.constants.iconSizes.small + theme.padding.calc(1)), 0.5, 0),
73
+ AnchorPoint = Vector2.new(1, 0.5),
74
+ BackgroundTransparency = 1,
75
+ BorderSizePixel = 0,
76
+ Font = theme.typography.fontFamilies.default,
77
+ TextSize = theme.typography.fontSizes.body,
78
+ TextColor3 = toastColors.content,
79
+ AutoButtonColor = false,
80
+ ZIndex = 50001,
81
+ },
64
82
  close = {
65
83
  Size = UDim2.new(0, theme.options.constants.iconSizes.small, 0, theme.options.constants.iconSizes.small),
66
84
  Position = UDim2.new(1, -theme.padding.calc(2), 0, theme.padding.calc(2)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.2.0-alpha.15",
3
+ "version": "0.2.0-alpha.17",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.luau",
6
6
  "packageManager": "pnpm@11.3.0",