@rbxts/uiblox 0.2.0-alpha.3 → 0.2.0-alpha.30
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 +27 -109
- package/out/hooks/index.d.ts +1 -0
- package/out/hooks/init.luau +3 -0
- package/out/hooks/useBreakpoints.luau +2 -11
- package/out/hooks/viewportObserver.d.ts +10 -0
- package/out/hooks/viewportObserver.luau +75 -0
- package/out/theme/interfaces/theme/Theme.d.ts +15 -0
- package/out/theme/styles/utilities/componentStyles.luau +45 -3
- package/out/theme/styles/utilities/componentTheme.d.ts +15 -0
- package/out/theme/styles/utilities/index.d.ts +2 -0
- package/out/theme/styles/utilities/init.luau +7 -0
- package/out/theme/styles/utilities/resolveStyle.d.ts +10 -2
- package/out/theme/styles/utilities/resolveStyle.luau +7 -3
- package/out/theme/styles/utilities/resolveSx.d.ts +110 -0
- package/out/theme/styles/utilities/resolveSx.luau +479 -0
- package/out/theme/styles/utilities/styleCache.d.ts +2 -0
- package/out/theme/styles/utilities/styleCache.luau +9 -0
- package/out/ui/packages/accordion/components/Accordion.d.ts +2 -0
- package/out/ui/packages/accordion/components/Accordion.luau +46 -30
- 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 +48 -42
- 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 +47 -36
- package/out/ui/packages/appBar/components/AppBar.styles.d.ts +2 -0
- package/out/ui/packages/appBar/components/AppBar.styles.luau +16 -5
- package/out/ui/packages/assetField/components/AssetField.luau +12 -16
- 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 +27 -26
- 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 +51 -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 +32 -24
- 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 +20 -18
- 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 +67 -40
- 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/BrickColorPicker.luau +12 -16
- package/out/ui/packages/button/components/Button.luau +28 -22
- package/out/ui/packages/card/components/Card.d.ts +3 -1
- package/out/ui/packages/card/components/Card.luau +10 -0
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +75 -53
- package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +26 -9
- package/out/ui/packages/checkbox/components/Checkbox.luau +16 -16
- 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 +61 -17
- package/out/ui/packages/chip/components/Chip.styles.d.ts +6 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +54 -9
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +29 -18
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +16 -20
- package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +34 -20
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +34 -35
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +65 -62
- package/out/ui/packages/dialog/components/Dialog.d.ts +3 -2
- package/out/ui/packages/dialog/components/Dialog.luau +41 -21
- package/out/ui/packages/divider/components/Divider.d.ts +1 -0
- package/out/ui/packages/divider/components/Divider.luau +52 -17
- package/out/ui/packages/divider/components/Divider.styles.luau +32 -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 +3 -1
- package/out/ui/packages/drawer/components/Drawer.luau +71 -37
- 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 +79 -37
- package/out/ui/packages/fab/components/Fab.styles.d.ts +3 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +39 -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/fontEditor/components/FontEditor.luau +12 -16
- package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
- package/out/ui/packages/formText/components/FormHelperText.luau +40 -0
- package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
- package/out/ui/packages/formText/components/FormLabel.luau +42 -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/gradientEditor/components/GradientEditor.luau +56 -42
- package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +37 -4
- package/out/ui/packages/host/components/SxHost.d.ts +18 -0
- package/out/ui/packages/host/components/SxHost.luau +202 -0
- package/out/ui/packages/host/hostPaint.d.ts +11 -0
- package/out/ui/packages/host/hostPaint.luau +33 -0
- package/out/ui/packages/host/hostRules.d.ts +15 -0
- package/out/ui/packages/host/hostRules.luau +92 -0
- package/out/ui/packages/host/index.d.ts +3 -0
- package/out/ui/packages/host/init.luau +13 -0
- package/out/ui/packages/icon/components/Icon.luau +9 -16
- package/out/ui/packages/iconButton/components/IconButton.luau +22 -17
- 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 +93 -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 +8 -0
- package/out/ui/packages/init.luau +24 -0
- package/out/ui/packages/input/components/Input.d.ts +1 -0
- package/out/ui/packages/input/components/Input.luau +22 -19
- package/out/ui/packages/layout/components/Box.d.ts +11 -0
- package/out/ui/packages/layout/components/Box.luau +40 -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 +45 -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 +40 -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 +41 -19
- package/out/ui/packages/layout/components/List.luau +9 -16
- package/out/ui/packages/layout/components/Stack.d.ts +14 -0
- package/out/ui/packages/layout/components/Stack.luau +44 -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 +80 -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 +4 -1
- package/out/ui/packages/listItem/components/ListItem.luau +44 -4
- 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 +7 -1
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.d.ts +11 -0
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.luau +2 -0
- package/out/ui/packages/markdown/components/Markdown.d.ts +6 -0
- package/out/ui/packages/markdown/components/Markdown.luau +221 -0
- package/out/ui/packages/markdown/components/Markdown.styles.d.ts +2 -0
- package/out/ui/packages/markdown/components/Markdown.styles.luau +101 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.d.ts +16 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +315 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +6 -0
- package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +132 -0
- package/out/ui/packages/markdown/htmlToMarkdown.d.ts +2 -0
- package/out/ui/packages/markdown/htmlToMarkdown.luau +350 -0
- package/out/ui/packages/markdown/index.d.ts +8 -0
- package/out/ui/packages/markdown/init.luau +11 -0
- package/out/ui/packages/markdown/parseMarkdown.d.ts +42 -0
- package/out/ui/packages/markdown/parseMarkdown.luau +459 -0
- package/out/ui/packages/menu/components/Menu.d.ts +7 -1
- package/out/ui/packages/menu/components/Menu.luau +68 -26
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/modal/components/Modal.d.ts +2 -1
- package/out/ui/packages/modal/components/Modal.luau +79 -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 +16 -3
- package/out/ui/packages/numberInput/components/numberValue.d.ts +1 -0
- package/out/ui/packages/numberInput/components/numberValue.luau +45 -0
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +12 -16
- package/out/ui/packages/pagination/components/Pagination.d.ts +6 -1
- package/out/ui/packages/pagination/components/Pagination.luau +62 -38
- 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 +4 -2
- package/out/ui/packages/paper/components/Paper.luau +31 -9
- 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 +63 -38
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +21 -7
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +2 -0
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +14 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -1
- package/out/ui/packages/popup/components/Popup.luau +35 -18
- package/out/ui/packages/popup/index.d.ts +1 -0
- package/out/ui/packages/popup/init.luau +1 -0
- package/out/ui/packages/preloader/components/Preloader.luau +9 -16
- package/out/ui/packages/progressBar/components/ProgressBar.luau +12 -16
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +16 -18
- 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 +97 -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/rayEditor/components/RayEditor.luau +12 -16
- package/out/ui/packages/rectEditor/components/RectEditor.luau +86 -43
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +30 -7
- package/out/ui/packages/select/components/Select.d.ts +5 -0
- package/out/ui/packages/select/components/Select.luau +61 -77
- package/out/ui/packages/select/components/Select.styles.luau +1 -1
- package/out/ui/packages/shadow/components/Shadow.d.ts +2 -1
- package/out/ui/packages/shadow/components/Shadow.luau +39 -17
- package/out/ui/packages/shadow/components/Shadow.styles.luau +7 -2
- package/out/ui/packages/sidebar/components/Sidebar.luau +9 -16
- package/out/ui/packages/skeleton/components/Skeleton.luau +22 -30
- 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 +47 -19
- 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 +97 -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 +13 -17
- 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 +872 -881
- package/out/ui/packages/stepper/components/Stepper.d.ts +1 -0
- package/out/ui/packages/stepper/components/Stepper.luau +16 -17
- 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 +21 -16
- package/out/ui/packages/switch/components/Switch.styles.d.ts +2 -0
- package/out/ui/packages/switch/components/Switch.styles.luau +6 -1
- 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 +15 -19
- 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 +24 -19
- 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 +41 -13
- package/out/ui/packages/toast/components/Toast.styles.luau +23 -5
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +21 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +129 -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/tooltip/components/Tooltip.luau +9 -16
- package/out/ui/packages/treeView/components/TreeView.luau +9 -16
- package/out/ui/packages/typography/components/Typography.luau +13 -14
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +12 -16
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +12 -16
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +7 -0
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +43 -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/components/VirtualList.luau +9 -16
- 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/ui/packages/select/components/selectMotion.d.ts +0 -2
- package/out/ui/packages/select/components/selectMotion.luau +0 -12
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Dot-path into `theme.palette` (typed for common roles).
|
|
3
|
+
local function resolvePaletteToken(palette, token)
|
|
4
|
+
local _token = token
|
|
5
|
+
if not (type(_token) == "string") then
|
|
6
|
+
return token
|
|
7
|
+
end
|
|
8
|
+
local parts = string.split(token, ".")
|
|
9
|
+
local cursor = palette
|
|
10
|
+
for _, part in parts do
|
|
11
|
+
local _condition = cursor == nil
|
|
12
|
+
if not _condition then
|
|
13
|
+
local _cursor = cursor
|
|
14
|
+
_condition = typeof(_cursor) ~= "table"
|
|
15
|
+
end
|
|
16
|
+
if _condition then
|
|
17
|
+
return Color3.new(0, 0, 0)
|
|
18
|
+
end
|
|
19
|
+
cursor = cursor[part]
|
|
20
|
+
end
|
|
21
|
+
local _cursor = cursor
|
|
22
|
+
if typeof(_cursor) == "Color3" then
|
|
23
|
+
return cursor
|
|
24
|
+
end
|
|
25
|
+
return Color3.new(0, 0, 0)
|
|
26
|
+
end
|
|
27
|
+
--* Matches `hooks/breakpoints` thresholds. Kept local so Node style checks need no path aliases.
|
|
28
|
+
local function resolveResponsive(value, width)
|
|
29
|
+
local _condition = value == nil
|
|
30
|
+
if not _condition then
|
|
31
|
+
local _value = value
|
|
32
|
+
_condition = typeof(_value) ~= "table"
|
|
33
|
+
end
|
|
34
|
+
if _condition then
|
|
35
|
+
return value
|
|
36
|
+
end
|
|
37
|
+
local record = value
|
|
38
|
+
local size = if width == width and width < math.huge and width > 0 then width else 0
|
|
39
|
+
local name = if size < 600 then "phone" elseif size < 960 then "tablet" else "desktop"
|
|
40
|
+
if name == "desktop" then
|
|
41
|
+
local _condition_1 = record.desktop
|
|
42
|
+
if _condition_1 == nil then
|
|
43
|
+
_condition_1 = record.tablet
|
|
44
|
+
if _condition_1 == nil then
|
|
45
|
+
_condition_1 = record.phone
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
return _condition_1
|
|
49
|
+
end
|
|
50
|
+
if name == "tablet" then
|
|
51
|
+
local _condition_1 = record.tablet
|
|
52
|
+
if _condition_1 == nil then
|
|
53
|
+
_condition_1 = record.phone
|
|
54
|
+
end
|
|
55
|
+
return _condition_1
|
|
56
|
+
end
|
|
57
|
+
return record.phone
|
|
58
|
+
end
|
|
59
|
+
local SELECTORS = {
|
|
60
|
+
_hover = true,
|
|
61
|
+
_pressed = true,
|
|
62
|
+
_focus = true,
|
|
63
|
+
_focusVisible = true,
|
|
64
|
+
_disabled = true,
|
|
65
|
+
_selected = true,
|
|
66
|
+
_checked = true,
|
|
67
|
+
_loading = true,
|
|
68
|
+
_first = true,
|
|
69
|
+
_last = true,
|
|
70
|
+
_odd = true,
|
|
71
|
+
_even = true,
|
|
72
|
+
}
|
|
73
|
+
local SHORTHAND = {
|
|
74
|
+
width = true,
|
|
75
|
+
height = true,
|
|
76
|
+
w = true,
|
|
77
|
+
h = true,
|
|
78
|
+
size = true,
|
|
79
|
+
x = true,
|
|
80
|
+
y = true,
|
|
81
|
+
position = true,
|
|
82
|
+
pos = true,
|
|
83
|
+
anchor = true,
|
|
84
|
+
p = true,
|
|
85
|
+
px = true,
|
|
86
|
+
py = true,
|
|
87
|
+
pt = true,
|
|
88
|
+
pr = true,
|
|
89
|
+
pb = true,
|
|
90
|
+
pl = true,
|
|
91
|
+
padding = true,
|
|
92
|
+
gap = true,
|
|
93
|
+
bgcolor = true,
|
|
94
|
+
bg = true,
|
|
95
|
+
backgroundColor = true,
|
|
96
|
+
color = true,
|
|
97
|
+
borderColor = true,
|
|
98
|
+
opacity = true,
|
|
99
|
+
transparency = true,
|
|
100
|
+
border = true,
|
|
101
|
+
borderWidth = true,
|
|
102
|
+
radius = true,
|
|
103
|
+
typography = true,
|
|
104
|
+
fontSize = true,
|
|
105
|
+
font = true,
|
|
106
|
+
visible = true,
|
|
107
|
+
zIndex = true,
|
|
108
|
+
z = true,
|
|
109
|
+
}
|
|
110
|
+
--* CSS-like shorthands + pass-through Instance props. No CSS string parser.
|
|
111
|
+
local function pick(value, width)
|
|
112
|
+
if value == nil then
|
|
113
|
+
return nil
|
|
114
|
+
end
|
|
115
|
+
if width ~= nil then
|
|
116
|
+
return resolveResponsive(value, width)
|
|
117
|
+
end
|
|
118
|
+
local _value = value
|
|
119
|
+
if typeof(_value) ~= "table" then
|
|
120
|
+
return value
|
|
121
|
+
end
|
|
122
|
+
local record = value
|
|
123
|
+
if record.phone ~= nil or record.tablet ~= nil or record.desktop ~= nil then
|
|
124
|
+
local _condition = record.desktop
|
|
125
|
+
if _condition == nil then
|
|
126
|
+
_condition = record.tablet
|
|
127
|
+
if _condition == nil then
|
|
128
|
+
_condition = record.phone
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
return _condition
|
|
132
|
+
end
|
|
133
|
+
return value
|
|
134
|
+
end
|
|
135
|
+
local function asUDim(value)
|
|
136
|
+
local _value = value
|
|
137
|
+
return if type(_value) == "number" then UDim.new(0, value) else value
|
|
138
|
+
end
|
|
139
|
+
local function sizeAxis(value, axis)
|
|
140
|
+
if value == nil then
|
|
141
|
+
return nil
|
|
142
|
+
end
|
|
143
|
+
local _value = value
|
|
144
|
+
if type(_value) == "number" then
|
|
145
|
+
return UDim.new(0, value)
|
|
146
|
+
end
|
|
147
|
+
local _value_1 = value
|
|
148
|
+
if typeof(_value_1) == "UDim" then
|
|
149
|
+
return value
|
|
150
|
+
end
|
|
151
|
+
return if axis == "X" then value.X else value.Y
|
|
152
|
+
end
|
|
153
|
+
local function padSides(padding)
|
|
154
|
+
if padding == nil then
|
|
155
|
+
return {
|
|
156
|
+
top = 0,
|
|
157
|
+
right = 0,
|
|
158
|
+
bottom = 0,
|
|
159
|
+
left = 0,
|
|
160
|
+
}
|
|
161
|
+
end
|
|
162
|
+
local _padding = padding
|
|
163
|
+
if type(_padding) == "number" then
|
|
164
|
+
return {
|
|
165
|
+
top = padding,
|
|
166
|
+
right = padding,
|
|
167
|
+
bottom = padding,
|
|
168
|
+
left = padding,
|
|
169
|
+
}
|
|
170
|
+
end
|
|
171
|
+
local _condition = padding.x
|
|
172
|
+
if _condition == nil then
|
|
173
|
+
_condition = 0
|
|
174
|
+
end
|
|
175
|
+
local x = _condition
|
|
176
|
+
local _condition_1 = padding.y
|
|
177
|
+
if _condition_1 == nil then
|
|
178
|
+
_condition_1 = 0
|
|
179
|
+
end
|
|
180
|
+
local y = _condition_1
|
|
181
|
+
local _object = {}
|
|
182
|
+
local _left = "top"
|
|
183
|
+
local _condition_2 = padding.top
|
|
184
|
+
if _condition_2 == nil then
|
|
185
|
+
_condition_2 = y
|
|
186
|
+
end
|
|
187
|
+
_object[_left] = _condition_2
|
|
188
|
+
local _left_1 = "right"
|
|
189
|
+
local _condition_3 = padding.right
|
|
190
|
+
if _condition_3 == nil then
|
|
191
|
+
_condition_3 = x
|
|
192
|
+
end
|
|
193
|
+
_object[_left_1] = _condition_3
|
|
194
|
+
local _left_2 = "bottom"
|
|
195
|
+
local _condition_4 = padding.bottom
|
|
196
|
+
if _condition_4 == nil then
|
|
197
|
+
_condition_4 = y
|
|
198
|
+
end
|
|
199
|
+
_object[_left_2] = _condition_4
|
|
200
|
+
local _left_3 = "left"
|
|
201
|
+
local _condition_5 = padding.left
|
|
202
|
+
if _condition_5 == nil then
|
|
203
|
+
_condition_5 = x
|
|
204
|
+
end
|
|
205
|
+
_object[_left_3] = _condition_5
|
|
206
|
+
return _object
|
|
207
|
+
end
|
|
208
|
+
local function colorOf(theme, value)
|
|
209
|
+
if value == nil then
|
|
210
|
+
return nil
|
|
211
|
+
end
|
|
212
|
+
return resolvePaletteToken(theme.palette, value)
|
|
213
|
+
end
|
|
214
|
+
--[[
|
|
215
|
+
*
|
|
216
|
+
* Maps sx shorthands / tokens → Instance props (+ UIPadding / UICorner / gap helpers).
|
|
217
|
+
* Pass-through keys (BackgroundColor3, _hover, …) stay on `root` for `resolveStyle`.
|
|
218
|
+
|
|
219
|
+
]]
|
|
220
|
+
local function resolveSx(theme, sx, width)
|
|
221
|
+
if sx == nil then
|
|
222
|
+
return {
|
|
223
|
+
root = {},
|
|
224
|
+
}
|
|
225
|
+
end
|
|
226
|
+
local root = {}
|
|
227
|
+
local pad
|
|
228
|
+
local radius
|
|
229
|
+
local gap
|
|
230
|
+
local _condition = sx.width
|
|
231
|
+
if _condition == nil then
|
|
232
|
+
_condition = sx.w
|
|
233
|
+
end
|
|
234
|
+
local widthVal = pick(_condition, width)
|
|
235
|
+
local _condition_1 = sx.height
|
|
236
|
+
if _condition_1 == nil then
|
|
237
|
+
_condition_1 = sx.h
|
|
238
|
+
end
|
|
239
|
+
local heightVal = pick(_condition_1, width)
|
|
240
|
+
local sizeVal = pick(sx.size, width)
|
|
241
|
+
local sizeX = sizeAxis(widthVal, "X")
|
|
242
|
+
local sizeY = sizeAxis(heightVal, "Y")
|
|
243
|
+
if sizeVal ~= nil then
|
|
244
|
+
if typeof(sizeVal) == "UDim2" then
|
|
245
|
+
sizeX = sizeX or sizeVal.X
|
|
246
|
+
sizeY = sizeY or sizeVal.Y
|
|
247
|
+
else
|
|
248
|
+
local record = sizeVal
|
|
249
|
+
sizeX = sizeX or sizeAxis(record.width, "X")
|
|
250
|
+
sizeY = sizeY or sizeAxis(record.height, "Y")
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
if sizeX ~= nil or sizeY ~= nil then
|
|
254
|
+
local _result = sizeX
|
|
255
|
+
if _result ~= nil then
|
|
256
|
+
_result = _result.Scale
|
|
257
|
+
end
|
|
258
|
+
local _condition_2 = _result
|
|
259
|
+
if _condition_2 == nil then
|
|
260
|
+
_condition_2 = 0
|
|
261
|
+
end
|
|
262
|
+
local _result_1 = sizeX
|
|
263
|
+
if _result_1 ~= nil then
|
|
264
|
+
_result_1 = _result_1.Offset
|
|
265
|
+
end
|
|
266
|
+
local _condition_3 = _result_1
|
|
267
|
+
if _condition_3 == nil then
|
|
268
|
+
_condition_3 = 0
|
|
269
|
+
end
|
|
270
|
+
local _result_2 = sizeY
|
|
271
|
+
if _result_2 ~= nil then
|
|
272
|
+
_result_2 = _result_2.Scale
|
|
273
|
+
end
|
|
274
|
+
local _condition_4 = _result_2
|
|
275
|
+
if _condition_4 == nil then
|
|
276
|
+
_condition_4 = 0
|
|
277
|
+
end
|
|
278
|
+
local _result_3 = sizeY
|
|
279
|
+
if _result_3 ~= nil then
|
|
280
|
+
_result_3 = _result_3.Offset
|
|
281
|
+
end
|
|
282
|
+
local _condition_5 = _result_3
|
|
283
|
+
if _condition_5 == nil then
|
|
284
|
+
_condition_5 = 0
|
|
285
|
+
end
|
|
286
|
+
root.Size = UDim2.new(_condition_2, _condition_3, _condition_4, _condition_5)
|
|
287
|
+
end
|
|
288
|
+
local position = pick(sx.position or sx.pos, width)
|
|
289
|
+
local x = pick(sx.x, width)
|
|
290
|
+
local y = pick(sx.y, width)
|
|
291
|
+
if position ~= nil then
|
|
292
|
+
root.Position = position
|
|
293
|
+
elseif x ~= nil or y ~= nil then
|
|
294
|
+
local xU = if x ~= nil then asUDim(x) else UDim.new(0, 0)
|
|
295
|
+
local yU = if y ~= nil then asUDim(y) else UDim.new(0, 0)
|
|
296
|
+
root.Position = UDim2.new(xU.Scale, xU.Offset, yU.Scale, yU.Offset)
|
|
297
|
+
end
|
|
298
|
+
local anchor = pick(sx.anchor, width)
|
|
299
|
+
if anchor ~= nil then
|
|
300
|
+
if type(anchor) == "number" then
|
|
301
|
+
root.AnchorPoint = Vector2.new(anchor, anchor)
|
|
302
|
+
elseif typeof(anchor) == "Vector2" then
|
|
303
|
+
root.AnchorPoint = anchor
|
|
304
|
+
else
|
|
305
|
+
local pair = anchor
|
|
306
|
+
root.AnchorPoint = Vector2.new(pair[1], pair[2])
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
local padding = pick(sx.padding, width)
|
|
310
|
+
if padding ~= nil then
|
|
311
|
+
pad = padSides(padding)
|
|
312
|
+
end
|
|
313
|
+
local p = pick(sx.p, width)
|
|
314
|
+
local px = pick(sx.px, width)
|
|
315
|
+
local py = pick(sx.py, width)
|
|
316
|
+
local pt = pick(sx.pt, width)
|
|
317
|
+
local pr = pick(sx.pr, width)
|
|
318
|
+
local pb = pick(sx.pb, width)
|
|
319
|
+
local pl = pick(sx.pl, width)
|
|
320
|
+
if p ~= nil or px ~= nil or py ~= nil or pt ~= nil or pr ~= nil or pb ~= nil or pl ~= nil then
|
|
321
|
+
local base = pad or {
|
|
322
|
+
top = 0,
|
|
323
|
+
right = 0,
|
|
324
|
+
bottom = 0,
|
|
325
|
+
left = 0,
|
|
326
|
+
}
|
|
327
|
+
local _condition_2 = p
|
|
328
|
+
if _condition_2 == nil then
|
|
329
|
+
_condition_2 = 0
|
|
330
|
+
end
|
|
331
|
+
local uniform = _condition_2
|
|
332
|
+
local _object = {}
|
|
333
|
+
local _left = "top"
|
|
334
|
+
local _condition_3 = pt
|
|
335
|
+
if _condition_3 == nil then
|
|
336
|
+
_condition_3 = py
|
|
337
|
+
if _condition_3 == nil then
|
|
338
|
+
_condition_3 = (if p ~= nil then uniform else base.top)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
_object[_left] = _condition_3
|
|
342
|
+
local _left_1 = "right"
|
|
343
|
+
local _condition_4 = pr
|
|
344
|
+
if _condition_4 == nil then
|
|
345
|
+
_condition_4 = px
|
|
346
|
+
if _condition_4 == nil then
|
|
347
|
+
_condition_4 = (if p ~= nil then uniform else base.right)
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
_object[_left_1] = _condition_4
|
|
351
|
+
local _left_2 = "bottom"
|
|
352
|
+
local _condition_5 = pb
|
|
353
|
+
if _condition_5 == nil then
|
|
354
|
+
_condition_5 = py
|
|
355
|
+
if _condition_5 == nil then
|
|
356
|
+
_condition_5 = (if p ~= nil then uniform else base.bottom)
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
_object[_left_2] = _condition_5
|
|
360
|
+
local _left_3 = "left"
|
|
361
|
+
local _condition_6 = pl
|
|
362
|
+
if _condition_6 == nil then
|
|
363
|
+
_condition_6 = px
|
|
364
|
+
if _condition_6 == nil then
|
|
365
|
+
_condition_6 = (if p ~= nil then uniform else base.left)
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
_object[_left_3] = _condition_6
|
|
369
|
+
pad = _object
|
|
370
|
+
end
|
|
371
|
+
local gapVal = pick(sx.gap, width)
|
|
372
|
+
if gapVal ~= nil then
|
|
373
|
+
gap = theme.spacing.calc(gapVal)
|
|
374
|
+
end
|
|
375
|
+
local bg = pick(sx.bgcolor or sx.bg or sx.backgroundColor, width)
|
|
376
|
+
local bgColor = colorOf(theme, bg)
|
|
377
|
+
if bgColor ~= nil then
|
|
378
|
+
root.BackgroundColor3 = bgColor
|
|
379
|
+
if root.BackgroundTransparency == nil then
|
|
380
|
+
root.BackgroundTransparency = 0
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
local textColor = colorOf(theme, pick(sx.color, width))
|
|
384
|
+
if textColor ~= nil then
|
|
385
|
+
root.TextColor3 = textColor
|
|
386
|
+
end
|
|
387
|
+
local borderColor = colorOf(theme, pick(sx.borderColor, width))
|
|
388
|
+
if borderColor ~= nil then
|
|
389
|
+
root.BorderColor3 = borderColor
|
|
390
|
+
end
|
|
391
|
+
local opacity = pick(sx.opacity, width)
|
|
392
|
+
if opacity ~= nil then
|
|
393
|
+
root.BackgroundTransparency = 1 - opacity
|
|
394
|
+
end
|
|
395
|
+
local transparency = pick(sx.transparency, width)
|
|
396
|
+
if transparency ~= nil then
|
|
397
|
+
root.BackgroundTransparency = transparency
|
|
398
|
+
end
|
|
399
|
+
local _condition_2 = sx.border
|
|
400
|
+
if _condition_2 == nil then
|
|
401
|
+
_condition_2 = sx.borderWidth
|
|
402
|
+
end
|
|
403
|
+
local border = pick(_condition_2, width)
|
|
404
|
+
if border ~= nil then
|
|
405
|
+
root.BorderSizePixel = border
|
|
406
|
+
end
|
|
407
|
+
local radiusVal = pick(sx.radius, width)
|
|
408
|
+
if radiusVal ~= nil then
|
|
409
|
+
radius = radiusVal
|
|
410
|
+
end
|
|
411
|
+
local typography = pick(sx.typography, width)
|
|
412
|
+
if typography ~= nil then
|
|
413
|
+
local variant = theme.typography.variants[typography]
|
|
414
|
+
if variant ~= nil then
|
|
415
|
+
root.TextSize = variant.size
|
|
416
|
+
root.Font = theme.typography.fontFamilies[variant.family]
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
local fontSize = pick(sx.fontSize, width)
|
|
420
|
+
if fontSize ~= nil then
|
|
421
|
+
root.TextSize = fontSize
|
|
422
|
+
end
|
|
423
|
+
local font = pick(sx.font, width)
|
|
424
|
+
if font ~= nil then
|
|
425
|
+
if typeof(font) == "EnumItem" then
|
|
426
|
+
root.Font = font
|
|
427
|
+
else
|
|
428
|
+
root.Font = theme.typography.fontFamilies[font]
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
local visible = pick(sx.visible, width)
|
|
432
|
+
if visible ~= nil then
|
|
433
|
+
root.Visible = visible
|
|
434
|
+
end
|
|
435
|
+
local _condition_3 = sx.zIndex
|
|
436
|
+
if _condition_3 == nil then
|
|
437
|
+
_condition_3 = sx.z
|
|
438
|
+
end
|
|
439
|
+
local zIndex = pick(_condition_3, width)
|
|
440
|
+
if zIndex ~= nil then
|
|
441
|
+
root.ZIndex = zIndex
|
|
442
|
+
end
|
|
443
|
+
for key, raw in pairs(sx) do
|
|
444
|
+
local name = key
|
|
445
|
+
if SHORTHAND[name] == true then
|
|
446
|
+
continue
|
|
447
|
+
end
|
|
448
|
+
if SELECTORS[name] == true then
|
|
449
|
+
local nested = resolveSx(theme, raw, width)
|
|
450
|
+
root[name] = nested.root
|
|
451
|
+
continue
|
|
452
|
+
end
|
|
453
|
+
root[name] = pick(raw, width)
|
|
454
|
+
end
|
|
455
|
+
local resolved = {
|
|
456
|
+
root = root,
|
|
457
|
+
}
|
|
458
|
+
if pad ~= nil then
|
|
459
|
+
resolved.padding = {
|
|
460
|
+
PaddingTop = UDim.new(0, theme.spacing.calc(pad.top)),
|
|
461
|
+
PaddingRight = UDim.new(0, theme.spacing.calc(pad.right)),
|
|
462
|
+
PaddingBottom = UDim.new(0, theme.spacing.calc(pad.bottom)),
|
|
463
|
+
PaddingLeft = UDim.new(0, theme.spacing.calc(pad.left)),
|
|
464
|
+
}
|
|
465
|
+
end
|
|
466
|
+
if radius ~= nil then
|
|
467
|
+
resolved.corner = {
|
|
468
|
+
CornerRadius = UDim.new(0, radius),
|
|
469
|
+
}
|
|
470
|
+
end
|
|
471
|
+
if gap ~= nil then
|
|
472
|
+
resolved.gap = gap
|
|
473
|
+
end
|
|
474
|
+
return resolved
|
|
475
|
+
end
|
|
476
|
+
return {
|
|
477
|
+
resolvePaletteToken = resolvePaletteToken,
|
|
478
|
+
resolveSx = resolveSx,
|
|
479
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare function styleDepsKey(props: object | undefined): string;
|
|
2
2
|
export declare function createStyleCache<T extends defined>(): (theme: object, key: string, create: () => T) => T;
|
|
3
|
+
/** Drop all makeStyles memo buckets (theme hot-reload / tests). */
|
|
4
|
+
export declare function clearStyleCaches(): void;
|
|
@@ -9,6 +9,7 @@ local KEYED = {
|
|
|
9
9
|
CFrame = true,
|
|
10
10
|
BrickColor = true,
|
|
11
11
|
}
|
|
12
|
+
local caches = {}
|
|
12
13
|
local function styleDepsKey(props)
|
|
13
14
|
if props == nil then
|
|
14
15
|
return ""
|
|
@@ -40,6 +41,7 @@ local function styleDepsKey(props)
|
|
|
40
41
|
end
|
|
41
42
|
local function createStyleCache()
|
|
42
43
|
local byTheme = {}
|
|
44
|
+
table.insert(caches, byTheme)
|
|
43
45
|
return function(theme, key, create)
|
|
44
46
|
local _theme = theme
|
|
45
47
|
local bucket = byTheme[_theme]
|
|
@@ -62,7 +64,14 @@ local function createStyleCache()
|
|
|
62
64
|
return value
|
|
63
65
|
end
|
|
64
66
|
end
|
|
67
|
+
--* Drop all makeStyles memo buckets (theme hot-reload / tests).
|
|
68
|
+
local function clearStyleCaches()
|
|
69
|
+
for _, cache in caches do
|
|
70
|
+
table.clear(cache)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
65
73
|
return {
|
|
66
74
|
styleDepsKey = styleDepsKey,
|
|
67
75
|
createStyleCache = createStyleCache,
|
|
76
|
+
clearStyleCaches = clearStyleCaches,
|
|
68
77
|
}
|
|
@@ -3,13 +3,19 @@ local TS = _G[script]
|
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
5
|
local useState = _react.useState
|
|
6
|
-
local
|
|
6
|
+
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
7
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
8
|
+
local _accordionOpen = TS.import(script, script.Parent, "accordionOpen")
|
|
9
|
+
local accordionGlyph = _accordionOpen.accordionGlyph
|
|
10
|
+
local accordionOpen = _accordionOpen.accordionOpen
|
|
7
11
|
local useAccordionStyles = TS.import(script, script.Parent, "Accordion.styles").default
|
|
8
12
|
local function Accordion(props)
|
|
9
13
|
local _binding = props
|
|
10
14
|
local title = _binding.title
|
|
11
15
|
local controlled = _binding.open
|
|
12
16
|
local defaultOpen = _binding.defaultOpen
|
|
17
|
+
local disabled = _binding.disabled
|
|
18
|
+
local square = _binding.square
|
|
13
19
|
local onChange = _binding.onChange
|
|
14
20
|
local children = _binding.children
|
|
15
21
|
local className = _binding.className
|
|
@@ -20,8 +26,12 @@ local function Accordion(props)
|
|
|
20
26
|
local open = accordionOpen(localOpen, controlled)
|
|
21
27
|
local styles = useAccordionStyles({
|
|
22
28
|
open = open,
|
|
29
|
+
disabled = disabled,
|
|
23
30
|
})
|
|
24
31
|
local toggle = function()
|
|
32
|
+
if disabled == true then
|
|
33
|
+
return nil
|
|
34
|
+
end
|
|
25
35
|
local nextOpen = not open
|
|
26
36
|
if controlled == nil then
|
|
27
37
|
setLocalOpen(nextOpen)
|
|
@@ -31,52 +41,58 @@ local function Accordion(props)
|
|
|
31
41
|
_result(nextOpen)
|
|
32
42
|
end
|
|
33
43
|
end
|
|
34
|
-
local _attributes = {
|
|
44
|
+
local _attributes = {
|
|
45
|
+
tag = "frame",
|
|
46
|
+
}
|
|
35
47
|
local _condition = id
|
|
36
48
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
37
49
|
_condition = "Accordion"
|
|
38
50
|
end
|
|
39
51
|
_attributes.key = _condition
|
|
40
|
-
_attributes.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
end
|
|
52
|
+
_attributes.hostRef = ref
|
|
53
|
+
_attributes.base = styles.root
|
|
54
|
+
_attributes.className = className
|
|
55
|
+
_attributes.sx = sx
|
|
56
|
+
_attributes.state = {
|
|
57
|
+
disabled = disabled,
|
|
58
|
+
}
|
|
59
|
+
local _condition_1 = square ~= true
|
|
60
|
+
if _condition_1 then
|
|
61
|
+
local _attributes_1 = table.clone(styles.corner)
|
|
62
|
+
setmetatable(_attributes_1, nil)
|
|
63
|
+
_condition_1 = React.createElement("uicorner", _attributes_1)
|
|
53
64
|
end
|
|
54
|
-
local _attributes_1 = table.clone(styles.
|
|
65
|
+
local _attributes_1 = table.clone(styles.list)
|
|
55
66
|
setmetatable(_attributes_1, nil)
|
|
56
|
-
local _exp = React.createElement("
|
|
57
|
-
local _attributes_2 =
|
|
58
|
-
setmetatable(_attributes_2, nil)
|
|
59
|
-
local _exp_1 = React.createElement("uilistlayout", _attributes_2)
|
|
60
|
-
local _attributes_3 = {
|
|
67
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
68
|
+
local _attributes_2 = {
|
|
61
69
|
key = "Header",
|
|
62
70
|
}
|
|
63
71
|
for _k, _v in styles.header do
|
|
64
|
-
|
|
72
|
+
_attributes_2[_k] = _v
|
|
65
73
|
end
|
|
66
|
-
|
|
74
|
+
_attributes_2.Event = {
|
|
67
75
|
Activated = toggle,
|
|
68
76
|
}
|
|
69
|
-
local
|
|
70
|
-
setmetatable(
|
|
71
|
-
local
|
|
72
|
-
local
|
|
77
|
+
local _attributes_3 = table.clone(styles.padding)
|
|
78
|
+
setmetatable(_attributes_3, nil)
|
|
79
|
+
local _exp_1 = React.createElement("uipadding", _attributes_3)
|
|
80
|
+
local _attributes_4 = {
|
|
73
81
|
key = "Title",
|
|
74
82
|
}
|
|
75
83
|
for _k, _v in styles.title do
|
|
84
|
+
_attributes_4[_k] = _v
|
|
85
|
+
end
|
|
86
|
+
_attributes_4.Text = title
|
|
87
|
+
local _exp_2 = React.createElement("textlabel", _attributes_4)
|
|
88
|
+
local _attributes_5 = {
|
|
89
|
+
key = "Icon",
|
|
90
|
+
}
|
|
91
|
+
for _k, _v in styles.icon do
|
|
76
92
|
_attributes_5[_k] = _v
|
|
77
93
|
end
|
|
78
|
-
_attributes_5.
|
|
79
|
-
local _exp_3 = React.createElement("textbutton",
|
|
94
|
+
_attributes_5.Image = if accordionGlyph(open) == "expanded" then Icons.Expanded else Icons.Collapsed
|
|
95
|
+
local _exp_3 = React.createElement("textbutton", _attributes_2, _exp_1, _exp_2, React.createElement("imagelabel", _attributes_5))
|
|
80
96
|
local _attributes_6 = {
|
|
81
97
|
key = "Body",
|
|
82
98
|
}
|
|
@@ -85,7 +101,7 @@ local function Accordion(props)
|
|
|
85
101
|
end
|
|
86
102
|
local _attributes_7 = table.clone(styles.padding)
|
|
87
103
|
setmetatable(_attributes_7, nil)
|
|
88
|
-
return React.createElement(
|
|
104
|
+
return React.createElement(SxHost, _attributes, _condition_1, _exp, _exp_3, React.createElement("frame", _attributes_6, React.createElement("uipadding", _attributes_7), children))
|
|
89
105
|
end
|
|
90
106
|
local default = Accordion
|
|
91
107
|
return {
|
|
@@ -8,6 +8,7 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
|
|
|
8
8
|
if open == nil then
|
|
9
9
|
open = false
|
|
10
10
|
end
|
|
11
|
+
local disabled = _param.disabled
|
|
11
12
|
return createStyles({
|
|
12
13
|
root = {
|
|
13
14
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
@@ -27,19 +28,30 @@ local useAccordionStyles = componentStyles("Accordion", function(theme, _param)
|
|
|
27
28
|
BorderSizePixel = 0,
|
|
28
29
|
AutoButtonColor = false,
|
|
29
30
|
Text = "",
|
|
30
|
-
Active = true,
|
|
31
|
-
Selectable = true,
|
|
31
|
+
Active = disabled ~= true,
|
|
32
|
+
Selectable = disabled ~= true,
|
|
32
33
|
},
|
|
33
34
|
title = {
|
|
34
|
-
AutomaticSize = Enum.AutomaticSize.
|
|
35
|
-
Size = UDim2.
|
|
35
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
36
|
+
Size = UDim2.new(1, -theme.spacing.calc(4), 0, 0),
|
|
36
37
|
BackgroundTransparency = 1,
|
|
37
38
|
BorderSizePixel = 0,
|
|
38
39
|
Font = theme.typography.fontFamilies.default,
|
|
39
40
|
TextSize = theme.typography.fontSizes.body,
|
|
40
41
|
TextColor3 = theme.palette.text.primary,
|
|
42
|
+
TextTransparency = if disabled == true then 0.5 else 0,
|
|
41
43
|
TextXAlignment = Enum.TextXAlignment.Left,
|
|
42
44
|
},
|
|
45
|
+
icon = {
|
|
46
|
+
Size = UDim2.fromOffset(theme.options.constants.iconSizes.small, theme.options.constants.iconSizes.small),
|
|
47
|
+
Position = UDim2.new(1, -theme.padding.calc(1.5), 0.5, 0),
|
|
48
|
+
AnchorPoint = Vector2.new(1, 0.5),
|
|
49
|
+
BackgroundTransparency = 1,
|
|
50
|
+
BorderSizePixel = 0,
|
|
51
|
+
ScaleType = Enum.ScaleType.Fit,
|
|
52
|
+
ImageColor3 = theme.palette.text.primary,
|
|
53
|
+
ImageTransparency = if disabled == true then 0.5 else 0,
|
|
54
|
+
},
|
|
43
55
|
padding = {
|
|
44
56
|
PaddingTop = UDim.new(0, theme.padding.calc(1)),
|
|
45
57
|
PaddingBottom = UDim.new(0, theme.padding.calc(1)),
|