@rbxts/uiblox 0.2.0-alpha.7 → 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.
@@ -6,6 +6,7 @@ export interface BreadcrumbItem {
6
6
  export interface BreadcrumbsProps {
7
7
  items: BreadcrumbItem[];
8
8
  separator?: string;
9
+ maxItems?: number;
9
10
  }
10
11
  declare function Breadcrumbs(props: CustomizedProps<Frame, BreadcrumbsProps>): JSX.Element;
11
12
  export default Breadcrumbs;
@@ -2,7 +2,9 @@
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local cx = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").cx
5
- local breadcrumbCurrent = TS.import(script, script.Parent, "breadcrumbItems").breadcrumbCurrent
5
+ local _breadcrumbItems = TS.import(script, script.Parent, "breadcrumbItems")
6
+ local breadcrumbCurrent = _breadcrumbItems.breadcrumbCurrent
7
+ local breadcrumbVisible = _breadcrumbItems.breadcrumbVisible
6
8
  local useBreadcrumbStyles = TS.import(script, script.Parent, "Breadcrumbs.styles").default
7
9
  local function Breadcrumbs(props)
8
10
  local _binding = props
@@ -11,11 +13,13 @@ local function Breadcrumbs(props)
11
13
  if separator == nil then
12
14
  separator = "/"
13
15
  end
16
+ local maxItems = _binding.maxItems
14
17
  local className = _binding.className
15
18
  local sx = _binding.sx
16
19
  local id = _binding.id
17
20
  local ref = _binding.ref
18
21
  local styles = useBreadcrumbStyles()
22
+ local visible = breadcrumbVisible(items, maxItems)
19
23
  local _attributes = {}
20
24
  local _condition = id
21
25
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -40,38 +44,68 @@ local function Breadcrumbs(props)
40
44
  setmetatable(_attributes_1, nil)
41
45
  local _exp = React.createElement("uilistlayout", _attributes_1)
42
46
  -- ▼ ReadonlyArray.map ▼
43
- local _newValue = table.create(#items)
44
- local _callback = function(item, index)
45
- local current = breadcrumbCurrent(index, #items)
46
- local _condition_1 = index > 0
47
+ local _newValue = table.create(#visible)
48
+ local _callback = function(entry, order)
49
+ local current = not entry.ellipsis and breadcrumbCurrent(entry.index, #items)
50
+ local item = if entry.ellipsis then nil else items[entry.index + 1]
51
+ local _condition_1 = order > 0
47
52
  if _condition_1 then
48
53
  local _attributes_2 = table.clone(styles.separator)
49
54
  setmetatable(_attributes_2, nil)
50
55
  _attributes_2.Text = separator
51
- _attributes_2.LayoutOrder = index * 2
56
+ _attributes_2.LayoutOrder = order * 2
52
57
  _condition_1 = React.createElement("textlabel", _attributes_2)
53
58
  end
54
- local _attributes_2 = table.clone(cx(styles.item, current and styles.current))
55
- setmetatable(_attributes_2, nil)
56
- _attributes_2.Text = item.label
57
- _attributes_2.LayoutOrder = index * 2 + 1
58
- _attributes_2.Active = not current and item.onActivated ~= nil
59
- _attributes_2.Selectable = not current and item.onActivated ~= nil
60
- _attributes_2.Event = {
61
- Activated = function()
62
- local _result = item.onActivated
63
- if _result ~= nil then
64
- _result = _result()
59
+ local _result
60
+ if entry.ellipsis then
61
+ local _attributes_2 = table.clone(styles.separator)
62
+ setmetatable(_attributes_2, nil)
63
+ _attributes_2.Text = "…"
64
+ _attributes_2.LayoutOrder = order * 2 + 1
65
+ _result = (React.createElement("textlabel", _attributes_2))
66
+ else
67
+ local _attributes_2 = table.clone(cx(styles.item, current and styles.current))
68
+ setmetatable(_attributes_2, nil)
69
+ _attributes_2.Text = entry.label
70
+ _attributes_2.LayoutOrder = order * 2 + 1
71
+ local _condition_2 = not current
72
+ if _condition_2 then
73
+ local _result_1 = item
74
+ if _result_1 ~= nil then
75
+ _result_1 = _result_1.onActivated
65
76
  end
66
- return _result
67
- end,
68
- }
77
+ _condition_2 = _result_1 ~= nil
78
+ end
79
+ _attributes_2.Active = _condition_2
80
+ local _condition_3 = not current
81
+ if _condition_3 then
82
+ local _result_1 = item
83
+ if _result_1 ~= nil then
84
+ _result_1 = _result_1.onActivated
85
+ end
86
+ _condition_3 = _result_1 ~= nil
87
+ end
88
+ _attributes_2.Selectable = _condition_3
89
+ _attributes_2.Event = {
90
+ Activated = function()
91
+ local _result_1 = item
92
+ if _result_1 ~= nil then
93
+ _result_1 = _result_1.onActivated
94
+ if _result_1 ~= nil then
95
+ _result_1 = _result_1()
96
+ end
97
+ end
98
+ return _result_1
99
+ end,
100
+ }
101
+ _result = (React.createElement("textbutton", _attributes_2))
102
+ end
69
103
  return React.createElement(React.Fragment, {
70
- key = `{item.label}-{index}`,
71
- }, _condition_1, React.createElement("textbutton", _attributes_2))
104
+ key = `{entry.label}-{order}`,
105
+ }, _condition_1, _result)
72
106
  end
73
- for _k, _v in items do
74
- _newValue[_k] = _callback(_v, _k - 1, items)
107
+ for _k, _v in visible do
108
+ _newValue[_k] = _callback(_v, _k - 1, visible)
75
109
  end
76
110
  -- ▲ ReadonlyArray.map ▲
77
111
  return React.createElement("frame", _attributes, _exp, _newValue)
@@ -1 +1,10 @@
1
1
  export declare function breadcrumbCurrent(index: number, count: number): boolean;
2
+ export interface BreadcrumbSlice {
3
+ label: string;
4
+ index: number;
5
+ ellipsis?: boolean;
6
+ }
7
+ /** Collapse middle items when over maxItems (keep ends). */
8
+ export declare function breadcrumbVisible<T extends {
9
+ label: string;
10
+ }>(items: T[], maxItems?: number): BreadcrumbSlice[];
@@ -2,6 +2,74 @@
2
2
  local function breadcrumbCurrent(index, count)
3
3
  return count > 0 and index == count - 1
4
4
  end
5
+ --* Collapse middle items when over maxItems (keep ends).
6
+ local function breadcrumbVisible(items, maxItems)
7
+ local count = #items
8
+ if maxItems == nil or maxItems < 1 or count <= maxItems then
9
+ local out = {}
10
+ do
11
+ local i = 0
12
+ local _shouldIncrement = false
13
+ while true do
14
+ if _shouldIncrement then
15
+ i += 1
16
+ else
17
+ _shouldIncrement = true
18
+ end
19
+ if not (i < count) then
20
+ break
21
+ end
22
+ local _arg0 = {
23
+ label = items[i + 1].label,
24
+ index = i,
25
+ }
26
+ table.insert(out, _arg0)
27
+ end
28
+ end
29
+ return out
30
+ end
31
+ if maxItems == 1 then
32
+ return { {
33
+ label = items[count].label,
34
+ index = count - 1,
35
+ } }
36
+ end
37
+ local keepEnd = 1
38
+ local rawStart = maxItems - keepEnd - 1
39
+ local keepStart = if rawStart < 1 then 1 else rawStart
40
+ local out = {}
41
+ do
42
+ local i = 0
43
+ local _shouldIncrement = false
44
+ while true do
45
+ if _shouldIncrement then
46
+ i += 1
47
+ else
48
+ _shouldIncrement = true
49
+ end
50
+ if not (i < keepStart) then
51
+ break
52
+ end
53
+ local _arg0 = {
54
+ label = items[i + 1].label,
55
+ index = i,
56
+ }
57
+ table.insert(out, _arg0)
58
+ end
59
+ end
60
+ table.insert(out, {
61
+ label = "…",
62
+ index = -1,
63
+ ellipsis = true,
64
+ })
65
+ local _arg0 = {
66
+ label = items[count].label,
67
+ index = count - 1,
68
+ }
69
+ table.insert(out, _arg0)
70
+ return out
71
+ end
5
72
  return {
6
73
  breadcrumbCurrent = breadcrumbCurrent,
74
+ breadcrumbVisible = breadcrumbVisible,
7
75
  }
@@ -1,2 +1,3 @@
1
1
  export { default as Breadcrumbs } from "./components/Breadcrumbs";
2
2
  export { BreadcrumbItem, BreadcrumbsProps } from "./components/Breadcrumbs";
3
+ export { breadcrumbCurrent, breadcrumbVisible } from "./components/breadcrumbItems";
@@ -2,4 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
4
  exports.Breadcrumbs = TS.import(script, script, "components", "Breadcrumbs").default
5
+ local _breadcrumbItems = TS.import(script, script, "components", "breadcrumbItems")
6
+ exports.breadcrumbCurrent = _breadcrumbItems.breadcrumbCurrent
7
+ exports.breadcrumbVisible = _breadcrumbItems.breadcrumbVisible
5
8
  return exports
@@ -3,6 +3,7 @@ import { Icons } from "../../../enums/index";
3
3
  import { FabSize } from "./fabSize";
4
4
  export interface FabProps {
5
5
  icon: Icons;
6
+ label?: string;
6
7
  size?: FabSize;
7
8
  disabled?: boolean;
8
9
  loading?: boolean;
@@ -8,11 +8,14 @@ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "t
8
8
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
9
9
  local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
10
10
  local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
11
- local fabIconPixels = TS.import(script, script.Parent, "fabSize").fabIconPixels
11
+ local _fabSize = TS.import(script, script.Parent, "fabSize")
12
+ local fabExtended = _fabSize.fabExtended
13
+ local fabIconPixels = _fabSize.fabIconPixels
12
14
  local useFabStyles = TS.import(script, script.Parent, "Fab.styles").default
13
15
  local function Fab(props)
14
16
  local _binding = props
15
17
  local icon = _binding.icon
18
+ local label = _binding.label
16
19
  local size = _binding.size
17
20
  if size == nil then
18
21
  size = "medium"
@@ -29,9 +32,11 @@ local function Fab(props)
29
32
  local id = _binding.id
30
33
  local ref = _binding.ref
31
34
  local active = canActivate(disabled, loading)
35
+ local extended = fabExtended(label)
32
36
  local styles = useFabStyles({
33
37
  size = size,
34
38
  disabled = not active,
39
+ extended = extended,
35
40
  })
36
41
  local _binding_1 = useTheme()
37
42
  local theme = _binding_1.theme
@@ -45,6 +50,34 @@ local function Fab(props)
45
50
  setHovering(false)
46
51
  setFocused(false)
47
52
  end, { active })
53
+ local _result
54
+ if loading then
55
+ _result = (React.createElement(CircularProgress, {
56
+ size = iconPx,
57
+ thickness = 2,
58
+ color = theme.palette.primary.on,
59
+ reducedMotion = reducedMotion,
60
+ className = if extended then {
61
+ LayoutOrder = 1,
62
+ } else {
63
+ AnchorPoint = Vector2.new(0.5, 0.5),
64
+ Position = UDim2.fromScale(0.5, 0.5),
65
+ },
66
+ }))
67
+ else
68
+ local _attributes = {
69
+ key = "Icon",
70
+ }
71
+ for _k, _v in styles.icon do
72
+ _attributes[_k] = _v
73
+ end
74
+ _attributes.Size = UDim2.fromOffset(iconPx, iconPx)
75
+ _attributes.AnchorPoint = if extended then Vector2.new(0, 0) else Vector2.new(0.5, 0.5)
76
+ _attributes.Position = if extended then UDim2.fromScale(0, 0) else UDim2.fromScale(0.5, 0.5)
77
+ _attributes.Image = tostring(icon)
78
+ _result = (React.createElement("imagelabel", _attributes))
79
+ end
80
+ local iconEl = _result
48
81
  local _attributes = {}
49
82
  local _condition = id
50
83
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -95,32 +128,31 @@ local function Fab(props)
95
128
  setmetatable(_attributes_1, nil)
96
129
  local _exp = React.createElement("uicorner", _attributes_1)
97
130
  local _exp_1 = React.createElement(Shadow)
98
- local _result
99
- if loading then
100
- _result = (React.createElement(CircularProgress, {
101
- size = iconPx,
102
- thickness = 2,
103
- color = theme.palette.primary.on,
104
- reducedMotion = reducedMotion,
105
- className = {
106
- AnchorPoint = Vector2.new(0.5, 0.5),
107
- Position = UDim2.fromScale(0.5, 0.5),
108
- },
109
- }))
110
- else
111
- local _attributes_2 = {
112
- key = "Icon",
113
- }
114
- for _k, _v in styles.icon do
115
- _attributes_2[_k] = _v
131
+ local _result_1
132
+ if extended then
133
+ local _attributes_2 = table.clone(styles.padding)
134
+ setmetatable(_attributes_2, nil)
135
+ local _exp_2 = React.createElement("uipadding", _attributes_2)
136
+ local _attributes_3 = table.clone(styles.row)
137
+ setmetatable(_attributes_3, nil)
138
+ local _exp_3 = React.createElement("uilistlayout", _attributes_3)
139
+ local _exp_4 = iconEl
140
+ local _condition_1 = not loading
141
+ if _condition_1 then
142
+ local _attributes_4 = {
143
+ key = "Label",
144
+ }
145
+ for _k, _v in styles.label do
146
+ _attributes_4[_k] = _v
147
+ end
148
+ _attributes_4.Text = label
149
+ _condition_1 = React.createElement("textlabel", _attributes_4)
116
150
  end
117
- _attributes_2.Size = UDim2.fromOffset(iconPx, iconPx)
118
- _attributes_2.AnchorPoint = Vector2.new(0.5, 0.5)
119
- _attributes_2.Position = UDim2.fromScale(0.5, 0.5)
120
- _attributes_2.Image = tostring(icon)
121
- _result = (React.createElement("imagelabel", _attributes_2))
151
+ _result_1 = (React.createElement(React.Fragment, nil, _exp_2, _exp_3, _exp_4, _condition_1))
152
+ else
153
+ _result_1 = iconEl
122
154
  end
123
- return React.createElement("textbutton", _attributes, _exp, _exp_1, _result)
155
+ return React.createElement("textbutton", _attributes, _exp, _exp_1, _result_1)
124
156
  end
125
157
  local default = Fab
126
158
  return {
@@ -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
@@ -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
@@ -1341,187 +1341,207 @@ local function chromeRows()
1341
1341
  local _Length_8 = #_array_9
1342
1342
  table.move(_array_9, 1, _Length_8, _length + 1, _array)
1343
1343
  _length += _Length_8
1344
- local _array_10 = pair("Breadcrumbs", "custom-separator", {
1345
- text = "Home > Item",
1344
+ local _array_10 = pair("Breadcrumbs", "collapsed", {
1345
+ text = "Home / … / Item",
1346
+ size = "small",
1346
1347
  })
1347
1348
  local _Length_9 = #_array_10
1348
1349
  table.move(_array_10, 1, _Length_9, _length + 1, _array)
1349
1350
  _length += _Length_9
1350
- local _array_11 = pair("Pagination", "first", {
1351
- value = 1,
1351
+ local _array_11 = pair("Breadcrumbs", "custom-separator", {
1352
+ text = "Home > Item",
1352
1353
  })
1353
1354
  local _Length_10 = #_array_11
1354
1355
  table.move(_array_11, 1, _Length_10, _length + 1, _array)
1355
1356
  _length += _Length_10
1356
- local _array_12 = pair("Pagination", "middle", {
1357
- value = 3,
1357
+ local _array_12 = pair("Pagination", "first", {
1358
+ value = 1,
1358
1359
  })
1359
1360
  local _Length_11 = #_array_12
1360
1361
  table.move(_array_12, 1, _Length_11, _length + 1, _array)
1361
1362
  _length += _Length_11
1362
- local _array_13 = pair("Pagination", "disabled", {
1363
- value = 2,
1364
- disabled = true,
1363
+ local _array_13 = pair("Pagination", "middle", {
1364
+ value = 3,
1365
1365
  })
1366
1366
  local _Length_12 = #_array_13
1367
1367
  table.move(_array_13, 1, _Length_12, _length + 1, _array)
1368
1368
  _length += _Length_12
1369
- local _array_14 = pair("Stepper", "first", {
1370
- value = 0,
1369
+ local _array_14 = pair("Pagination", "collapsed", {
1370
+ value = 10,
1371
+ size = "large",
1371
1372
  })
1372
1373
  local _Length_13 = #_array_14
1373
1374
  table.move(_array_14, 1, _Length_13, _length + 1, _array)
1374
1375
  _length += _Length_13
1375
- local _array_15 = pair("Stepper", "middle", {
1376
- value = 1,
1376
+ local _array_15 = pair("Pagination", "disabled", {
1377
+ value = 2,
1378
+ disabled = true,
1377
1379
  })
1378
1380
  local _Length_14 = #_array_15
1379
1381
  table.move(_array_15, 1, _Length_14, _length + 1, _array)
1380
1382
  _length += _Length_14
1381
- local _array_16 = pair("Stepper", "last", {
1382
- value = 2,
1383
+ local _array_16 = pair("Stepper", "first", {
1384
+ value = 0,
1383
1385
  })
1384
1386
  local _Length_15 = #_array_16
1385
1387
  table.move(_array_16, 1, _Length_15, _length + 1, _array)
1386
1388
  _length += _Length_15
1387
- local _array_17 = pair("Accordion", "closed", {
1388
- open = false,
1389
+ local _array_17 = pair("Stepper", "middle", {
1390
+ value = 1,
1389
1391
  })
1390
1392
  local _Length_16 = #_array_17
1391
1393
  table.move(_array_17, 1, _Length_16, _length + 1, _array)
1392
1394
  _length += _Length_16
1393
- local _array_18 = pair("Accordion", "open", {
1394
- open = true,
1395
+ local _array_18 = pair("Stepper", "last", {
1396
+ value = 2,
1395
1397
  })
1396
1398
  local _Length_17 = #_array_18
1397
1399
  table.move(_array_18, 1, _Length_17, _length + 1, _array)
1398
1400
  _length += _Length_17
1399
- local _array_19 = pair("Snackbar", "open", {
1400
- open = true,
1401
- text = "Saved",
1401
+ local _array_19 = pair("Accordion", "closed", {
1402
+ open = false,
1402
1403
  })
1403
1404
  local _Length_18 = #_array_19
1404
1405
  table.move(_array_19, 1, _Length_18, _length + 1, _array)
1405
1406
  _length += _Length_18
1406
- local _array_20 = pair("Snackbar", "closed", {
1407
- open = false,
1408
- text = "Saved",
1407
+ local _array_20 = pair("Accordion", "open", {
1408
+ open = true,
1409
1409
  })
1410
1410
  local _Length_19 = #_array_20
1411
1411
  table.move(_array_20, 1, _Length_19, _length + 1, _array)
1412
1412
  _length += _Length_19
1413
- local _array_21 = pair("Table", "empty", {
1414
- text = "",
1413
+ local _array_21 = pair("Snackbar", "open", {
1414
+ open = true,
1415
+ text = "Saved",
1415
1416
  })
1416
1417
  local _Length_20 = #_array_21
1417
1418
  table.move(_array_21, 1, _Length_20, _length + 1, _array)
1418
1419
  _length += _Length_20
1419
- local _array_22 = pair("Table", "default", {
1420
- text = "Name / Role",
1420
+ local _array_22 = pair("Snackbar", "closed", {
1421
+ open = false,
1422
+ text = "Saved",
1421
1423
  })
1422
1424
  local _Length_21 = #_array_22
1423
1425
  table.move(_array_22, 1, _Length_21, _length + 1, _array)
1424
1426
  _length += _Length_21
1425
- local _array_23 = pair("Table", "selected", {
1426
- text = "Name / Role",
1427
- value = 0,
1427
+ local _array_23 = pair("Table", "empty", {
1428
+ text = "",
1428
1429
  })
1429
1430
  local _Length_22 = #_array_23
1430
1431
  table.move(_array_23, 1, _Length_22, _length + 1, _array)
1431
1432
  _length += _Length_22
1432
- local _array_24 = pair("Autocomplete", "default", {
1433
- value = "Continue",
1434
- options = { "Continue", "Other" },
1433
+ local _array_24 = pair("Table", "default", {
1434
+ text = "Name / Role",
1435
1435
  })
1436
1436
  local _Length_23 = #_array_24
1437
1437
  table.move(_array_24, 1, _Length_23, _length + 1, _array)
1438
1438
  _length += _Length_23
1439
- local _array_25 = pair("Autocomplete", "open", {
1440
- value = "Continue",
1441
- options = { "Continue", "Other" },
1442
- open = true,
1439
+ local _array_25 = pair("Table", "selected", {
1440
+ text = "Name / Role",
1441
+ value = 0,
1443
1442
  })
1444
1443
  local _Length_24 = #_array_25
1445
1444
  table.move(_array_25, 1, _Length_24, _length + 1, _array)
1446
1445
  _length += _Length_24
1447
- local _array_26 = pair("Autocomplete", "disabled", {
1446
+ local _array_26 = pair("Autocomplete", "default", {
1448
1447
  value = "Continue",
1449
1448
  options = { "Continue", "Other" },
1450
- disabled = true,
1451
1449
  })
1452
1450
  local _Length_25 = #_array_26
1453
1451
  table.move(_array_26, 1, _Length_25, _length + 1, _array)
1454
1452
  _length += _Length_25
1455
- local _array_27 = pair("Autocomplete", "empty", {
1456
- value = "",
1457
- options = {},
1453
+ local _array_27 = pair("Autocomplete", "open", {
1454
+ value = "Continue",
1455
+ options = { "Continue", "Other" },
1458
1456
  open = true,
1459
1457
  })
1460
1458
  local _Length_26 = #_array_27
1461
1459
  table.move(_array_27, 1, _Length_26, _length + 1, _array)
1462
1460
  _length += _Length_26
1463
- local _array_28 = pair("Autocomplete", "no-results", {
1461
+ local _array_28 = pair("Autocomplete", "disabled", {
1464
1462
  value = "Continue",
1465
1463
  options = { "Continue", "Other" },
1466
- open = true,
1467
- filter = "zzz",
1464
+ disabled = true,
1468
1465
  })
1469
1466
  local _Length_27 = #_array_28
1470
1467
  table.move(_array_28, 1, _Length_27, _length + 1, _array)
1471
1468
  _length += _Length_27
1472
- local _array_29 = pair("Fab", "default")
1469
+ local _array_29 = pair("Autocomplete", "empty", {
1470
+ value = "",
1471
+ options = {},
1472
+ open = true,
1473
+ })
1473
1474
  local _Length_28 = #_array_29
1474
1475
  table.move(_array_29, 1, _Length_28, _length + 1, _array)
1475
1476
  _length += _Length_28
1476
- local _array_30 = pair("Fab", "small", {
1477
- size = "small",
1477
+ local _array_30 = pair("Autocomplete", "no-results", {
1478
+ value = "Continue",
1479
+ options = { "Continue", "Other" },
1480
+ open = true,
1481
+ filter = "zzz",
1478
1482
  })
1479
1483
  local _Length_29 = #_array_30
1480
1484
  table.move(_array_30, 1, _Length_29, _length + 1, _array)
1481
1485
  _length += _Length_29
1482
- local _array_31 = pair("Fab", "large", {
1483
- size = "large",
1484
- })
1486
+ local _array_31 = pair("Fab", "default")
1485
1487
  local _Length_30 = #_array_31
1486
1488
  table.move(_array_31, 1, _Length_30, _length + 1, _array)
1487
1489
  _length += _Length_30
1488
- local _array_32 = pair("Fab", "disabled", {
1489
- disabled = true,
1490
+ local _array_32 = pair("Fab", "extended", {
1491
+ text = "Compose",
1490
1492
  })
1491
1493
  local _Length_31 = #_array_32
1492
1494
  table.move(_array_32, 1, _Length_31, _length + 1, _array)
1493
1495
  _length += _Length_31
1494
- local _array_33 = pair("Fab", "loading", {
1495
- loading = true,
1496
+ local _array_33 = pair("Fab", "small", {
1497
+ size = "small",
1496
1498
  })
1497
1499
  local _Length_32 = #_array_33
1498
1500
  table.move(_array_33, 1, _Length_32, _length + 1, _array)
1499
1501
  _length += _Length_32
1500
- local _array_34 = pair("AppBar", "default", {
1501
- text = "Storyblox",
1502
+ local _array_34 = pair("Fab", "large", {
1503
+ size = "large",
1502
1504
  })
1503
1505
  local _Length_33 = #_array_34
1504
1506
  table.move(_array_34, 1, _Length_33, _length + 1, _array)
1505
1507
  _length += _Length_33
1506
- local _array_35 = pair("AppBar", "flat", {
1507
- text = "Storyblox",
1508
- variant = "flat",
1508
+ local _array_35 = pair("Fab", "disabled", {
1509
+ disabled = true,
1509
1510
  })
1510
1511
  local _Length_34 = #_array_35
1511
1512
  table.move(_array_35, 1, _Length_34, _length + 1, _array)
1512
1513
  _length += _Length_34
1513
- local _array_36 = pair("AppBar", "raised", {
1514
- text = "Storyblox",
1515
- variant = "raised",
1514
+ local _array_36 = pair("Fab", "loading", {
1515
+ loading = true,
1516
1516
  })
1517
1517
  local _Length_35 = #_array_36
1518
1518
  table.move(_array_36, 1, _Length_35, _length + 1, _array)
1519
1519
  _length += _Length_35
1520
- local _array_37 = pair("BottomNavigation", "default", {
1520
+ local _array_37 = pair("AppBar", "default", {
1521
+ text = "Storyblox",
1522
+ })
1523
+ local _Length_36 = #_array_37
1524
+ table.move(_array_37, 1, _Length_36, _length + 1, _array)
1525
+ _length += _Length_36
1526
+ local _array_38 = pair("AppBar", "flat", {
1527
+ text = "Storyblox",
1528
+ variant = "flat",
1529
+ })
1530
+ local _Length_37 = #_array_38
1531
+ table.move(_array_38, 1, _Length_37, _length + 1, _array)
1532
+ _length += _Length_37
1533
+ local _array_39 = pair("AppBar", "raised", {
1534
+ text = "Storyblox",
1535
+ variant = "raised",
1536
+ })
1537
+ local _Length_38 = #_array_39
1538
+ table.move(_array_39, 1, _Length_38, _length + 1, _array)
1539
+ _length += _Length_38
1540
+ local _array_40 = pair("BottomNavigation", "default", {
1521
1541
  value = "Home",
1522
1542
  options = { "Home", "Search", "Profile" },
1523
1543
  })
1524
- table.move(_array_37, 1, #_array_37, _length + 1, _array)
1544
+ table.move(_array_40, 1, #_array_40, _length + 1, _array)
1525
1545
  return _array
1526
1546
  end
1527
1547
  local function miscRows()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.2.0-alpha.7",
3
+ "version": "0.2.0-alpha.8",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.luau",
6
6
  "packageManager": "pnpm@11.3.0",