@rbxts/uiblox 0.2.0-alpha.4 → 0.2.0-alpha.5

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 (43) hide show
  1. package/out/ui/packages/autocomplete/components/Autocomplete.luau +8 -0
  2. package/out/ui/packages/chip/components/Chip.d.ts +1 -0
  3. package/out/ui/packages/chip/components/Chip.luau +37 -2
  4. package/out/ui/packages/chip/components/Chip.styles.d.ts +1 -0
  5. package/out/ui/packages/chip/components/Chip.styles.luau +29 -1
  6. package/out/ui/packages/formText/components/FormHelperText.d.ts +8 -0
  7. package/out/ui/packages/formText/components/FormHelperText.luau +44 -0
  8. package/out/ui/packages/formText/components/FormLabel.d.ts +9 -0
  9. package/out/ui/packages/formText/components/FormLabel.luau +46 -0
  10. package/out/ui/packages/formText/components/FormText.styles.d.ts +5 -0
  11. package/out/ui/packages/formText/components/FormText.styles.luau +33 -0
  12. package/out/ui/packages/formText/index.d.ts +4 -0
  13. package/out/ui/packages/formText/init.luau +6 -0
  14. package/out/ui/packages/index.d.ts +2 -0
  15. package/out/ui/packages/init.luau +6 -0
  16. package/out/ui/packages/layout/components/Stack.d.ts +12 -0
  17. package/out/ui/packages/layout/components/Stack.luau +49 -0
  18. package/out/ui/packages/layout/components/Stack.styles.d.ts +8 -0
  19. package/out/ui/packages/layout/components/Stack.styles.luau +72 -0
  20. package/out/ui/packages/layout/components/stackAlign.d.ts +8 -0
  21. package/out/ui/packages/layout/components/stackAlign.luau +29 -0
  22. package/out/ui/packages/layout/index.d.ts +3 -0
  23. package/out/ui/packages/layout/init.luau +1 -0
  24. package/out/ui/packages/menu/components/Menu.d.ts +3 -0
  25. package/out/ui/packages/menu/components/Menu.luau +48 -23
  26. package/out/ui/packages/menu/components/Menu.styles.luau +5 -1
  27. package/out/ui/packages/select/components/Select.d.ts +5 -0
  28. package/out/ui/packages/select/components/Select.luau +48 -24
  29. package/out/ui/packages/select/components/Select.styles.luau +1 -1
  30. package/out/ui/packages/speedDial/components/SpeedDial.d.ts +17 -0
  31. package/out/ui/packages/speedDial/components/SpeedDial.luau +92 -0
  32. package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +2 -0
  33. package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +26 -0
  34. package/out/ui/packages/speedDial/index.d.ts +2 -0
  35. package/out/ui/packages/speedDial/init.luau +5 -0
  36. package/out/ui/packages/stateMatrix.luau +193 -75
  37. package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +6 -0
  38. package/out/ui/packages/virtualList/components/EmptyListHint.luau +32 -0
  39. package/out/ui/packages/virtualList/components/EmptyListHint.styles.d.ts +5 -0
  40. package/out/ui/packages/virtualList/components/EmptyListHint.styles.luau +26 -0
  41. package/out/ui/packages/virtualList/index.d.ts +2 -0
  42. package/out/ui/packages/virtualList/init.luau +1 -0
  43. package/package.json +2 -2
@@ -3,6 +3,7 @@ local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local ListItem = TS.import(script, script.Parent.Parent.Parent, "listItem").ListItem
5
5
  local Popup = TS.import(script, script.Parent.Parent.Parent, "popup").Popup
6
+ local EmptyListHint = TS.import(script, script.Parent.Parent.Parent, "virtualList").EmptyListHint
6
7
  local useMenuStyles = TS.import(script, script.Parent, "Menu.styles").default
7
8
  local ROW = 28
8
9
  local function Menu(props)
@@ -12,10 +13,14 @@ local function Menu(props)
12
13
  local items = _binding.items
13
14
  local onSelect = _binding.onSelect
14
15
  local onClose = _binding.onClose
16
+ local emptyText = _binding.emptyText
17
+ local empty = _binding.empty
15
18
  local styles = useMenuStyles()
16
19
  if not open then
17
20
  return nil
18
21
  end
22
+ local vacant = #items == 0
23
+ local height = if vacant then ROW else #items * ROW
19
24
  local _attributes = {
20
25
  key = "Surface",
21
26
  }
@@ -25,34 +30,54 @@ local function Menu(props)
25
30
  local _attributes_1 = table.clone(styles.corner)
