@rbxts/uiblox 0.2.0-alpha.6 → 0.2.0-alpha.8

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.
Files changed (60) hide show
  1. package/out/ui/packages/backdrop/components/Backdrop.d.ts +10 -0
  2. package/out/ui/packages/backdrop/components/Backdrop.luau +58 -0
  3. package/out/ui/packages/backdrop/components/Backdrop.styles.d.ts +4 -0
  4. package/out/ui/packages/backdrop/components/Backdrop.styles.luau +24 -0
  5. package/out/ui/packages/backdrop/index.d.ts +2 -0
  6. package/out/ui/packages/backdrop/init.luau +5 -0
  7. package/out/ui/packages/badge/components/Badge.styles.luau +6 -3
  8. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.d.ts +1 -0
  9. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +58 -24
  10. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +9 -0
  11. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +68 -0
  12. package/out/ui/packages/breadcrumbs/index.d.ts +1 -0
  13. package/out/ui/packages/breadcrumbs/init.luau +3 -0
  14. package/out/ui/packages/chip/components/Chip.d.ts +2 -1
  15. package/out/ui/packages/chip/components/Chip.luau +2 -0
  16. package/out/ui/packages/chip/components/Chip.styles.d.ts +2 -0
  17. package/out/ui/packages/chip/components/Chip.styles.luau +13 -7
  18. package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
  19. package/out/ui/packages/dialog/components/Dialog.luau +27 -18
  20. package/out/ui/packages/fab/components/Fab.d.ts +1 -0
  21. package/out/ui/packages/fab/components/Fab.luau +57 -25
  22. package/out/ui/packages/fab/components/Fab.styles.d.ts +1 -0
  23. package/out/ui/packages/fab/components/Fab.styles.luau +26 -1
  24. package/out/ui/packages/fab/components/fabSize.d.ts +1 -0
  25. package/out/ui/packages/fab/components/fabSize.luau +4 -0
  26. package/out/ui/packages/fab/index.d.ts +1 -1
  27. package/out/ui/packages/fab/init.luau +1 -0
  28. package/out/ui/packages/index.d.ts +1 -0
  29. package/out/ui/packages/init.luau +3 -0
  30. package/out/ui/packages/layout/components/Container.d.ts +10 -0
  31. package/out/ui/packages/layout/components/Container.luau +54 -0
  32. package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
  33. package/out/ui/packages/layout/components/Container.styles.luau +41 -0
  34. package/out/ui/packages/layout/components/Grid.d.ts +1 -1
  35. package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
  36. package/out/ui/packages/layout/components/containerWidth.luau +17 -0
  37. package/out/ui/packages/layout/index.d.ts +3 -0
  38. package/out/ui/packages/layout/init.luau +2 -0
  39. package/out/ui/packages/modal/components/Modal.d.ts +1 -1
  40. package/out/ui/packages/modal/components/Modal.luau +55 -37
  41. package/out/ui/packages/pagination/components/Pagination.d.ts +2 -0
  42. package/out/ui/packages/pagination/components/Pagination.luau +37 -21
  43. package/out/ui/packages/pagination/components/Pagination.styles.luau +9 -0
  44. package/out/ui/packages/pagination/components/pageRange.d.ts +2 -1
  45. package/out/ui/packages/pagination/components/pageRange.luau +91 -8
  46. package/out/ui/packages/pagination/index.d.ts +1 -0
  47. package/out/ui/packages/pagination/init.luau +1 -0
  48. package/out/ui/packages/popup/index.d.ts +1 -0
  49. package/out/ui/packages/popup/init.luau +1 -0
  50. package/out/ui/packages/stateMatrix.luau +235 -149
  51. package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
  52. package/out/ui/packages/tabs/components/Tabs.luau +10 -3
  53. package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
  54. package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
  55. package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
  56. package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
  57. package/out/ui/packages/tabs/index.d.ts +1 -0
  58. package/out/ui/packages/tabs/init.luau +1 -0
  59. package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
  60. package/package.json +2 -2
@@ -2,6 +2,7 @@ import { FabSize } from "./fabSize";
2
2
  export interface FabStyleProps {
3
3
  size?: FabSize;
4
4
  disabled?: boolean;
5
+ extended?: boolean;
5
6
  }
6
7
  declare const useFabStyles: (props: FabStyleProps) => import("../../../../theme/index").ClassNameMap<string>;
7
8
  export default useFabStyles;
@@ -10,10 +10,12 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
10
10
  size = "medium"
11
11
  end
12
12
  local disabled = _param.disabled
