@rbxts/uiblox 0.2.0-alpha.37 → 0.2.0-alpha.38
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/README.md +1 -18
- package/out/theme/constants/NumberConstants.d.ts +10 -0
- package/out/theme/constants/NumberConstants.luau +12 -0
- package/out/theme/interfaces/density/controlMetrics.luau +2 -2
- package/out/theme/interfaces/palette/Palette.d.ts +7 -0
- package/out/theme/interfaces/spacing/Shape.d.ts +6 -0
- package/out/theme/interfaces/theme/Theme.d.ts +6 -0
- package/out/theme/interfaces/typography/FontFamilies.luau +1 -0
- package/out/theme/interfaces/typography/FontFamilyOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizeOptions.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +2 -0
- package/out/theme/interfaces/typography/Variants.d.ts +3 -1
- package/out/theme/interfaces/typography/Variants.luau +25 -1
- package/out/theme/styles/utilities/focusRing.d.ts +2 -0
- package/out/theme/styles/utilities/focusRing.luau +3 -0
- package/out/theme/styles/utilities/index.d.ts +1 -1
- package/out/theme/styles/utilities/init.luau +3 -1
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/themes/createPalette.luau +15 -0
- package/out/ui/packages/accordion/components/Accordion.luau +84 -40
- package/out/ui/packages/accordion/components/Accordion.styles.luau +35 -17
- package/out/ui/packages/alert/components/Alert.luau +15 -11
- package/out/ui/packages/alert/components/Alert.styles.luau +37 -26
- package/out/ui/packages/appBar/components/AppBar.luau +35 -13
- package/out/ui/packages/appBar/components/AppBar.styles.luau +41 -35
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +4 -0
- package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.luau +9 -2
- package/out/ui/packages/avatar/components/Avatar.styles.luau +7 -0
- package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +9 -4
- package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +6 -1
- package/out/ui/packages/badge/components/Badge.luau +14 -11
- package/out/ui/packages/badge/components/Badge.styles.luau +5 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +4 -3
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +6 -2
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +4 -0
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +20 -2
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.styles.luau +72 -66
- package/out/ui/packages/button/components/Button.luau +61 -34
- package/out/ui/packages/button/components/buttonPaint.d.ts +16 -0
- package/out/ui/packages/button/components/buttonPaint.luau +70 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +1 -0
- package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +17 -2
- package/out/ui/packages/card/components/Card.styles.luau +4 -2
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -1
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +50 -41
- package/out/ui/packages/checkbox/components/Checkbox.luau +5 -4
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +2 -2
- package/out/ui/packages/checkbox/components/checkboxLook.luau +2 -2
- package/out/ui/packages/chip/components/Chip.luau +16 -14
- package/out/ui/packages/chip/components/Chip.styles.luau +7 -4
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +10 -3
- package/out/ui/packages/codeEditor/components/CodeEditor.d.ts +12 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.luau +262 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.d.ts +6 -0
- package/out/ui/packages/codeEditor/components/CodeEditor.styles.luau +124 -0
- package/out/ui/packages/codeEditor/highlightCode.d.ts +11 -0
- package/out/ui/packages/codeEditor/highlightCode.luau +503 -0
- package/out/ui/packages/codeEditor/index.d.ts +2 -0
- package/out/ui/packages/codeEditor/init.luau +5 -0
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +9 -1
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +74 -67
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -4
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -4
- package/out/ui/packages/dateRange/components/DateRangePicker.luau +31 -19
- package/out/ui/packages/dialog/components/Dialog.styles.luau +4 -2
- package/out/ui/packages/divider/components/Divider.luau +3 -1
- package/out/ui/packages/divider/components/Divider.styles.luau +1 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
- package/out/ui/packages/drawer/components/Drawer.luau +43 -14
- package/out/ui/packages/drawer/components/Drawer.styles.luau +13 -5
- package/out/ui/packages/drawer/components/drawerPlacement.d.ts +2 -0
- package/out/ui/packages/drawer/components/drawerPlacement.luau +18 -0
- package/out/ui/packages/editorFace.d.ts +22 -0
- package/out/ui/packages/editorFace.luau +49 -0
- package/out/ui/packages/fab/components/Fab.luau +19 -6
- package/out/ui/packages/fab/components/Fab.styles.luau +4 -3
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
- package/out/ui/packages/fontEditor/components/FontEditor.luau +13 -3
- package/out/ui/packages/fontEditor/components/FontEditor.styles.luau +36 -27
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +21 -13
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +52 -44
- package/out/ui/packages/icon/components/DrawnGlyph.d.ts +11 -0
- package/out/ui/packages/icon/components/DrawnGlyph.luau +87 -0
- package/out/ui/packages/icon/components/Icon.d.ts +6 -2
- package/out/ui/packages/icon/components/Icon.luau +23 -3
- package/out/ui/packages/icon/components/Icon.styles.luau +3 -0
- package/out/ui/packages/icon/components/glyphs.d.ts +28 -0
- package/out/ui/packages/icon/components/glyphs.luau +64 -0
- package/out/ui/packages/icon/index.d.ts +1 -0
- package/out/ui/packages/iconButton/components/IconButton.d.ts +5 -2
- package/out/ui/packages/iconButton/components/IconButton.luau +83 -16
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -27
- package/out/ui/packages/iconButton/components/iconButtonBox.d.ts +11 -0
- package/out/ui/packages/iconButton/components/iconButtonBox.luau +48 -0
- package/out/ui/packages/iconButton/components/transportGlyph.d.ts +1 -0
- package/out/ui/packages/iconButton/components/transportGlyph.luau +4 -0
- package/out/ui/packages/imageList/components/ImageList.luau +11 -36
- package/out/ui/packages/imageList/components/ImageList.styles.luau +1 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -2
- package/out/ui/packages/imageList/components/imageListLayout.luau +0 -8
- package/out/ui/packages/index.d.ts +1 -0
- package/out/ui/packages/init.luau +3 -0
- package/out/ui/packages/input/components/Input.luau +46 -29
- package/out/ui/packages/input/components/Input.styles.luau +8 -11
- package/out/ui/packages/input/components/fieldChrome.d.ts +5 -0
- package/out/ui/packages/input/components/fieldChrome.luau +11 -0
- package/out/ui/packages/layout/components/Box.luau +92 -13
- package/out/ui/packages/layout/components/Box.styles.d.ts +0 -2
- package/out/ui/packages/layout/components/Box.styles.luau +0 -9
- package/out/ui/packages/layout/components/Grid.luau +81 -16
- package/out/ui/packages/layout/components/Pad.d.ts +24 -0
- package/out/ui/packages/layout/components/Pad.luau +88 -0
- package/out/ui/packages/layout/components/Stack.luau +79 -13
- package/out/ui/packages/link/components/Link.luau +19 -13
- package/out/ui/packages/link/components/Link.styles.luau +10 -1
- package/out/ui/packages/listItem/components/ListItem.luau +61 -4
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +28 -11
- package/out/ui/packages/listItem/components/listItemInk.d.ts +1 -1
- package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -2
- package/out/ui/packages/listItem/components/listItemLayout.luau +29 -2
- package/out/ui/packages/markdown/components/Markdown.luau +163 -50
- package/out/ui/packages/markdown/components/Markdown.styles.luau +125 -76
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +215 -146
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +1 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +153 -83
- package/out/ui/packages/markdown/index.d.ts +1 -1
- package/out/ui/packages/markdown/parseMarkdown.d.ts +9 -1
- package/out/ui/packages/markdown/parseMarkdown.luau +350 -29
- package/out/ui/packages/menu/components/Menu.d.ts +1 -1
- package/out/ui/packages/menu/components/Menu.luau +12 -11
- package/out/ui/packages/menu/components/Menu.styles.luau +6 -1
- package/out/ui/packages/menu/components/menuIcon.d.ts +1 -1
- package/out/ui/packages/numberInput/components/NumberInput.luau +19 -4
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +9 -1
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.styles.luau +23 -16
- package/out/ui/packages/pager/components/Pager.luau +15 -13
- package/out/ui/packages/pager/components/Pager.styles.luau +5 -0
- package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -1
- package/out/ui/packages/paper/components/Paper.luau +17 -11
- package/out/ui/packages/paper/components/Paper.styles.luau +12 -5
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +9 -1
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +24 -19
- package/out/ui/packages/popover/components/Popover.d.ts +1 -1
- package/out/ui/packages/popover/components/Popover.luau +6 -4
- package/out/ui/packages/popover/components/Popover.styles.luau +6 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -0
- package/out/ui/packages/popup/components/Popup.luau +64 -2
- package/out/ui/packages/popup/components/placement.luau +6 -4
- package/out/ui/packages/progressBar/components/ProgressBar.luau +1 -1
- package/out/ui/packages/progressBar/components/ProgressBar.styles.luau +3 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +2 -1
- package/out/ui/packages/rating/components/Rating.luau +45 -3
- package/out/ui/packages/rating/components/Rating.styles.luau +1 -1
- package/out/ui/packages/rayEditor/components/RayEditor.luau +9 -1
- package/out/ui/packages/rayEditor/components/RayEditor.styles.luau +17 -11
- package/out/ui/packages/rectEditor/components/RectEditor.luau +9 -1
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +49 -42
- package/out/ui/packages/select/components/Select.d.ts +2 -0
- package/out/ui/packages/select/components/Select.luau +148 -106
- package/out/ui/packages/select/components/Select.styles.d.ts +2 -0
- package/out/ui/packages/select/components/Select.styles.luau +29 -5
- package/out/ui/packages/shadow/components/Shadow.luau +188 -19
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +1 -0
- package/out/ui/packages/skeleton/components/Skeleton.luau +4 -0
- package/out/ui/packages/slider/components/RangeSlider.luau +6 -5
- package/out/ui/packages/slider/components/Slider.luau +11 -16
- package/out/ui/packages/sparkline/components/Sparkline.luau +7 -5
- package/out/ui/packages/speedDial/components/SpeedDial.luau +4 -1
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +5 -0
- package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +1 -1
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stepper/components/Stepper.styles.luau +9 -6
- package/out/ui/packages/switch/components/Switch.luau +2 -2
- package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
- package/out/ui/packages/switch/components/switchLook.luau +4 -10
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +92 -53
- package/out/ui/packages/table/components/Table.styles.luau +23 -6
- package/out/ui/packages/table/components/tableColumns.d.ts +2 -0
- package/out/ui/packages/table/components/tableColumns.luau +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +7 -4
- package/out/ui/packages/tabs/components/Tabs.styles.luau +12 -11
- package/out/ui/packages/tabs/components/tabIndicator.d.ts +7 -0
- package/out/ui/packages/tabs/components/tabIndicator.luau +21 -0
- package/out/ui/packages/text/components/Text.d.ts +2 -0
- package/out/ui/packages/text/components/Text.luau +12 -2
- package/out/ui/packages/timeField/components/TimeField.luau +11 -7
- package/out/ui/packages/timeline/components/Timeline.luau +35 -32
- package/out/ui/packages/timeline/components/Timeline.styles.luau +19 -10
- package/out/ui/packages/toast/components/Toast.luau +168 -72
- package/out/ui/packages/toast/components/Toast.styles.luau +36 -19
- package/out/ui/packages/toast/components/toastPlace.d.ts +4 -0
- package/out/ui/packages/toast/components/toastPlace.luau +13 -0
- package/out/ui/packages/toast/enums/ToastVariants.d.ts +2 -1
- package/out/ui/packages/toast/enums/ToastVariants.luau +1 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +43 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +1 -1
- package/out/ui/packages/tooltip/components/Tooltip.styles.luau +2 -2
- package/out/ui/packages/treeView/components/TreeView.luau +12 -13
- package/out/ui/packages/treeView/components/TreeView.styles.luau +6 -0
- package/out/ui/packages/typography/components/Typography.d.ts +2 -0
- package/out/ui/packages/typography/components/Typography.luau +8 -0
- package/out/ui/packages/typography/components/Typography.styles.luau +3 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +9 -1
- package/out/ui/packages/udimEditor/components/UDimEditor.styles.luau +25 -18
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +17 -3
- package/out/ui/packages/vectorEditor/components/VectorEditor.styles.luau +30 -16
- package/out/ui/packages/virtualList/components/VirtualList.styles.luau +1 -0
- package/package.json +69 -67
|
@@ -6,21 +6,26 @@ local createStyles = _theme.createStyles
|
|
|
6
6
|
local useTimelineStyles = componentStyles("Timeline", function(theme)
|
|
7
7
|
local dot = theme.spacing.calc(1.5)
|
|
8
8
|
local rail = theme.spacing.calc(2)
|
|
9
|
+
local pad = theme.padding.calc(1)
|
|
9
10
|
return createStyles({
|
|
10
11
|
root = {
|
|
11
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
12
|
-
Size = UDim2.
|
|
12
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
13
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
13
14
|
BackgroundTransparency = 1,
|
|
14
15
|
BorderSizePixel = 0,
|
|
15
16
|
},
|
|
17
|
+
inset = {
|
|
18
|
+
PaddingLeft = UDim.new(0, pad),
|
|
19
|
+
PaddingRight = UDim.new(0, pad),
|
|
20
|
+
},
|
|
16
21
|
list = {
|
|
17
22
|
FillDirection = Enum.FillDirection.Vertical,
|
|
18
23
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
19
24
|
Padding = UDim.new(0, 0),
|
|
20
25
|
},
|
|
21
26
|
item = {
|
|
22
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
23
|
-
Size = UDim2.
|
|
27
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
28
|
+
Size = UDim2.new(1, -pad * 2, 0, 0),
|
|
24
29
|
BackgroundTransparency = 1,
|
|
25
30
|
BorderSizePixel = 0,
|
|
26
31
|
},
|
|
@@ -65,8 +70,8 @@ local useTimelineStyles = componentStyles("Timeline", function(theme)
|
|
|
65
70
|
},
|
|
66
71
|
body = {
|
|
67
72
|
LayoutOrder = 1,
|
|
68
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
69
|
-
Size = UDim2.
|
|
73
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
74
|
+
Size = UDim2.new(1, -(rail + theme.spacing.calc(1)), 0, 0),
|
|
70
75
|
BackgroundTransparency = 1,
|
|
71
76
|
BorderSizePixel = 0,
|
|
72
77
|
},
|
|
@@ -79,24 +84,28 @@ local useTimelineStyles = componentStyles("Timeline", function(theme)
|
|
|
79
84
|
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
80
85
|
},
|
|
81
86
|
title = {
|
|
82
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
83
|
-
Size = UDim2.
|
|
87
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
88
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
84
89
|
BackgroundTransparency = 1,
|
|
85
90
|
BorderSizePixel = 0,
|
|
86
91
|
Font = theme.typography.fontFamilies.default,
|
|
87
92
|
TextSize = theme.typography.fontSizes.body,
|
|
88
93
|
TextColor3 = theme.palette.text.primary,
|
|
89
94
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
95
|
+
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
96
|
+
TextWrapped = false,
|
|
90
97
|
},
|
|
91
98
|
caption = {
|
|
92
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
93
|
-
Size = UDim2.
|
|
99
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
100
|
+
Size = UDim2.new(1, 0, 0, 0),
|
|
94
101
|
BackgroundTransparency = 1,
|
|
95
102
|
BorderSizePixel = 0,
|
|
96
103
|
Font = theme.typography.fontFamilies.default,
|
|
97
104
|
TextSize = theme.typography.fontSizes.caption,
|
|
98
105
|
TextColor3 = theme.palette.text.secondary,
|
|
99
106
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
107
|
+
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
108
|
+
TextWrapped = false,
|
|
100
109
|
},
|
|
101
110
|
})
|
|
102
111
|
end)
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local BoatTween = TS.import(script, TS.getModule(script, "@rbxts", "boat-tween").src).BoatTween
|
|
4
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
4
|
local React = _react
|
|
6
5
|
local useEffect = _react.useEffect
|
|
7
6
|
local useRef = _react.useRef
|
|
8
7
|
local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local useTheme = _theme.useTheme
|
|
12
|
-
local Directions = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Directions
|
|
8
|
+
local useReducedMotion = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks").useReducedMotion
|
|
9
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
13
10
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
11
|
+
local Icon = TS.import(script, script.Parent.Parent.Parent, "icon").Icon
|
|
12
|
+
local IconButton = TS.import(script, script.Parent.Parent.Parent, "iconButton").IconButton
|
|
13
|
+
local motionDuration = TS.import(script, script.Parent.Parent.Parent, "motion", "duration").motionDuration
|
|
14
|
+
local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion", "play").playProperty
|
|
14
15
|
local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
|
|
15
16
|
local useToastStyles = TS.import(script, script.Parent, "Toast.styles").default
|
|
16
|
-
local
|
|
17
|
-
local
|
|
17
|
+
local _toastPlace = TS.import(script, script.Parent, "toastPlace")
|
|
18
|
+
local toastGlyph = _toastPlace.toastGlyph
|
|
19
|
+
local toastHold = _toastPlace.toastHold
|
|
20
|
+
local toastWrap = _toastPlace.toastWrap
|
|
21
|
+
local function withoutPosition(style)
|
|
22
|
+
local body = {}
|
|
23
|
+
for key, value in pairs(style) do
|
|
24
|
+
if key ~= "Position" then
|
|
25
|
+
body[key] = value
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
return body
|
|
29
|
+
end
|
|
18
30
|
local function Toast(props)
|
|
19
31
|
local _binding = props
|
|
20
32
|
local text = _binding.text
|
|
@@ -25,6 +37,7 @@ local function Toast(props)
|
|
|
25
37
|
end
|
|
26
38
|
local action = _binding.action
|
|
27
39
|
local onAction = _binding.onAction
|
|
40
|
+
local toggledAt = _binding.toggledAt
|
|
28
41
|
local className = _binding.className
|
|
29
42
|
local sx = _binding.sx
|
|
30
43
|
local id = _binding.id
|
|
@@ -33,88 +46,166 @@ local function Toast(props)
|
|
|
33
46
|
local container = _binding_1.container
|
|
34
47
|
local label = _binding_1.label
|
|
35
48
|
local close = _binding_1.close
|
|
49
|
+
local closeGlyph = _binding_1.closeGlyph
|
|
50
|
+
local mark = _binding_1.mark
|
|
36
51
|
local actionStyle = _binding_1.action
|
|
37
52
|
local activePosition = _binding_1.activePosition
|
|
38
53
|
local inActivePosition = _binding_1.inActivePosition
|
|
39
54
|
local _binding_2 = useTheme()
|
|
40
55
|
local theme = _binding_2.theme
|
|
56
|
+
local reduced = useReducedMotion()
|
|
41
57
|
local frameRef = useRef()
|
|
58
|
+
local dismiss = useRef(onDismiss)
|
|
59
|
+
dismiss.current = onDismiss
|
|
60
|
+
local timer = useRef()
|
|
61
|
+
local exitTimer = useRef()
|
|
62
|
+
local stopMotion = useRef(function() end)
|
|
63
|
+
local leaving = useRef(false)
|
|
42
64
|
local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
|
|
43
65
|
local _condition = theme.typography.fontSizes.body
|
|
44
66
|
if _condition == nil then
|
|
45
67
|
_condition = 14
|
|
46
68
|
end
|
|
47
69
|
local textSize = _condition
|
|
48
|
-
local
|
|
49
|
-
local
|
|
70
|
+
local glyph = toastGlyph(props.variant)
|
|
71
|
+
local _exp = (if action ~= nil and #action > 0 then theme.spacing.calc(8) else 0)
|
|
72
|
+
local _condition_1 = theme.typography.fontSizes.caption
|
|
73
|
+
if _condition_1 == nil then
|
|
74
|
+
_condition_1 = 12
|
|
75
|
+
end
|
|
76
|
+
local actionSlot = _exp + _condition_1 + theme.padding.calc(1)
|
|
77
|
+
local _result = closeGlyph.Size
|
|
78
|
+
if _result ~= nil then
|
|
79
|
+
_result = _result.X.Offset
|
|
80
|
+
end
|
|
81
|
+
local _condition_2 = _result
|
|
82
|
+
if _condition_2 == nil then
|
|
83
|
+
_condition_2 = 16
|
|
84
|
+
end
|
|
85
|
+
local iconSize = _condition_2
|
|
86
|
+
local lead = if glyph ~= nil then iconSize + theme.padding.calc(1) else 0
|
|
87
|
+
local box = theme.spacing.calc(20) - theme.padding.calc(4) - actionSlot - lead
|
|
50
88
|
local bounds = TextService:GetTextSize(text, textSize, font, Vector2.new(10000, 100))
|
|
51
89
|
local wrap = toastWrap(bounds.X, box)
|
|
52
90
|
local pad = theme.padding.calc(2)
|
|
53
|
-
local
|
|
91
|
+
local _result_1
|
|
54
92
|
if wrap then
|
|
55
93
|
local _object = table.clone(container)
|
|
56
94
|
setmetatable(_object, nil)
|
|
57
95
|
_object.AutomaticSize = Enum.AutomaticSize.Y
|
|
58
|
-
|
|
96
|
+
_result_1 = _object
|
|
59
97
|
else
|
|
60
|
-
|
|
98
|
+
_result_1 = container
|
|
61
99
|
end
|
|
62
|
-
local boxStyle =
|
|
63
|
-
local
|
|
100
|
+
local boxStyle = _result_1
|
|
101
|
+
local _result_2
|
|
64
102
|
if wrap then
|
|
65
103
|
local _object = table.clone(label)
|
|
66
104
|
setmetatable(_object, nil)
|
|
67
105
|
_object.TextWrapped = true
|
|
68
106
|
_object.TextTruncate = Enum.TextTruncate.None
|
|
69
107
|
_object.AutomaticSize = Enum.AutomaticSize.Y
|
|
70
|
-
_object.Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot), 0, 0)
|
|
108
|
+
_object.Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot + lead), 0, 0)
|
|
71
109
|
_object.AnchorPoint = Vector2.new(0, 0)
|
|
72
|
-
_object.Position = UDim2.new(0, pad, 0, pad)
|
|
110
|
+
_object.Position = UDim2.new(0, pad + lead, 0, pad)
|
|
73
111
|
_object.TextXAlignment = Enum.TextXAlignment.Left
|
|
74
112
|
_object.TextYAlignment = Enum.TextYAlignment.Top
|
|
75
|
-
|
|
113
|
+
_result_2 = _object
|
|
76
114
|
else
|
|
77
|
-
|
|
115
|
+
_result_2 = label
|
|
78
116
|
end
|
|
79
|
-
local labelStyle =
|
|
80
|
-
local
|
|
81
|
-
|
|
82
|
-
|
|
117
|
+
local labelStyle = _result_2
|
|
118
|
+
local active = activePosition.Position
|
|
119
|
+
local idle = inActivePosition.Position
|
|
120
|
+
local clock = useRef({
|
|
121
|
+
active = active,
|
|
122
|
+
idle = idle,
|
|
123
|
+
enter = theme.motion.slow,
|
|
124
|
+
exit = theme.motion.default,
|
|
125
|
+
reduced = reduced,
|
|
126
|
+
duration = duration,
|
|
127
|
+
})
|
|
128
|
+
clock.current = {
|
|
129
|
+
active = active,
|
|
130
|
+
idle = idle,
|
|
131
|
+
enter = theme.motion.slow,
|
|
132
|
+
exit = theme.motion.default,
|
|
133
|
+
reduced = reduced,
|
|
134
|
+
duration = duration,
|
|
135
|
+
}
|
|
136
|
+
local leave = function()
|
|
137
|
+
if leaving.current then
|
|
83
138
|
return nil
|
|
84
139
|
end
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
140
|
+
leaving.current = true
|
|
141
|
+
if timer.current then
|
|
142
|
+
task.cancel(timer.current)
|
|
143
|
+
timer.current = nil
|
|
144
|
+
end
|
|
145
|
+
stopMotion.current()
|
|
146
|
+
local frame = frameRef.current
|
|
147
|
+
local now = clock.current
|
|
148
|
+
if frame and now.idle then
|
|
149
|
+
stopMotion.current = playProperty(frame, {
|
|
150
|
+
Position = now.idle,
|
|
151
|
+
GroupTransparency = 1,
|
|
152
|
+
}, now.exit, now.reduced)
|
|
153
|
+
end
|
|
154
|
+
exitTimer.current = task.delay(motionDuration(now.exit, now.reduced), function()
|
|
155
|
+
exitTimer.current = nil
|
|
156
|
+
dismiss.current()
|
|
157
|
+
end)
|
|
99
158
|
end
|
|
100
159
|
useEffect(function()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if onDismiss then
|
|
105
|
-
onDismiss()
|
|
160
|
+
local frame = frameRef.current
|
|
161
|
+
if not frame then
|
|
162
|
+
return nil
|
|
106
163
|
end
|
|
107
|
-
|
|
164
|
+
leaving.current = false
|
|
165
|
+
local now = clock.current
|
|
166
|
+
if now.idle then
|
|
167
|
+
frame.Position = now.idle
|
|
168
|
+
end
|
|
169
|
+
frame.GroupTransparency = 1
|
|
170
|
+
stopMotion.current()
|
|
171
|
+
if now.active then
|
|
172
|
+
stopMotion.current = playProperty(frame, {
|
|
173
|
+
Position = now.active,
|
|
174
|
+
GroupTransparency = 0,
|
|
175
|
+
}, now.enter, now.reduced)
|
|
176
|
+
end
|
|
177
|
+
local hold = task.delay(toastHold(now.enter, now.duration, now.reduced), function()
|
|
178
|
+
timer.current = nil
|
|
179
|
+
leave()
|
|
180
|
+
end)
|
|
181
|
+
timer.current = hold
|
|
182
|
+
return function()
|
|
183
|
+
if timer.current == hold then
|
|
184
|
+
task.cancel(hold)
|
|
185
|
+
end
|
|
186
|
+
if exitTimer.current then
|
|
187
|
+
task.cancel(exitTimer.current)
|
|
188
|
+
end
|
|
189
|
+
exitTimer.current = nil
|
|
190
|
+
stopMotion.current()
|
|
191
|
+
end
|
|
192
|
+
end, { duration, text, toggledAt, reduced })
|
|
108
193
|
local _attributes = {
|
|
109
|
-
tag = "
|
|
194
|
+
tag = "canvasgroup",
|
|
110
195
|
}
|
|
111
|
-
local
|
|
112
|
-
if not (
|
|
113
|
-
|
|
196
|
+
local _condition_3 = id
|
|
197
|
+
if not (_condition_3 ~= 0 and _condition_3 == _condition_3 and _condition_3 ~= "" and _condition_3) then
|
|
198
|
+
_condition_3 = "Toast"
|
|
114
199
|
end
|
|
115
|
-
_attributes.key =
|
|
200
|
+
_attributes.key = _condition_3
|
|
116
201
|
_attributes.hostRef = function(instance)
|
|
117
202
|
frameRef.current = instance
|
|
203
|
+
if instance and clock.current.idle then
|
|
204
|
+
instance.Position = clock.current.idle
|
|
205
|
+
end
|
|
206
|
+
if instance then
|
|
207
|
+
instance.GroupTransparency = 1
|
|
208
|
+
end
|
|
118
209
|
if ref == nil then
|
|
119
210
|
return nil
|
|
120
211
|
end
|
|
@@ -124,17 +215,23 @@ local function Toast(props)
|
|
|
124
215
|
end
|
|
125
216
|
ref.current = instance
|
|
126
217
|
end
|
|
127
|
-
_attributes.base = boxStyle
|
|
218
|
+
_attributes.base = withoutPosition(boxStyle)
|
|
128
219
|
_attributes.className = className
|
|
129
220
|
_attributes.sx = sx
|
|
130
|
-
local
|
|
221
|
+
local _exp_1 = React.createElement("uicorner", {
|
|
131
222
|
key = "Corner",
|
|
132
|
-
CornerRadius = UDim.new(0,
|
|
223
|
+
CornerRadius = UDim.new(0, theme.shape.borderRadius),
|
|
133
224
|
})
|
|
134
|
-
local
|
|
135
|
-
local
|
|
225
|
+
local _exp_2 = React.createElement(Shadow)
|
|
226
|
+
local _exp_3 = wrap and React.createElement("uipadding", {
|
|
136
227
|
PaddingBottom = UDim.new(0, pad),
|
|
137
228
|
})
|
|
229
|
+
local _exp_4 = glyph ~= nil and (React.createElement(Icon, {
|
|
230
|
+
glyph = glyph,
|
|
231
|
+
size = iconSize,
|
|
232
|
+
tint = closeGlyph.ImageColor3,
|
|
233
|
+
className = mark,
|
|
234
|
+
}))
|
|
138
235
|
local _attributes_1 = {
|
|
139
236
|
key = "Label",
|
|
140
237
|
}
|
|
@@ -142,9 +239,9 @@ local function Toast(props)
|
|
|
142
239
|
_attributes_1[_k] = _v
|
|
143
240
|
end
|
|
144
241
|
_attributes_1.Text = text
|
|
145
|
-
local
|
|
146
|
-
local
|
|
147
|
-
if
|
|
242
|
+
local _exp_5 = React.createElement("textlabel", _attributes_1)
|
|
243
|
+
local _condition_4 = action ~= nil and #action > 0
|
|
244
|
+
if _condition_4 then
|
|
148
245
|
local _attributes_2 = {
|
|
149
246
|
key = "Action",
|
|
150
247
|
}
|
|
@@ -157,29 +254,28 @@ local function Toast(props)
|
|
|
157
254
|
if onAction then
|
|
158
255
|
onAction()
|
|
159
256
|
end
|
|
160
|
-
|
|
161
|
-
if onDismiss then
|
|
162
|
-
onDismiss()
|
|
163
|
-
end
|
|
257
|
+
leave()
|
|
164
258
|
end,
|
|
165
259
|
}
|
|
166
|
-
|
|
260
|
+
_condition_4 = (React.createElement("textbutton", _attributes_2))
|
|
167
261
|
end
|
|
168
262
|
local _attributes_2 = {
|
|
169
|
-
|
|
263
|
+
id = "Close",
|
|
264
|
+
glyph = "close",
|
|
170
265
|
}
|
|
171
|
-
|
|
172
|
-
|
|
266
|
+
local _result_3 = closeGlyph.Size
|
|
267
|
+
if _result_3 ~= nil then
|
|
268
|
+
_result_3 = _result_3.X.Offset
|
|
173
269
|
end
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return React.createElement(SxHost, _attributes,
|
|
270
|
+
local _condition_5 = _result_3
|
|
271
|
+
if _condition_5 == nil then
|
|
272
|
+
_condition_5 = 16
|
|
273
|
+
end
|
|
274
|
+
_attributes_2.iconSize = _condition_5
|
|
275
|
+
_attributes_2.tint = closeGlyph.ImageColor3
|
|
276
|
+
_attributes_2.className = close
|
|
277
|
+
_attributes_2.onClick = leave
|
|
278
|
+
return React.createElement(SxHost, _attributes, _exp_1, _exp_2, _exp_3, _exp_4, _exp_5, _condition_4, React.createElement(IconButton, _attributes_2))
|
|
183
279
|
end
|
|
184
280
|
local default = Toast
|
|
185
281
|
return {
|
|
@@ -3,10 +3,11 @@ local TS = _G[script]
|
|
|
3
3
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
4
|
local createStyles = _theme.createStyles
|
|
5
5
|
local componentStyles = _theme.componentStyles
|
|
6
|
-
local
|
|
7
|
-
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
6
|
+
local controlMetrics = _theme.controlMetrics
|
|
8
7
|
local ToastVariants = TS.import(script, script.Parent.Parent, "enums", "ToastVariants").default
|
|
9
|
-
local
|
|
8
|
+
local _toastPlace = TS.import(script, script.Parent, "toastPlace")
|
|
9
|
+
local toastGlyph = _toastPlace.toastGlyph
|
|
10
|
+
local toastPlace = _toastPlace.toastPlace
|
|
10
11
|
local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
11
12
|
local variant = _param.variant
|
|
12
13
|
if variant == nil then
|
|
@@ -34,6 +35,12 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
34
35
|
content = theme.palette.status.warning.on,
|
|
35
36
|
}
|
|
36
37
|
end
|
|
38
|
+
if variant == (ToastVariants.info) then
|
|
39
|
+
return {
|
|
40
|
+
background = theme.palette.status.info.main,
|
|
41
|
+
content = theme.palette.status.info.on,
|
|
42
|
+
}
|
|
43
|
+
end
|
|
37
44
|
return {
|
|
38
45
|
background = theme.palette.surface.overlay,
|
|
39
46
|
content = theme.palette.text.primary,
|
|
@@ -42,8 +49,13 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
42
49
|
end
|
|
43
50
|
local toastColors = getToastColors()
|
|
44
51
|
local hasAction = action ~= nil and #action > 0
|
|
45
|
-
local
|
|
46
|
-
local
|
|
52
|
+
local glyph = controlMetrics(theme.density).icon
|
|
53
|
+
local hit = glyph + theme.padding.calc(2)
|
|
54
|
+
local marked = toastGlyph(variant) ~= nil
|
|
55
|
+
local lead = if marked then glyph + theme.padding.calc(1) else 0
|
|
56
|
+
local pinLeft = hasAction or marked
|
|
57
|
+
local actionSlot = (if hasAction then theme.spacing.calc(8) else 0) + hit
|
|
58
|
+
local place = toastPlace(edge, theme.padding.calc(2), theme.spacing.calc(20) + theme.padding.calc(2))
|
|
47
59
|
local ACTIVE_POSITION = UDim2.new(0.5, 0, place.activeY, place.activeOffset)
|
|
48
60
|
local INACTIVE_POSITION = UDim2.new(0.5, 0, place.idleY, place.idleOffset)
|
|
49
61
|
return createStyles({
|
|
@@ -56,23 +68,24 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
56
68
|
ZIndex = 50000,
|
|
57
69
|
},
|
|
58
70
|
label = {
|
|
59
|
-
Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot), 1, -theme.padding.calc(4)),
|
|
60
|
-
Position = if
|
|
61
|
-
AnchorPoint = if
|
|
71
|
+
Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot + lead), 1, -theme.padding.calc(4)),
|
|
72
|
+
Position = if pinLeft then UDim2.new(0, theme.padding.calc(2) + lead, 0.5, 0) else UDim2.new(0.5, 0, 0.5, 0),
|
|
73
|
+
AnchorPoint = if pinLeft then Vector2.new(0, 0.5) else Vector2.new(0.5, 0.5),
|
|
62
74
|
BackgroundTransparency = 1,
|
|
63
75
|
BorderSizePixel = 0,
|
|
64
76
|
TextSize = theme.typography.fontSizes.body,
|
|
65
77
|
TextColor3 = toastColors.content,
|
|
66
78
|
Font = theme.typography.fontFamilies.default,
|
|
67
|
-
TextXAlignment = if
|
|
68
|
-
|
|
79
|
+
TextXAlignment = if pinLeft then Enum.TextXAlignment.Left else Enum.TextXAlignment.Center,
|
|
80
|
+
TextWrapped = true,
|
|
81
|
+
TextTruncate = Enum.TextTruncate.None,
|
|
69
82
|
TextScaled = false,
|
|
70
83
|
ZIndex = 50001,
|
|
71
84
|
},
|
|
72
85
|
action = {
|
|
73
86
|
AutomaticSize = Enum.AutomaticSize.X,
|
|
74
87
|
Size = UDim2.new(0, 0, 0, theme.spacing.calc(3)),
|
|
75
|
-
Position = UDim2.new(1, -(theme.padding.calc(
|
|
88
|
+
Position = UDim2.new(1, -(theme.padding.calc(1) + hit), 0.5, 0),
|
|
76
89
|
AnchorPoint = Vector2.new(1, 0.5),
|
|
77
90
|
BackgroundTransparency = 1,
|
|
78
91
|
BorderSizePixel = 0,
|
|
@@ -83,17 +96,21 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
83
96
|
ZIndex = 50001,
|
|
84
97
|
},
|
|
85
98
|
close = {
|
|
86
|
-
Size = UDim2.
|
|
87
|
-
Position = UDim2.new(1, -theme.padding.calc(
|
|
88
|
-
AnchorPoint = Vector2.new(1, 0),
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
Size = UDim2.fromOffset(hit, hit),
|
|
100
|
+
Position = UDim2.new(1, -theme.padding.calc(1), 0.5, 0),
|
|
101
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
102
|
+
ZIndex = 50001,
|
|
103
|
+
},
|
|
104
|
+
mark = {
|
|
105
|
+
Position = UDim2.new(0, theme.padding.calc(2), 0.5, 0),
|
|
106
|
+
AnchorPoint = Vector2.new(0, 0.5),
|
|
91
107
|
BackgroundTransparency = 1,
|
|
92
|
-
AutoButtonColor = false,
|
|
93
|
-
BorderSizePixel = 0,
|
|
94
|
-
Active = true,
|
|
95
108
|
ZIndex = 50001,
|
|
96
109
|
},
|
|
110
|
+
closeGlyph = {
|
|
111
|
+
Size = UDim2.fromOffset(glyph, glyph),
|
|
112
|
+
ImageColor3 = toastColors.content,
|
|
113
|
+
},
|
|
97
114
|
activePosition = {
|
|
98
115
|
Position = ACTIVE_POSITION,
|
|
99
116
|
},
|
|
@@ -10,3 +10,7 @@ export interface ToastPlace {
|
|
|
10
10
|
export declare function toastPlace(edge: ToastEdge | undefined, inset: number, hidden: number): ToastPlace;
|
|
11
11
|
/** A line wider than the toast wraps. A short line stays one row. */
|
|
12
12
|
export declare function toastWrap(textWidth: number, box: number): boolean;
|
|
13
|
+
export type ToastGlyph = "success" | "error" | "warning" | "info";
|
|
14
|
+
export declare function toastGlyph(variant?: string): ToastGlyph | undefined;
|
|
15
|
+
/** Enter slide, then the visible duration. Reduced motion skips the slide. */
|
|
16
|
+
export declare function toastHold(enter: number, visible: number, reduced?: boolean): number;
|
|
@@ -25,7 +25,20 @@ local function toastWrap(textWidth, box)
|
|
|
25
25
|
end
|
|
26
26
|
return textWidth > box
|
|
27
27
|
end
|
|
28
|
+
local function toastGlyph(variant)
|
|
29
|
+
if variant == "success" or variant == "error" or variant == "warning" or variant == "info" then
|
|
30
|
+
return variant
|
|
31
|
+
end
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
--* Enter slide, then the visible duration. Reduced motion skips the slide.
|
|
35
|
+
local function toastHold(enter, visible, reduced)
|
|
36
|
+
local slide = if reduced == true then 0 else enter
|
|
37
|
+
return slide + visible
|
|
38
|
+
end
|
|
28
39
|
return {
|
|
29
40
|
toastPlace = toastPlace,
|
|
30
41
|
toastWrap = toastWrap,
|
|
42
|
+
toastGlyph = toastGlyph,
|
|
43
|
+
toastHold = toastHold,
|
|
31
44
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useState = _react.useState
|
|
6
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
7
|
+
local controlFade = _theme.controlFade
|
|
8
|
+
local focusRing = _theme.focusRing
|
|
9
|
+
local useTheme = _theme.useTheme
|
|
4
10
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
5
11
|
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
6
12
|
local useToggleButtonStyles = TS.import(script, script.Parent, "ToggleButton.styles").default
|
|
@@ -23,7 +29,12 @@ local function ToggleButton(props)
|
|
|
23
29
|
disabled = disabled,
|
|
24
30
|
size = size,
|
|
25
31
|
})
|
|
32
|
+
local _binding_1 = useTheme()
|
|
33
|
+
local theme = _binding_1.theme
|
|
26
34
|
local active = canActivate(disabled)
|
|
35
|
+
local hovering, setHovering = useState(false)
|
|
36
|
+
local focused, setFocused = useState(false)
|
|
37
|
+
local face = if selected == true then theme.palette.action.selected elseif hovering and active then theme.palette.action.hover else theme.palette.surface.input
|
|
27
38
|
local _attributes = {
|
|
28
39
|
tag = "textbutton",
|
|
29
40
|
}
|
|
@@ -39,10 +50,14 @@ local function ToggleButton(props)
|
|
|
39
50
|
_attributes.state = {
|
|
40
51
|
disabled = disabled,
|
|
41
52
|
selected = selected,
|
|
53
|
+
hover = hovering,
|
|
54
|
+
focused = focused,
|
|
42
55
|
}
|
|
43
56
|
_attributes.Text = label
|
|
44
57
|
_attributes.Active = active
|
|
45
58
|
_attributes.Selectable = active
|
|
59
|
+
_attributes.BackgroundColor3 = face
|
|
60
|
+
_attributes.BackgroundTransparency = if disabled == true then controlFade else 0
|
|
46
61
|
_attributes.Event = {
|
|
47
62
|
Activated = function()
|
|
48
63
|
if active then
|
|
@@ -52,6 +67,22 @@ local function ToggleButton(props)
|
|
|
52
67
|
end
|
|
53
68
|
end
|
|
54
69
|
end,
|
|
70
|
+
MouseEnter = function()
|
|
71
|
+
if active then
|
|
72
|
+
setHovering(true)
|
|
73
|
+
end
|
|
74
|
+
end,
|
|
75
|
+
MouseLeave = function()
|
|
76
|
+
return setHovering(false)
|
|
77
|
+
end,
|
|
78
|
+
SelectionGained = function()
|
|
79
|
+
if active then
|
|
80
|
+
setFocused(true)
|
|
81
|
+
end
|
|
82
|
+
end,
|
|
83
|
+
SelectionLost = function()
|
|
84
|
+
return setFocused(false)
|
|
85
|
+
end,
|
|
55
86
|
}
|
|
56
87
|
local _attributes_1 = table.clone(styles.padding)
|
|
57
88
|
setmetatable(_attributes_1, nil)
|
|
@@ -59,9 +90,17 @@ local function ToggleButton(props)
|
|
|
59
90
|
local _attributes_2 = table.clone(styles.corner)
|
|
60
91
|
setmetatable(_attributes_2, nil)
|
|
61
92
|
local _exp_1 = React.createElement("uicorner", _attributes_2)
|
|
62
|
-
local
|
|
63
|
-
|
|
64
|
-
|
|
93
|
+
local _result
|
|
94
|
+
if focused and active then
|
|
95
|
+
local _attributes_3 = table.clone(focusRing(theme.palette.focus))
|
|
96
|
+
setmetatable(_attributes_3, nil)
|
|
97
|
+
_result = React.createElement("uistroke", _attributes_3)
|
|
98
|
+
else
|
|
99
|
+
local _attributes_3 = table.clone(styles.stroke)
|
|
100
|
+
setmetatable(_attributes_3, nil)
|
|
101
|
+
_result = React.createElement("uistroke", _attributes_3)
|
|
102
|
+
end
|
|
103
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _result)
|
|
65
104
|
end
|
|
66
105
|
local function ToggleButtonGroup(props)
|
|
67
106
|
local _binding = props
|
|
@@ -32,7 +32,7 @@ local useToggleButtonStyles = componentStyles("ToggleButton", function(theme, _p
|
|
|
32
32
|
AutoButtonColor = false,
|
|
33
33
|
Active = not disabled,
|
|
34
34
|
Selectable = not disabled,
|
|
35
|
-
TextColor3 = if
|
|
35
|
+
TextColor3 = if selected then theme.palette.primary.main else theme.palette.text.primary,
|
|
36
36
|
Font = theme.typography.fontFamilies.default,
|
|
37
37
|
TextSize = textSize,
|
|
38
38
|
},
|