26
31
  setmetatable(_attributes_1, nil)
27
32
  local _exp = React.createElement("uicorner", _attributes_1)
28
- local _attributes_2 = table.clone(styles.list)
33
+ local _attributes_2 = table.clone(styles.stroke)
29
34
  setmetatable(_attributes_2, nil)
30
- local _exp_1 = React.createElement("uilistlayout", _attributes_2)
31
- -- ▼ ReadonlyArray.map ▼
32
- local _newValue = table.create(#items)
33
- local _callback = function(item)
34
- return React.createElement(ListItem, {
35
- key = item.id,
36
- text = item.text,
37
- disabled = item.disabled,
38
- onActivated = function()
39
- if item.disabled == true then
40
- return nil
41
- end
42
- onSelect(item.id)
43
- onClose()
44
- end,
45
- })
35
+ local _exp_1 = React.createElement("uistroke", _attributes_2)
36
+ local _attributes_3 = table.clone(styles.list)
37
+ setmetatable(_attributes_3, nil)
38
+ local _exp_2 = React.createElement("uilistlayout", _attributes_3)
39
+ local _result
40
+ if vacant then
41
+ local _condition = empty
42
+ if _condition == nil then
43
+ local _attributes_4 = {}
44
+ local _condition_1 = emptyText
45
+ if _condition_1 == nil then
46
+ _condition_1 = "No options"
47
+ end
48
+ _attributes_4.text = _condition_1
49
+ _attributes_4.height = ROW
50
+ _condition = React.createElement(EmptyListHint, _attributes_4)
51
+ end
52
+ _result = _condition
53
+ else
54
+ -- ▼ ReadonlyArray.map ▼
55
+ local _newValue = table.create(#items)
56
+ local _callback = function(item)
57
+ return React.createElement(ListItem, {
58
+ key = item.id,
59
+ text = item.text,
60
+ disabled = item.disabled,
61
+ onActivated = function()
62
+ if item.disabled == true then
63
+ return nil
64
+ end
65
+ onSelect(item.id)
66
+ onClose()
67
+ end,
68
+ })
69
+ end
70
+ for _k, _v in items do
71
+ _newValue[_k] = _callback(_v, _k - 1, items)
72
+ end
73
+ -- ▲ ReadonlyArray.map ▲
74
+ _result = _newValue
46
75
  end
47
- for _k, _v in items do
48
- _newValue[_k] = _callback(_v, _k - 1, items)
49
- end
50
- -- ▲ ReadonlyArray.map ▲
51
76
  return React.createElement(Popup, {
52
77
  anchor = anchor,
53
- preferredHeight = #items * ROW,
78
+ preferredHeight = height,
54
79
  onDismiss = onClose,
55
- }, React.createElement("frame", _attributes, _exp, _exp_1, _newValue))
80
+ }, React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, _result))
56
81
  end
57
82
  local default = Menu
