@rbxts/uiblox 0.2.0-alpha.1 → 0.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/out/theme/constants/NumberConstants.d.ts +3 -1
- package/out/theme/constants/NumberConstants.luau +3 -0
- package/out/theme/context/ThemeProvider.d.ts +1 -1
- package/out/theme/hooks/useTheme.d.ts +1 -1
- package/out/theme/interfaces/palette/colorTokens/ColorTokens.d.ts +1 -1
- package/out/theme/interfaces/spacing/Shape.d.ts +3 -0
- package/out/theme/interfaces/typography/FontSizes.d.ts +1 -1
- package/out/theme/interfaces/typography/FontSizes.luau +15 -8
- package/out/theme/interfaces/typography/ThemeTypography.d.ts +3 -0
- package/out/theme/interfaces/typography/Variants.d.ts +14 -15
- package/out/theme/interfaces/typography/Variants.luau +68 -18
- package/out/theme/themes/DarkTheme.luau +4 -0
- package/out/theme/themes/LightTheme.luau +4 -0
- package/out/theme/types/types.d.ts +1 -1
- package/out/ui/packages/accordion/components/Accordion.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.luau +5 -0
- package/out/ui/packages/accordion/components/Accordion.styles.d.ts +1 -0
- package/out/ui/packages/accordion/components/Accordion.styles.luau +4 -2
- package/out/ui/packages/alert/components/Alert.d.ts +10 -0
- package/out/ui/packages/alert/components/Alert.luau +98 -0
- package/out/ui/packages/alert/components/Alert.styles.d.ts +6 -0
- package/out/ui/packages/alert/components/Alert.styles.luau +93 -0
- package/out/ui/packages/alert/components/alertTone.d.ts +2 -0
- package/out/ui/packages/alert/components/alertTone.luau +7 -0
- package/out/ui/packages/alert/index.d.ts +3 -0
- package/out/ui/packages/alert/init.luau +6 -0
- package/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
- package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
- package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
- package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
- package/out/ui/packages/backdrop/index.d.ts +2 -0
- package/out/ui/packages/backdrop/init.luau +5 -0
- package/out/ui/packages/badge/components/Badge.styles.luau +6 -3
- package/out/ui/packages/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/checkbox/components/checkboxLook.d.ts +1 -1
- package/out/ui/packages/chip/components/Chip.d.ts +3 -1
- package/out/ui/packages/chip/components/Chip.luau +39 -2
- package/out/ui/packages/chip/components/Chip.styles.d.ts +3 -0
- package/out/ui/packages/chip/components/Chip.styles.luau +40 -6
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +13 -2
- package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
- package/out/ui/packages/dialog/components/Dialog.luau +27 -18
- package/out/ui/packages/fab/components/Fab.d.ts +1 -0
- package/out/ui/packages/fab/components/Fab.luau +57 -25
- package/out/ui/packages/fab/components/Fab.styles.d.ts +1 -0
- package/out/ui/packages/fab/components/Fab.styles.luau +26 -1
- 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 +84 -0
- package/out/ui/packages/imageList/components/ImageList.styles.d.ts +6 -0
- package/out/ui/packages/imageList/components/ImageList.styles.luau +54 -0
- package/out/ui/packages/imageList/components/imageListLayout.d.ts +3 -0
- package/out/ui/packages/imageList/components/imageListLayout.luau +24 -0
- package/out/ui/packages/imageList/index.d.ts +2 -0
- package/out/ui/packages/imageList/init.luau +5 -0
- package/out/ui/packages/index.d.ts +8 -0
- package/out/ui/packages/init.luau +24 -0
- package/out/ui/packages/input/components/Input.luau +1 -1
- package/out/ui/packages/layout/components/Box.d.ts +11 -0
- package/out/ui/packages/layout/components/Box.luau +49 -0
- package/out/ui/packages/layout/components/Box.styles.d.ts +7 -0
- package/out/ui/packages/layout/components/Box.styles.luau +34 -0
- package/out/ui/packages/layout/components/Container.d.ts +10 -0
- package/out/ui/packages/layout/components/Container.luau +54 -0
- package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
- package/out/ui/packages/layout/components/Container.styles.luau +41 -0
- package/out/ui/packages/layout/components/Grid.d.ts +1 -1
- package/out/ui/packages/layout/components/Stack.d.ts +12 -0
- package/out/ui/packages/layout/components/Stack.luau +49 -0
- package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
- package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
- package/out/ui/packages/layout/components/boxPad.d.ts +14 -0
- package/out/ui/packages/layout/components/boxPad.luau +59 -0
- package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
- package/out/ui/packages/layout/components/containerWidth.luau +17 -0
- package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
- package/out/ui/packages/layout/components/stackAlign.luau +29 -0
- package/out/ui/packages/layout/index.d.ts +10 -0
- package/out/ui/packages/layout/init.luau +4 -0
- package/out/ui/packages/link/components/Link.d.ts +11 -0
- package/out/ui/packages/link/components/Link.luau +83 -0
- package/out/ui/packages/link/components/Link.styles.d.ts +8 -0
- package/out/ui/packages/link/components/Link.styles.luau +59 -0
- package/out/ui/packages/link/index.d.ts +3 -0
- package/out/ui/packages/link/init.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.luau +5 -0
- package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
- package/out/ui/packages/listItem/components/ListItem.styles.luau +10 -5
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +2 -0
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +23 -19
- package/out/ui/packages/menu/components/Menu.d.ts +3 -0
- package/out/ui/packages/menu/components/Menu.luau +48 -23
- package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
- package/out/ui/packages/modal/components/Modal.d.ts +1 -1
- package/out/ui/packages/modal/components/Modal.luau +55 -37
- package/out/ui/packages/motion/index.d.ts +1 -1
- package/out/ui/packages/motion/init.luau +1 -0
- package/out/ui/packages/motion/unit.d.ts +5 -0
- package/out/ui/packages/motion/unit.luau +23 -0
- package/out/ui/packages/pagination/components/Pagination.d.ts +2 -0
- package/out/ui/packages/pagination/components/Pagination.luau +37 -21
- package/out/ui/packages/pagination/components/Pagination.styles.luau +9 -0
- package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
- package/out/ui/packages/pagination/components/pageRange.luau +91 -8
- package/out/ui/packages/pagination/index.d.ts +1 -0
- package/out/ui/packages/pagination/init.luau +1 -0
- package/out/ui/packages/paper/components/Paper.d.ts +1 -0
- package/out/ui/packages/paper/components/Paper.luau +8 -3
- package/out/ui/packages/popup/index.d.ts +1 -0
- package/out/ui/packages/popup/init.luau +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +4 -2
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.d.ts +1 -0
- package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +4 -1
- package/out/ui/packages/rating/components/Rating.d.ts +9 -0
- package/out/ui/packages/rating/components/Rating.luau +95 -0
- package/out/ui/packages/rating/components/Rating.styles.d.ts +4 -0
- package/out/ui/packages/rating/components/Rating.styles.luau +39 -0
- package/out/ui/packages/rating/index.d.ts +2 -0
- package/out/ui/packages/rating/init.luau +5 -0
- package/out/ui/packages/select/components/Select.d.ts +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 +1 -0
- package/out/ui/packages/slider/components/Slider.luau +24 -1
- package/out/ui/packages/slider/components/Slider.styles.luau +8 -0
- package/out/ui/packages/slider/components/sliderMarks.d.ts +1 -0
- package/out/ui/packages/slider/components/sliderMarks.luau +37 -0
- package/out/ui/packages/speedDial/components/SpeedDial.d.ts +17 -0
- package/out/ui/packages/speedDial/components/SpeedDial.luau +92 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +2 -0
- package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +26 -0
- package/out/ui/packages/speedDial/index.d.ts +2 -0
- package/out/ui/packages/speedDial/init.luau +5 -0
- package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
- package/out/ui/packages/stateMatrix.d.ts +2 -0
- package/out/ui/packages/stateMatrix.luau +1843 -1437
- package/out/ui/packages/switch/components/Switch.styles.luau +1 -1
- package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
- package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
- package/out/ui/packages/tabs/components/Tabs.luau +10 -3
- package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
- package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
- package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
- package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
- package/out/ui/packages/tabs/index.d.ts +1 -0
- package/out/ui/packages/tabs/init.luau +1 -0
- package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
- package/out/ui/packages/toggleButton/components/ToggleButton.d.ts +17 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +126 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.d.ts +5 -0
- package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +58 -0
- package/out/ui/packages/toggleButton/index.d.ts +2 -0
- package/out/ui/packages/toggleButton/init.luau +7 -0
- package/out/ui/packages/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
|
@@ -3,6 +3,8 @@ export interface PaginationProps {
|
|
|
3
3
|
count: number;
|
|
4
4
|
page: number;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
siblingCount?: number;
|
|
7
|
+
boundaryCount?: number;
|
|
6
8
|
onChange: (page: number) => void;
|
|
7
9
|
}
|
|
8
10
|
declare function Pagination(props: CustomizedProps<Frame, PaginationProps>): JSX.Element;
|
|
@@ -9,12 +9,15 @@ local function Pagination(props)
|
|
|
9
9
|
local count = _binding.count
|
|
10
10
|
local page = _binding.page
|
|
11
11
|
local disabled = _binding.disabled
|
|
12
|
+
local siblingCount = _binding.siblingCount
|
|
13
|
+
local boundaryCount = _binding.boundaryCount
|
|
12
14
|
local onChange = _binding.onChange
|
|
13
15
|
local className = _binding.className
|
|
14
16
|
local sx = _binding.sx
|
|
15
17
|
local id = _binding.id
|
|
16
18
|
local ref = _binding.ref
|
|
17
19
|
local styles = usePaginationStyles()
|
|
20
|
+
local tokens = pageRange(count, page, siblingCount, boundaryCount)
|
|
18
21
|
local _attributes = {}
|
|
19
22
|
local _condition = id
|
|
20
23
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
@@ -38,30 +41,43 @@ local function Pagination(props)
|
|
|
38
41
|
local _attributes_1 = table.clone(styles.list)
|
|
39
42
|
setmetatable(_attributes_1, nil)
|
|
40
43
|
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
41
|
-
local _exp_1 = pageRange(count)
|
|
42
44
|
-- ▼ ReadonlyArray.map ▼
|
|
43
|
-
local _newValue = table.create(#
|
|
44
|
-
local _callback = function(item)
|
|
45
|
-
local
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
local _newValue = table.create(#tokens)
|
|
46
|
+
local _callback = function(item, index)
|
|
47
|
+
local _result
|
|
48
|
+
if item == "ellipsis" then
|
|
49
|
+
local _attributes_2 = {
|
|
50
|
+
key = `e-{index}`,
|
|
51
|
+
}
|
|
52
|
+
for _k, _v in styles.ellipsis do
|
|
53
|
+
_attributes_2[_k] = _v
|
|
54
|
+
end
|
|
55
|
+
_attributes_2.LayoutOrder = index
|
|
56
|
+
_result = (React.createElement("textlabel", _attributes_2))
|
|
57
|
+
else
|
|
58
|
+
local _attributes_2 = {
|
|
59
|
+
key = tostring(item),
|
|
60
|
+
}
|
|
61
|
+
for _k, _v in cx(styles.page, item == page and styles.selected) do
|
|
62
|
+
_attributes_2[_k] = _v
|
|
63
|
+
end
|
|
64
|
+
_attributes_2.Text = tostring(item)
|
|
65
|
+
_attributes_2.LayoutOrder = index
|
|
66
|
+
_attributes_2.Active = disabled ~= true
|
|
67
|
+
_attributes_2.Selectable = disabled ~= true
|
|
68
|
+
_attributes_2.Event = {
|
|
69
|
+
Activated = function()
|
|
70
|
+
return disabled ~= true and item ~= page and onChange(item)
|
|
71
|
+
end,
|
|
72
|
+
}
|
|
73
|
+
local _attributes_3 = table.clone(styles.corner)
|
|
74
|
+
setmetatable(_attributes_3, nil)
|
|
75
|
+
_result = (React.createElement("textbutton", _attributes_2, React.createElement("uicorner", _attributes_3)))
|
|
50
76
|
end
|
|
51
|
-
|
|
52
|
-
_attributes_2.Active = disabled ~= true
|
|
53
|
-
_attributes_2.Selectable = disabled ~= true
|
|
54
|
-
_attributes_2.Event = {
|
|
55
|
-
Activated = function()
|
|
56
|
-
return disabled ~= true and item ~= page and onChange(item)
|
|
57
|
-
end,
|
|
58
|
-
}
|
|
59
|
-
local _attributes_3 = table.clone(styles.corner)
|
|
60
|
-
setmetatable(_attributes_3, nil)
|
|
61
|
-
return React.createElement("textbutton", _attributes_2, React.createElement("uicorner", _attributes_3))
|
|
77
|
+
return _result
|
|
62
78
|
end
|
|
63
|
-
for _k, _v in
|
|
64
|
-
_newValue[_k] = _callback(_v, _k - 1,
|
|
79
|
+
for _k, _v in tokens do
|
|
80
|
+
_newValue[_k] = _callback(_v, _k - 1, tokens)
|
|
65
81
|
end
|
|
66
82
|
-- ▲ ReadonlyArray.map ▲
|
|
67
83
|
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
@@ -28,6 +28,15 @@ local usePaginationStyles = componentStyles("Pagination", function(theme)
|
|
|
28
28
|
selected = {
|
|
29
29
|
BackgroundColor3 = theme.palette.action.selected,
|
|
30
30
|
},
|
|
31
|
+
ellipsis = {
|
|
32
|
+
Size = UDim2.fromOffset(theme.spacing.calc(3), theme.spacing.calc(3)),
|
|
33
|
+
BackgroundTransparency = 1,
|
|
34
|
+
BorderSizePixel = 0,
|
|
35
|
+
Font = theme.typography.fontFamilies.default,
|
|
36
|
+
TextSize = theme.typography.fontSizes.body,
|
|
37
|
+
TextColor3 = theme.palette.text.secondary,
|
|
38
|
+
Text = "…",
|
|
39
|
+
},
|
|
31
40
|
corner = {
|
|
32
41
|
CornerRadius = UDim.new(1, 0),
|
|
33
42
|
},
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type PageToken = number | "ellipsis";
|
|
2
|
+
export declare function pageRange(count: number, page?: number, siblingCount?: number, boundaryCount?: number): PageToken[];
|
|
@@ -1,23 +1,106 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local function pageRange(count)
|
|
3
|
-
|
|
2
|
+
local function pageRange(count, page, siblingCount, boundaryCount)
|
|
3
|
+
if page == nil then
|
|
4
|
+
page = 1
|
|
5
|
+
end
|
|
6
|
+
if siblingCount == nil then
|
|
7
|
+
siblingCount = 1
|
|
8
|
+
end
|
|
9
|
+
if boundaryCount == nil then
|
|
10
|
+
boundaryCount = 1
|
|
11
|
+
end
|
|
12
|
+
local total = math.max(0, math.floor(count))
|
|
13
|
+
if total == 0 then
|
|
14
|
+
return {}
|
|
15
|
+
end
|
|
16
|
+
local current = math.clamp(math.floor(page), 1, total)
|
|
17
|
+
local siblings = math.max(0, math.floor(siblingCount))
|
|
18
|
+
local boundaries = math.max(0, math.floor(boundaryCount))
|
|
19
|
+
local rangeLength = boundaries * 2 + siblings * 2 + 3
|
|
20
|
+
if total <= rangeLength then
|
|
21
|
+
local all = {}
|
|
22
|
+
do
|
|
23
|
+
local i = 1
|
|
24
|
+
local _shouldIncrement = false
|
|
25
|
+
while true do
|
|
26
|
+
if _shouldIncrement then
|
|
27
|
+
i += 1
|
|
28
|
+
else
|
|
29
|
+
_shouldIncrement = true
|
|
30
|
+
end
|
|
31
|
+
if not (i <= total) then
|
|
32
|
+
break
|
|
33
|
+
end
|
|
34
|
+
local _i = i
|
|
35
|
+
table.insert(all, _i)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return all
|
|
39
|
+
end
|
|
40
|
+
local startFrom = math.max(current - siblings, boundaries + 2)
|
|
41
|
+
local endAt = math.min(current + siblings, total - (boundaries + 1))
|
|
42
|
+
local tokens = {}
|
|
43
|
+
do
|
|
44
|
+
local i = 1
|
|
45
|
+
local _shouldIncrement = false
|
|
46
|
+
while true do
|
|
47
|
+
if _shouldIncrement then
|
|
48
|
+
i += 1
|
|
49
|
+
else
|
|
50
|
+
_shouldIncrement = true
|
|
51
|
+
end
|
|
52
|
+
if not (i <= boundaries) then
|
|
53
|
+
break
|
|
54
|
+
end
|
|
55
|
+
local _i = i
|
|
56
|
+
table.insert(tokens, _i)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
if startFrom > boundaries + 2 then
|
|
60
|
+
table.insert(tokens, "ellipsis")
|
|
61
|
+
elseif boundaries + 1 < startFrom then
|
|
62
|
+
local _arg0 = boundaries + 1
|
|
63
|
+
table.insert(tokens, _arg0)
|
|
64
|
+
end
|
|
65
|
+
do
|
|
66
|
+
local i = startFrom
|
|
67
|
+
local _shouldIncrement = false
|
|
68
|
+
while true do
|
|
69
|
+
if _shouldIncrement then
|
|
70
|
+
i += 1
|
|
71
|
+
else
|
|
72
|
+
_shouldIncrement = true
|
|
73
|
+
end
|
|
74
|
+
if not (i <= endAt) then
|
|
75
|
+
break
|
|
76
|
+
end
|
|
77
|
+
local _i = i
|
|
78
|
+
table.insert(tokens, _i)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
if endAt < total - (boundaries + 1) then
|
|
82
|
+
table.insert(tokens, "ellipsis")
|
|
83
|
+
elseif endAt + 1 < total - boundaries + 1 then
|
|
84
|
+
local _arg0 = endAt + 1
|
|
85
|
+
table.insert(tokens, _arg0)
|
|
86
|
+
end
|
|
4
87
|
do
|
|
5
|
-
local
|
|
88
|
+
local i = total - boundaries + 1
|
|
6
89
|
local _shouldIncrement = false
|
|
7
90
|
while true do
|
|
8
91
|
if _shouldIncrement then
|
|
9
|
-
|
|
92
|
+
i += 1
|
|
10
93
|
else
|
|
11
94
|
_shouldIncrement = true
|
|
12
95
|
end
|
|
13
|
-
if not (
|
|
96
|
+
if not (i <= total) then
|
|
14
97
|
break
|
|
15
98
|
end
|
|
16
|
-
local
|
|
17
|
-
table.insert(
|
|
99
|
+
local _i = i
|
|
100
|
+
table.insert(tokens, _i)
|
|
18
101
|
end
|
|
19
102
|
end
|
|
20
|
-
return
|
|
103
|
+
return tokens
|
|
21
104
|
end
|
|
22
105
|
return {
|
|
23
106
|
pageRange = pageRange,
|
|
@@ -8,6 +8,7 @@ local function Paper(props)
|
|
|
8
8
|
if elevation == nil then
|
|
9
9
|
elevation = "flat"
|
|
10
10
|
end
|
|
11
|
+
local square = _binding.square
|
|
11
12
|
local children = _binding.children
|
|
12
13
|
local styles = usePaperStyles({
|
|
13
14
|
elevation = elevation,
|
|
@@ -21,9 +22,13 @@ local function Paper(props)
|
|
|
21
22
|
local _attributes_1 = table.clone(styles.padding)
|
|
22
23
|
setmetatable(_attributes_1, nil)
|
|
23
24
|
local _exp = React.createElement("uipadding", _attributes_1)
|
|
24
|
-
local
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
local _condition = square ~= true
|
|
26
|
+
if _condition then
|
|
27
|
+
local _attributes_2 = table.clone(styles.corner)
|
|
28
|
+
setmetatable(_attributes_2, nil)
|
|
29
|
+
_condition = React.createElement("uicorner", _attributes_2)
|
|
30
|
+
end
|
|
31
|
+
return React.createElement("frame", _attributes, _exp, _condition, children)
|
|
27
32
|
end
|
|
28
33
|
local default = Paper
|
|
29
34
|
return {
|
|
@@ -2,3 +2,4 @@ export { default as Popup } from "./components/Popup";
|
|
|
2
2
|
export { PopupProps } from "./components/Popup";
|
|
3
3
|
export { default as Portal } from "./components/Portal";
|
|
4
4
|
export { PortalProps } from "./components/Portal";
|
|
5
|
+
export { portalTarget } from "./components/portalTarget";
|
|
@@ -3,4 +3,5 @@ local TS = _G[script]
|
|
|
3
3
|
local exports = {}
|
|
4
4
|
exports.Popup = TS.import(script, script, "components", "Popup").default
|
|
5
5
|
exports.Portal = TS.import(script, script, "components", "Portal").default
|
|
6
|
+
exports.portalTarget = TS.import(script, script, "components", "portalTarget").portalTarget
|
|
6
7
|
return exports
|
|
@@ -11,6 +11,7 @@ export interface RadioGroupProps<T> {
|
|
|
11
11
|
onChange: (value: T) => void;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
size?: ControlSize;
|
|
14
|
+
row?: boolean;
|
|
14
15
|
}
|
|
15
16
|
declare function RadioGroup<T>(props: CustomizedProps<Frame, RadioGroupProps<T>>): JSX.Element;
|
|
16
17
|
export default RadioGroup;
|
|
@@ -10,17 +10,19 @@ local function RadioGroup(props)
|
|
|
10
10
|
local onChange = _binding.onChange
|
|
11
11
|
local disabled = _binding.disabled
|
|
12
12
|
local size = _binding.size
|
|
13
|
+
local row = _binding.row
|
|
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
18
|
local _binding_1 = useRadioGroupStyles({
|
|
18
19
|
size = size,
|
|
20
|
+
row = row,
|
|
19
21
|
})
|
|
20
22
|
local root = _binding_1.root
|
|
21
23
|
local list = _binding_1.list
|
|
22
24
|
local option = _binding_1.option
|
|
23
|
-
local
|
|
25
|
+
local optionRow = _binding_1.optionRow
|
|
24
26
|
local ring = _binding_1.ring
|
|
25
27
|
local dot = _binding_1.dot
|
|
26
28
|
local stroke = _binding_1.stroke
|
|
@@ -70,7 +72,7 @@ local function RadioGroup(props)
|
|
|
70
72
|
end
|
|
71
73
|
end,
|
|
72
74
|
}
|
|
73
|
-
local _attributes_3 = table.clone(
|
|
75
|
+
local _attributes_3 = table.clone(optionRow)
|
|
74
76
|
setmetatable(_attributes_3, nil)
|
|
75
77
|
local _exp_1 = React.createElement("uilistlayout", _attributes_3)
|
|
76
78
|
local _attributes_4 = table.clone(ring)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ControlSize } from "../../../../theme/index";
|
|
2
2
|
export interface RadioGroupStyleProps {
|
|
3
3
|
size?: ControlSize;
|
|
4
|
+
row?: boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const useRadioGroupStyles: (props: RadioGroupStyleProps) => import("../../../../theme/index").ClassNameMap<string>;
|
|
6
7
|
export default useRadioGroupStyles;
|
|
@@ -6,6 +6,7 @@ local createStyles = _theme.createStyles
|
|
|
6
6
|
local componentStyles = _theme.componentStyles
|
|
7
7
|
local useRadioGroupStyles = componentStyles("RadioGroup", function(theme, _param)
|
|
8
8
|
local size = _param.size
|
|
9
|
+
local row = _param.row
|
|
9
10
|
local metrics = controlMetrics(theme.density, size)
|
|
10
11
|
return createStyles({
|
|
11
12
|
root = {
|
|
@@ -15,8 +16,10 @@ local useRadioGroupStyles = componentStyles("RadioGroup", function(theme, _param
|
|
|
15
16
|
BorderSizePixel = 0,
|
|
16
17
|
},
|
|
17
18
|
list = {
|
|
19
|
+
FillDirection = if row == true then Enum.FillDirection.Horizontal else Enum.FillDirection.Vertical,
|
|
18
20
|
Padding = UDim.new(0, theme.padding.default),
|
|
19
21
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
22
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
20
23
|
},
|
|
21
24
|
option = {
|
|
22
25
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
@@ -25,7 +28,7 @@ local useRadioGroupStyles = componentStyles("RadioGroup", function(theme, _param
|
|
|
25
28
|
BorderSizePixel = 0,
|
|
26
29
|
Text = "",
|
|
27
30
|
},
|
|
28
|
-
|
|
31
|
+
optionRow = {
|
|
29
32
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
30
33
|
Padding = UDim.new(0, theme.padding.default),
|
|
31
34
|
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CustomizedProps } from "../../../../theme/index";
|
|
2
|
+
export interface RatingProps {
|
|
3
|
+
value: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onChange: (value: number) => void;
|
|
7
|
+
}
|
|
8
|
+
declare function Rating(props: CustomizedProps<Frame, RatingProps>): JSX.Element;
|
|
9
|
+
export default Rating;
|
|
@@ -0,0 +1,95 @@
|
|
|
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 Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
5
|
+
local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
|
|
6
|
+
local useRatingStyles = TS.import(script, script.Parent, "Rating.styles").default
|
|
7
|
+
local function Rating(props)
|
|
8
|
+
local _binding = props
|
|
9
|
+
local value = _binding.value
|
|
10
|
+
local max = _binding.max
|
|
11
|
+
if max == nil then
|
|
12
|
+
max = 5
|
|
13
|
+
end
|
|
14
|
+
local disabled = _binding.disabled
|
|
15
|
+
local onChange = _binding.onChange
|
|
16
|
+
local className = _binding.className
|
|
17
|
+
local sx = _binding.sx
|
|
18
|
+
local id = _binding.id
|
|
19
|
+
local ref = _binding.ref
|
|
20
|
+
local styles = useRatingStyles({
|
|
21
|
+
disabled = disabled,
|
|
22
|
+
})
|
|
23
|
+
local active = canActivate(disabled)
|
|
24
|
+
local stars = {}
|
|
25
|
+
do
|
|
26
|
+
local i = 1
|
|
27
|
+
local _shouldIncrement = false
|
|
28
|
+
while true do
|
|
29
|
+
if _shouldIncrement then
|
|
30
|
+
i += 1
|
|
31
|
+
else
|
|
32
|
+
_shouldIncrement = true
|
|
33
|
+
end
|
|
34
|
+
if not (i <= max) then
|
|
35
|
+
break
|
|
36
|
+
end
|
|
37
|
+
local _i = i
|
|
38
|
+
table.insert(stars, _i)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
local _attributes = {}
|
|
42
|
+
local _condition = id
|
|
43
|
+
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
44
|
+
_condition = "Rating"
|
|
45
|
+
end
|
|
46
|
+
_attributes.key = _condition
|
|
47
|
+
_attributes.ref = ref
|
|
48
|
+
for _k, _v in styles.root do
|
|
49
|
+
_attributes[_k] = _v
|
|
50
|
+
end
|
|
51
|
+
if className then
|
|
52
|
+
for _k, _v in className do
|
|
53
|
+
_attributes[_k] = _v
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
if sx then
|
|
57
|
+
for _k, _v in sx do
|
|
58
|
+
_attributes[_k] = _v
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
local _attributes_1 = table.clone(styles.list)
|
|
62
|
+
setmetatable(_attributes_1, nil)
|
|
63
|
+
local _exp = React.createElement("uilistlayout", _attributes_1)
|
|
64
|
+
-- ▼ ReadonlyArray.map ▼
|
|
65
|
+
local _newValue = table.create(#stars)
|
|
66
|
+
local _callback = function(n)
|
|
67
|
+
local _attributes_2 = {
|
|
68
|
+
key = `Star-{n}`,
|
|
69
|
+
}
|
|
70
|
+
for _k, _v in styles.star do
|
|
71
|
+
_attributes_2[_k] = _v
|
|
72
|
+
end
|
|
73
|
+
_attributes_2.Image = tostring(if n <= value then Icons.StarFilled else Icons.Star)
|
|
74
|
+
_attributes_2.LayoutOrder = n
|
|
75
|
+
_attributes_2.Active = active
|
|
76
|
+
_attributes_2.Selectable = active
|
|
77
|
+
_attributes_2.Event = {
|
|
78
|
+
Activated = function()
|
|
79
|
+
if active then
|
|
80
|
+
onChange(if n == value then 0 else n)
|
|
81
|
+
end
|
|
82
|
+
end,
|
|
83
|
+
}
|
|
84
|
+
return React.createElement("imagebutton", _attributes_2)
|
|
85
|
+
end
|
|
86
|
+
for _k, _v in stars do
|
|
87
|
+
_newValue[_k] = _callback(_v, _k - 1, stars)
|
|
88
|
+
end
|
|
89
|
+
-- ▲ ReadonlyArray.map ▲
|
|
90
|
+
return React.createElement("frame", _attributes, _exp, _newValue)
|
|
91
|
+
end
|
|
92
|
+
local default = Rating
|
|
93
|
+
return {
|
|
94
|
+
default = default,
|
|
95
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 useRatingStyles = componentStyles("Rating", function(theme, _param)
|
|
7
|
+
local disabled = _param.disabled
|
|
8
|
+
if disabled == nil then
|
|
9
|
+
disabled = false
|
|
10
|
+
end
|
|
11
|
+
return createStyles({
|
|
12
|
+
root = {
|
|
13
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
14
|
+
Size = UDim2.fromScale(0, 0),
|
|
15
|
+
BackgroundTransparency = 1,
|
|
16
|
+
BorderSizePixel = 0,
|
|
17
|
+
},
|
|
18
|
+
list = {
|
|
19
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
20
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Left,
|
|
21
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
22
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
23
|
+
Padding = UDim.new(0, theme.padding.calc(0.5)),
|
|
24
|
+
},
|
|
25
|
+
star = {
|
|
26
|
+
Size = UDim2.fromOffset(theme.spacing.calc(3), theme.spacing.calc(3)),
|
|
27
|
+
BackgroundTransparency = 1,
|
|
28
|
+
BorderSizePixel = 0,
|
|
29
|
+
AutoButtonColor = false,
|
|
30
|
+
Active = not disabled,
|
|
31
|
+
Selectable = not disabled,
|
|
32
|
+
ImageColor3 = if disabled then theme.palette.text.disabled else theme.palette.primary.main,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
end)
|
|
36
|
+
local default = useRatingStyles
|
|
37
|
+
return {
|
|
38
|
+
default = default,
|
|
39
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
1
2
|
import { ControlSize, CustomizedProps } from "../../../../theme/index";
|
|
2
3
|
import { ChoiceOption } from "../../radioGroup/index";
|
|
3
4
|
export interface SelectProps<T> {
|
|
@@ -9,6 +10,10 @@ export interface SelectProps<T> {
|
|
|
9
10
|
loading?: boolean;
|
|
10
11
|
placeholder?: string;
|
|
11
12
|
searchable?: boolean;
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
defaultQuery?: string;
|
|
15
|
+
emptyText?: string;
|
|
16
|
+
empty?: React.Element;
|
|
12
17
|
reducedMotion?: boolean;
|
|
13
18
|
size?: ControlSize;
|
|
14
19
|
}
|