13
+ local extended = _param.extended
13
14
  local diameter = fabPixels(size)
14
15
  return createStyles({
15
16
  root = {
16
- Size = UDim2.fromOffset(diameter, diameter),
17
+ Size = if extended == true then UDim2.new(0, 0, 0, diameter) else UDim2.fromOffset(diameter, diameter),
18
+ AutomaticSize = if extended == true then Enum.AutomaticSize.X else Enum.AutomaticSize.None,
17
19
  BackgroundColor3 = theme.palette.primary.main,
18
20
  BackgroundTransparency = if disabled then 0.5 else 0,
19
21
  BorderSizePixel = 0,
@@ -24,6 +26,17 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
24
26
  corner = {
25
27
  CornerRadius = UDim.new(1, 0),
26
28
  },
29
+ padding = {
30
+ PaddingLeft = UDim.new(0, theme.padding.calc(2)),
31
+ PaddingRight = UDim.new(0, theme.padding.calc(2.5)),
32
+ },
33
+ row = {
34
+ FillDirection = Enum.FillDirection.Horizontal,
35
+ VerticalAlignment = Enum.VerticalAlignment.Center,
36
+ HorizontalAlignment = Enum.HorizontalAlignment.Center,
37
+ SortOrder = Enum.SortOrder.LayoutOrder,
38
+ Padding = UDim.new(0, theme.padding.calc(1)),
39
+ },
27
40
  icon = {
28
41
  Size = UDim2.fromScale(1, 1),
29
42
  BackgroundTransparency = 1,
@@ -31,6 +44,18 @@ local useFabStyles = componentStyles("Fab", function(theme, _param)
31
44
  ScaleType = Enum.ScaleType.Fit,
32
45
  ImageColor3 = theme.palette.primary.on,
33
46
  ImageTransparency = if disabled then 0.5 else 0,
47
+ LayoutOrder = 1,
48
+ },
49
+ label = {
50
+ AutomaticSize = Enum.AutomaticSize.XY,
51
+ Size = UDim2.fromScale(0, 0),
52
+ BackgroundTransparency = 1,
53
+ BorderSizePixel = 0,
54
+ Font = theme.typography.fontFamilies.default,
55
+ TextSize = theme.typography.fontSizes.body,
56
+ TextColor3 = theme.palette.primary.on,
57
+ TextTransparency = if disabled then 0.5 else 0,
58
+ LayoutOrder = 2,
34
59
  },
35
60
  })
36
61
  end)
@@ -1,3 +1,4 @@
1
1
  export type FabSize = "small" | "medium" | "large";
2
2
  export declare function fabPixels(size?: FabSize): 40 | 64 | 56;
3
3
  export declare function fabIconPixels(size?: FabSize): 18 | 24 | 28;
4
+ export declare function fabExtended(label?: string): boolean;
@@ -23,7 +23,11 @@ local function fabIconPixels(size)
23
23
  end
24
24
  return 24
25
25
  end
26
+ local function fabExtended(label)
27
+ return label ~= nil and label ~= ""
28
+ end
26
29
  return {
27
30
  fabPixels = fabPixels,
28
31
  fabIconPixels = fabIconPixels,
32
+ fabExtended = fabExtended,
29
33
  }
@@ -1,3 +1,3 @@
1
1
  export { default as Fab } from "./components/Fab";
2
2
  export { FabProps } from "./components/Fab";
3
- export { FabSize, fabPixels, fabIconPixels } from "./components/fabSize";
3
+ export { FabSize, fabPixels, fabIconPixels, fabExtended } from "./components/fabSize";
@@ -5,4 +5,5 @@ exports.Fab = TS.import(script, script, "components", "Fab").default
5
5
  local _fabSize = TS.import(script, script, "components", "fabSize")
6
6
  exports.fabPixels = _fabSize.fabPixels
7
7
  exports.fabIconPixels = _fabSize.fabIconPixels
8
+ exports.fabExtended = _fabSize.fabExtended
8
9
  return exports
@@ -32,6 +32,7 @@ export * from "./cframeEditor/index";
32
32
  export * from "./enumPicker/index";
33
33
  export * from "./popup/index";
34
34
  export * from "./modal/index";
35
+ export * from "./backdrop/index";
35
36
  export * from "./dialog/index";
36
37
  export * from "./paper/index";
37
38
  export * from "./card/index";
@@ -103,6 +103,9 @@ end
103
103
  for _k, _v in TS.import(script, script, "modal") or {} do
104
104
  exports[_k] = _v
105
105
  end
106
+ for _k, _v in TS.import(script, script, "backdrop") or {} do
107
+ exports[_k] = _v
108
+ end
106
109
  for _k, _v in TS.import(script, script, "dialog") or {} do
107
110
  exports[_k] = _v
108
111
  end
@@ -0,0 +1,10 @@
1
+ import React from "@rbxts/react";
2
+ import { CustomizedProps } from "../../../../theme/index";
3
+ import { ContainerMaxWidth } from "./containerWidth";
4
+ export interface ContainerProps {
5
+ maxWidth?: ContainerMaxWidth;
6
+ disableGutters?: boolean;
7
+ children?: React.ReactNode;
8
+ }
9
+ declare function Container(props: CustomizedProps<Frame, ContainerProps>): JSX.Element;
10
+ export default Container;
@@ -0,0 +1,54 @@
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 useContainerStyles = TS.import(script, script.Parent, "Container.styles").default
5
+ local function Container(props)
6
+ local _binding = props
7
+ local maxWidth = _binding.maxWidth
8
+ local disableGutters = _binding.disableGutters
9
+ local children = _binding.children
10
+ local className = _binding.className
11
+ local sx = _binding.sx
12
+ local id = _binding.id
13
+ local ref = _binding.ref
14
+ local styles = useContainerStyles({
15
+ maxWidth = maxWidth,
16
+ disableGutters = disableGutters,
17
+ })
18
+ local _attributes = {}
19
+ local _condition = id
20
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
21
+ _condition = "Container"
22
+ end
23
+ _attributes.key = _condition
24
+ _attributes.ref = ref
25
+ for _k, _v in styles.root do
26
+ _attributes[_k] = _v
27
+ end
28
+ if className then
29
+ for _k, _v in className do
30
+ _attributes[_k] = _v
31
+ end
32
+ end
33
+ if sx then
34
+ for _k, _v in sx do
35
+ _attributes[_k] = _v
36
+ end
37
+ end
38
+ local _attributes_1 = {
39
+ key = "Inner",
40
+ }
41
+ for _k, _v in styles.inner do
42
+ _attributes_1[_k] = _v
43
+ end
44
+ local _attributes_2 = table.clone(styles.constraint)
45
+ setmetatable(_attributes_2, nil)
46
+ local _exp = React.createElement("uisizeconstraint", _attributes_2)
47
+ local _attributes_3 = table.clone(styles.gutter)
48
+ setmetatable(_attributes_3, nil)
49
+ return React.createElement("frame", _attributes, React.createElement("frame", _attributes_1, _exp, React.createElement("uipadding", _attributes_3), children))
50
+ end
51
+ local default = Container
52
+ return {
53
+ default = default,
54
+ }
@@ -0,0 +1,6 @@
1
+ import { ContainerMaxWidth } from "./containerWidth";
2
+ declare const useContainerStyles: (props: {
3
+ maxWidth?: ContainerMaxWidth;
4
+ disableGutters?: boolean;
5
+ }) => import("../../../../theme/index").ClassNameMap<string>;
6
+ export default useContainerStyles;
@@ -0,0 +1,41 @@
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 containerMaxPx = TS.import(script, script.Parent, "containerWidth").containerMaxPx
7
+ local useContainerStyles = componentStyles("Container", function(theme, _param)
8
+ local maxWidth = _param.maxWidth
9
+ local disableGutters = _param.disableGutters
10
+ local maxPx = containerMaxPx(maxWidth)
11
+ local gutter = theme.spacing.calc(2)
12
+ return createStyles({
13
+ root = {
14
+ AutomaticSize = Enum.AutomaticSize.Y,
15
+ Size = UDim2.new(1, 0, 0, 0),
16
+ BackgroundTransparency = 1,
17
+ BorderSizePixel = 0,
18
+ },
19
+ inner = {
20
+ AutomaticSize = Enum.AutomaticSize.Y,
21
+ Size = UDim2.new(1, 0, 0, 0),
22
+ Position = UDim2.new(0.5, 0, 0, 0),
23
+ AnchorPoint = Vector2.new(0.5, 0),
24
+ BackgroundTransparency = 1,
25
+ BorderSizePixel = 0,
26
+ },
27
+ constraint = {
28
+ MaxSize = if maxPx ~= nil then Vector2.new(maxPx, math.huge) else Vector2.new(math.huge, math.huge),
29
+ },
30
+ gutter = {
31
+ PaddingTop = UDim.new(0, 0),
32
+ PaddingBottom = UDim.new(0, 0),
33
+ PaddingLeft = UDim.new(0, if disableGutters == true then 0 else gutter),
34
+ PaddingRight = UDim.new(0, if disableGutters == true then 0 else gutter),
35
+ },
36
+ })
37
+ end)
38
+ local default = useContainerStyles
39
+ return {
40
+ default = default,
41
+ }
@@ -5,7 +5,7 @@ export interface GridProps {
5
5
  fillDirection?: Enum.FillDirection;
6
6
  fillDirectionMaxCells?: number;
7
7
  sortOrder?: Enum.SortOrder;
8
- startCorner: Enum.StartCorner;
8
+ startCorner?: Enum.StartCorner;
9
9
  horizontalAlignment?: Enum.HorizontalAlignment;
10
10
  verticalAlignment?: Enum.VerticalAlignment;
11
11
  }
@@ -0,0 +1,2 @@
1
+ export type ContainerMaxWidth = "xs" | "sm" | "md" | "lg" | "xl" | false;
2
+ export declare function containerMaxPx(maxWidth?: ContainerMaxWidth): number | undefined;
@@ -0,0 +1,17 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local WIDTHS = {
3
+ xs = 444,
4
+ sm = 600,
5
+ md = 900,
6
+ lg = 1200,
7
+ xl = 1536,
8
+ }
9
+ local function containerMaxPx(maxWidth)
10
+ if maxWidth == false then
11
+ return nil
12
+ end
13
+ return WIDTHS[maxWidth or "lg"]
14
+ end
15
+ return {
16
+ containerMaxPx = containerMaxPx,
17
+ }
@@ -11,3 +11,6 @@ export { default as Box } from "./components/Box";
11
11
  export { BoxProps } from "./components/Box";
12
12
  export { BoxPad } from "./components/boxPad";
13
13
  export { BoxBg } from "./components/Box.styles";
14
+ export { default as Container } from "./components/Container";
15
+ export { ContainerProps } from "./components/Container";
16
+ export { ContainerMaxWidth, containerMaxPx } from "./components/containerWidth";
@@ -11,4 +11,6 @@ for _k, _v in TS.import(script, script, "components", "List") or {} do
11
11
  end
12
12
  exports.Stack = TS.import(script, script, "components", "Stack").default
13
13
  exports.Box = TS.import(script, script, "components", "Box").default
14
+ exports.Container = TS.import(script, script, "components", "Container").default
15
+ exports.containerMaxPx = TS.import(script, script, "components", "containerWidth").containerMaxPx
14
16
  return exports
@@ -5,5 +5,5 @@ export interface ModalProps {
5
5
  onClose: () => void;
6
6
  children?: React.ReactNode;
7
7
  }
8
- declare function Modal(props: ModalProps): JSX.Element | undefined;
8
+ declare function Modal(props: ModalProps): JSX.Element;
9
9
  export default Modal;
@@ -4,10 +4,13 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local React = _react
5
5
  local useEffect = _react.useEffect
6
6
  local useRef = _react.useRef
7
+ local useState = _react.useState
7
8
  local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
8
9
  local GuiService = _services.GuiService
9
10
  local UserInputService = _services.UserInputService
10
- local Portal = TS.import(script, script.Parent.Parent.Parent, "popup").Portal
11
+ local _popup = TS.import(script, script.Parent.Parent.Parent, "popup")
12
+ local Portal = _popup.Portal
13
+ local portalTarget = _popup.portalTarget
11
14
  local isDismissInput = TS.import(script, script.Parent, "dismissInput").isDismissInput
12
15
  local _focusTrap = TS.import(script, script.Parent, "focusTrap")
13
16
  local isFocusable = _focusTrap.isFocusable
@@ -22,7 +25,14 @@ local function Modal(props)
22
25
  local styles = useModalStyles()
23
26
  local close = useRef(onClose)
24
27
  local surface = useRef()
28
+ local anchor = useRef()
29
+ local layer, setLayer = useState(function()
30
+ return portalTarget(host)
31
+ end)
25
32
  close.current = onClose
33
+ useEffect(function()
34
+ setLayer(portalTarget(host or anchor.current))
35
+ end, { host, open })
26
36
  useEffect(function()
27
37
  if not open then
28
38
  return nil
@@ -53,43 +63,51 @@ local function Modal(props)
53
63
  GuiService.SelectedObject = previous
54
64
  end
55
65
  end
56
- end, { open })
57
- if not open then
58
- return nil
59
- end
60
- local _attributes = {
61
- key = "Modal",
62
- }
63
- for _k, _v in styles.root do
64
- _attributes[_k] = _v
65
- end
66
- local _attributes_1 = {
67
- key = "Backdrop",
68
- }
69
- for _k, _v in styles.backdrop do
70
- _attributes_1[_k] = _v
71
- end
72
- _attributes_1.Event = {
73
- Activated = function()
74
- return close.current()
75
- end,
76
- }
77
- local _exp = React.createElement("textbutton", _attributes_1)
78
- local _attributes_2 = {
79
- key = "Surface",
80
- ref = surface,
81
- }
82
- for _k, _v in styles.surface do
83
- _attributes_2[_k] = _v
66
+ end, { open, layer })
67
+ local _exp = React.createElement("frame", {
68
+ key = "ModalAnchor",
69
+ ref = anchor,
70
+ Size = UDim2.fromOffset(0, 0),
71
+ BackgroundTransparency = 1,
72
+ BorderSizePixel = 0,
73
+ })
74
+ local _condition = open and layer ~= nil
75
+ if _condition then
76
+ local _attributes = {
77
+ key = "Modal",
78
+ }
79
+ for _k, _v in styles.root do
80
+ _attributes[_k] = _v
81
+ end
82
+ local _attributes_1 = {
83
+ key = "Backdrop",
84
+ }
85
+ for _k, _v in styles.backdrop do
86
+ _attributes_1[_k] = _v
87
+ end
88
+ _attributes_1.Event = {
89
+ Activated = function()
90
+ return close.current()
91
+ end,
92
+ }
93
+ local _exp_1 = React.createElement("textbutton", _attributes_1)
94
+ local _attributes_2 = {
95
+ key = "Surface",
96
+ ref = surface,
97
+ }
98
+ for _k, _v in styles.surface do
99
+ _attributes_2[_k] = _v
100
+ end
101
+ local _attributes_3 = table.clone(styles.padding)
102
+ setmetatable(_attributes_3, nil)
103
+ local _exp_2 = React.createElement("uipadding", _attributes_3)
104
+ local _attributes_4 = table.clone(styles.corner)
105
+ setmetatable(_attributes_4, nil)
106
+ _condition = (React.createElement(Portal, {
107
+ host = layer,
108
+ }, React.createElement("frame", _attributes, _exp_1, React.createElement("frame", _attributes_2, _exp_2, React.createElement("uicorner", _attributes_4), children))))
84
109
  end