58
83
  return {
@@ -8,12 +8,16 @@ local useMenuStyles = componentStyles("Menu", function(theme)
8
8
  surface = {
9
9
  Size = UDim2.new(1, 0, 0, 0),
10
10
  AutomaticSize = Enum.AutomaticSize.Y,
11
- BackgroundColor3 = theme.palette.surface.paper,
11
+ BackgroundColor3 = theme.palette.surface.elevated,
12
12
  BorderSizePixel = 0,
13
13
  },
14
14
  corner = {
15
15
  CornerRadius = UDim.new(0, theme.shape.borderRadius),
16
16
  },
17
+ stroke = {
18
+ Color = theme.palette.border,
19
+ ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
20
+ },
17
21
  list = {
18
22
  FillDirection = Enum.FillDirection.Vertical,
19
23
  SortOrder = Enum.SortOrder.LayoutOrder,
@@ -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
  }
@@ -20,7 +20,9 @@ local Input = TS.import(script, script.Parent.Parent.Parent, "input").Input
20
20
  local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion").playProperty
21
21
  local Popup = TS.import(script, script.Parent.Parent.Parent, "popup").Popup
22
22
  local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
23
- local VirtualList = TS.import(script, script.Parent.Parent.Parent, "virtualList").VirtualList
23
+ local _virtualList = TS.import(script, script.Parent.Parent.Parent, "virtualList")
24
+ local EmptyListHint = _virtualList.EmptyListHint
25
+ local VirtualList = _virtualList.VirtualList
24
26
  local useSelectStyles = TS.import(script, script.Parent, "Select.styles").default
25
27
  local optionLabel = TS.import(script, script.Parent, "optionLabel").optionLabel
26
28
  local _selectFilter = TS.import(script, script.Parent, "selectFilter")
@@ -53,6 +55,10 @@ local function Select(props)
53
55
  placeholder = ""
54
56
  end
55
57
  local searchable = _binding.searchable
58
+ local defaultOpen = _binding.defaultOpen
59
+ local defaultQuery = _binding.defaultQuery
60
+ local emptyText = _binding.emptyText
61
+ local empty = _binding.empty
56
62
  local reducedProp = _binding.reducedMotion
57
63
  local size = _binding.size
58
64
  local className = _binding.className
@@ -68,11 +74,15 @@ local function Select(props)
68
74
  local row = controlMetrics(theme.density, size).height
69
75
  local active = canActivate(disabled, loading)
70
76
  local anchor, setAnchor = useState()
71
- local open, setOpen = useState(false)
77
+ local open, setOpen = useState(defaultOpen == true and not loading)
72
78
  local held, setHeld = useState(false)
73
79
  local focused, setFocused = useState(false)
74
80
  local highlight, setHighlight = useState(-1)
75
- local query, setQuery = useState("")
81
+ local _condition = defaultQuery
82
+ if _condition == nil then
83
+ _condition = ""
84
+ end
85
+ local query, setQuery = useState(_condition)
76
86
  local recent = useRef()
77
87
  local typed = useRef()
78
88
  local onKeyRef = useRef()
@@ -95,7 +105,20 @@ local function Select(props)
95
105
  local search = usesSelectSearch(#options, searchable)
96
106
  local filtered = filterChoices(options, query)
97
107
  local rows = groupRows(filtered)
98
- local menuHeight = math.min(#rows * row, theme.spacing.calc(16)) + (if search then row else 0)
108
+ local listHeight = if #rows == 0 then row else math.min(#rows * row, theme.spacing.calc(16))
109
+ local menuHeight = listHeight + (if search then row else 0)
110
+ local _condition_1 = empty
111
+ if _condition_1 == nil then
112
+ local _attributes = {}
113
+ local _condition_2 = emptyText
114
+ if _condition_2 == nil then
115
+ _condition_2 = (if #query > 0 or #options > 0 then "No results" else "No options")
116
+ end
117
+ _attributes.text = _condition_2
118
+ _attributes.height = row
119
+ _condition_1 = (React.createElement(EmptyListHint, _attributes))
120
+ end
121
+ local emptyHint = _condition_1
99
122
  local close = function()
100
123
  setOpen(false)
101
124
  setQuery("")
@@ -125,15 +148,15 @@ local function Select(props)
125
148
  if fromPointer == nil then
126
149
  fromPointer = false
127
150
  end
128
- local _condition = fromPointer
129
- if _condition then
151
+ local _condition_2 = fromPointer
152
+ if _condition_2 then
130
153
  local _result_1 = listRef.current
131
154
  if _result_1 ~= nil then
132
155
  _result_1 = _result_1.suppressClick()
133
156
  end
134
- _condition = _result_1
157
+ _condition_2 = _result_1
135
158
  end
136
- if _condition then
159
+ if _condition_2 then
137
160
  return nil
138
161
  end
139
162
  local choice = filtered[index + 1]
@@ -254,11 +277,11 @@ local function Select(props)
254
277
  end
255
278
  end, { shown, held, reducedMotion })
256
279
  local _attributes = {}
257
- local _condition = id
258
- if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
259
- _condition = "Select"
280
+ local _condition_2 = id
281
+ if not (_condition_2 ~= 0 and _condition_2 == _condition_2 and _condition_2 ~= "" and _condition_2) then
282
+ _condition_2 = "Select"
260
283
  end
261
- _attributes.key = _condition
284
+ _attributes.key = _condition_2
262
285
  _attributes.ref = ref
263
286
  for _k, _v in styles.root do
264
287
  _attributes[_k] = _v
@@ -290,11 +313,11 @@ local function Select(props)
290
313
  if _result_2 ~= nil then
291
314
  _result_2 = _result_2.label
292
315
  end
293
- local _condition_1 = _result_2
294
- if _condition_1 == nil then
295
- _condition_1 = placeholder
316
+ local _condition_3 = _result_2
317
+ if _condition_3 == nil then
318
+ _condition_3 = placeholder
296
319
  end
297
- _result_1 = _condition_1
320
+ _result_1 = _condition_3
298
321
  end
299
322
  _attributes_1.Text = _result_1
300
323
  _attributes_1.Active = active
@@ -337,8 +360,8 @@ local function Select(props)
337
360
  Position = UDim2.new(1, -theme.padding.calc(1), 0.5, 0),
338
361
  },
339
362
  })))
