@rbxts/uiblox 0.2.0-alpha.2 → 0.2.0-alpha.20
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 +8 -2
- 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 +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/card/components/Card.d.ts +1 -0
- package/out/ui/packages/card/components/Card.luau +2 -0
- package/out/ui/packages/checkbox/components/checkboxLook.d.ts +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/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/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 +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 +4 -1
- package/out/ui/packages/pagination/components/Pagination.luau +41 -22
- package/out/ui/packages/pagination/components/Pagination.styles.d.ts +4 -1
- package/out/ui/packages/pagination/components/Pagination.styles.luau +19 -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/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 +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/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 +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 +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/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +809 -252
- package/out/ui/packages/stepper/components/Stepper.d.ts +1 -0
- package/out/ui/packages/stepper/components/Stepper.luau +7 -1
- 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/switch/components/switchLook.d.ts +1 -1
- package/out/ui/packages/table/components/Table.d.ts +1 -0
- package/out/ui/packages/table/components/Table.luau +4 -1
- 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 +12 -3
- 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 +19 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +135 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +7 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +65 -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/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
|
@@ -2,6 +2,7 @@ import { CustomizedProps } from "../../../../theme/index";
|
|
|
2
2
|
export interface StepperProps {
|
|
3
3
|
steps: string[];
|
|
4
4
|
activeStep: number;
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
5
6
|
}
|
|
6
7
|
declare function Stepper(props: CustomizedProps<Frame, StepperProps>): JSX.Element;
|
|
7
8
|
export default Stepper;
|
|
@@ -8,11 +8,17 @@ local function Stepper(props)
|
|
|
8
8
|
local _binding = props
|
|
9
9
|
local steps = _binding.steps
|
|
10
10
|
local activeStep = _binding.activeStep
|
|
11
|
+
local orientation = _binding.orientation
|
|
12
|
+
if orientation == nil then
|
|
13
|
+
orientation = "horizontal"
|
|
14
|
+
end
|
|
11
15
|
local className = _binding.className
|
|
12
16
|
local sx = _binding.sx
|
|
13
17
|
local id = _binding.id
|
|
14
18
|
local ref = _binding.ref
|
|
15
|
-
local styles = useStepperStyles(
|
|
19
|
+
local styles = useStepperStyles({
|
|
20
|
+
orientation = orientation,
|
|
21
|
+
})
|
|
16
22
|
local _attributes = {}
|
|
17
23
|
local _condition = id
|
|
18
24
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const useStepperStyles: (
|
|
1
|
+
declare const useStepperStyles: (props: {
|
|
2
|
+
orientation?: "horizontal" | "vertical";
|
|
3
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
2
4
|
export default useStepperStyles;
|
|
@@ -3,7 +3,11 @@ local TS = _G[script]
|
|
|
3
3
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
4
|
local componentStyles = _theme.componentStyles
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
|
-
local useStepperStyles = componentStyles("Stepper", function(theme)
|
|
6
|
+
local useStepperStyles = componentStyles("Stepper", function(theme, _param)
|
|
7
|
+
local orientation = _param.orientation
|
|
8
|
+
if orientation == nil then
|
|
9
|
+
orientation = "horizontal"
|
|
10
|
+
end
|
|
7
11
|
return createStyles({
|
|
8
12
|
root = {
|
|
9
13
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -12,7 +16,7 @@ local useStepperStyles = componentStyles("Stepper", function(theme)
|
|
|
12
16
|
BorderSizePixel = 0,
|
|
13
17
|
},
|
|
14
18
|
list = {
|
|
15
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
19
|
+
FillDirection = if orientation == "vertical" then Enum.FillDirection.Vertical else Enum.FillDirection.Horizontal,
|
|
16
20
|
Padding = UDim.new(0, theme.padding.calc(1)),
|
|
17
21
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
18
22
|
},
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ControlSize, CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { SwitchColor } from "./Switch.styles";
|
|
2
3
|
export interface SwitchProps {
|
|
3
4
|
value: boolean;
|
|
4
5
|
onChange: (value: boolean) => void;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
label?: string;
|
|
7
8
|
size?: ControlSize;
|
|
9
|
+
color?: SwitchColor;
|
|
8
10
|
reducedMotion?: boolean;
|
|
9
11
|
}
|
|
10
12
|
declare function Switch(props: CustomizedProps<TextButton, SwitchProps>): JSX.Element;
|
|
@@ -27,6 +27,10 @@ local function Switch(props)
|
|
|
27
27
|
local disabled = _binding.disabled
|
|
28
28
|
local label = _binding.label
|
|
29
29
|
local size = _binding.size
|
|
30
|
+
local color = _binding.color
|
|
31
|
+
if color == nil then
|
|
32
|
+
color = "primary"
|
|
33
|
+
end
|
|
30
34
|
local reducedProp = _binding.reducedMotion
|
|
31
35
|
local className = _binding.className
|
|
32
36
|
local sx = _binding.sx
|
|
@@ -37,6 +41,7 @@ local function Switch(props)
|
|
|
37
41
|
local theme = _binding_1.theme
|
|
38
42
|
local _binding_2 = useSwitchStyles({
|
|
39
43
|
size = size,
|
|
44
|
+
color = color,
|
|
40
45
|
})
|
|
41
46
|
local root = _binding_2.root
|
|
42
47
|
local row = _binding_2.row
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ControlSize } from "../../../../theme/index";
|
|
2
|
+
export type SwitchColor = "primary" | "accent";
|
|
2
3
|
export interface SwitchStyleProps {
|
|
3
4
|
size?: ControlSize;
|
|
5
|
+
color?: SwitchColor;
|
|
4
6
|
}
|
|
5
7
|
declare const useSwitchStyles: (props: SwitchStyleProps) => import("../../../../theme/index").ClassNameMap<string>;
|
|
6
8
|
export default useSwitchStyles;
|
|
@@ -6,7 +6,12 @@ local createStyles = _theme.createStyles
|
|
|
6
6
|
local componentStyles = _theme.componentStyles
|
|
7
7
|
local useSwitchStyles = componentStyles("Switch", function(theme, _param)
|
|
8
8
|
local size = _param.size
|
|
9
|
+
local color = _param.color
|
|
10
|
+
if color == nil then
|
|
11
|
+
color = "primary"
|
|
12
|
+
end
|
|
9
13
|
local metrics = controlMetrics(theme.density, size)
|
|
14
|
+
local onTone = if color == "accent" then theme.palette.accent.main else theme.palette.primary.main
|
|
10
15
|
return createStyles({
|
|
11
16
|
root = {
|
|
12
17
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -28,7 +33,7 @@ local useSwitchStyles = componentStyles("Switch", function(theme, _param)
|
|
|
28
33
|
BorderSizePixel = 0,
|
|
29
34
|
},
|
|
30
35
|
trackOn = {
|
|
31
|
-
BackgroundColor3 =
|
|
36
|
+
BackgroundColor3 = onTone,
|
|
32
37
|
},
|
|
33
38
|
knob = {
|
|
34
39
|
Size = UDim2.fromOffset(metrics.switchThumb, metrics.switchThumb),
|
|
@@ -47,7 +52,7 @@ local useSwitchStyles = componentStyles("Switch", function(theme, _param)
|
|
|
47
52
|
TextWrapped = true,
|
|
48
53
|
},
|
|
49
54
|
corner = {
|
|
50
|
-
CornerRadius = UDim.new(
|
|
55
|
+
CornerRadius = UDim.new(theme.shape.pillScale, 0),
|
|
51
56
|
},
|
|
52
57
|
stroke = {
|
|
53
58
|
Color = theme.palette.focus,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type SwitchPointer = "rest" | "hover" | "press" | "focus";
|
|
2
2
|
export declare function switchPointer(hovering: boolean, pressed: boolean, focused: boolean): SwitchPointer;
|
|
3
|
-
export declare function switchTrackTransparency(on: boolean, disabled: boolean, pointer: SwitchPointer): 0 | 0.25 | 0.
|
|
3
|
+
export declare function switchTrackTransparency(on: boolean, disabled: boolean, pointer: SwitchPointer): 0 | 0.25 | 0.55 | 0.35 | 0.15 | 0.65 | 0.08;
|
|
4
4
|
export declare function switchThumbTransparency(disabled: boolean): 0 | 0.35;
|
|
5
5
|
export declare function switchStrokeTransparency(disabled: boolean, pointer: SwitchPointer): 1 | 0 | 0.35;
|
|
6
6
|
export declare function switchThumbPlacement(on: boolean, inset: number): {
|
|
@@ -9,12 +9,15 @@ local function Table(props)
|
|
|
9
9
|
local columns = _binding.columns
|
|
10
10
|
local rows = _binding.rows
|
|
11
11
|
local selected = _binding.selected
|
|
12
|
+
local dense = _binding.dense
|
|
12
13
|
local onRowActivated = _binding.onRowActivated
|
|
13
14
|
local className = _binding.className
|
|
14
15
|
local sx = _binding.sx
|
|
15
16
|
local id = _binding.id
|
|
16
17
|
local ref = _binding.ref
|
|
17
|
-
local styles = useTableStyles(
|
|
18
|
+
local styles = useTableStyles({
|
|
19
|
+
dense = dense,
|
|
20
|
+
})
|
|
18
21
|
local width = if #columns > 0 then 1 / #columns else 1
|
|
19
22
|
local _attributes = {}
|
|
20
23
|
local _condition = id
|
|
@@ -3,7 +3,11 @@ local TS = _G[script]
|
|
|
3
3
|
local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
|
|
4
4
|
local componentStyles = _theme.componentStyles
|
|
5
5
|
local createStyles = _theme.createStyles
|
|
6
|
-
local useTableStyles = componentStyles("Table", function(theme)
|
|
6
|
+
local useTableStyles = componentStyles("Table", function(theme, _param)
|
|
7
|
+
local dense = _param.dense
|
|
8
|
+
local padY = theme.padding.calc(if dense == true then 0.5 else 1)
|
|
9
|
+
local padX = theme.padding.calc(if dense == true then 1 else 1.5)
|
|
10
|
+
local textSize = if dense == true then theme.typography.fontSizes.caption else theme.typography.fontSizes.body
|
|
7
11
|
return createStyles({
|
|
8
12
|
root = {
|
|
9
13
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
@@ -44,7 +48,7 @@ local useTableStyles = componentStyles("Table", function(theme)
|
|
|
44
48
|
BackgroundTransparency = 1,
|
|
45
49
|
BorderSizePixel = 0,
|
|
46
50
|
Font = theme.typography.fontFamilies.default,
|
|
47
|
-
TextSize =
|
|
51
|
+
TextSize = textSize,
|
|
48
52
|
TextColor3 = theme.palette.text.primary,
|
|
49
53
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
50
54
|
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
@@ -54,10 +58,10 @@ local useTableStyles = componentStyles("Table", function(theme)
|
|
|
54
58
|
TextColor3 = theme.palette.text.secondary,
|
|
55
59
|
},
|
|
56
60
|
padding = {
|
|
57
|
-
PaddingTop = UDim.new(0,
|
|
58
|
-
PaddingBottom = UDim.new(0,
|
|
59
|
-
PaddingLeft = UDim.new(0,
|
|
60
|
-
PaddingRight = UDim.new(0,
|
|
61
|
+
PaddingTop = UDim.new(0, padY),
|
|
62
|
+
PaddingBottom = UDim.new(0, padY),
|
|
63
|
+
PaddingLeft = UDim.new(0, padX),
|
|
64
|
+
PaddingRight = UDim.new(0, padX),
|
|
61
65
|
},
|
|
62
66
|
corner = {
|
|
63
67
|
CornerRadius = UDim.new(0, theme.shape.borderRadius),
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { CustomizedProps } from "../../../../theme/index";
|
|
2
2
|
import { ChoiceOption } from "../../radioGroup/index";
|
|
3
|
+
import { TabsOrientation } from "./tabsOrientation";
|
|
3
4
|
export interface TabsProps<T> {
|
|
4
5
|
value: T;
|
|
5
6
|
options: ChoiceOption<T>[];
|
|
6
7
|
onChange: (value: T) => void;
|
|
7
8
|
disabled?: boolean;
|
|
9
|
+
orientation?: TabsOrientation;
|
|
10
|
+
centered?: boolean;
|
|
8
11
|
}
|
|
9
12
|
declare function Tabs<T>(props: CustomizedProps<ScrollingFrame, TabsProps<T>>): JSX.Element;
|
|
10
13
|
export default Tabs;
|
|
@@ -4,6 +4,7 @@ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
|
|
5
5
|
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
6
6
|
local stepChoice = TS.import(script, script.Parent.Parent.Parent, "select", "components", "stepChoice").stepChoice
|
|
7
|
+
local tabsIsVertical = TS.import(script, script.Parent, "tabsOrientation").tabsIsVertical
|
|
7
8
|
local useTabsStyles = TS.import(script, script.Parent, "Tabs.styles").default
|
|
8
9
|
local function Tabs(props)
|
|
9
10
|
local _binding = props
|
|
@@ -11,11 +12,17 @@ local function Tabs(props)
|
|
|
11
12
|
local options = _binding.options
|
|
12
13
|
local onChange = _binding.onChange
|
|
13
14
|
local disabled = _binding.disabled
|
|
15
|
+
local orientation = _binding.orientation
|
|
16
|
+
local centered = _binding.centered
|
|
14
17
|
local className = _binding.className
|
|
15
18
|
local sx = _binding.sx
|
|
16
19
|
local id = _binding.id
|
|
17
20
|
local ref = _binding.ref
|
|
18
|
-
local styles = useTabsStyles(
|
|
21
|
+
local styles = useTabsStyles({
|
|
22
|
+
orientation = orientation,
|
|
23
|
+
centered = centered,
|
|
24
|
+
})
|
|
25
|
+
local vertical = tabsIsVertical(orientation)
|
|
19
26
|
local choose = function(index)
|
|
20
27
|
local choice = options[index + 1]
|
|
21
28
|
if choice ~= nil and canActivate(disabled or choice.disabled) and choice.value ~= value then
|
|
@@ -36,9 +43,11 @@ local function Tabs(props)
|
|
|
36
43
|
end
|
|
37
44
|
-- ▲ ReadonlyArray.findIndex ▲
|
|
38
45
|
local index = _result
|
|
39
|
-
if
|
|
46
|
+
local back = if vertical then Enum.KeyCode.Up else Enum.KeyCode.Left
|
|
47
|
+
local forward = if vertical then Enum.KeyCode.Down else Enum.KeyCode.Right
|
|
48
|
+
if input.KeyCode == back then
|
|
40
49
|
choose(stepChoice(options, index, -1))
|
|
41
|
-
elseif input.KeyCode ==
|
|
50
|
+
elseif input.KeyCode == forward then
|
|
42
51
|
choose(stepChoice(options, index, 1))
|
|
43
52
|
end
|
|
44
53
|
end
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { TabsOrientation } from "./tabsOrientation";
|
|
2
|
+
declare const useTabsStyles: (props: {
|
|
3
|
+
orientation?: TabsOrientation;
|
|
4
|
+
centered?: boolean;
|
|
5
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
2
6
|
export default useTabsStyles;
|
|
@@ -3,32 +3,40 @@ 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
|
|
6
|
+
local tabsIsVertical = TS.import(script, script.Parent, "tabsOrientation").tabsIsVertical
|
|
7
|
+
local useTabsStyles = componentStyles("Tabs", function(theme, _param)
|
|
8
|
+
local orientation = _param.orientation
|
|
9
|
+
local centered = _param.centered
|
|
10
|
+
local vertical = tabsIsVertical(orientation)
|
|
11
|
+
local bar = theme.padding.calc(0.5)
|
|
7
12
|
return createStyles({
|
|
8
13
|
root = {
|
|
9
|
-
Size = UDim2.new(1, 0, 0, theme.spacing.calc(4)),
|
|
14
|
+
Size = if vertical then UDim2.new(0, theme.spacing.calc(16), 1, 0) else UDim2.new(1, 0, 0, theme.spacing.calc(4)),
|
|
10
15
|
BackgroundTransparency = 1,
|
|
11
16
|
BorderSizePixel = 0,
|
|
12
17
|
CanvasSize = UDim2.fromScale(0, 0),
|
|
13
|
-
AutomaticCanvasSize = Enum.AutomaticSize.X,
|
|
14
|
-
ScrollingDirection = Enum.ScrollingDirection.X,
|
|
18
|
+
AutomaticCanvasSize = if vertical then Enum.AutomaticSize.Y else Enum.AutomaticSize.X,
|
|
19
|
+
ScrollingDirection = if vertical then Enum.ScrollingDirection.Y else Enum.ScrollingDirection.X,
|
|
15
20
|
HorizontalScrollBarInset = Enum.ScrollBarInset.Always,
|
|
21
|
+
VerticalScrollBarInset = Enum.ScrollBarInset.Always,
|
|
16
22
|
ScrollBarThickness = theme.padding.calc(0.5),
|
|
17
23
|
ScrollBarImageColor3 = theme.palette.text.secondary,
|
|
18
24
|
},
|
|
19
25
|
list = {
|
|
20
|
-
FillDirection = Enum.FillDirection.Horizontal,
|
|
26
|
+
FillDirection = if vertical then Enum.FillDirection.Vertical else Enum.FillDirection.Horizontal,
|
|
27
|
+
HorizontalAlignment = if centered == true and vertical ~= true then Enum.HorizontalAlignment.Center else Enum.HorizontalAlignment.Left,
|
|
21
28
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
22
29
|
},
|
|
23
30
|
tab = {
|
|
24
|
-
AutomaticSize = Enum.AutomaticSize.X,
|
|
25
|
-
Size = UDim2.fromScale(0, 1),
|
|
31
|
+
AutomaticSize = if vertical then Enum.AutomaticSize.Y else Enum.AutomaticSize.X,
|
|
32
|
+
Size = if vertical then UDim2.new(1, 0, 0, 0) else UDim2.fromScale(0, 1),
|
|
26
33
|
BackgroundTransparency = 1,
|
|
27
34
|
BorderSizePixel = 0,
|
|
28
35
|
AutoButtonColor = false,
|
|
29
36
|
TextColor3 = theme.palette.text.secondary,
|
|
30
37
|
Font = theme.typography.fontFamilies.default,
|
|
31
38
|
TextSize = theme.typography.fontSizes.body,
|
|
39
|
+
TextXAlignment = if vertical then Enum.TextXAlignment.Left else Enum.TextXAlignment.Center,
|
|
32
40
|
},
|
|
33
41
|
selected = {
|
|
34
42
|
TextColor3 = theme.palette.text.primary,
|
|
@@ -39,14 +47,22 @@ local useTabsStyles = componentStyles("Tabs", function(theme)
|
|
|
39
47
|
padding = {
|
|
40
48
|
PaddingLeft = UDim.new(0, theme.padding.calc(2)),
|
|
41
49
|
PaddingRight = UDim.new(0, theme.padding.calc(2)),
|
|
50
|
+
PaddingTop = UDim.new(0, if vertical then theme.padding.calc(1) else 0),
|
|
51
|
+
PaddingBottom = UDim.new(0, if vertical then theme.padding.calc(1) else 0),
|
|
42
52
|
},
|
|
43
|
-
indicator = {
|
|
44
|
-
Size = UDim2.new(
|
|
53
|
+
indicator = if vertical then ({
|
|
54
|
+
Size = UDim2.new(0, bar, 1, -theme.padding.calc(2)),
|
|
55
|
+
Position = UDim2.new(0, 0, 0.5, 0),
|
|
56
|
+
AnchorPoint = Vector2.new(0, 0.5),
|
|
57
|
+
BackgroundColor3 = theme.palette.primary.main,
|
|
58
|
+
BorderSizePixel = 0,
|
|
59
|
+
}) else ({
|
|
60
|
+
Size = UDim2.new(1, theme.padding.calc(4), 0, bar),
|
|
45
61
|
Position = UDim2.fromScale(0.5, 1),
|
|
46
62
|
AnchorPoint = Vector2.new(0.5, 1),
|
|
47
63
|
BackgroundColor3 = theme.palette.primary.main,
|
|
48
64
|
BorderSizePixel = 0,
|
|
49
|
-
},
|
|
65
|
+
}),
|
|
50
66
|
})
|
|
51
67
|
end)
|
|
52
68
|
local default = useTabsStyles
|
|
@@ -18,6 +18,8 @@ local function Toast(props)
|
|
|
18
18
|
if duration == nil then
|
|
19
19
|
duration = 4
|
|
20
20
|
end
|
|
21
|
+
local action = _binding.action
|
|
22
|
+
local onAction = _binding.onAction
|
|
21
23
|
local className = _binding.className
|
|
22
24
|
local sx = _binding.sx
|
|
23
25
|
local id = _binding.id
|
|
@@ -26,6 +28,7 @@ local function Toast(props)
|
|
|
26
28
|
local container = _binding_1.container
|
|
27
29
|
local label = _binding_1.label
|
|
28
30
|
local close = _binding_1.close
|
|
31
|
+
local actionStyle = _binding_1.action
|
|
29
32
|
local activePosition = _binding_1.activePosition
|
|
30
33
|
local inActivePosition = _binding_1.inActivePosition
|
|
31
34
|
local frameRef = useRef()
|
|
@@ -90,6 +93,28 @@ local function Toast(props)
|
|
|
90
93
|
end
|
|
91
94
|
_attributes_1.Text = text
|
|
92
95
|
local _exp_2 = React.createElement("textlabel", _attributes_1)
|
|
96
|
+
local _condition_1 = action ~= nil and #action > 0
|
|
97
|
+
if _condition_1 then
|
|
98
|
+
local _attributes_2 = {
|
|
99
|
+
key = "Action",
|
|
100
|
+
}
|
|
101
|
+
for _k, _v in actionStyle do
|
|
102
|
+
_attributes_2[_k] = _v
|
|
103
|
+
end
|
|
104
|
+
_attributes_2.Text = action
|
|
105
|
+
_attributes_2.Event = {
|
|
106
|
+
Activated = function()
|
|
107
|
+
if onAction then
|
|
108
|
+
onAction()
|
|
109
|
+
end
|
|
110
|
+
tween(Directions.Out)
|
|
111
|
+
if onDismiss then
|
|
112
|
+
onDismiss()
|
|
113
|
+
end
|
|
114
|
+
end,
|
|
115
|
+
}
|
|
116
|
+
_condition_1 = (React.createElement("textbutton", _attributes_2))
|
|
117
|
+
end
|
|
93
118
|
local _attributes_2 = {
|
|
94
119
|
key = "Close",
|
|
95
120
|
}
|
|
@@ -104,7 +129,7 @@ local function Toast(props)
|
|
|
104
129
|
end
|
|
105
130
|
end,
|
|
106
131
|
}
|
|
107
|
-
return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, React.createElement("imagebutton", _attributes_2))
|
|
132
|
+
return React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _condition_1, React.createElement("imagebutton", _attributes_2))
|
|
108
133
|
end
|
|
109
134
|
local default = Toast
|
|
110
135
|
return {
|
|
@@ -11,6 +11,7 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
11
11
|
if variant == nil then
|
|
12
12
|
variant = ToastVariants.default
|
|
13
13
|
end
|
|
14
|
+
local action = _param.action
|
|
14
15
|
local getToastColors = function()
|
|
15
16
|
repeat
|
|
16
17
|
if variant == (ToastVariants.success) then
|
|
@@ -38,6 +39,8 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
38
39
|
until true
|
|
39
40
|
end
|
|
40
41
|
local toastColors = getToastColors()
|
|
42
|
+
local hasAction = action ~= nil and #action > 0
|
|
43
|
+
local actionSlot = if hasAction then theme.spacing.calc(8) else 0
|
|
41
44
|
local ACTIVE_POSITION = UDim2.new(0.5, 0, 1, -DEFAULT_THEME.padding.calc(2))
|
|
42
45
|
local INACTIVE_POSITION = UDim2.new(0.5, 0, 1, DEFAULT_THEME.spacing.calc(20) + DEFAULT_THEME.padding.calc(2))
|
|
43
46
|
return createStyles({
|
|
@@ -50,19 +53,34 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
|
|
|
50
53
|
ZIndex = 50000,
|
|
51
54
|
},
|
|
52
55
|
label = {
|
|
53
|
-
Size = UDim2.new(1, -theme.padding.calc(4), 1, -theme.padding.calc(4)),
|
|
54
|
-
Position = UDim2.new(0.5, 0, 0.5, 0),
|
|
55
|
-
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
56
|
+
Size = UDim2.new(1, -(theme.padding.calc(4) + actionSlot), 1, -theme.padding.calc(4)),
|
|
57
|
+
Position = if hasAction then UDim2.new(0, theme.padding.calc(2), 0.5, 0) else UDim2.new(0.5, 0, 0.5, 0),
|
|
58
|
+
AnchorPoint = if hasAction then Vector2.new(0, 0.5) else Vector2.new(0.5, 0.5),
|
|
56
59
|
BackgroundTransparency = 1,
|
|
57
60
|
BorderSizePixel = 0,
|
|
58
61
|
TextSize = theme.typography.fontSizes.body,
|
|
59
62
|
TextColor3 = toastColors.content,
|
|
60
63
|
Font = theme.typography.fontFamilies.default,
|
|
64
|
+
TextXAlignment = if hasAction then Enum.TextXAlignment.Left else Enum.TextXAlignment.Center,
|
|
65
|
+
TextTruncate = Enum.TextTruncate.AtEnd,
|
|
61
66
|
TextScaled = false,
|
|
62
67
|
ZIndex = 50001,
|
|
63
68
|
},
|
|
69
|
+
action = {
|
|
70
|
+
AutomaticSize = Enum.AutomaticSize.X,
|
|
71
|
+
Size = UDim2.new(0, 0, 0, theme.spacing.calc(3)),
|
|
72
|
+
Position = UDim2.new(1, -(theme.padding.calc(2) + theme.options.constants.iconSizes.small + theme.padding.calc(1)), 0.5, 0),
|
|
73
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
74
|
+
BackgroundTransparency = 1,
|
|
75
|
+
BorderSizePixel = 0,
|
|
76
|
+
Font = theme.typography.fontFamilies.default,
|
|
77
|
+
TextSize = theme.typography.fontSizes.body,
|
|
78
|
+
TextColor3 = toastColors.content,
|
|
79
|
+
AutoButtonColor = false,
|
|
80
|
+
ZIndex = 50001,
|
|
81
|
+
},
|
|
64
82
|
close = {
|
|
65
|
-
Size = UDim2.new(0, theme.
|
|
83
|
+
Size = UDim2.new(0, theme.options.constants.iconSizes.small, 0, theme.options.constants.iconSizes.small),
|
|
66
84
|
Position = UDim2.new(1, -theme.padding.calc(2), 0, theme.padding.calc(2)),
|
|
67
85
|
AnchorPoint = Vector2.new(1, 0),
|
|
68
86
|
ImageColor3 = toastColors.content,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ControlSize, CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
import { ChoiceOption } from "../../radioGroup/index";
|
|
3
|
+
export interface ToggleButtonProps {
|
|
4
|
+
label: string;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
size?: ControlSize;
|
|
8
|
+
onActivated?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare function ToggleButton(props: CustomizedProps<TextButton, ToggleButtonProps>): JSX.Element;
|
|
11
|
+
export interface ToggleButtonGroupProps<T> {
|
|
12
|
+
value: T;
|
|
13
|
+
options: ChoiceOption<T>[];
|
|
14
|
+
onChange: (value: T) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
size?: ControlSize;
|
|
17
|
+
}
|
|
18
|
+
export declare function ToggleButtonGroup<T>(props: CustomizedProps<Frame, ToggleButtonGroupProps<T>>): JSX.Element;
|
|
19
|
+
export default ToggleButton;
|
|
@@ -0,0 +1,135 @@
|
|
|
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 canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
5
|
+
local useToggleButtonStyles = TS.import(script, script.Parent, "ToggleButton.styles").default
|
|
6
|
+
local function ToggleButton(props)
|
|
7
|
+
local _binding = props
|
|
8
|
+
local label = _binding.label
|
|
9
|
+
local selected = _binding.selected
|
|
10
|
+
local disabled = _binding.disabled
|
|
11
|
+
local size = _binding.size
|
|
12
|
+
if size == nil then
|
|
13
|
+
size = "medium"
|
|
14
|
+
end
|
|
15
|
+
local onActivated = _binding.onActivated
|
|
16
|
+
local className = _binding.className
|
|
17
|
+
local sx = _binding.sx
|
|
18
|
+
local id = _binding.id
|
|
19
|
+
local ref = _binding.ref
|
|
20
|
+
local styles = useToggleButtonStyles({
|
|
21
|
+
selected = selected,
|
|
22
|
+
disabled = disabled,
|
|
23
|
+
size = size,
|
|
24
|
+
})
|
|
25
|
+
local active = canActivate(disabled)
|
|
26
|
+
local _attributes = {}
|
|
27
|
+
local _condition = id
|
|
28
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
29
|
+
_condition = "ToggleButton"
|
|
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
|
+
_attributes.Text = label
|
|
47
|
+
_attributes.Active = active
|
|
48
|
+
_attributes.Selectable = active
|
|
49
|
+
_attributes.Event = {
|
|
50
|
+
Activated = function()
|
|
51
|
+
if active then
|
|
52
|
+
local _result = onActivated
|
|
53
|
+
if _result ~= nil then
|
|
54
|
+
_result()
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end,
|
|
58
|
+
}
|
|
59
|
+
local _attributes_1 = table.clone(styles.padding)
|
|
60
|
+
setmetatable(_attributes_1, nil)
|
|
61
|
+
local _exp = React.createElement("uipadding", _attributes_1)
|
|
62
|
+
local _attributes_2 = table.clone(styles.corner)
|
|
63
|
+
setmetatable(_attributes_2, nil)
|
|
64
|
+
local _exp_1 = React.createElement("uicorner", _attributes_2)
|
|
65
|
+
local _attributes_3 = table.clone(styles.stroke)
|
|
66
|
+
setmetatable(_attributes_3, nil)
|
|
67
|
+
return React.createElement("textbutton", _attributes, _exp, _exp_1, React.createElement("uistroke", _attributes_3))
|
|
68
|
+
end
|
|
69
|
+
local function ToggleButtonGroup(props)
|
|
70
|
+
local _binding = props
|
|
71
|
+
local value = _binding.value
|
|
72
|
+
local options = _binding.options
|
|
73
|
+
local onChange = _binding.onChange
|
|
74
|
+
local disabled = _binding.disabled
|
|
75
|
+
local size = _binding.size
|
|
76
|
+
local className = _binding.className
|
|
77
|
+
local sx = _binding.sx
|
|
78
|
+
local id = _binding.id
|
|
79
|
+
local ref = _binding.ref
|
|
80
|
+
local styles = useToggleButtonStyles({
|
|
81
|
+
size = size,
|
|
82
|
+
})
|
|
83
|
+
local _attributes = {}
|
|
84
|
+
local _condition = id
|
|
85
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
86
|
+
_condition = "ToggleButtonGroup"
|
|
87
|
+
end
|
|
88
|
+
_attributes.key = _condition
|
|
89
|
+
_attributes.ref = ref
|
|
90
|
+
for _k, _v in styles.group do
|
|
91
|
+
_attributes[_k] = _v
|
|
92
|
+
end
|
|
93
|
+
if className then
|
|
94
|
+
for _k, _v in className do
|
|
95
|
+
_attributes[_k] = _v
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
if sx then
|
|
99
|
+
for _k, _v in sx do
|
|
100
|
+
_attributes[_k] = _v
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
local _attributes_1 = table.clone(styles.list)
|
|
104
|
+
setmetatable(_attributes_1, nil)
|
|
105
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
106
|
+
-- ▼ ReadonlyArray.map ▼
|
|
107
|
+
local _newValue = table.create(#options)
|
|
108
|
+
local _callback = function(choice, index)
|
|
109
|
+
return React.createElement(ToggleButton, {
|
|
110
|
+
key = `{choice.label}-{index}`,
|
|
111
|
+
label = choice.label,
|
|
112
|
+
selected = choice.value == value,
|
|
113
|
+
disabled = disabled == true or choice.disabled == true,
|
|
114
|
+
size = size,
|
|
115
|
+
onActivated = function()
|
|
116
|
+
if choice.value ~= value then
|
|
117
|
+
onChange(choice.value)
|
|
118
|
+
end
|
|
119
|
+
end,
|
|
120
|
+
className = {
|
|
121
|
+
LayoutOrder = index,
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
end
|
|
125
|
+
for _k, _v in options do
|
|
126
|
+
_newValue[_k] = _callback(_v, _k - 1, options)
|
|
127
|
+
end
|
|
128
|
+
-- ▲ ReadonlyArray.map ▲
|
|
129
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
130
|
+
end
|
|
131
|
+
local default = ToggleButton
|
|
132
|
+
return {
|
|
133
|
+
ToggleButtonGroup = ToggleButtonGroup,
|
|
134
|
+
default = default,
|
|
135
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ControlSize } from "../../../../theme/index";
|
|
2
|
+
declare const useToggleButtonStyles: (props: {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
size?: ControlSize;
|
|
6
|
+
}) => import("../../../../theme/index").ClassNameMap<string>;
|
|
7
|
+
export default useToggleButtonStyles;
|