85
- local _attributes_3 = table.clone(styles.padding)
86
- setmetatable(_attributes_3, nil)
87
- local _exp_1 = React.createElement("uipadding", _attributes_3)
88
- local _attributes_4 = table.clone(styles.corner)
89
- setmetatable(_attributes_4, nil)
90
- return React.createElement(Portal, {
91
- host = host,
92
- }, React.createElement("frame", _attributes, _exp, React.createElement("frame", _attributes_2, _exp_1, React.createElement("uicorner", _attributes_4), children)))
110
+ return React.createElement(React.Fragment, nil, _exp, _condition)
93
111
  end
94
112
  local default = Modal
95
113
  return {
@@ -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(#_exp_1)
44
- local _callback = function(item)
45
- local _attributes_2 = {
46
- key = tostring(item),
47
- }
48
- for _k, _v in cx(styles.page, item == page and styles.selected) do
49
- _attributes_2[_k] = _v
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
- _attributes_2.Text = tostring(item)
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 _exp_1 do
64
- _newValue[_k] = _callback(_v, _k - 1, _exp_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 declare function pageRange(count: number): number[];
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
- local pages = {}
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 page = 1
88
+ local i = total - boundaries + 1
6
89
  local _shouldIncrement = false
7
90
  while true do
8
91
  if _shouldIncrement then
9
- page += 1
92
+ i += 1
10
93
  else
11
94
  _shouldIncrement = true
12
95
  end
13
- if not (page <= math.max(0, math.floor(count))) then
96
+ if not (i <= total) then
14
97
  break
15
98
  end
16
- local _page = page
17
- table.insert(pages, _page)
99
+ local _i = i
100
+ table.insert(tokens, _i)
18
101
  end
19
102
  end
20
- return pages
103
+ return tokens
21
104
  end
22
105
  return {
23
106
  pageRange = pageRange,
@@ -1,2 +1,3 @@
1
1
  export { default as Pagination } from "./components/Pagination";
2
2
  export { PaginationProps } from "./components/Pagination";
3
+ export { pageRange, PageToken } from "./components/pageRange";
@@ -2,4 +2,5 @@
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
4
  exports.Pagination = TS.import(script, script, "components", "Pagination").default
5
+ exports.pageRange = TS.import(script, script, "components", "pageRange").pageRange
5
6
  return exports
@@ -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