340
- local _condition_1 = (shown or held)
341
- if _condition_1 then
363
+ local _condition_3 = (shown or held)
364
+ if _condition_3 then
342
365
  local _attributes_5 = {
343
366
  key = "Menu",
344
367
  }
@@ -356,8 +379,8 @@ local function Select(props)
356
379
  FillDirection = Enum.FillDirection.Vertical,
357
380
  SortOrder = Enum.SortOrder.LayoutOrder,
358
381
  })
359
- local _condition_2 = search
360
- if _condition_2 then
382
+ local _condition_4 = search
383
+ if _condition_4 then
361
384
  local _attributes_8 = {
362
385
  key = "Search",
363
386
  }
@@ -365,7 +388,7 @@ local function Select(props)
365
388
  _attributes_8[_k] = _v
366
389
  end
367
390
  _attributes_8.LayoutOrder = 1
368
- _condition_2 = (React.createElement("frame", _attributes_8, React.createElement(Input, {
391
+ _condition_4 = (React.createElement("frame", _attributes_8, React.createElement(Input, {
369
392
  text = query,
370
393
  placeholder = "Search",
371
394
  width = UDim.new(1, 0),
@@ -375,7 +398,7 @@ local function Select(props)
375
398
  end,
376
399
  })))
377
400
  end
378
- _condition_1 = (React.createElement(Popup, {
401
+ _condition_3 = (React.createElement(Popup, {
379
402
  anchor = anchor,
380
403
  preferredHeight = menuHeight,
381
404
  onDismiss = close,
@@ -387,7 +410,7 @@ local function Select(props)
387
410
  Size = UDim2.fromScale(1, 1),
388
411
  BackgroundTransparency = 1,
389
412
  GroupTransparency = 1,
390
- }, React.createElement("frame", _attributes_5, _exp_3, _exp_4, _exp_5, _exp_6, _condition_2, React.createElement("frame", {
413
+ }, React.createElement("frame", _attributes_5, _exp_3, _exp_4, _exp_5, _exp_6, _condition_4, React.createElement("frame", {
391
414
  key = "ListHost",
392
415
  Size = UDim2.new(1, 0, 1, if search then -row else 0),
393
416
  BackgroundTransparency = 1,
@@ -400,6 +423,7 @@ local function Select(props)
400
423
  end,
401
424
  itemHeight = row,
402
425
  listRef = listRef,
426
+ empty = emptyHint,
403
427
  className = styles.list,
404
428
  renderItem = function(row)
405
429
  if row.kind == "header" then
@@ -447,7 +471,7 @@ local function Select(props)
447
471
  end,
448
472
  }))))))
449
473
  end
450
- return React.createElement("frame", _attributes, _exp_2, _condition_1)
474
+ return React.createElement("frame", _attributes, _exp_2, _condition_3)
451
475
  end
452
476
  local default = Select
453
477
  return {
@@ -44,7 +44,7 @@ local useSelectStyles = componentStyles("Select", function(theme, _param)
44
44
  },
45
45
  list = {
46
46
  Size = UDim2.fromScale(1, 1),
47
- BackgroundColor3 = theme.palette.surface.elevated,
47
+ BackgroundTransparency = 1,
48
48
  BorderSizePixel = 0,
49
49
  ScrollBarThickness = theme.padding.default,
50
50
  ScrollBarImageColor3 = theme.palette.text.secondary,
@@ -0,0 +1,17 @@
1
+ import { CustomizedProps } from "../../../../theme/index";
2
+ import { Icons } from "../../../enums/index";
3
+ export interface SpeedDialAction {
4
+ icon: Icons;
5
+ disabled?: boolean;
6
+ onClick?: () => void;
7
+ }
8
+ export interface SpeedDialProps {
9
+ open: boolean;
10
+ onOpenChange: (open: boolean) => void;
11
+ actions: SpeedDialAction[];
12
+ icon?: Icons;
13
+ openIcon?: Icons;
14
+ disabled?: boolean;
15
+ }
16
+ declare function SpeedDial(props: CustomizedProps<Frame, SpeedDialProps>): JSX.Element;
17
+ export default SpeedDial;
@@ -0,0 +1,92 @@
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 Fab = TS.import(script, script.Parent.Parent.Parent, "fab").Fab
6
+ local useSpeedDialStyles = TS.import(script, script.Parent, "SpeedDial.styles").default
7
+ local function SpeedDial(props)
8
+ local _binding = props
9
+ local open = _binding.open
10
+ local onOpenChange = _binding.onOpenChange
11
+ local actions = _binding.actions
12
+ local icon = _binding.icon
13
+ if icon == nil then
14
+ icon = Icons.OpenBox
15
+ end
16
+ local openIcon = _binding.openIcon
17
+ if openIcon == nil then
18
+ openIcon = Icons.Close
19
+ end
20
+ local disabled = _binding.disabled
21
+ local className = _binding.className
22
+ local sx = _binding.sx
23
+ local id = _binding.id
24
+ local ref = _binding.ref
25
+ local styles = useSpeedDialStyles()
26
+ local _attributes = {}
27
+ local _condition = id
28
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
29
+ _condition = "SpeedDial"
30
+ end
31
+ _attributes.key = _condition
32
+ _attributes.ref = ref
33
+ for _k, _v in styles.root do
34
+ _attributes[_k] = _v
35
+ end
36
+ if className then
37
+ for _k, _v in className do
38
+ _attributes[_k] = _v
39
+ end
40
+ end
41
+ if sx then
42
+ for _k, _v in sx do
43
+ _attributes[_k] = _v
44
+ end
45
+ end
46
+ local _attributes_1 = table.clone(styles.list)
47
+ setmetatable(_attributes_1, nil)
48
+ local _exp = React.createElement("uilistlayout", _attributes_1)
49
+ local _condition_1 = open
50
+ if _condition_1 then
51
+ -- ▼ ReadonlyArray.map ▼
52
+ local _newValue = table.create(#actions)
53
+ local _callback = function(action, index)
54
+ return React.createElement(Fab, {
55
+ key = `Action-{index}`,
56
+ icon = action.icon,
57
+ size = "small",
58
+ disabled = disabled == true or action.disabled == true,
59
+ onClick = function()
60
+ local _result = action.onClick
61
+ if _result ~= nil then
62
+ _result()
63
+ end
64
+ onOpenChange(false)
65
+ end,
66
+ className = {
67
+ LayoutOrder = index,
68
+ },
69
+ })
70
+ end
71
+ for _k, _v in actions do
72
+ _newValue[_k] = _callback(_v, _k - 1, actions)
73
+ end
74
+ -- ▲ ReadonlyArray.map ▲
75
+ _condition_1 = _newValue
76
+ end
77
+ return React.createElement("frame", _attributes, _exp, _condition_1, React.createElement(Fab, {
78
+ key = "Main",
79
+ icon = if open then openIcon else icon,
80
+ disabled = disabled,
81
+ onClick = function()
82
+ return onOpenChange(not open)
83
+ end,
84
+ className = {
85
+ LayoutOrder = 1000,
86
+ },
87
+ }))
88
+ end
89
+ local default = SpeedDial
90
+ return {
91
+ default = default,
92
+ }
@@ -0,0 +1,2 @@
1
+ declare const useSpeedDialStyles: () => import("../../../../theme/index").ClassNameMap<string>;
2
+ export default useSpeedDialStyles;
@@ -0,0 +1,26 @@
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 useSpeedDialStyles = componentStyles("SpeedDial", function(theme)
7
+ return createStyles({
8
+ root = {
9
+ AutomaticSize = Enum.AutomaticSize.XY,
10
+ Size = UDim2.fromScale(0, 0),
11
+ BackgroundTransparency = 1,
12
+ BorderSizePixel = 0,
13
+ },
14
+ list = {
15
+ FillDirection = Enum.FillDirection.Vertical,
16
+ HorizontalAlignment = Enum.HorizontalAlignment.Center,
17
+ VerticalAlignment = Enum.VerticalAlignment.Bottom,
18
+ SortOrder = Enum.SortOrder.LayoutOrder,
19
+ Padding = UDim.new(0, theme.padding.calc(1)),
20
+ },
21
+ })
22
+ end)
23
+ local default = useSpeedDialStyles
24
+ return {
25
+ default = default,
26
+ }
@@ -0,0 +1,2 @@
1
+ export { default as SpeedDial } from "./components/SpeedDial";
2
+ export { SpeedDialProps, SpeedDialAction } from "./components/SpeedDial";
@@ -0,0 +1,5 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ exports.SpeedDial = TS.import(script, script, "components", "SpeedDial").default
5
+ return exports