@rbxts/uiblox 0.2.0-alpha.0 → 0.2.0-alpha.10
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 +51 -34
- package/out/theme/constants/NumberConstants.d.ts +4 -2
- package/out/theme/constants/NumberConstants.luau +6 -4
- package/out/theme/context/ThemeProvider.d.ts +1 -1
- package/out/theme/hooks/useTheme.d.ts +1 -1
- package/out/theme/interfaces/palette/colorTokens/ColorTokens.d.ts +1 -1
- package/out/theme/interfaces/spacing/Shape.d.ts +3 -0
- package/out/theme/interfaces/typography/FontSizes.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +15 -8
- package/out/theme/interfaces/typography/ThemeTypography.d.ts +3 -0
- package/out/theme/interfaces/typography/Variants.d.ts +14 -15
- package/out/theme/interfaces/typography/Variants.luau +68 -18
- package/out/theme/styles/utilities/index.d.ts +1 -1
- package/out/theme/styles/utilities/init.luau +3 -1
- package/out/theme/styles/utilities/resolveStyle.d.ts +32 -0
- package/out/theme/styles/utilities/resolveStyle.luau +66 -0
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/types/types.d.ts +1 -1
- package/out/ui/packages/accordion/components/Accordion.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.luau +5 -0
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.styles.luau +4 -2
- package/out/ui/packages/alert/components/Alert.d.ts +10 -0
- package/out/ui/packages/alert/components/Alert.luau +98 -0
- package/out/ui/packages/alert/components/Alert.styles.d.ts +6 -0
- package/out/ui/packages/alert/components/Alert.styles.luau +93 -0
- package/out/ui/packages/alert/components/alertTone.d.ts +2 -0
- package/out/ui/packages/alert/components/alertTone.luau +7 -0
- package/out/ui/packages/alert/index.d.ts +3 -0
- package/out/ui/packages/alert/init.luau +6 -0
- package/out/ui/packages/appBar/components/AppBar.d.ts +10 -0
- package/out/ui/packages/appBar/components/AppBar.luau +77 -0
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +6 -0
- package/out/ui/packages/appBar/components/AppBar.styles.luau +66 -0
- package/out/ui/packages/appBar/index.d.ts +3 -0
- package/out/ui/packages/appBar/init.luau +5 -0
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
- package/out/ui/packages/backdrop/index.d.ts +2 -0
- package/out/ui/packages/backdrop/init.luau +5 -0
- package/out/ui/packages/badge/components/Badge.styles.luau +6 -3
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +10 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +86 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +2 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +58 -0
- package/out/ui/packages/bottomNavigation/index.d.ts +2 -0
- package/out/ui/packages/bottomNavigation/init.luau +5 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +58 -24
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
- package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
- package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/init.luau +3 -0
- package/out/ui/packages/brickColorPicker/components/brickColorCatalog.luau +1 -1
- package/out/ui/packages/button/components/Button.luau +9 -5
- package/out/ui/packages/button/components/Button.styles.luau +0 -6
- package/out/ui/packages/button/components/buttonLook.d.ts +2 -2
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +3 -1
- package/out/ui/packages/chip/components/Chip.luau +39 -2
- package/out/ui/packages/chip/components/Chip.styles.d.ts +3 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +40 -6
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +13 -2
- package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
- package/out/ui/packages/dialog/components/Dialog.luau +27 -18
- package/out/ui/packages/fab/components/Fab.d.ts +14 -0
- package/out/ui/packages/fab/components/Fab.luau +160 -0
- package/out/ui/packages/fab/components/Fab.styles.d.ts +8 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +65 -0
- package/out/ui/packages/fab/components/fabSize.d.ts +4 -0
- package/out/ui/packages/fab/components/fabSize.luau +33 -0
- package/out/ui/packages/fab/index.d.ts +3 -0
- package/out/ui/packages/fab/init.luau +9 -0
- package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
- package/out/ui/packages/formText/components/FormHelperText.luau +44 -0
- package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
- package/out/ui/packages/formText/components/FormLabel.luau +46 -0
- package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
- package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
- package/out/ui/packages/formText/index.d.ts +4 -0
- package/out/ui/packages/formText/init.luau +6 -0
- package/out/ui/packages/icon/components/Icon.styles.luau +4 -4
- package/out/ui/packages/iconButton/components/IconButton.luau +7 -2
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +7 -4
- package/out/ui/packages/imageList/components/ImageList.d.ts +14 -0
- package/out/ui/packages/imageList/components/ImageList.luau +84 -0
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +54 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +3 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +24 -0
- package/out/ui/packages/imageList/index.d.ts +2 -0
- package/out/ui/packages/imageList/init.luau +5 -0
- package/out/ui/packages/index.d.ts +11 -0
- package/out/ui/packages/init.luau +33 -0
- package/out/ui/packages/input/components/Input.d.ts +2 -0
- package/out/ui/packages/input/components/Input.luau +64 -27
- package/out/ui/packages/input/components/Input.styles.luau +6 -2
- package/out/ui/packages/layout/components/Box.d.ts +11 -0
- package/out/ui/packages/layout/components/Box.luau +49 -0
- package/out/ui/packages/layout/components/Box.styles.d.ts +7 -0
- package/out/ui/packages/layout/components/Box.styles.luau +34 -0
- package/out/ui/packages/layout/components/Container.d.ts +10 -0
- package/out/ui/packages/layout/components/Container.luau +54 -0
- package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
- package/out/ui/packages/layout/components/Container.styles.luau +41 -0
- package/out/ui/packages/layout/components/Grid.d.ts +1 -1
- package/out/ui/packages/layout/components/Stack.d.ts +12 -0
- package/out/ui/packages/layout/components/Stack.luau +49 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
- package/out/ui/packages/layout/components/boxPad.d.ts +14 -0
- package/out/ui/packages/layout/components/boxPad.luau +59 -0
- package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
- package/out/ui/packages/layout/components/containerWidth.luau +17 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
- package/out/ui/packages/layout/components/stackAlign.luau +29 -0
- package/out/ui/packages/layout/index.d.ts +10 -0
- package/out/ui/packages/layout/init.luau +4 -0
- package/out/ui/packages/link/components/Link.d.ts +11 -0
- package/out/ui/packages/link/components/Link.luau +83 -0
- package/out/ui/packages/link/components/Link.styles.d.ts +8 -0
- package/out/ui/packages/link/components/Link.styles.luau +59 -0
- package/out/ui/packages/link/index.d.ts +3 -0
- package/out/ui/packages/link/init.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +10 -5
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +2 -0
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
- package/out/ui/packages/menu/components/Menu.d.ts +3 -0
- package/out/ui/packages/menu/components/Menu.luau +48 -23
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/modal/components/Modal.d.ts +1 -1
- package/out/ui/packages/modal/components/Modal.luau +55 -37
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +1 -0
- package/out/ui/packages/motion/unit.d.ts +5 -0
- package/out/ui/packages/motion/unit.luau +23 -0
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +2 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +4 -0
- package/out/ui/packages/pagination/components/Pagination.d.ts +2 -0
- package/out/ui/packages/pagination/components/Pagination.luau +37 -21
- package/out/ui/packages/pagination/components/Pagination.styles.luau +9 -0
- package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
- package/out/ui/packages/pagination/components/pageRange.luau +91 -8
- package/out/ui/packages/pagination/index.d.ts +1 -0
- package/out/ui/packages/pagination/init.luau +1 -0
- package/out/ui/packages/paper/components/Paper.d.ts +1 -0
- package/out/ui/packages/paper/components/Paper.luau +8 -3
- package/out/ui/packages/popup/index.d.ts +1 -0
- package/out/ui/packages/popup/init.luau +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +4 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +4 -1
- package/out/ui/packages/rating/components/Rating.d.ts +9 -0
- package/out/ui/packages/rating/components/Rating.luau +95 -0
- package/out/ui/packages/rating/components/Rating.styles.d.ts +4 -0
- package/out/ui/packages/rating/components/Rating.styles.luau +39 -0
- package/out/ui/packages/rating/index.d.ts +2 -0
- package/out/ui/packages/rating/init.luau +5 -0
- package/out/ui/packages/select/components/Select.d.ts +6 -0
- package/out/ui/packages/select/components/Select.luau +74 -27
- package/out/ui/packages/select/components/Select.styles.luau +3 -3
- package/out/ui/packages/sidebar/components/Sidebar.styles.luau +2 -2
- package/out/ui/packages/skeleton/components/Skeleton.luau +3 -2
- package/out/ui/packages/skeleton/components/Skeleton.styles.luau +7 -2
- package/out/ui/packages/skeleton/components/skeletonMotion.luau +1 -1
- package/out/ui/packages/skeleton/components/skeletonTone.d.ts +20 -0
- package/out/ui/packages/skeleton/components/skeletonTone.luau +14 -0
- package/out/ui/packages/slider/components/Slider.d.ts +1 -0
- package/out/ui/packages/slider/components/Slider.luau +24 -1
- package/out/ui/packages/slider/components/Slider.styles.luau +8 -0
- package/out/ui/packages/slider/components/sliderMarks.d.ts +1 -0
- package/out/ui/packages/slider/components/sliderMarks.luau +37 -0
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +17 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +92 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +2 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +26 -0
- package/out/ui/packages/speedDial/index.d.ts +2 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +1843 -1335
- package/out/ui/packages/switch/components/Switch.styles.luau +1 -1
- package/out/ui/packages/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +10 -3
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
- package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
- package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
- package/out/ui/packages/tabs/index.d.ts +1 -0
- package/out/ui/packages/tabs/init.luau +1 -0
- package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +17 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +126 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +5 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +58 -0
- package/out/ui/packages/toggleButton/index.d.ts +2 -0
- package/out/ui/packages/toggleButton/init.luau +7 -0
- package/out/ui/packages/treeView/components/TreeView.luau +3 -3
- package/out/ui/packages/treeView/components/TreeView.styles.luau +3 -3
- package/out/ui/packages/typography/components/Typography.styles.luau +4 -5
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +6 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +32 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
- package/out/ui/packages/virtualList/index.d.ts +2 -0
- package/out/ui/packages/virtualList/init.luau +1 -0
- package/package.json +2 -2
- package/out/theme/styles/utilities/interaction.d.ts +0 -13
- package/out/theme/styles/utilities/interaction.luau +0 -68
|
@@ -4,37 +4,41 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useEffect = _react.useEffect
|
|
6
6
|
local useRef = _react.useRef
|
|
7
|
-
local
|
|
7
|
+
local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
|
|
8
|
+
local loopProperty = TS.import(script, script.Parent.Parent.Parent, "motion").loopProperty
|
|
8
9
|
local function LoadingStroke(props)
|
|
9
10
|
local _binding = props
|
|
10
11
|
local animating = _binding.animating
|
|
11
12
|
if animating == nil then
|
|
12
13
|
animating = false
|
|
13
14
|
end
|
|
15
|
+
local color = _binding.color
|
|
16
|
+
local thickness = _binding.thickness
|
|
17
|
+
if thickness == nil then
|
|
18
|
+
thickness = 2
|
|
19
|
+
end
|
|
14
20
|
local className = _binding.className
|
|
15
21
|
local sx = _binding.sx
|
|
16
22
|
local children = _binding.children
|
|
17
23
|
local id = _binding.id
|
|
18
24
|
local ref = _binding.ref
|
|
25
|
+
local _binding_1 = useTheme()
|
|
26
|
+
local theme = _binding_1.theme
|
|
19
27
|
local gradientRef = useRef()
|
|
28
|
+
local stroke = color or theme.palette.primary.on
|
|
20
29
|
useEffect(function()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
else
|
|
31
|
-
gradientRef.current.Rotation = 0
|
|
32
|
-
end
|
|
30
|
+
local gradient = gradientRef.current
|
|
31
|
+
if not gradient then
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
if animating then
|
|
35
|
+
gradient.Rotation = 0
|
|
36
|
+
return loopProperty(gradient, {
|
|
37
|
+
Rotation = 360,
|
|
38
|
+
}, 1.2)
|
|
33
39
|
end
|
|
40
|
+
gradient.Rotation = 0
|
|
34
41
|
end, { animating })
|
|
35
|
-
-- Decorative shimmer; not a semantic text/surface token.
|
|
36
|
-
local stroke = Color3.fromRGB(255, 255, 255)
|
|
37
|
-
local mid = Color3.fromRGB(235, 235, 235)
|
|
38
42
|
local _attributes = {}
|
|
39
43
|
local _condition = id
|
|
40
44
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
@@ -43,7 +47,7 @@ local function LoadingStroke(props)
|
|
|
43
47
|
_attributes.key = _condition
|
|
44
48
|
_attributes.ref = ref
|
|
45
49
|
_attributes.Color = stroke
|
|
46
|
-
_attributes.Thickness =
|
|
50
|
+
_attributes.Thickness = thickness
|
|
47
51
|
_attributes.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
|
|
48
52
|
if className then
|
|
49
53
|
for _k, _v in className do
|
|
@@ -57,9 +61,9 @@ local function LoadingStroke(props)
|
|
|
57
61
|
end
|
|
58
62
|
return React.createElement("uistroke", _attributes, React.createElement("uigradient", {
|
|
59
63
|
ref = gradientRef,
|
|
60
|
-
Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.
|
|
64
|
+
Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.45, 0), NumberSequenceKeypoint.new(0.55, 0), NumberSequenceKeypoint.new(1, 1) }),
|
|
61
65
|
Rotation = 0,
|
|
62
|
-
Color = ColorSequence.new(
|
|
66
|
+
Color = ColorSequence.new(stroke),
|
|
63
67
|
}), children)
|
|
64
68
|
end
|
|
65
69
|
local default = LoadingStroke
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
1
2
|
export interface MenuItem {
|
|
2
3
|
id: string;
|
|
3
4
|
text: string;
|
|
@@ -9,6 +10,8 @@ export interface MenuProps {
|
|
|
9
10
|
items: MenuItem[];
|
|
10
11
|
onSelect: (id: string) => void;
|
|
11
12
|
onClose: () => void;
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
empty?: React.Element;
|
|
12
15
|
}
|
|
13
16
|
declare function Menu(props: MenuProps): JSX.Element | undefined;
|
|
14
17
|
export default Menu;
|
|
@@ -3,6 +3,7 @@ local TS = _G[script]
|
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local ListItem = TS.import(script, script.Parent.Parent.Parent, "listItem").ListItem
|
|
5
5
|
local Popup = TS.import(script, script.Parent.Parent.Parent, "popup").Popup
|
|
6
|
+
local EmptyListHint = TS.import(script, script.Parent.Parent.Parent, "virtualList").EmptyListHint
|
|
6
7
|
local useMenuStyles = TS.import(script, script.Parent, "Menu.styles").default
|
|
7
8
|
local ROW = 28
|
|
8
9
|
local function Menu(props)
|
|
@@ -12,10 +13,14 @@ local function Menu(props)
|
|
|
12
13
|
local items = _binding.items
|
|
13
14
|
local onSelect = _binding.onSelect
|
|
14
15
|
local onClose = _binding.onClose
|
|
16
|
+
local emptyText = _binding.emptyText
|
|
17
|
+
local empty = _binding.empty
|
|
15
18
|
local styles = useMenuStyles()
|
|
16
19
|
if not open then
|
|
17
20
|
return nil
|
|
18
21
|
end
|
|
22
|
+
local vacant = #items == 0
|
|
23
|
+
local height = if vacant then ROW else #items * ROW
|
|
19
24
|
local _attributes = {
|
|
20
25
|
key = "Surface",
|
|
21
26
|
}
|
|
@@ -25,34 +30,54 @@ local function Menu(props)
|
|
|
25
30
|
local _attributes_1 = table.clone(styles.corner)
|
|
26
31
|
setmetatable(_attributes_1, nil)
|
|
27
32
|
local _exp = React.createElement("uicorner", _attributes_1)
|
|
28
|
-
local _attributes_2 = table.clone(styles.
|
|
33
|
+
local _attributes_2 = table.clone(styles.stroke)
|
|
29
34
|
setmetatable(_attributes_2, nil)
|
|
30
|
-
local _exp_1 = React.createElement("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
local
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
local _exp_1 = React.createElement("uistroke", _attributes_2)
|
|
36
|
+
local _attributes_3 = table.clone(styles.list)
|
|
37
|
+
setmetatable(_attributes_3, nil)
|
|
38
|
+
local _exp_2 = React.createElement("uilistlayout", _attributes_3)
|
|
39
|
+
local _result
|
|
40
|
+
if vacant then
|
|
41
|
+
local _condition = empty
|
|
42
|
+
if _condition == nil then
|
|
43
|
+
local _attributes_4 = {}
|
|
44
|
+
local _condition_1 = emptyText
|
|
45
|
+
if _condition_1 == nil then
|
|
46
|
+
_condition_1 = "No options"
|
|
47
|
+
end
|
|
48
|
+
_attributes_4.text = _condition_1
|
|
49
|
+
_attributes_4.height = ROW
|
|
50
|
+
_condition = React.createElement(EmptyListHint, _attributes_4)
|
|
51
|
+
end
|
|
52
|
+
_result = _condition
|
|
53
|
+
else
|
|
54
|
+
-- ▼ ReadonlyArray.map ▼
|
|
55
|
+
local _newValue = table.create(#items)
|
|
56
|
+
local _callback = function(item)
|
|
57
|
+
return React.createElement(ListItem, {
|
|
58
|
+
key = item.id,
|
|
59
|
+
text = item.text,
|
|
60
|
+
disabled = item.disabled,
|
|
61
|
+
onActivated = function()
|
|
62
|
+
if item.disabled == true then
|
|
63
|
+
return nil
|
|
64
|
+
end
|
|
65
|
+
onSelect(item.id)
|
|
66
|
+
onClose()
|
|
67
|
+
end,
|
|
68
|
+
})
|
|
69
|
+
end
|
|
70
|
+
for _k, _v in items do
|
|
71
|
+
_newValue[_k] = _callback(_v, _k - 1, items)
|
|
72
|
+
end
|
|
73
|
+
-- ▲ ReadonlyArray.map ▲
|
|
74
|
+
_result = _newValue
|
|
46
75
|
end
|
|
47
|
-
for _k, _v in items do
|
|
48
|
-
_newValue[_k] = _callback(_v, _k - 1, items)
|
|
49
|
-
end
|
|
50
|
-
-- ▲ ReadonlyArray.map ▲
|
|
51
76
|
return React.createElement(Popup, {
|
|
52
77
|
anchor = anchor,
|
|
53
|
-
preferredHeight =
|
|
78
|
+
preferredHeight = height,
|
|
54
79
|
onDismiss = onClose,
|
|
55
|
-
}, React.createElement("frame", _attributes, _exp, _exp_1,
|
|
80
|
+
}, React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _result))
|
|
56
81
|
end
|
|
57
82
|
local default = Menu
|
|
58
83
|
return {
|
|
@@ -8,12 +8,16 @@ local useMenuStyles = componentStyles("Menu", function(theme)
|
|
|
8
8
|
surface = {
|
|
9
9
|
Size = UDim2.new(1, 0, 0, 0),
|
|
10
10
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
11
|
-
BackgroundColor3 = theme.palette.surface.
|
|
11
|
+
BackgroundColor3 = theme.palette.surface.elevated,
|
|
12
12
|
BorderSizePixel = 0,
|
|
13
13
|
},
|
|
14
14
|
corner = {
|
|
15
15
|
CornerRadius = UDim.new(0, theme.shape.borderRadius),
|
|
16
16
|
},
|
|
17
|
+
stroke = {
|
|
18
|
+
Color = theme.palette.border,
|
|
19
|
+
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
|
|
20
|
+
},
|
|
17
21
|
list = {
|
|
18
22
|
FillDirection = Enum.FillDirection.Vertical,
|
|
19
23
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
@@ -4,10 +4,13 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useEffect = _react.useEffect
|
|
6
6
|
local useRef = _react.useRef
|
|
7
|
+
local useState = _react.useState
|
|
7
8
|
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
8
9
|
local GuiService = _services.GuiService
|
|
9
10
|
local UserInputService = _services.UserInputService
|
|
10
|
-
local
|
|
11
|
+
local _popup = TS.import(script, script.Parent.Parent.Parent, "popup")
|
|
12
|
+
local Portal = _popup.Portal
|
|
13
|
+
local portalTarget = _popup.portalTarget
|
|
11
14
|
local isDismissInput = TS.import(script, script.Parent, "dismissInput").isDismissInput
|
|
12
15
|
local _focusTrap = TS.import(script, script.Parent, "focusTrap")
|
|
13
16
|
local isFocusable = _focusTrap.isFocusable
|
|
@@ -22,7 +25,14 @@ local function Modal(props)
|
|
|
22
25
|
local styles = useModalStyles()
|
|
23
26
|
local close = useRef(onClose)
|
|
24
27
|
local surface = useRef()
|
|
28
|
+
local anchor = useRef()
|
|
29
|
+
local layer, setLayer = useState(function()
|
|
30
|
+
return portalTarget(host)
|
|
31
|
+
end)
|
|
25
32
|
close.current = onClose
|
|
33
|
+
useEffect(function()
|
|
34
|
+
setLayer(portalTarget(host or anchor.current))
|
|
35
|
+
end, { host, open })
|
|
26
36
|
useEffect(function()
|
|
27
37
|
if not open then
|
|
28
38
|
return nil
|
|
@@ -53,43 +63,51 @@ local function Modal(props)
|
|
|
53
63
|
GuiService.SelectedObject = previous
|
|
54
64
|
end
|
|
55
65
|
end
|
|
56
|
-
end, { open })
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
end, { open, layer })
|
|
67
|
+
local _exp = React.createElement("frame", {
|
|
68
|
+
key = "ModalAnchor",
|
|
69
|
+
ref = anchor,
|
|
70
|
+
Size = UDim2.fromOffset(0, 0),
|
|
71
|
+
BackgroundTransparency = 1,
|
|
72
|
+
BorderSizePixel = 0,
|
|
73
|
+
})
|
|
74
|
+
local _condition = open and layer ~= nil
|
|
75
|
+
if _condition then
|
|
76
|
+
local _attributes = {
|
|
77
|
+
key = "Modal",
|
|
78
|
+
}
|
|
79
|
+
for _k, _v in styles.root do
|
|
80
|
+
_attributes[_k] = _v
|
|
81
|
+
end
|
|
82
|
+
local _attributes_1 = {
|
|
83
|
+
key = "Backdrop",
|
|
84
|
+
}
|
|
85
|
+
for _k, _v in styles.backdrop do
|
|
86
|
+
_attributes_1[_k] = _v
|
|
87
|
+
end
|
|
88
|
+
_attributes_1.Event = {
|
|
89
|
+
Activated = function()
|
|
90
|
+
return close.current()
|
|
91
|
+
end,
|
|
92
|
+
}
|
|
93
|
+
local _exp_1 = React.createElement("textbutton", _attributes_1)
|
|
94
|
+
local _attributes_2 = {
|
|
95
|
+
key = "Surface",
|
|
96
|
+
ref = surface,
|
|
97
|
+
}
|
|
98
|
+
for _k, _v in styles.surface do
|
|
99
|
+
_attributes_2[_k] = _v
|
|
100
|
+
end
|
|
101
|
+
local _attributes_3 = table.clone(styles.padding)
|
|
102
|
+
setmetatable(_attributes_3, nil)
|
|
103
|
+
local _exp_2 = React.createElement("uipadding", _attributes_3)
|
|
104
|
+
local _attributes_4 = table.clone(styles.corner)
|
|
105
|
+
setmetatable(_attributes_4, nil)
|
|
106
|
+
_condition = (React.createElement(Portal, {
|
|
107
|
+
host = layer,
|
|
108
|
+
}, React.createElement("frame", _attributes, _exp_1, React.createElement("frame", _attributes_2, _exp_2, React.createElement("uicorner", _attributes_4), children))))
|
|
84
109
|
end
|
|
85
|
-
|
|
86
|
-
setmetatable(_attributes_3, nil)
|
|
87
|
-
local _exp_1 = React.createElement("uipadding", _attributes_3)
|
|
88
|
-
local _attributes_4 = table.clone(styles.corner)
|
|
89
|
-
setmetatable(_attributes_4, nil)
|
|
90
|
-
return React.createElement(Portal, {
|
|
91
|
-
host = host,
|
|
92
|
-
}, React.createElement("frame", _attributes, _exp, React.createElement("frame", _attributes_2, _exp_1, React.createElement("uicorner", _attributes_4), children)))
|
|
110
|
+
return React.createElement(React.Fragment, nil, _exp, _condition)
|
|
93
111
|
end
|
|
94
112
|
local default = Modal
|
|
95
113
|
return {
|
|
@@ -2,4 +2,4 @@ export { loopProperty } from "./loop";
|
|
|
2
2
|
export { motionDuration, assignGoal } from "./duration";
|
|
3
3
|
export { playProperty } from "./play";
|
|
4
4
|
export { resolveReduced } from "./resolveReduced";
|
|
5
|
-
export { clampUnit, stopOnce, progressUnit, progressSpin, arcKeys } from "./unit";
|
|
5
|
+
export { clampUnit, stopOnce, progressUnit, progressSpin, arcKeys, spinArcKeys } from "./unit";
|
|
@@ -6,3 +6,8 @@ export declare function arcKeys(value: number): {
|
|
|
6
6
|
time: number;
|
|
7
7
|
transparency: number;
|
|
8
8
|
}[];
|
|
9
|
+
/** Indeterminate ring: long clear trail, bright head — reads as a sweep. */
|
|
10
|
+
export declare function spinArcKeys(): {
|
|
11
|
+
time: number;
|
|
12
|
+
transparency: number;
|
|
13
|
+
}[];
|
|
@@ -71,10 +71,33 @@ local function arcKeys(value)
|
|
|
71
71
|
transparency = 1,
|
|
72
72
|
} }
|
|
73
73
|
end
|
|
74
|
+
--* Indeterminate ring: long clear trail, bright head — reads as a sweep.
|
|
75
|
+
local function spinArcKeys()
|
|
76
|
+
return { {
|
|
77
|
+
time = 0,
|
|
78
|
+
transparency = 1,
|
|
79
|
+
}, {
|
|
80
|
+
time = 0.45,
|
|
81
|
+
transparency = 1,
|
|
82
|
+
}, {
|
|
83
|
+
time = 0.7,
|
|
84
|
+
transparency = 0.55,
|
|
85
|
+
}, {
|
|
86
|
+
time = 0.88,
|
|
87
|
+
transparency = 0,
|
|
88
|
+
}, {
|
|
89
|
+
time = 0.96,
|
|
90
|
+
transparency = 0.35,
|
|
91
|
+
}, {
|
|
92
|
+
time = 1,
|
|
93
|
+
transparency = 1,
|
|
94
|
+
} }
|
|
95
|
+
end
|
|
74
96
|
return {
|
|
75
97
|
clampUnit = clampUnit,
|
|
76
98
|
stopOnce = stopOnce,
|
|
77
99
|
progressUnit = progressUnit,
|
|
78
100
|
progressSpin = progressSpin,
|
|
79
101
|
arcKeys = arcKeys,
|
|
102
|
+
spinArcKeys = spinArcKeys,
|
|
80
103
|
}
|
|
@@ -6,9 +6,11 @@ export interface NumberInputProps {
|
|
|
6
6
|
max?: number;
|
|
7
7
|
step?: number;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
width?: UDim;
|
|
11
12
|
size?: ControlSize;
|
|
13
|
+
reducedMotion?: boolean;
|
|
12
14
|
}
|
|
13
15
|
declare function NumberInput(props: CustomizedProps<Frame, NumberInputProps>): JSX.Element;
|
|
14
16
|
export default NumberInput;
|
|
@@ -11,9 +11,11 @@ local function NumberInput(props)
|
|
|
11
11
|
local max = _binding.max
|
|
12
12
|
local step = _binding.step
|
|
13
13
|
local disabled = _binding.disabled
|
|
14
|
+
local loading = _binding.loading
|
|
14
15
|
local placeholder = _binding.placeholder
|
|
15
16
|
local width = _binding.width
|
|
16
17
|
local size = _binding.size
|
|
18
|
+
local reducedMotion = _binding.reducedMotion
|
|
17
19
|
local className = _binding.className
|
|
18
20
|
local id = _binding.id
|
|
19
21
|
local ref = _binding.ref
|
|
@@ -29,7 +31,9 @@ local function NumberInput(props)
|
|
|
29
31
|
_attributes.placeholder = placeholder
|
|
30
32
|
_attributes.width = width
|
|
31
33
|
_attributes.disabled = disabled
|
|
34
|
+
_attributes.loading = loading
|
|
32
35
|
_attributes.size = size
|
|
36
|
+
_attributes.reducedMotion = reducedMotion
|
|
33
37
|
_attributes.onTextChanged = function(text)
|
|
34
38
|
local committed = parseNumberDraft(text, min, max, step)
|
|
35
39
|
if committed ~= nil and committed ~= value then
|
|
@@ -3,6 +3,8 @@ export interface PaginationProps {
|
|
|
3
3
|
count: number;
|
|
4
4
|
page: number;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
siblingCount?: number;
|
|
7
|
+
boundaryCount?: number;
|
|
6
8
|
onChange: (page: number) => void;
|
|
7
9
|
}
|
|
8
10
|
declare function Pagination(props: CustomizedProps<Frame, PaginationProps>): JSX.Element;
|
|
@@ -9,12 +9,15 @@ local function Pagination(props)
|
|
|
9
9
|
local count = _binding.count
|
|
10
10
|
local page = _binding.page
|
|
11
11
|
local disabled = _binding.disabled
|
|
12
|
+
local siblingCount = _binding.siblingCount
|
|
13
|
+
local boundaryCount = _binding.boundaryCount
|
|
12
14
|
local onChange = _binding.onChange
|
|
13
15
|
local className = _binding.className
|
|
14
16
|
local sx = _binding.sx
|
|
15
17
|
local id = _binding.id
|
|
16
18
|
local ref = _binding.ref
|
|
17
19
|
local styles = usePaginationStyles()
|
|
20
|
+
local tokens = pageRange(count, page, siblingCount, boundaryCount)
|
|
18
21
|
local _attributes = {}
|
|
19
22
|
local _condition = id
|
|
20
23
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
@@ -38,30 +41,43 @@ local function Pagination(props)
|
|
|
38
41
|
local _attributes_1 = table.clone(styles.list)
|
|
39
42
|
setmetatable(_attributes_1, nil)
|
|
40
43
|
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
41
|
-
local _exp_1 = pageRange(count)
|
|
42
44
|
-- ▼ ReadonlyArray.map ▼
|
|
43
|
-
local _newValue = table.create(#
|
|
44
|
-
local _callback = function(item)
|
|
45
|
-
local
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
local _newValue = table.create(#tokens)
|
|
46
|
+
local _callback = function(item, index)
|
|
47
|
+
local _result
|
|
48
|
+
if item == "ellipsis" then
|
|
49
|
+
local _attributes_2 = {
|
|
50
|
+
key = `e-{index}`,
|
|
51
|
+
}
|
|
52
|
+
for _k, _v in styles.ellipsis do
|
|
53
|
+
_attributes_2[_k] = _v
|
|
54
|
+
end
|
|
55
|
+
_attributes_2.LayoutOrder = index
|
|
56
|
+
_result = (React.createElement("textlabel", _attributes_2))
|
|
57
|
+
else
|
|
58
|
+
local _attributes_2 = {
|
|
59
|
+
key = tostring(item),
|
|
60
|
+
}
|
|
61
|
+
for _k, _v in cx(styles.page, item == page and styles.selected) do
|
|
62
|
+
_attributes_2[_k] = _v
|
|
63
|
+
end
|
|
64
|
+
_attributes_2.Text = tostring(item)
|
|
65
|
+
_attributes_2.LayoutOrder = index
|
|
66
|
+
_attributes_2.Active = disabled ~= true
|
|
67
|
+
_attributes_2.Selectable = disabled ~= true
|
|
68
|
+
_attributes_2.Event = {
|
|
69
|
+
Activated = function()
|
|
70
|
+
return disabled ~= true and item ~= page and onChange(item)
|
|
71
|
+
end,
|
|
72
|
+
}
|
|
73
|
+
local _attributes_3 = table.clone(styles.corner)
|
|
74
|
+
setmetatable(_attributes_3, nil)
|
|
75
|
+
_result = (React.createElement("textbutton", _attributes_2, React.createElement("uicorner", _attributes_3)))
|
|
50
76
|
end
|
|
51
|
-
|
|
52
|
-
_attributes_2.Active = disabled ~= true
|
|
53
|
-
_attributes_2.Selectable = disabled ~= true
|
|
54
|
-
_attributes_2.Event = {
|
|
55
|
-
Activated = function()
|
|
56
|
-
return disabled ~= true and item ~= page and onChange(item)
|
|
57
|
-
end,
|
|
58
|
-
}
|
|
59
|
-
local _attributes_3 = table.clone(styles.corner)
|
|
60
|
-
setmetatable(_attributes_3, nil)
|
|
61
|
-
return React.createElement("textbutton", _attributes_2, React.createElement("uicorner", _attributes_3))
|
|
77
|
+
return _result
|
|
62
78
|
end
|
|
63
|
-
for _k, _v in
|
|
64
|
-
_newValue[_k] = _callback(_v, _k - 1,
|
|
79
|
+
for _k, _v in tokens do
|
|
80
|
+
_newValue[_k] = _callback(_v, _k - 1, tokens)
|
|
65
81
|
end
|
|
66
82
|
-- ▲ ReadonlyArray.map ▲
|
|
67
83
|
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
@@ -28,6 +28,15 @@ local usePaginationStyles = componentStyles("Pagination", function(theme)
|
|
|
28
28
|
selected = {
|
|
29
29
|
BackgroundColor3 = theme.palette.action.selected,
|
|
30
30
|
},
|
|
31
|
+
ellipsis = {
|
|
32
|
+
Size = UDim2.fromOffset(theme.spacing.calc(3), theme.spacing.calc(3)),
|
|
33
|
+
BackgroundTransparency = 1,
|
|
34
|
+
BorderSizePixel = 0,
|
|
35
|
+
Font = theme.typography.fontFamilies.default,
|
|
36
|
+
TextSize = theme.typography.fontSizes.body,
|
|
37
|
+
TextColor3 = theme.palette.text.secondary,
|
|
38
|
+
Text = "…",
|
|
39
|
+
},
|
|
31
40
|
corner = {
|
|
32
41
|
CornerRadius = UDim.new(1, 0),
|
|
33
42
|
},
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type PageToken = number | "ellipsis";
|
|
2
|
+
export declare function pageRange(count: number, page?: number, siblingCount?: number, boundaryCount?: number): PageToken[];
|
|
@@ -1,23 +1,106 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local function pageRange(count)
|
|
3
|
-
|
|
2
|
+
local function pageRange(count, page, siblingCount, boundaryCount)
|
|
3
|
+
if page == nil then
|
|
4
|
+
page = 1
|
|
5
|
+
end
|
|
6
|
+
if siblingCount == nil then
|
|
7
|
+
siblingCount = 1
|
|
8
|
+
end
|
|
9
|
+
if boundaryCount == nil then
|
|
10
|
+
boundaryCount = 1
|
|
11
|
+
end
|
|
12
|
+
local total = math.max(0, math.floor(count))
|
|
13
|
+
if total == 0 then
|
|
14
|
+
return {}
|
|
15
|
+
end
|
|
16
|
+
local current = math.clamp(math.floor(page), 1, total)
|
|
17
|
+
local siblings = math.max(0, math.floor(siblingCount))
|
|
18
|
+
local boundaries = math.max(0, math.floor(boundaryCount))
|
|
19
|
+
local rangeLength = boundaries * 2 + siblings * 2 + 3
|
|
20
|
+
if total <= rangeLength then
|
|
21
|
+
local all = {}
|
|
22
|
+
do
|
|
23
|
+
local i = 1
|
|
24
|
+
local _shouldIncrement = false
|
|
25
|
+
while true do
|
|
26
|
+
if _shouldIncrement then
|
|
27
|
+
i += 1
|
|
28
|
+
else
|
|
29
|
+
_shouldIncrement = true
|
|
30
|
+
end
|
|
31
|
+
if not (i <= total) then
|
|
32
|
+
break
|
|
33
|
+
end
|
|
34
|
+
local _i = i
|
|
35
|
+
table.insert(all, _i)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return all
|
|
39
|
+
end
|
|
40
|
+
local startFrom = math.max(current - siblings, boundaries + 2)
|
|
41
|
+
local endAt = math.min(current + siblings, total - (boundaries + 1))
|
|
42
|
+
local tokens = {}
|
|
43
|
+
do
|
|
44
|
+
local i = 1
|
|
45
|
+
local _shouldIncrement = false
|
|
46
|
+
while true do
|
|
47
|
+
if _shouldIncrement then
|
|
48
|
+
i += 1
|
|
49
|
+
else
|
|
50
|
+
_shouldIncrement = true
|
|
51
|
+
end
|
|
52
|
+
if not (i <= boundaries) then
|
|
53
|
+
break
|
|
54
|
+
end
|
|
55
|
+
local _i = i
|
|
56
|
+
table.insert(tokens, _i)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
if startFrom > boundaries + 2 then
|
|
60
|
+
table.insert(tokens, "ellipsis")
|
|
61
|
+
elseif boundaries + 1 < startFrom then
|
|
62
|
+
local _arg0 = boundaries + 1
|
|
63
|
+
table.insert(tokens, _arg0)
|
|
64
|
+
end
|
|
65
|
+
do
|
|
66
|
+
local i = startFrom
|
|
67
|
+
local _shouldIncrement = false
|
|
68
|
+
while true do
|
|
69
|
+
if _shouldIncrement then
|
|
70
|
+
i += 1
|
|
71
|
+
else
|
|
72
|
+
_shouldIncrement = true
|
|
73
|
+
end
|
|
74
|
+
if not (i <= endAt) then
|
|
75
|
+
break
|
|
76
|
+
end
|
|
77
|
+
local _i = i
|
|
78
|
+
table.insert(tokens, _i)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
if endAt < total - (boundaries + 1) then
|
|
82
|
+
table.insert(tokens, "ellipsis")
|
|
83
|
+
elseif endAt + 1 < total - boundaries + 1 then
|
|
84
|
+
local _arg0 = endAt + 1
|
|
85
|
+
table.insert(tokens, _arg0)
|
|
86
|
+
end
|
|
4
87
|
do
|
|
5
|
-
local
|
|
88
|
+
local i = total - boundaries + 1
|
|
6
89
|
local _shouldIncrement = false
|
|
7
90
|
while true do
|
|
8
91
|
if _shouldIncrement then
|
|
9
|
-
|
|
92
|
+
i += 1
|
|
10
93
|
else
|
|
11
94
|
_shouldIncrement = true
|
|
12
95
|
end
|
|
13
|
-
if not (
|
|
96
|
+
if not (i <= total) then
|
|
14
97
|
break
|
|
15
98
|
end
|
|
16
|
-
local
|
|
17
|
-
table.insert(
|
|
99
|
+
local _i = i
|
|
100
|
+
table.insert(tokens, _i)
|
|
18
101
|
end
|
|
19
102
|
end
|
|
20
|
-
return
|
|
103
|
+
return tokens
|
|
21
104
|
end
|
|
22
105
|
return {
|
|
23
106
|
pageRange = pageRange,
|