@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.
- package/out/ui/packages/accordion/components/Accordion.luau +17 -6
- package/out/ui/packages/accordion/components/Accordion.styles.luau +12 -2
- package/out/ui/packages/accordion/components/accordionOpen.d.ts +1 -0
- package/out/ui/packages/accordion/components/accordionOpen.luau +4 -0
- package/out/ui/packages/badge/components/Badge.d.ts +2 -0
- package/out/ui/packages/badge/components/Badge.luau +5 -0
- package/out/ui/packages/badge/components/Badge.styles.d.ts +2 -0
- package/out/ui/packages/badge/components/Badge.styles.luau +7 -2
- package/out/ui/packages/fab/components/Fab.d.ts +2 -0
- package/out/ui/packages/fab/components/Fab.luau +5 -0
- package/out/ui/packages/fab/components/Fab.styles.d.ts +2 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +8 -3
- package/out/ui/packages/paper/components/Paper.d.ts +1 -1
- package/out/ui/packages/paper/components/Paper.luau +7 -1
- package/out/ui/packages/paper/components/Paper.styles.d.ts +1 -1
- package/out/ui/packages/paper/components/Paper.styles.luau +6 -0
- package/out/ui/packages/rating/components/Rating.d.ts +1 -0
- package/out/ui/packages/rating/components/Rating.luau +2 -1
- package/out/ui/packages/snackbar/components/Snackbar.d.ts +2 -0
- package/out/ui/packages/snackbar/components/Snackbar.luau +5 -0
- package/out/ui/packages/snackbar/components/snackbarAction.d.ts +1 -0
- package/out/ui/packages/snackbar/components/snackbarAction.luau +10 -0
- package/out/ui/packages/stateMatrix.luau +249 -212
- package/out/ui/packages/toast/components/Toast.d.ts +2 -0
- package/out/ui/packages/toast/components/Toast.luau +26 -1
- package/out/ui/packages/toast/components/Toast.styles.luau +21 -3
- package/package.json +1 -1
|
@@ -3,7 +3,10 @@ local TS = _G[script]
|
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
5
|
local useState = _react.useState
|
|
6
|
-
local
|
|
6
|
+
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
7
|
+
local _accordionOpen = TS.import(script, script.Parent, "accordionOpen")
|
|
8
|
+
local accordionGlyph = _accordionOpen.accordionGlyph
|
|
9
|
+
local accordionOpen = _accordionOpen.accordionOpen
|
|
7
10
|
local useAccordionStyles = TS.import(script, script.Parent, "Accordion.styles").default
|
|
8
11
|
local function Accordion(props)
|
|
9
12
|
local _binding = props
|
|
@@ -81,16 +84,24 @@ local function Accordion(props)
|
|
|
81
84
|
_attributes_5[_k] = _v
|
|
82
85
|
end
|
|
83
86
|
_attributes_5.Text = title
|
|
84
|
-
local _exp_3 = React.createElement("
|
|
87
|
+
local _exp_3 = React.createElement("textlabel", _attributes_5)
|
|
85
88
|
local _attributes_6 = {
|
|
89
|
+
key = "Icon",
|
|
90
|
+
}
|
|
91
|
+
for _k, _v in styles.icon do
|
|
92
|
+
_attributes_6[_k] = _v
|
|
93
|
+
end
|
|
94
|
+
_attributes_6.Image = if accordionGlyph(open) == "expanded" then Icons.Expanded else Icons.Collapsed
|
|
95
|
+
local _exp_4 = React.createElement("textbutton", _attributes_3, _exp_2, _exp_3, React.createElement("imagelabel", _attributes_6))
|
|
96
|
+
local _attributes_7 = {
|
|
86
97
|
key = "Body",
|
|
87
98
|
}
|
|
88
99
|
for _k, _v in styles.body do
|
|
89
|
-
|
|
100
|
+
_attributes_7[_k] = _v
|
|
90
101
|
end
|
|
91
|
-
local
|
|
92
|
-
setmetatable(
|
|
93
|
-
return React.createElement("frame", _attributes, _exp, _exp_1,
|
|
102
|
+
local _attributes_8 = table.clone(styles.padding)
|
|
103
|
+
setmetatable(_attributes_8, nil)
|
|
104
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, _exp_4, React.createElement("frame", _attributes_7, React.createElement("uipadding", _attributes_8), children))
|
|
94
105
|
end
|
|
95
106
|
local default = Accordion
|
|
96
107
|
return {
|
|
@@ -32,8 +32,8 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
|
|
|
32
32
|
Selectable = disabled ~= true,
|
|
33
33
|
},
|
|
34
34
|
title = {
|
|
35
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
36
|
-
Size = UDim2.
|
|
35
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
36
|
+
Size = UDim2.new(1, -theme.spacing.calc(4), 0, 0),
|
|
37
37
|
BackgroundTransparency = 1,
|
|
38
38
|
BorderSizePixel = 0,
|
|
39
39
|
Font = theme.typography.fontFamilies.default,
|
|
@@ -42,6 +42,16 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
|
|
|
42
42
|
TextTransparency = if disabled == true then 0.5 else 0,
|
|
43
43
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
44
44
|
},
|
|
45
|
+
icon = {
|
|
46
|
+
Size = UDim2.fromOffset(theme.options.constants.iconSizes.small, theme.options.constants.iconSizes.small),
|
|
47
|
+
Position = UDim2.new(1, -theme.padding.calc(1.5), 0.5, 0),
|
|
48
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
49
|
+
BackgroundTransparency = 1,
|
|
50
|
+
BorderSizePixel = 0,
|
|
51
|
+
ScaleType = Enum.ScaleType.Fit,
|
|
52
|
+
ImageColor3 = theme.palette.text.primary,
|
|
53
|
+
ImageTransparency = if disabled == true then 0.5 else 0,
|
|
54
|
+
},
|
|
45
55
|
padding = {
|
|
46
56
|
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
47
57
|
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|
|
@@ -5,6 +5,10 @@ local function accordionOpen(expanded, controlled)
|
|
|
5
5
|
end
|
|
6
6
|
return expanded == true
|
|
7
7
|
end
|
|
8
|
+
local function accordionGlyph(open)
|
|
9
|
+
return if open == true then "expanded" else "collapsed"
|
|
10
|
+
end
|
|
8
11
|
return {
|
|
9
12
|
accordionOpen = accordionOpen,
|
|
13
|
+
accordionGlyph = accordionGlyph,
|
|
10
14
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { BadgeColor } from "./Badge.styles";
|
|
3
4
|
export interface BadgeProps {
|
|
4
5
|
count?: number;
|
|
5
6
|
max?: number;
|
|
6
7
|
invisible?: boolean;
|
|
7
8
|
variant?: "standard" | "dot";
|
|
9
|
+
color?: BadgeColor;
|
|
8
10
|
children?: React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
declare function Badge(props: CustomizedProps<Frame, BadgeProps>): JSX.Element;
|
|
@@ -21,6 +21,10 @@ local function Badge(props)
|
|
|
21
21
|
if variant == nil then
|
|
22
22
|
variant = "standard"
|
|
23
23
|
end
|
|
24
|
+
local color = _binding.color
|
|
25
|
+
if color == nil then
|
|
26
|
+
color = "error"
|
|
27
|
+
end
|
|
24
28
|
local children = _binding.children
|
|
25
29
|
local className = _binding.className
|
|
26
30
|
local sx = _binding.sx
|
|
@@ -28,6 +32,7 @@ local function Badge(props)
|
|
|
28
32
|
local ref = _binding.ref
|
|
29
33
|
local styles = useBadgeStyles({
|
|
30
34
|
variant = variant,
|
|
35
|
+
color = color,
|
|
31
36
|
})
|
|
32
37
|
local isDot = variant == "dot"
|
|
33
38
|
local shown = not invisible and (isDot or count > 0)
|
|
@@ -8,7 +8,12 @@ local useBadgeStyles = componentStyles("Badge", function(theme, _param)
|
|
|
8
8
|
if variant == nil then
|
|
9
9
|
variant = "standard"
|
|
10
10
|
end
|
|
11
|
+
local color = _param.color
|
|
12
|
+
if color == nil then
|
|
13
|
+
color = "error"
|
|
14
|
+
end
|
|
11
15
|
local diameter = if variant == "dot" then theme.spacing.calc(1) else theme.spacing.calc(2) + theme.padding.calc(1)
|
|
16
|
+
local tone = if color == "primary" then theme.palette.primary elseif color == "success" then theme.palette.status.success else theme.palette.status.error
|
|
12
17
|
return createStyles({
|
|
13
18
|
root = {
|
|
14
19
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -21,11 +26,11 @@ local useBadgeStyles = componentStyles("Badge", function(theme, _param)
|
|
|
21
26
|
Position = UDim2.fromScale(1, 0),
|
|
22
27
|
AutomaticSize = if variant == "dot" then Enum.AutomaticSize.None else Enum.AutomaticSize.X,
|
|
23
28
|
Size = UDim2.fromOffset(diameter, diameter),
|
|
24
|
-
BackgroundColor3 =
|
|
29
|
+
BackgroundColor3 = tone.main,
|
|
25
30
|
BorderSizePixel = 0,
|
|
26
31
|
Font = theme.typography.fontFamilies.default,
|
|
27
32
|
TextSize = theme.typography.fontSizes.caption,
|
|
28
|
-
TextColor3 = theme.palette.text.inverse,
|
|
33
|
+
TextColor3 = if color == "error" then theme.palette.text.inverse else tone.on,
|
|
29
34
|
TextXAlignment = Enum.TextXAlignment.Center,
|
|
30
35
|
TextYAlignment = Enum.TextYAlignment.Center,
|
|
31
36
|
ZIndex = 2,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CustomizedProps } from "../../../../theme/index";
|
|
2
2
|
import { Icons } from "../../../enums/index";
|
|
3
3
|
import { FabSize } from "./fabSize";
|
|
4
|
+
import { FabColor } from "./Fab.styles";
|
|
4
5
|
export interface FabProps {
|
|
5
6
|
icon: Icons;
|
|
6
7
|
label?: string;
|
|
7
8
|
size?: FabSize;
|
|
9
|
+
color?: FabColor;
|
|
8
10
|
disabled?: boolean;
|
|
9
11
|
loading?: boolean;
|
|
10
12
|
reducedMotion?: boolean;
|
|
@@ -20,6 +20,10 @@ local function Fab(props)
|
|
|
20
20
|
if size == nil then
|
|
21
21
|
size = "medium"
|
|
22
22
|
end
|
|
23
|
+
local color = _binding.color
|
|
24
|
+
if color == nil then
|
|
25
|
+
color = "primary"
|
|
26
|
+
end
|
|
23
27
|
local disabled = _binding.disabled
|
|
24
28
|
local loading = _binding.loading
|
|
25
29
|
if loading == nil then
|
|
@@ -35,6 +39,7 @@ local function Fab(props)
|
|
|
35
39
|
local extended = fabExtended(label)
|
|
36
40
|
local styles = useFabStyles({
|
|
37
41
|
size = size,
|
|
42
|
+
color = color,
|
|
38
43
|
disabled = not active,
|
|
39
44
|
extended = extended,
|
|
40
45
|
})
|
|
@@ -9,14 +9,19 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
|
|
|
9
9
|
if size == nil then
|
|
10
10
|
size = "medium"
|
|
11
11
|
end
|
|
12
|
+
local color = _param.color
|
|
13
|
+
if color == nil then
|
|
14
|
+
color = "primary"
|
|
15
|
+
end
|
|
12
16
|
local disabled = _param.disabled
|
|
13
17
|
local extended = _param.extended
|
|
14
18
|
local diameter = fabPixels(size)
|
|
19
|
+
local tone = if color == "accent" then theme.palette.accent else theme.palette.primary
|
|
15
20
|
return createStyles({
|
|
16
21
|
root = {
|
|
17
22
|
Size = if extended == true then UDim2.new(0, 0, 0, diameter) else UDim2.fromOffset(diameter, diameter),
|
|
18
23
|
AutomaticSize = if extended == true then Enum.AutomaticSize.X else Enum.AutomaticSize.None,
|
|
19
|
-
BackgroundColor3 =
|
|
24
|
+
BackgroundColor3 = tone.main,
|
|
20
25
|
BackgroundTransparency = if disabled then 0.5 else 0,
|
|
21
26
|
BorderSizePixel = 0,
|
|
22
27
|
AutoButtonColor = false,
|
|
@@ -42,7 +47,7 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
|
|
|
42
47
|
BackgroundTransparency = 1,
|
|
43
48
|
BorderSizePixel = 0,
|
|
44
49
|
ScaleType = Enum.ScaleType.Fit,
|
|
45
|
-
ImageColor3 =
|
|
50
|
+
ImageColor3 = tone.on,
|
|
46
51
|
ImageTransparency = if disabled then 0.5 else 0,
|
|
47
52
|
LayoutOrder = 1,
|
|
48
53
|
},
|
|
@@ -53,7 +58,7 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
|
|
|
53
58
|
BorderSizePixel = 0,
|
|
54
59
|
Font = theme.typography.fontFamilies.default,
|
|
55
60
|
TextSize = theme.typography.fontSizes.body,
|
|
56
|
-
TextColor3 =
|
|
61
|
+
TextColor3 = tone.on,
|
|
57
62
|
TextTransparency = if disabled then 0.5 else 0,
|
|
58
63
|
LayoutOrder = 2,
|
|
59
64
|
},
|
|
@@ -28,7 +28,13 @@ local function Paper(props)
|
|
|
28
28
|
setmetatable(_attributes_2, nil)
|
|
29
29
|
_condition = React.createElement("uicorner", _attributes_2)
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
local _condition_1 = elevation == "outlined"
|
|
32
|
+
if _condition_1 then
|
|
33
|
+
local _attributes_2 = table.clone(styles.stroke)
|
|
34
|
+
setmetatable(_attributes_2, nil)
|
|
35
|
+
_condition_1 = React.createElement("uistroke", _attributes_2)
|
|
36
|
+
end
|
|
37
|
+
return React.createElement("frame", _attributes, _exp, _condition, _condition_1, children)
|
|
32
38
|
end
|
|
33
39
|
local default = Paper
|
|
34
40
|
return {
|
|
@@ -15,6 +15,12 @@ local usePaperStyles = componentStyles("Paper", function(theme, _param)
|
|
|
15
15
|
BackgroundColor3 = if elevation == "raised" then theme.palette.surface.elevated else theme.palette.surface.paper,
|
|
16
16
|
BorderSizePixel = 0,
|
|
17
17
|
},
|
|
18
|
+
stroke = {
|
|
19
|
+
Color = theme.palette.border,
|
|
20
|
+
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
21
|
+
Thickness = 1,
|
|
22
|
+
Transparency = 0,
|
|
23
|
+
},
|
|
18
24
|
padding = {
|
|
19
25
|
PaddingTop = UDim.new(0, theme.padding.calc(2)),
|
|
20
26
|
PaddingBottom = UDim.new(0, theme.padding.calc(2)),
|
|
@@ -16,6 +16,7 @@ local function Rating(props)
|
|
|
16
16
|
size = "medium"
|
|
17
17
|
end
|
|
18
18
|
local disabled = _binding.disabled
|
|
19
|
+
local readOnly = _binding.readOnly
|
|
19
20
|
local onChange = _binding.onChange
|
|
20
21
|
local className = _binding.className
|
|
21
22
|
local sx = _binding.sx
|
|
@@ -25,7 +26,7 @@ local function Rating(props)
|
|
|
25
26
|
disabled = disabled,
|
|
26
27
|
size = size,
|
|
27
28
|
})
|
|
28
|
-
local active = canActivate(disabled)
|
|
29
|
+
local active = canActivate(disabled) and readOnly ~= true
|
|
29
30
|
local stars = {}
|
|
30
31
|
do
|
|
31
32
|
local i = 1
|
|
@@ -6,6 +6,8 @@ export interface SnackbarProps {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
variant?: ToastVariants;
|
|
8
8
|
open?: boolean;
|
|
9
|
+
action?: string;
|
|
10
|
+
onAction?: () => void;
|
|
9
11
|
}
|
|
10
12
|
declare function Snackbar(props: CustomizedProps<Frame, SnackbarProps>): JSX.Element | undefined;
|
|
11
13
|
export default Snackbar;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local Toast = TS.import(script, script.Parent.Parent.Parent, "toast").Toast
|
|
5
|
+
local snackbarActionLabel = TS.import(script, script.Parent, "snackbarAction").snackbarActionLabel
|
|
5
6
|
local function Snackbar(props)
|
|
6
7
|
local _binding = props
|
|
7
8
|
local message = _binding.message
|
|
@@ -12,6 +13,8 @@ local function Snackbar(props)
|
|
|
12
13
|
if open == nil then
|
|
13
14
|
open = true
|
|
14
15
|
end
|
|
16
|
+
local action = _binding.action
|
|
17
|
+
local onAction = _binding.onAction
|
|
15
18
|
local className = _binding.className
|
|
16
19
|
local sx = _binding.sx
|
|
17
20
|
local id = _binding.id
|
|
@@ -24,6 +27,8 @@ local function Snackbar(props)
|
|
|
24
27
|
onDismiss = onDismiss,
|
|
25
28
|
duration = duration,
|
|
26
29
|
variant = variant,
|
|
30
|
+
action = snackbarActionLabel(action),
|
|
31
|
+
onAction = onAction,
|
|
27
32
|
className = className,
|
|
28
33
|
sx = sx,
|
|
29
34
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function snackbarActionLabel(action?: string): string | undefined;
|