@rbxts/uiblox 0.2.0-alpha.2 → 0.2.0-alpha.21
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 +2 -0
- package/out/theme/constants/NumberConstants.d.ts +2 -0
- package/out/theme/constants/NumberConstants.luau +3 -0
- 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/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/ui/packages/accordion/components/Accordion.d.ts +2 -0
- package/out/ui/packages/accordion/components/Accordion.luau +36 -16
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.styles.luau +16 -4
- 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/alert/components/Alert.d.ts +2 -0
- package/out/ui/packages/alert/components/Alert.luau +40 -27
- package/out/ui/packages/alert/components/Alert.styles.d.ts +2 -0
- package/out/ui/packages/alert/components/Alert.styles.luau +17 -8
- package/out/ui/packages/appBar/components/AppBar.d.ts +2 -1
- package/out/ui/packages/appBar/components/AppBar.luau +5 -0
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +2 -0
- package/out/ui/packages/appBar/components/AppBar.styles.luau +6 -2
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
- package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.luau +20 -12
- package/out/ui/packages/avatar/components/Avatar.styles.d.ts +2 -0
- package/out/ui/packages/avatar/components/Avatar.styles.luau +5 -1
- 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.d.ts +3 -0
- package/out/ui/packages/badge/components/Badge.luau +23 -8
- package/out/ui/packages/badge/components/Badge.styles.d.ts +5 -1
- package/out/ui/packages/badge/components/Badge.styles.luau +20 -8
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +1 -0
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +9 -3
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.d.ts +3 -1
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +6 -2
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +59 -25
- 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/card/components/Card.d.ts +1 -0
- package/out/ui/packages/card/components/Card.luau +2 -0
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +6 -1
- package/out/ui/packages/chip/components/Chip.luau +49 -2
- package/out/ui/packages/chip/components/Chip.styles.d.ts +6 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +55 -10
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +13 -2
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +1 -1
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +1 -1
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +1 -1
- 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/divider/components/Divider.d.ts +1 -0
- package/out/ui/packages/divider/components/Divider.luau +48 -0
- package/out/ui/packages/divider/components/Divider.styles.luau +29 -0
- package/out/ui/packages/divider/components/dividerLabel.d.ts +1 -0
- package/out/ui/packages/divider/components/dividerLabel.luau +10 -0
- package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
- package/out/ui/packages/drawer/components/Drawer.luau +4 -1
- package/out/ui/packages/drawer/components/Drawer.styles.d.ts +3 -1
- package/out/ui/packages/drawer/components/Drawer.styles.luau +3 -2
- package/out/ui/packages/fab/components/Fab.d.ts +3 -0
- package/out/ui/packages/fab/components/Fab.luau +62 -25
- package/out/ui/packages/fab/components/Fab.styles.d.ts +3 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +33 -3
- package/out/ui/packages/fab/components/fabSize.d.ts +1 -0
- package/out/ui/packages/fab/components/fabSize.luau +4 -0
- package/out/ui/packages/fab/index.d.ts +1 -1
- package/out/ui/packages/fab/init.luau +1 -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/iconButton/components/IconButton.luau +7 -2
- package/out/ui/packages/iconButton/components/IconButton.styles.luau +3 -0
- package/out/ui/packages/imageList/components/ImageList.d.ts +14 -0
- package/out/ui/packages/imageList/components/ImageList.luau +100 -0
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +73 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +4 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +31 -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 +7 -0
- package/out/ui/packages/init.luau +21 -0
- package/out/ui/packages/input/components/Input.d.ts +1 -0
- package/out/ui/packages/input/components/Input.luau +8 -3
- 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/FlexItem.d.ts +12 -0
- package/out/ui/packages/layout/components/FlexItem.luau +49 -0
- package/out/ui/packages/layout/components/FlexItem.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/FlexItem.styles.luau +66 -0
- package/out/ui/packages/layout/components/Grid.d.ts +5 -1
- package/out/ui/packages/layout/components/Grid.luau +35 -4
- package/out/ui/packages/layout/components/Stack.d.ts +14 -0
- package/out/ui/packages/layout/components/Stack.luau +53 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +10 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +101 -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/flexItemMode.d.ts +6 -0
- package/out/ui/packages/layout/components/flexItemMode.luau +36 -0
- package/out/ui/packages/layout/components/gridProps.d.ts +3 -0
- package/out/ui/packages/layout/components/gridProps.luau +20 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +10 -0
- package/out/ui/packages/layout/components/stackAlign.luau +43 -0
- package/out/ui/packages/layout/index.d.ts +14 -0
- package/out/ui/packages/layout/init.luau +5 -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 +2 -0
- package/out/ui/packages/listItem/components/ListItem.luau +22 -1
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +16 -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 +5 -0
- package/out/ui/packages/menu/components/Menu.luau +54 -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 +1 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +2 -0
- package/out/ui/packages/pagination/components/Pagination.d.ts +6 -1
- package/out/ui/packages/pagination/components/Pagination.luau +51 -23
- package/out/ui/packages/pagination/components/Pagination.styles.d.ts +6 -1
- package/out/ui/packages/pagination/components/Pagination.styles.luau +36 -4
- 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 +2 -1
- package/out/ui/packages/paper/components/Paper.luau +14 -3
- 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/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +1 -1
- 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 +5 -3
- 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 +11 -0
- package/out/ui/packages/rating/components/Rating.luau +101 -0
- package/out/ui/packages/rating/components/Rating.styles.d.ts +6 -0
- package/out/ui/packages/rating/components/Rating.styles.luau +44 -0
- package/out/ui/packages/rating/index.d.ts +2 -0
- package/out/ui/packages/rating/init.luau +5 -0
- package/out/ui/packages/rectEditor/components/RectEditor.luau +1 -1
- package/out/ui/packages/select/components/Select.d.ts +5 -0
- package/out/ui/packages/select/components/Select.luau +48 -24
- package/out/ui/packages/select/components/Select.styles.luau +1 -1
- package/out/ui/packages/skeleton/components/Skeleton.luau +4 -3
- 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 +3 -0
- package/out/ui/packages/slider/components/Slider.luau +32 -3
- package/out/ui/packages/slider/components/Slider.styles.d.ts +2 -0
- package/out/ui/packages/slider/components/Slider.styles.luau +14 -1
- 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/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/speedDial/components/SpeedDial.d.ts +19 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +101 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +5 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +31 -0
- package/out/ui/packages/speedDial/index.d.ts +3 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/splitPane/components/SplitPane.luau +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +881 -253
- package/out/ui/packages/stepper/components/Stepper.d.ts +1 -0
- package/out/ui/packages/stepper/components/Stepper.luau +8 -2
- package/out/ui/packages/stepper/components/Stepper.styles.d.ts +3 -1
- package/out/ui/packages/stepper/components/Stepper.styles.luau +6 -2
- package/out/ui/packages/switch/components/Switch.d.ts +2 -0
- package/out/ui/packages/switch/components/Switch.luau +5 -0
- package/out/ui/packages/switch/components/Switch.styles.d.ts +2 -0
- package/out/ui/packages/switch/components/Switch.styles.luau +7 -2
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +7 -4
- package/out/ui/packages/table/components/Table.styles.d.ts +3 -1
- package/out/ui/packages/table/components/Table.styles.luau +10 -6
- package/out/ui/packages/tabs/components/Tabs.d.ts +3 -0
- package/out/ui/packages/tabs/components/Tabs.luau +13 -4
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +5 -1
- package/out/ui/packages/tabs/components/Tabs.styles.luau +26 -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.d.ts +2 -0
- package/out/ui/packages/toast/components/Toast.luau +26 -1
- package/out/ui/packages/toast/components/Toast.styles.luau +22 -4
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +21 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +137 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +9 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +69 -0
- package/out/ui/packages/toggleButton/index.d.ts +2 -0
- package/out/ui/packages/toggleButton/init.luau +7 -0
- package/out/ui/packages/typography/components/Typography.styles.luau +4 -5
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +1 -1
- 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
|
@@ -4,7 +4,32 @@ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
5
5
|
local componentStyles = _theme.componentStyles
|
|
6
6
|
local createStyles = _theme.createStyles
|
|
7
|
-
local
|
|
7
|
+
local _gridProps = TS.import(script, script.Parent, "gridProps")
|
|
8
|
+
local gridCornerKey = _gridProps.gridCornerKey
|
|
9
|
+
local gridMaxCells = _gridProps.gridMaxCells
|
|
10
|
+
local function cornerEnum(corner)
|
|
11
|
+
if corner == nil then
|
|
12
|
+
return nil
|
|
13
|
+
end
|
|
14
|
+
local _corner = corner
|
|
15
|
+
if not (type(_corner) == "string") then
|
|
16
|
+
return corner
|
|
17
|
+
end
|
|
18
|
+
local key = gridCornerKey(corner)
|
|
19
|
+
if key == "top-right" then
|
|
20
|
+
return Enum.StartCorner.TopRight
|
|
21
|
+
end
|
|
22
|
+
if key == "bottom-left" then
|
|
23
|
+
return Enum.StartCorner.BottomLeft
|
|
24
|
+
end
|
|
25
|
+
if key == "bottom-right" then
|
|
26
|
+
return Enum.StartCorner.BottomRight
|
|
27
|
+
end
|
|
28
|
+
return Enum.StartCorner.TopLeft
|
|
29
|
+
end
|
|
30
|
+
local useGridStyles = componentStyles("Grid", function(theme, props)
|
|
31
|
+
local cells = gridMaxCells(props.columns, props.maxColumns, props.fillDirectionMaxCells)
|
|
32
|
+
local pad = if props.gap ~= nil then UDim2.fromOffset(theme.spacing.calc(props.gap), theme.spacing.calc(props.gap)) else props.cellPadding
|
|
8
33
|
return createStyles({
|
|
9
34
|
baseGrid = {
|
|
10
35
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -13,12 +38,12 @@ local useGridStyles = componentStyles("Grid", function(_, props)
|
|
|
13
38
|
BorderSizePixel = 0,
|
|
14
39
|
},
|
|
15
40
|
baseLayout = {
|
|
16
|
-
CellPadding =
|
|
41
|
+
CellPadding = pad,
|
|
17
42
|
CellSize = props.cellSize,
|
|
18
43
|
FillDirection = props.fillDirection,
|
|
19
|
-
FillDirectionMaxCells =
|
|
44
|
+
FillDirectionMaxCells = cells,
|
|
20
45
|
SortOrder = props.sortOrder,
|
|
21
|
-
StartCorner = props.startCorner,
|
|
46
|
+
StartCorner = cornerEnum(props.startCorner),
|
|
22
47
|
HorizontalAlignment = props.horizontalAlignment,
|
|
23
48
|
VerticalAlignment = props.verticalAlignment,
|
|
24
49
|
},
|
|
@@ -34,6 +59,9 @@ local function Grid(props)
|
|
|
34
59
|
if cellSize == nil then
|
|
35
60
|
cellSize = UDim2.fromOffset(100, 100)
|
|
36
61
|
end
|
|
62
|
+
local gap = _binding.gap
|
|
63
|
+
local columns = _binding.columns
|
|
64
|
+
local maxColumns = _binding.maxColumns
|
|
37
65
|
local fillDirection = _binding.fillDirection
|
|
38
66
|
if fillDirection == nil then
|
|
39
67
|
fillDirection = Enum.FillDirection.Horizontal
|
|
@@ -66,6 +94,9 @@ local function Grid(props)
|
|
|
66
94
|
local _binding_1 = useGridStyles({
|
|
67
95
|
cellPadding = cellPadding,
|
|
68
96
|
cellSize = cellSize,
|
|
97
|
+
gap = gap,
|
|
98
|
+
columns = columns,
|
|
99
|
+
maxColumns = maxColumns,
|
|
69
100
|
fillDirection = fillDirection,
|
|
70
101
|
fillDirectionMaxCells = fillDirectionMaxCells,
|
|
71
102
|
sortOrder = sortOrder,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
3
|
+
import { StackAlign, StackDirection, StackJustify } from "./stackAlign";
|
|
4
|
+
export interface StackProps {
|
|
5
|
+
direction?: StackDirection;
|
|
6
|
+
spacing?: number;
|
|
7
|
+
gap?: number;
|
|
8
|
+
wrap?: boolean;
|
|
9
|
+
alignItems?: StackAlign;
|
|
10
|
+
justifyContent?: StackJustify;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function Stack(props: CustomizedProps<Frame, StackProps>): JSX.Element;
|
|
14
|
+
export default Stack;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useStackStyles = TS.import(script, script.Parent, "Stack.styles").default
|
|
5
|
+
local function Stack(props)
|
|
6
|
+
local _binding = props
|
|
7
|
+
local direction = _binding.direction
|
|
8
|
+
local spacing = _binding.spacing
|
|
9
|
+
local gap = _binding.gap
|
|
10
|
+
local wrap = _binding.wrap
|
|
11
|
+
local alignItems = _binding.alignItems
|
|
12
|
+
local justifyContent = _binding.justifyContent
|
|
13
|
+
local children = _binding.children
|
|
14
|
+
local className = _binding.className
|
|
15
|
+
local sx = _binding.sx
|
|
16
|
+
local id = _binding.id
|
|
17
|
+
local ref = _binding.ref
|
|
18
|
+
local styles = useStackStyles({
|
|
19
|
+
direction = direction,
|
|
20
|
+
spacing = spacing,
|
|
21
|
+
gap = gap,
|
|
22
|
+
wrap = wrap,
|
|
23
|
+
alignItems = alignItems,
|
|
24
|
+
justifyContent = justifyContent,
|
|
25
|
+
})
|
|
26
|
+
local _attributes = {}
|
|
27
|
+
local _condition = id
|
|
28
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
29
|
+
_condition = "Stack"
|
|
30
|
+
end
|
|
31
|
+
_attributes.key = _condition
|
|
32
|
+
_attributes.ref = ref
|
|
33
|
+
for _k, _v in styles.root do
|
|
34
|
+
_attributes[_k] = _v
|
|
35
|
+
end
|
|
36
|
+
if className then
|
|
37
|
+
for _k, _v in className do
|
|
38
|
+
_attributes[_k] = _v
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
if sx then
|
|
42
|
+
for _k, _v in sx do
|
|
43
|
+
_attributes[_k] = _v
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
local _attributes_1 = table.clone(styles.list)
|
|
47
|
+
setmetatable(_attributes_1, nil)
|
|
48
|
+
return React.createElement("frame", _attributes, React.createElement("uilistlayout", _attributes_1), children)
|
|
49
|
+
end
|
|
50
|
+
local default = Stack
|
|
51
|
+
return {
|
|
52
|
+
default = default,
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StackAlign, StackDirection, StackJustify } from "./stackAlign";
|
|
2
|
+
declare const useStackStyles: (props: {
|
|
3
|
+
direction?: StackDirection;
|
|
4
|
+
spacing?: number;
|
|
5
|
+
gap?: number;
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
alignItems?: StackAlign;
|
|
8
|
+
justifyContent?: StackJustify;
|
|
9
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
10
|
+
export default useStackStyles;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local _stackAlign = TS.import(script, script.Parent, "stackAlign")
|
|
7
|
+
local stackAlignKey = _stackAlign.stackAlignKey
|
|
8
|
+
local stackGap = _stackAlign.stackGap
|
|
9
|
+
local stackIsRow = _stackAlign.stackIsRow
|
|
10
|
+
local stackJustifyKey = _stackAlign.stackJustifyKey
|
|
11
|
+
local stackNeedsMainFill = _stackAlign.stackNeedsMainFill
|
|
12
|
+
local stackRootAutomaticSize = _stackAlign.stackRootAutomaticSize
|
|
13
|
+
local stackUsesFlex = _stackAlign.stackUsesFlex
|
|
14
|
+
local function horizontalAlign(key)
|
|
15
|
+
if key == "center" then
|
|
16
|
+
return Enum.HorizontalAlignment.Center
|
|
17
|
+
end
|
|
18
|
+
if key == "end" then
|
|
19
|
+
return Enum.HorizontalAlignment.Right
|
|
20
|
+
end
|
|
21
|
+
return Enum.HorizontalAlignment.Left
|
|
22
|
+
end
|
|
23
|
+
local function verticalAlign(key)
|
|
24
|
+
if key == "center" then
|
|
25
|
+
return Enum.VerticalAlignment.Center
|
|
26
|
+
end
|
|
27
|
+
if key == "end" then
|
|
28
|
+
return Enum.VerticalAlignment.Bottom
|
|
29
|
+
end
|
|
30
|
+
return Enum.VerticalAlignment.Top
|
|
31
|
+
end
|
|
32
|
+
local function mainFlex(justify)
|
|
33
|
+
if justify == "space-between" then
|
|
34
|
+
return Enum.UIFlexAlignment.SpaceBetween
|
|
35
|
+
end
|
|
36
|
+
if justify == "space-around" then
|
|
37
|
+
return Enum.UIFlexAlignment.SpaceAround
|
|
38
|
+
end
|
|
39
|
+
if justify == "space-evenly" then
|
|
40
|
+
return Enum.UIFlexAlignment.SpaceEvenly
|
|
41
|
+
end
|
|
42
|
+
return Enum.UIFlexAlignment.None
|
|
43
|
+
end
|
|
44
|
+
local function lineAlign(align)
|
|
45
|
+
if align == "center" then
|
|
46
|
+
return Enum.ItemLineAlignment.Center
|
|
47
|
+
end
|
|
48
|
+
if align == "end" then
|
|
49
|
+
return Enum.ItemLineAlignment.End
|
|
50
|
+
end
|
|
51
|
+
if align == "stretch" then
|
|
52
|
+
return Enum.ItemLineAlignment.Stretch
|
|
53
|
+
end
|
|
54
|
+
return Enum.ItemLineAlignment.Start
|
|
55
|
+
end
|
|
56
|
+
local function automaticSize(key)
|
|
57
|
+
if key == "X" then
|
|
58
|
+
return Enum.AutomaticSize.X
|
|
59
|
+
end
|
|
60
|
+
if key == "Y" then
|
|
61
|
+
return Enum.AutomaticSize.Y
|
|
62
|
+
end
|
|
63
|
+
return Enum.AutomaticSize.XY
|
|
64
|
+
end
|
|
65
|
+
local useStackStyles = componentStyles("Stack", function(theme, _param)
|
|
66
|
+
local direction = _param.direction
|
|
67
|
+
local spacing = _param.spacing
|
|
68
|
+
local gap = _param.gap
|
|
69
|
+
local wrap = _param.wrap
|
|
70
|
+
local alignItems = _param.alignItems
|
|
71
|
+
local justifyContent = _param.justifyContent
|
|
72
|
+
local row = stackIsRow(direction)
|
|
73
|
+
local cross = stackAlignKey(alignItems)
|
|
74
|
+
local main = stackJustifyKey(justifyContent)
|
|
75
|
+
local flex = if stackUsesFlex(main) then mainFlex(main) else Enum.UIFlexAlignment.None
|
|
76
|
+
local fillMain = stackNeedsMainFill(wrap, main)
|
|
77
|
+
local auto = stackRootAutomaticSize(row, fillMain)
|
|
78
|
+
return createStyles({
|
|
79
|
+
root = {
|
|
80
|
+
AutomaticSize = automaticSize(auto),
|
|
81
|
+
Size = if fillMain then if row then UDim2.new(1, 0, 0, 0) else UDim2.new(0, 0, 1, 0) else UDim2.fromScale(0, 0),
|
|
82
|
+
BackgroundTransparency = 1,
|
|
83
|
+
BorderSizePixel = 0,
|
|
84
|
+
},
|
|
85
|
+
list = {
|
|
86
|
+
FillDirection = if row then Enum.FillDirection.Horizontal else Enum.FillDirection.Vertical,
|
|
87
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
88
|
+
Padding = UDim.new(0, theme.spacing.calc(stackGap(spacing, gap))),
|
|
89
|
+
Wraps = wrap == true,
|
|
90
|
+
ItemLineAlignment = lineAlign(cross),
|
|
91
|
+
HorizontalAlignment = if row then horizontalAlign(main) else horizontalAlign(if cross == "stretch" then "start" else cross),
|
|
92
|
+
VerticalAlignment = if row then verticalAlign(if cross == "stretch" then "start" else cross) else verticalAlign(main),
|
|
93
|
+
HorizontalFlex = if row then flex else Enum.UIFlexAlignment.None,
|
|
94
|
+
VerticalFlex = if row then Enum.UIFlexAlignment.None else flex,
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
end)
|
|
98
|
+
local default = useStackStyles
|
|
99
|
+
return {
|
|
100
|
+
default = default,
|
|
101
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type BoxPad = number | {
|
|
2
|
+
x?: number;
|
|
3
|
+
y?: number;
|
|
4
|
+
top?: number;
|
|
5
|
+
right?: number;
|
|
6
|
+
bottom?: number;
|
|
7
|
+
left?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function boxPadSides(padding?: BoxPad): {
|
|
10
|
+
top: number;
|
|
11
|
+
right: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
left: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function boxPadSides(padding)
|
|
3
|
+
if padding == nil then
|
|
4
|
+
return {
|
|
5
|
+
top = 0,
|
|
6
|
+
right = 0,
|
|
7
|
+
bottom = 0,
|
|
8
|
+
left = 0,
|
|
9
|
+
}
|
|
10
|
+
end
|
|
11
|
+
local _padding = padding
|
|
12
|
+
if type(_padding) == "number" then
|
|
13
|
+
return {
|
|
14
|
+
top = padding,
|
|
15
|
+
right = padding,
|
|
16
|
+
bottom = padding,
|
|
17
|
+
left = padding,
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
local _condition = padding.x
|
|
21
|
+
if _condition == nil then
|
|
22
|
+
_condition = 0
|
|
23
|
+
end
|
|
24
|
+
local x = _condition
|
|
25
|
+
local _condition_1 = padding.y
|
|
26
|
+
if _condition_1 == nil then
|
|
27
|
+
_condition_1 = 0
|
|
28
|
+
end
|
|
29
|
+
local y = _condition_1
|
|
30
|
+
local _object = {}
|
|
31
|
+
local _left = "top"
|
|
32
|
+
local _condition_2 = padding.top
|
|
33
|
+
if _condition_2 == nil then
|
|
34
|
+
_condition_2 = y
|
|
35
|
+
end
|
|
36
|
+
_object[_left] = _condition_2
|
|
37
|
+
local _left_1 = "right"
|
|
38
|
+
local _condition_3 = padding.right
|
|
39
|
+
if _condition_3 == nil then
|
|
40
|
+
_condition_3 = x
|
|
41
|
+
end
|
|
42
|
+
_object[_left_1] = _condition_3
|
|
43
|
+
local _left_2 = "bottom"
|
|
44
|
+
local _condition_4 = padding.bottom
|
|
45
|
+
if _condition_4 == nil then
|
|
46
|
+
_condition_4 = y
|
|
47
|
+
end
|
|
48
|
+
_object[_left_2] = _condition_4
|
|
49
|
+
local _left_3 = "left"
|
|
50
|
+
local _condition_5 = padding.left
|
|
51
|
+
if _condition_5 == nil then
|
|
52
|
+
_condition_5 = x
|
|
53
|
+
end
|
|
54
|
+
_object[_left_3] = _condition_5
|
|
55
|
+
return _object
|
|
56
|
+
end
|
|
57
|
+
return {
|
|
58
|
+
boxPadSides = boxPadSides,
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local WIDTHS = {
|
|
3
|
+
xs = 444,
|
|
4
|
+
sm = 600,
|
|
5
|
+
md = 900,
|
|
6
|
+
lg = 1200,
|
|
7
|
+
xl = 1536,
|
|
8
|
+
}
|
|
9
|
+
local function containerMaxPx(maxWidth)
|
|
10
|
+
if maxWidth == false then
|
|
11
|
+
return nil
|
|
12
|
+
end
|
|
13
|
+
return WIDTHS[maxWidth or "lg"]
|
|
14
|
+
end
|
|
15
|
+
return {
|
|
16
|
+
containerMaxPx = containerMaxPx,
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type FlexItemAlign = "auto" | "start" | "center" | "end" | "stretch";
|
|
2
|
+
export type FlexItemModeName = "none" | "grow" | "shrink" | "fill" | "custom";
|
|
3
|
+
export declare function flexItemMode(grow?: number, shrink?: number, fill?: boolean): FlexItemModeName;
|
|
4
|
+
export declare function flexItemGrowRatio(grow?: number): number;
|
|
5
|
+
export declare function flexItemShrinkRatio(shrink?: number): number;
|
|
6
|
+
export declare function flexItemAlignKey(align?: FlexItemAlign): FlexItemAlign;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function flexItemMode(grow, shrink, fill)
|
|
3
|
+
if fill then
|
|
4
|
+
return "fill"
|
|
5
|
+
end
|
|
6
|
+
local g = grow ~= nil and grow > 0
|
|
7
|
+
local s = shrink ~= nil and shrink > 0
|
|
8
|
+
if g and s then
|
|
9
|
+
return "custom"
|
|
10
|
+
end
|
|
11
|
+
if g then
|
|
12
|
+
return "grow"
|
|
13
|
+
end
|
|
14
|
+
if s then
|
|
15
|
+
return "shrink"
|
|
16
|
+
end
|
|
17
|
+
return "none"
|
|
18
|
+
end
|
|
19
|
+
local function flexItemGrowRatio(grow)
|
|
20
|
+
return if grow == nil then 0 else grow
|
|
21
|
+
end
|
|
22
|
+
local function flexItemShrinkRatio(shrink)
|
|
23
|
+
return if shrink == nil then 0 else shrink
|
|
24
|
+
end
|
|
25
|
+
local function flexItemAlignKey(align)
|
|
26
|
+
if align == "start" or align == "center" or align == "end" or align == "stretch" then
|
|
27
|
+
return align
|
|
28
|
+
end
|
|
29
|
+
return "auto"
|
|
30
|
+
end
|
|
31
|
+
return {
|
|
32
|
+
flexItemMode = flexItemMode,
|
|
33
|
+
flexItemGrowRatio = flexItemGrowRatio,
|
|
34
|
+
flexItemShrinkRatio = flexItemShrinkRatio,
|
|
35
|
+
flexItemAlignKey = flexItemAlignKey,
|
|
36
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type GridCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
2
|
+
export declare function gridMaxCells(columns?: number, maxColumns?: number, fillDirectionMaxCells?: number): number;
|
|
3
|
+
export declare function gridCornerKey(corner?: GridCorner): GridCorner;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function gridMaxCells(columns, maxColumns, fillDirectionMaxCells)
|
|
3
|
+
if columns ~= nil then
|
|
4
|
+
return columns
|
|
5
|
+
end
|
|
6
|
+
if maxColumns ~= nil then
|
|
7
|
+
return maxColumns
|
|
8
|
+
end
|
|
9
|
+
return if fillDirectionMaxCells == nil then 0 else fillDirectionMaxCells
|
|
10
|
+
end
|
|
11
|
+
local function gridCornerKey(corner)
|
|
12
|
+
if corner == "top-right" or corner == "bottom-left" or corner == "bottom-right" then
|
|
13
|
+
return corner
|
|
14
|
+
end
|
|
15
|
+
return "top-left"
|
|
16
|
+
end
|
|
17
|
+
return {
|
|
18
|
+
gridMaxCells = gridMaxCells,
|
|
19
|
+
gridCornerKey = gridCornerKey,
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type StackDirection = "row" | "column";
|
|
2
|
+
export type StackAlign = "start" | "center" | "end" | "stretch";
|
|
3
|
+
export type StackJustify = "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
4
|
+
export declare function stackIsRow(direction?: StackDirection): direction is "row";
|
|
5
|
+
export declare function stackGap(spacing?: number, gap?: number): number;
|
|
6
|
+
export declare function stackUsesFlex(justify?: StackJustify): justify is "space-between" | "space-around" | "space-evenly";
|
|
7
|
+
export declare function stackNeedsMainFill(wrap?: boolean, justify?: StackJustify): boolean;
|
|
8
|
+
export declare function stackRootAutomaticSize(row: boolean, fillMain: boolean): "XY" | "X" | "Y";
|
|
9
|
+
export declare function stackAlignKey(align?: StackAlign): StackAlign;
|
|
10
|
+
export declare function stackJustifyKey(justify?: StackJustify): StackJustify;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local function stackIsRow(direction)
|
|
3
|
+
return direction == "row"
|
|
4
|
+
end
|
|
5
|
+
local function stackGap(spacing, gap)
|
|
6
|
+
if gap ~= nil then
|
|
7
|
+
return gap
|
|
8
|
+
end
|
|
9
|
+
return if spacing == nil then 1 else spacing
|
|
10
|
+
end
|
|
11
|
+
local function stackUsesFlex(justify)
|
|
12
|
+
return justify == "space-between" or justify == "space-around" or justify == "space-evenly"
|
|
13
|
+
end
|
|
14
|
+
local function stackNeedsMainFill(wrap, justify)
|
|
15
|
+
return wrap == true or stackUsesFlex(justify)
|
|
16
|
+
end
|
|
17
|
+
local function stackRootAutomaticSize(row, fillMain)
|
|
18
|
+
if not fillMain then
|
|
19
|
+
return "XY"
|
|
20
|
+
end
|
|
21
|
+
return if row then "Y" else "X"
|
|
22
|
+
end
|
|
23
|
+
local function stackAlignKey(align)
|
|
24
|
+
if align == "center" or align == "end" or align == "stretch" then
|
|
25
|
+
return align
|
|
26
|
+
end
|
|
27
|
+
return "start"
|
|
28
|
+
end
|
|
29
|
+
local function stackJustifyKey(justify)
|
|
30
|
+
if justify == "center" or justify == "end" or justify == "space-between" or justify == "space-around" or justify == "space-evenly" then
|
|
31
|
+
return justify
|
|
32
|
+
end
|
|
33
|
+
return "start"
|
|
34
|
+
end
|
|
35
|
+
return {
|
|
36
|
+
stackIsRow = stackIsRow,
|
|
37
|
+
stackGap = stackGap,
|
|
38
|
+
stackUsesFlex = stackUsesFlex,
|
|
39
|
+
stackNeedsMainFill = stackNeedsMainFill,
|
|
40
|
+
stackRootAutomaticSize = stackRootAutomaticSize,
|
|
41
|
+
stackAlignKey = stackAlignKey,
|
|
42
|
+
stackJustifyKey = stackJustifyKey,
|
|
43
|
+
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
export { default as Grid } from "./components/Grid";
|
|
2
2
|
export { GridProps } from "./components/Grid";
|
|
3
|
+
export { GridCorner } from "./components/gridProps";
|
|
3
4
|
export * from "./components/Grid";
|
|
4
5
|
export { default as List } from "./components/List";
|
|
5
6
|
export { ListProps } from "./components/List";
|
|
6
7
|
export * from "./components/List";
|
|
8
|
+
export { default as Stack } from "./components/Stack";
|
|
9
|
+
export { StackProps } from "./components/Stack";
|
|
10
|
+
export { StackAlign, StackDirection, StackJustify } from "./components/stackAlign";
|
|
11
|
+
export { default as FlexItem } from "./components/FlexItem";
|
|
12
|
+
export { FlexItemProps } from "./components/FlexItem";
|
|
13
|
+
export { FlexItemAlign, FlexItemModeName } from "./components/flexItemMode";
|
|
14
|
+
export { default as Box } from "./components/Box";
|
|
15
|
+
export { BoxProps } from "./components/Box";
|
|
16
|
+
export { BoxPad } from "./components/boxPad";
|
|
17
|
+
export { BoxBg } from "./components/Box.styles";
|
|
18
|
+
export { default as Container } from "./components/Container";
|
|
19
|
+
export { ContainerProps } from "./components/Container";
|
|
20
|
+
export { ContainerMaxWidth, containerMaxPx } from "./components/containerWidth";
|
|
@@ -9,4 +9,9 @@ exports.List = TS.import(script, script, "components", "List").default
|
|
|
9
9
|
for _k, _v in TS.import(script, script, "components", "List") or {} do
|
|
10
10
|
exports[_k] = _v
|
|
11
11
|
end
|
|
12
|
+
exports.Stack = TS.import(script, script, "components", "Stack").default
|
|
13
|
+
exports.FlexItem = TS.import(script, script, "components", "FlexItem").default
|
|
14
|
+
exports.Box = TS.import(script, script, "components", "Box").default
|
|
15
|
+
exports.Container = TS.import(script, script, "components", "Container").default
|
|
16
|
+
exports.containerMaxPx = TS.import(script, script, "components", "containerWidth").containerMaxPx
|
|
12
17
|
return exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { LinkColor, LinkUnderline } from "./Link.styles";
|
|
3
|
+
export interface LinkProps {
|
|
4
|
+
text: string;
|
|
5
|
+
color?: LinkColor;
|
|
6
|
+
underline?: LinkUnderline;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onActivated?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare function Link(props: CustomizedProps<TextButton, LinkProps>): JSX.Element;
|
|
11
|
+
export default Link;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local useState = _react.useState
|
|
6
|
+
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
7
|
+
local useLinkStyles = TS.import(script, script.Parent, "Link.styles").default
|
|
8
|
+
local function Link(props)
|
|
9
|
+
local _binding = props
|
|
10
|
+
local text = _binding.text
|
|
11
|
+
local color = _binding.color
|
|
12
|
+
if color == nil then
|
|
13
|
+
color = "primary"
|
|
14
|
+
end
|
|
15
|
+
local underline = _binding.underline
|
|
16
|
+
if underline == nil then
|
|
17
|
+
underline = "always"
|
|
18
|
+
end
|
|
19
|
+
local disabled = _binding.disabled
|
|
20
|
+
local onActivated = _binding.onActivated
|
|
21
|
+
local className = _binding.className
|
|
22
|
+
local sx = _binding.sx
|
|
23
|
+
local id = _binding.id
|
|
24
|
+
local ref = _binding.ref
|
|
25
|
+
local hover, setHover = useState(false)
|
|
26
|
+
local showUnderline = underline == "always" or (underline == "hover" and hover)
|
|
27
|
+
local styles = useLinkStyles({
|
|
28
|
+
color = color,
|
|
29
|
+
disabled = disabled,
|
|
30
|
+
showUnderline = showUnderline,
|
|
31
|
+
})
|
|
32
|
+
local active = canActivate(disabled)
|
|
33
|
+
local _attributes = {}
|
|
34
|
+
local _condition = id
|
|
35
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
36
|
+
_condition = "Link"
|
|
37
|
+
end
|
|
38
|
+
_attributes.key = _condition
|
|
39
|
+
_attributes.ref = ref
|
|
40
|
+
for _k, _v in styles.root do
|
|
41
|
+
_attributes[_k] = _v
|
|
42
|
+
end
|
|
43
|
+
if className then
|
|
44
|
+
for _k, _v in className do
|
|
45
|
+
_attributes[_k] = _v
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
if sx then
|
|
49
|
+
for _k, _v in sx do
|
|
50
|
+
_attributes[_k] = _v
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
_attributes.Text = text
|
|
54
|
+
_attributes.Active = active
|
|
55
|
+
_attributes.Selectable = active
|
|
56
|
+
_attributes.Event = {
|
|
57
|
+
Activated = function()
|
|
58
|
+
if active then
|
|
59
|
+
local _result = onActivated
|
|
60
|
+
if _result ~= nil then
|
|
61
|
+
_result()
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end,
|
|
65
|
+
MouseEnter = function()
|
|
66
|
+
return setHover(true)
|
|
67
|
+
end,
|
|
68
|
+
MouseLeave = function()
|
|
69
|
+
return setHover(false)
|
|
70
|
+
end,
|
|
71
|
+
}
|
|
72
|
+
local _attributes_1 = {
|
|
73
|
+
key = "Underline",
|
|
74
|
+
}
|
|
75
|
+
for _k, _v in styles.underline do
|
|
76
|
+
_attributes_1[_k] = _v
|
|
77
|
+
end
|
|
78
|
+
return React.createElement("textbutton", _attributes, React.createElement("frame", _attributes_1))
|
|
79
|
+
end
|
|
80
|
+
local default = Link
|
|
81
|
+
return {
|
|
82
|
+
default = default,
|
|
83
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type LinkColor = "primary" | "inherit" | "error";
|
|
2
|
+
export type LinkUnderline = "always" | "hover" | "none";
|
|
3
|
+
declare const useLinkStyles: (props: {
|
|
4
|
+
color?: LinkColor;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
showUnderline?: boolean;
|
|
7
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
8
|
+
export default useLinkStyles;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
|
+
local componentStyles = _theme.componentStyles
|
|
5
|
+
local createStyles = _theme.createStyles
|
|
6
|
+
local function linkColor(theme, color, disabled)
|
|
7
|
+
if disabled then
|
|
8
|
+
return theme.palette.text.disabled
|
|
9
|
+
end
|
|
10
|
+
if color == "error" then
|
|
11
|
+
return theme.palette.status.error.main
|
|
12
|
+
end
|
|
13
|
+
if color == "inherit" then
|
|
14
|
+
return theme.palette.text.primary
|
|
15
|
+
end
|
|
16
|
+
return theme.palette.primary.main
|
|
17
|
+
end
|
|
18
|
+
local useLinkStyles = componentStyles("Link", function(theme, _param)
|
|
19
|
+
local color = _param.color
|
|
20
|
+
if color == nil then
|
|
21
|
+
color = "primary"
|
|
22
|
+
end
|
|
23
|
+
local disabled = _param.disabled
|
|
24
|
+
if disabled == nil then
|
|
25
|
+
disabled = false
|
|
26
|
+
end
|
|
27
|
+
local showUnderline = _param.showUnderline
|
|
28
|
+
if showUnderline == nil then
|
|
29
|
+
showUnderline = true
|
|
30
|
+
end
|
|
31
|
+
local ink = linkColor(theme, color, disabled)
|
|
32
|
+
return createStyles({
|
|
33
|
+
root = {
|
|
34
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
35
|
+
Size = UDim2.fromScale(0, 0),
|
|
36
|
+
BackgroundTransparency = 1,
|
|
37
|
+
BorderSizePixel = 0,
|
|
38
|
+
AutoButtonColor = false,
|
|
39
|
+
Active = not disabled,
|
|
40
|
+
Selectable = not disabled,
|
|
41
|
+
TextColor3 = ink,
|
|
42
|
+
Font = theme.typography.fontFamilies.default,
|
|
43
|
+
TextSize = theme.typography.fontSizes.body,
|
|
44
|
+
TextXAlignment = Enum.TextXAlignment.Left,
|
|
45
|
+
},
|
|
46
|
+
underline = {
|
|
47
|
+
Size = UDim2.new(1, 0, 0, 1),
|
|
48
|
+
Position = UDim2.new(0, 0, 1, 0),
|
|
49
|
+
AnchorPoint = Vector2.new(0, 1),
|
|
50
|
+
BackgroundColor3 = ink,
|
|
51
|
+
BackgroundTransparency = if showUnderline then 0 else 1,
|
|
52
|
+
BorderSizePixel = 0,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
end)
|
|
56
|
+
local default = useLinkStyles
|
|
57
|
+
return {
|
|
58
|
+
default = default,
|
|
59
|
+
}
|