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

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 (39) 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/chip/components/Chip.d.ts +2 -1
  9. package/out/ui/packages/chip/components/Chip.luau +2 -0
  10. package/out/ui/packages/chip/components/Chip.styles.d.ts +2 -0
  11. package/out/ui/packages/chip/components/Chip.styles.luau +13 -7
  12. package/out/ui/packages/dialog/components/Dialog.d.ts +1 -1
  13. package/out/ui/packages/dialog/components/Dialog.luau +27 -18
  14. package/out/ui/packages/index.d.ts +1 -0
  15. package/out/ui/packages/init.luau +3 -0
  16. package/out/ui/packages/layout/components/Container.d.ts +10 -0
  17. package/out/ui/packages/layout/components/Container.luau +54 -0
  18. package/out/ui/packages/layout/components/Container.styles.d.ts +6 -0
  19. package/out/ui/packages/layout/components/Container.styles.luau +41 -0
  20. package/out/ui/packages/layout/components/Grid.d.ts +1 -1
  21. package/out/ui/packages/layout/components/containerWidth.d.ts +2 -0
  22. package/out/ui/packages/layout/components/containerWidth.luau +17 -0
  23. package/out/ui/packages/layout/index.d.ts +3 -0
  24. package/out/ui/packages/layout/init.luau +2 -0
  25. package/out/ui/packages/modal/components/Modal.d.ts +1 -1
  26. package/out/ui/packages/modal/components/Modal.luau +55 -37
  27. package/out/ui/packages/popup/index.d.ts +1 -0
  28. package/out/ui/packages/popup/init.luau +1 -0
  29. package/out/ui/packages/stateMatrix.luau +148 -82
  30. package/out/ui/packages/tabs/components/Tabs.d.ts +2 -0
  31. package/out/ui/packages/tabs/components/Tabs.luau +10 -3
  32. package/out/ui/packages/tabs/components/Tabs.styles.d.ts +4 -1
  33. package/out/ui/packages/tabs/components/Tabs.styles.luau +24 -10
  34. package/out/ui/packages/tabs/components/tabsOrientation.d.ts +2 -0
  35. package/out/ui/packages/tabs/components/tabsOrientation.luau +7 -0
  36. package/out/ui/packages/tabs/index.d.ts +1 -0
  37. package/out/ui/packages/tabs/init.luau +1 -0
  38. package/out/ui/packages/toast/components/Toast.styles.luau +1 -1
  39. package/package.json +2 -2
@@ -0,0 +1,10 @@
1
+ import React from "@rbxts/react";
2
+ import { CustomizedProps } from "../../../../theme/index";
3
+ export interface BackdropProps {
4
+ open?: boolean;
5
+ invisible?: boolean;
6
+ onClick?: () => void;
7
+ children?: React.ReactNode;
8
+ }
9
+ declare function Backdrop(props: CustomizedProps<TextButton, BackdropProps>): JSX.Element | undefined;
10
+ export default Backdrop;
@@ -0,0 +1,58 @@
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 useBackdropStyles = TS.import(script, script.Parent, "Backdrop.styles").default
5
+ local function Backdrop(props)
6
+ local _binding = props
7
+ local open = _binding.open
8
+ if open == nil then
9
+ open = true
10
+ end
11
+ local invisible = _binding.invisible
12
+ local onClick = _binding.onClick
13
+ local children = _binding.children
14
+ local className = _binding.className
15
+ local sx = _binding.sx
16
+ local id = _binding.id
17
+ local ref = _binding.ref
18
+ local styles = useBackdropStyles({
19
+ invisible = invisible,
20
+ })
21
+ if open ~= true then
22
+ return nil
23
+ end
24
+ local _attributes = {}
25
+ local _condition = id
26
+ if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
27
+ _condition = "Backdrop"
28
+ end
29
+ _attributes.key = _condition
30
+ _attributes.ref = ref
31
+ for _k, _v in styles.root do
32
+ _attributes[_k] = _v
33
+ end
34
+ if className then
35
+ for _k, _v in className do
36
+ _attributes[_k] = _v
37
+ end
38
+ end
39
+ if sx then
40
+ for _k, _v in sx do
41
+ _attributes[_k] = _v
42
+ end
43
+ end
44
+ _attributes.Event = {
45
+ Activated = function()
46
+ local _result = onClick
47
+ if _result ~= nil then
48
+ _result = _result()
49
+ end
50
+ return _result
51
+ end,
52
+ }
53
+ return React.createElement("textbutton", _attributes, children)
54
+ end
55
+ local default = Backdrop
56
+ return {
57
+ default = default,
58
+ }
@@ -0,0 +1,4 @@
1
+ declare const useBackdropStyles: (props: {
2
+ invisible?: boolean;
3
+ }) => import("../../../../theme/index").ClassNameMap<string>;
4
+ export default useBackdropStyles;
@@ -0,0 +1,24 @@
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 useBackdropStyles = componentStyles("Backdrop", function(theme, _param)
7
+ local invisible = _param.invisible
8
+ return createStyles({
9
+ root = {
10
+ Size = UDim2.fromScale(1, 1),
11
+ BackgroundColor3 = theme.palette.backdrop,
12
+ BackgroundTransparency = if invisible == true then 1 else 0.45,
13
+ BorderSizePixel = 0,
14
+ Text = "",
15
+ AutoButtonColor = false,
16
+ Selectable = false,
17
+ ZIndex = 30000,
18
+ },
19
+ })
20
+ end)
21
+ local default = useBackdropStyles
22
+ return {
23
+ default = default,
24
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Backdrop } from "./components/Backdrop";
2
+ export { BackdropProps } from "./components/Backdrop";
@@ -0,0 +1,5 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ exports.Backdrop = TS.import(script, script, "components", "Backdrop").default
5
+ return exports
@@ -4,6 +4,7 @@ local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "the
4
4
  local componentStyles = _theme.componentStyles
5
5
  local createStyles = _theme.createStyles
6
6
  local useBadgeStyles = componentStyles("Badge", function(theme)
7
+ local diameter = theme.spacing.calc(2) + theme.padding.calc(1)
7
8
  return createStyles({
8
9
  root = {
9
10
  AutomaticSize = Enum.AutomaticSize.XY,
@@ -14,13 +15,15 @@ local useBadgeStyles = componentStyles("Badge", function(theme)
14
15
  badge = {
15
16
  AnchorPoint = Vector2.new(0.5, 0.5),
16
17
  Position = UDim2.fromScale(1, 0),
17
- AutomaticSize = Enum.AutomaticSize.XY,
18
- Size = UDim2.fromOffset(theme.padding.calc(2), theme.padding.calc(2)),
18
+ AutomaticSize = Enum.AutomaticSize.X,
19
+ Size = UDim2.fromOffset(diameter, diameter),
19
20
  BackgroundColor3 = theme.palette.status.error.main,
20
21
  BorderSizePixel = 0,
21
22
  Font = theme.typography.fontFamilies.default,
22
23
  TextSize = theme.typography.fontSizes.caption,
23
24
  TextColor3 = theme.palette.text.inverse,
25
+ TextXAlignment = Enum.TextXAlignment.Center,
26
+ TextYAlignment = Enum.TextYAlignment.Center,
24
27
  ZIndex = 2,
25
28
  },
26
29
  padding = {
@@ -28,7 +31,7 @@ local useBadgeStyles = componentStyles("Badge", function(theme)
28
31
  PaddingRight = UDim.new(0, theme.padding.calc(0.5)),
29
32
  },
30
33
  corner = {
31
- CornerRadius = UDim.new(1, 0),
34
+ CornerRadius = UDim.new(0.5, 0),
32
35
  },
33
36
  })
34
37
  end)
@@ -1,8 +1,9 @@
1
- import { CustomizedProps } from "../../../../theme/index";
1
+ import { ControlSize, CustomizedProps } from "../../../../theme/index";
2
2
  export interface ChipProps {
3
3
  label: string;
4
4
  selected?: boolean;
5
5
  disabled?: boolean;
6
+ size?: ControlSize;
6
7
  onActivated?: () => void;
7
8
  onDelete?: () => void;
8
9
  }
@@ -8,6 +8,7 @@ local function Chip(props)
8
8
  local label = _binding.label
9
9
  local selected = _binding.selected
10
10
  local disabled = _binding.disabled
11
+ local size = _binding.size
11
12
  local onActivated = _binding.onActivated
12
13
  local onDelete = _binding.onDelete
13
14
  local className = _binding.className
@@ -19,6 +20,7 @@ local function Chip(props)
19
20
  selected = selected,
20
21
  disabled = disabled,
21
22
  deletable = deletable,
23
+ size = size,
22
24
  })
23
25
  local _attributes = {}
24
26
  local _condition = id
@@ -1,6 +1,8 @@
1
+ import { ControlSize } from "../../../../theme/index";
1
2
  declare const useChipStyles: (props: {
2
3
  selected?: boolean;
3
4
  disabled?: boolean;
4
5
  deletable?: boolean;
6
+ size?: ControlSize;
5
7
  }) => import("../../../../theme/index").ClassNameMap<string>;
6
8
  export default useChipStyles;
@@ -2,6 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
4
  local componentStyles = _theme.componentStyles
5
+ local controlMetrics = _theme.controlMetrics
5
6
  local createStyles = _theme.createStyles
6
7
  local useChipStyles = componentStyles("Chip", function(theme, _param)
7
8
  local selected = _param.selected
@@ -16,6 +17,11 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
16
17
  if deletable == nil then
17
18
  deletable = false
18
19
  end
20
+ local size = _param.size
21
+ local metrics = controlMetrics(theme.density, size)
22
+ local padY = if size == "small" then 0.25 elseif size == "large" then 0.75 else 0.5
23
+ local padX = if size == "small" then 1 elseif size == "large" then 2 else 1.5
24
+ local deletePx = metrics.icon
19
25
  return createStyles({
20
26
  root = {
21
27
  AutomaticSize = Enum.AutomaticSize.XY,
@@ -27,13 +33,13 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
27
33
  Selectable = not disabled,
28
34
  TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
29
35
  Font = theme.typography.fontFamilies.default,
30
- TextSize = theme.typography.fontSizes.body,
36
+ TextSize = metrics.font,
31
37
  },
32
38
  padding = {
33
- PaddingTop = UDim.new(0, theme.padding.calc(0.5)),
34
- PaddingBottom = UDim.new(0, theme.padding.calc(0.5)),
35
- PaddingLeft = UDim.new(0, theme.padding.calc(1.5)),
36
- PaddingRight = UDim.new(0, theme.padding.calc(if deletable then 0.5 else 1.5)),
39
+ PaddingTop = UDim.new(0, theme.padding.calc(padY)),
40
+ PaddingBottom = UDim.new(0, theme.padding.calc(padY)),
41
+ PaddingLeft = UDim.new(0, theme.padding.calc(padX)),
42
+ PaddingRight = UDim.new(0, theme.padding.calc(if deletable then 0.5 else padX)),
37
43
  },
38
44
  corner = {
39
45
  CornerRadius = UDim.new(theme.shape.pillScale, 0),
@@ -56,11 +62,11 @@ local useChipStyles = componentStyles("Chip", function(theme, _param)
56
62
  BorderSizePixel = 0,
57
63
  TextColor3 = if disabled then theme.palette.text.disabled else theme.palette.text.primary,
58
64
  Font = theme.typography.fontFamilies.default,
59
- TextSize = theme.typography.fontSizes.body,
65
+ TextSize = metrics.font,
60
66
  LayoutOrder = 1,
61
67
  },
62
68
  delete = {
63
- Size = UDim2.fromOffset(theme.spacing.calc(2), theme.spacing.calc(2)),
69
+ Size = UDim2.fromOffset(deletePx, deletePx),
64
70
  BackgroundTransparency = 1,
65
71
  BorderSizePixel = 0,
66
72
  AutoButtonColor = false,
@@ -2,7 +2,7 @@ import React from "@rbxts/react";
2
2
  export interface DialogProps {
3
3
  host?: Instance;
4
4
  open: boolean;
5
- title: string;
5
+ title?: string;
6
6
  onClose: () => void;
7
7
  children?: React.ReactNode;
8
8
  actions?: React.ReactNode;
@@ -12,6 +12,8 @@ local function Dialog(props)
12
12
  local children = _binding.children
13
13
  local actions = _binding.actions
14
14
  local styles = useDialogStyles()
15
+ local hasTitle = title ~= nil and title ~= ""
16
+ local hasActions = actions ~= nil
15
17
  local _attributes = {
16
18
  key = "Column",
17
19
  }
@@ -21,34 +23,41 @@ local function Dialog(props)
21
23
  local _attributes_1 = table.clone(styles.columnList)
22
24
  setmetatable(_attributes_1, nil)
23
25
  local _exp = React.createElement("uilistlayout", _attributes_1)
24
- local _attributes_2 = {
25
- key = "Title",
26
- }
27
- for _k, _v in styles.title do
28
- _attributes_2[_k] = _v
26
+ local _condition = hasTitle
27
+ if _condition then
28
+ local _attributes_2 = {
29
+ key = "Title",
30
+ }
31
+ for _k, _v in styles.title do
32
+ _attributes_2[_k] = _v
33
+ end
34
+ _attributes_2.Text = title
35
+ _condition = React.createElement("textlabel", _attributes_2)
29
36
  end
30
- _attributes_2.Text = title
31
- local _exp_1 = React.createElement("textlabel", _attributes_2)
32
- local _attributes_3 = {
37
+ local _attributes_2 = {
33
38
  key = "Body",
34
39
  }
35
40
  for _k, _v in styles.body do
36
- _attributes_3[_k] = _v
41
+ _attributes_2[_k] = _v
37
42
  end
38
- local _exp_2 = React.createElement("frame", _attributes_3, children)
39
- local _attributes_4 = {
40
- key = "Actions",
41
- }
42
- for _k, _v in styles.actions do
43
- _attributes_4[_k] = _v
43
+ local _exp_1 = React.createElement("frame", _attributes_2, children)
44
+ local _condition_1 = hasActions
45
+ if _condition_1 then
46
+ local _attributes_3 = {
47
+ key = "Actions",
48
+ }
49
+ for _k, _v in styles.actions do
50
+ _attributes_3[_k] = _v
51
+ end
52
+ local _attributes_4 = table.clone(styles.actionList)
53
+ setmetatable(_attributes_4, nil)
54
+ _condition_1 = (React.createElement("frame", _attributes_3, React.createElement("uilistlayout", _attributes_4), actions))
44
55
  end
45
- local _attributes_5 = table.clone(styles.actionList)
46
- setmetatable(_attributes_5, nil)
47
56
  return React.createElement(Modal, {
48
57
  host = host,
49
58
  open = open,
50
59
  onClose = onClose,
51
- }, React.createElement("frame", _attributes, _exp, _exp_1, _exp_2, React.createElement("frame", _attributes_4, React.createElement("uilistlayout", _attributes_5), actions)))
60
+ }, React.createElement("frame", _attributes, _exp, _condition, _exp_1, _condition_1))
52
61
  end
53
62
  local default = Dialog
54
63
  return {
@@ -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 {
@@ -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
@@ -915,123 +915,131 @@ local function compositeRows()
915
915
  local _Length_19 = #_array_20
916
916
  table.move(_array_20, 1, _Length_19, _length + 1, _array)
917
917
  _length += _Length_19
918
- local _array_21 = pair("Tabs", "disabled", {
918
+ local _array_21 = pair("Tabs", "vertical", {
919
919
  value = "Continue",
920
920
  options = { "Continue", "Docs", "Actions" },
921
- disabled = true,
921
+ variant = "vertical",
922
922
  })
923
923
  local _Length_20 = #_array_21
924
924
  table.move(_array_21, 1, _Length_20, _length + 1, _array)
925
925
  _length += _Length_20
926
- local _array_22 = pair("Tabs", "hover", {
926
+ local _array_22 = pair("Tabs", "disabled", {
927
927
  value = "Continue",
928
928
  options = { "Continue", "Docs", "Actions" },
929
- pointer = "hover",
929
+ disabled = true,
930
930
  })
931
931
  local _Length_21 = #_array_22
932
932
  table.move(_array_22, 1, _Length_21, _length + 1, _array)
933
933
  _length += _Length_21
934
- local _array_23 = pair("Tabs", "long", {
935
- value = LONG,
936
- options = { LONG, "Docs", "Actions", "Source", "Settings" },
937
- text = LONG,
938
- width = NARROW,
934
+ local _array_23 = pair("Tabs", "hover", {
935
+ value = "Continue",
936
+ options = { "Continue", "Docs", "Actions" },
937
+ pointer = "hover",
939
938
  })
940
939
  local _Length_22 = #_array_23
941
940
  table.move(_array_23, 1, _Length_22, _length + 1, _array)
942
941
  _length += _Length_22
943
- local _array_24 = pair("SplitPane", "default", {
944
- value = 160,
942
+ local _array_24 = pair("Tabs", "long", {
943
+ value = LONG,
944
+ options = { LONG, "Docs", "Actions", "Source", "Settings" },
945
+ text = LONG,
946
+ width = NARROW,
945
947
  })
946
948
  local _Length_23 = #_array_24
947
949
  table.move(_array_24, 1, _Length_23, _length + 1, _array)
948
950
  _length += _Length_23
949
- local _array_25 = pair("SplitPane", "disabled", {
951
+ local _array_25 = pair("SplitPane", "default", {
950
952
  value = 160,
951
- disabled = true,
952
953
  })
953
954
  local _Length_24 = #_array_25
954
955
  table.move(_array_25, 1, _Length_24, _length + 1, _array)
955
956
  _length += _Length_24
956
- local _array_26 = pair("SplitPane", "hover", {
957
+ local _array_26 = pair("SplitPane", "disabled", {
957
958
  value = 160,
958
- pointer = "hover",
959
+ disabled = true,
959
960
  })
960
961
  local _Length_25 = #_array_26
961
962
  table.move(_array_26, 1, _Length_25, _length + 1, _array)
962
963
  _length += _Length_25
963
- local _array_27 = pair("SplitPane", "drag", {
964
+ local _array_27 = pair("SplitPane", "hover", {
964
965
  value = 160,
965
- pointer = "press",
966
+ pointer = "hover",
966
967
  })
967
968
  local _Length_26 = #_array_27
968
969
  table.move(_array_27, 1, _Length_26, _length + 1, _array)
969
970
  _length += _Length_26
970
- local _array_28 = pair("SplitPane", "long", {
971
- value = 80,
972
- text = LONG,
973
- width = NARROW,
971
+ local _array_28 = pair("SplitPane", "drag", {
972
+ value = 160,
973
+ pointer = "press",
974
974
  })
975
975
  local _Length_27 = #_array_28
976
976
  table.move(_array_28, 1, _Length_27, _length + 1, _array)
977
977
  _length += _Length_27
978
- local _array_29 = pair("Tooltip", "hidden")
978
+ local _array_29 = pair("SplitPane", "long", {
979
+ value = 80,
980
+ text = LONG,
981
+ width = NARROW,
982
+ })
979
983
  local _Length_28 = #_array_29
980
984
  table.move(_array_29, 1, _Length_28, _length + 1, _array)
981
985
  _length += _Length_28
982
- local _array_30 = pair("Tooltip", "shown", {
983
- pointer = "hover",
984
- })
986
+ local _array_30 = pair("Tooltip", "hidden")
985
987
  local _Length_29 = #_array_30
986
988
  table.move(_array_30, 1, _Length_29, _length + 1, _array)
987
989
  _length += _Length_29
988
- local _array_31 = pair("Tooltip", "long", {
989
- text = LONG,
990
- width = NARROW,
990
+ local _array_31 = pair("Tooltip", "shown", {
991
991
  pointer = "hover",
992
992
  })
993
993
  local _Length_30 = #_array_31
994
994
  table.move(_array_31, 1, _Length_30, _length + 1, _array)
995
995
  _length += _Length_30
996
- local _array_32 = pair("TreeView", "default", {
997
- selected = "Fixture/Styled",
996
+ local _array_32 = pair("Tooltip", "long", {
997
+ text = LONG,
998
+ width = NARROW,
999
+ pointer = "hover",
998
1000
  })
999
1001
  local _Length_31 = #_array_32
1000
1002
  table.move(_array_32, 1, _Length_31, _length + 1, _array)
1001
1003
  _length += _Length_31
1002
- local _array_33 = pair("TreeView", "hover", {
1004
+ local _array_33 = pair("TreeView", "default", {
1003
1005
  selected = "Fixture/Styled",
1004
- pointer = "hover",
1005
1006
  })
1006
1007
  local _Length_32 = #_array_33
1007
1008
  table.move(_array_33, 1, _Length_32, _length + 1, _array)
1008
1009
  _length += _Length_32
1009
- local _array_34 = pair("TreeView", "filter", {
1010
+ local _array_34 = pair("TreeView", "hover", {
1010
1011
  selected = "Fixture/Styled",
1011
- filter = "sty",
1012
+ pointer = "hover",
1012
1013
  })
1013
1014
  local _Length_33 = #_array_34
1014
1015
  table.move(_array_34, 1, _Length_33, _length + 1, _array)
1015
1016
  _length += _Length_33
1016
- local _array_35 = pair("TreeView", "long", {
1017
- selected = `Fixture/{LONG}`,
1018
- text = LONG,
1019
- width = NARROW,
1017
+ local _array_35 = pair("TreeView", "filter", {
1018
+ selected = "Fixture/Styled",
1019
+ filter = "sty",
1020
1020
  })
1021
1021
  local _Length_34 = #_array_35
1022
1022
  table.move(_array_35, 1, _Length_34, _length + 1, _array)
1023
1023
  _length += _Length_34
1024
- local _array_36 = pair("IconButton", "loading", {
1025
- loading = true,
1024
+ local _array_36 = pair("TreeView", "long", {
1025
+ selected = `Fixture/{LONG}`,
1026
+ text = LONG,
1027
+ width = NARROW,
1026
1028
  })
1027
1029
  local _Length_35 = #_array_36
1028
1030
  table.move(_array_36, 1, _Length_35, _length + 1, _array)
1029
1031
  _length += _Length_35
1030
- local _array_37 = pair("IconButton", "loading-disabled", {
1032
+ local _array_37 = pair("IconButton", "loading", {
1033
+ loading = true,
1034
+ })
1035
+ local _Length_36 = #_array_37
1036
+ table.move(_array_37, 1, _Length_36, _length + 1, _array)
1037
+ _length += _Length_36
1038
+ local _array_38 = pair("IconButton", "loading-disabled", {
1031
1039
  loading = true,
1032
1040
  disabled = true,
1033
1041
  })
1034
- table.move(_array_37, 1, #_array_37, _length + 1, _array)
1042
+ table.move(_array_38, 1, #_array_38, _length + 1, _array)
1035
1043
  return _array
1036
1044
  end
1037
1045
  local function surfacesRows()
@@ -1232,34 +1240,46 @@ local function surfacesRows()
1232
1240
  local _Length_30 = #_array_31
1233
1241
  table.move(_array_31, 1, _Length_30, _length + 1, _array)
1234
1242
  _length += _Length_30
1235
- local _array_32 = pair("Chip", "selected", {
1236
- value = true,
1243
+ local _array_32 = pair("Chip", "size-small", {
1244
+ size = "small",
1237
1245
  })
1238
1246
  local _Length_31 = #_array_32
1239
1247
  table.move(_array_32, 1, _Length_31, _length + 1, _array)
1240
1248
  _length += _Length_31
1241
- local _array_33 = pair("Chip", "disabled", {
1242
- disabled = true,
1249
+ local _array_33 = pair("Chip", "size-large", {
1250
+ size = "large",
1243
1251
  })
1244
1252
  local _Length_32 = #_array_33
1245
1253
  table.move(_array_33, 1, _Length_32, _length + 1, _array)
1246
1254
  _length += _Length_32
1247
- local _array_34 = pair("Chip", "deletable", {
1248
- text = "Tag",
1255
+ local _array_34 = pair("Chip", "selected", {
1256
+ value = true,
1249
1257
  })
1250
1258
  local _Length_33 = #_array_34
1251
1259
  table.move(_array_34, 1, _Length_33, _length + 1, _array)
1252
1260
  _length += _Length_33
1253
- local _array_35 = pair("Badge", "count", {
1254
- value = 3,
1261
+ local _array_35 = pair("Chip", "disabled", {
1262
+ disabled = true,
1255
1263
  })
1256
1264
  local _Length_34 = #_array_35
1257
1265
  table.move(_array_35, 1, _Length_34, _length + 1, _array)
1258
1266
  _length += _Length_34
1259
- local _array_36 = pair("Badge", "max", {
1267
+ local _array_36 = pair("Chip", "deletable", {
1268
+ text = "Tag",
1269
+ })
1270
+ local _Length_35 = #_array_36
1271
+ table.move(_array_36, 1, _Length_35, _length + 1, _array)
1272
+ _length += _Length_35
1273
+ local _array_37 = pair("Badge", "count", {
1274
+ value = 3,
1275
+ })
1276
+ local _Length_36 = #_array_37
1277
+ table.move(_array_37, 1, _Length_36, _length + 1, _array)
1278
+ _length += _Length_36
1279
+ local _array_38 = pair("Badge", "max", {
1260
1280
  value = 100,
1261
1281
  })
1262
- table.move(_array_36, 1, #_array_36, _length + 1, _array)
1282
+ table.move(_array_38, 1, #_array_38, _length + 1, _array)
1263
1283
  return _array
1264
1284
  end
1265
1285
  local function chromeRows()
@@ -1662,91 +1682,137 @@ local function miscRows()
1662
1682
  local _Length_23 = #_array_24
1663
1683
  table.move(_array_24, 1, _Length_23, _length + 1, _array)
1664
1684
  _length += _Length_23
1665
- local _array_25 = pair("ImageList", "default")
1685
+ local _array_25 = pair("Container", "default", {
1686
+ variant = "lg",
1687
+ })
1666
1688
  local _Length_24 = #_array_25
1667
1689
  table.move(_array_25, 1, _Length_24, _length + 1, _array)
1668
1690
  _length += _Length_24
1669
- local _array_26 = pair("ImageList", "dense", {
1670
- size = "small",
1691
+ local _array_26 = pair("Container", "sm", {
1692
+ variant = "sm",
1671
1693
  })
1672
1694
  local _Length_25 = #_array_26
1673
1695
  table.move(_array_26, 1, _Length_25, _length + 1, _array)
1674
1696
  _length += _Length_25
1675
- local _array_27 = pair("ImageList", "wide", {
1676
- size = "large",
1697
+ local _array_27 = pair("Container", "fluid", {
1698
+ variant = "false",
1677
1699
  })
1678
1700
  local _Length_26 = #_array_27
1679
1701
  table.move(_array_27, 1, _Length_26, _length + 1, _array)
1680
1702
  _length += _Length_26
1681
- local _array_28 = pair("SpeedDial", "closed", {
1682
- open = false,
1683
- })
1703
+ local _array_28 = pair("Backdrop", "default")
1684
1704
  local _Length_27 = #_array_28
1685
1705
  table.move(_array_28, 1, _Length_27, _length + 1, _array)
1686
1706
  _length += _Length_27
1687
- local _array_29 = pair("SpeedDial", "open", {
1688
- open = true,
1707
+ local _array_29 = pair("Backdrop", "invisible", {
1708
+ variant = "invisible",
1689
1709
  })
1690
1710
  local _Length_28 = #_array_29
1691
1711
  table.move(_array_29, 1, _Length_28, _length + 1, _array)
1692
1712
  _length += _Length_28
1693
- local _array_30 = pair("SpeedDial", "disabled", {
1713
+ local _array_30 = pair("Backdrop", "closed", {
1694
1714
  open = false,
1695
- disabled = true,
1696
1715
  })
1697
1716
  local _Length_29 = #_array_30
1698
1717
  table.move(_array_30, 1, _Length_29, _length + 1, _array)
1699
1718
  _length += _Length_29
1700
- local _array_31 = pair("FormLabel", "default", {
1701
- text = "Email",
1719
+ local _array_31 = pair("Divider", "horizontal", {
1720
+ variant = "horizontal",
1702
1721
  })
1703
1722
  local _Length_30 = #_array_31
1704
1723
  table.move(_array_31, 1, _Length_30, _length + 1, _array)
1705
1724
  _length += _Length_30
1706
- local _array_32 = pair("FormLabel", "required", {
1707
- text = "Email",
1708
- value = true,
1725
+ local _array_32 = pair("Divider", "vertical", {
1726
+ variant = "vertical",
1709
1727
  })
1710
1728
  local _Length_31 = #_array_32
1711
1729
  table.move(_array_32, 1, _Length_31, _length + 1, _array)
1712
1730
  _length += _Length_31
1713
- local _array_33 = pair("FormLabel", "error", {
1714
- text = "Email",
1715
- hasError = true,
1716
- })
1731
+ local _array_33 = pair("ImageList", "default")
1717
1732
  local _Length_32 = #_array_33
1718
1733
  table.move(_array_33, 1, _Length_32, _length + 1, _array)
1719
1734
  _length += _Length_32
1720
- local _array_34 = pair("FormHelperText", "default", {
1721
- text = "We never share this",
1735
+ local _array_34 = pair("ImageList", "dense", {
1736
+ size = "small",
1722
1737
  })
1723
1738
  local _Length_33 = #_array_34
1724
1739
  table.move(_array_34, 1, _Length_33, _length + 1, _array)
1725
1740
  _length += _Length_33
1726
- local _array_35 = pair("FormHelperText", "error", {
1727
- text = "Required",
1728
- hasError = true,
1741
+ local _array_35 = pair("ImageList", "wide", {
1742
+ size = "large",
1729
1743
  })
1730
1744
  local _Length_34 = #_array_35
1731
1745
  table.move(_array_35, 1, _Length_34, _length + 1, _array)
1732
1746
  _length += _Length_34
1733
- local _array_36 = pair("Menu", "closed", {
1747
+ local _array_36 = pair("SpeedDial", "closed", {
1734
1748
  open = false,
1735
1749
  })
1736
1750
  local _Length_35 = #_array_36
1737
1751
  table.move(_array_36, 1, _Length_35, _length + 1, _array)
1738
1752
  _length += _Length_35
1739
- local _array_37 = pair("Menu", "open", {
1753
+ local _array_37 = pair("SpeedDial", "open", {
1740
1754
  open = true,
1741
1755
  })
1742
1756
  local _Length_36 = #_array_37
1743
1757
  table.move(_array_37, 1, _Length_36, _length + 1, _array)
1744
1758
  _length += _Length_36
1745
- local _array_38 = pair("Menu", "empty", {
1759
+ local _array_38 = pair("SpeedDial", "disabled", {
1760
+ open = false,
1761
+ disabled = true,
1762
+ })
1763
+ local _Length_37 = #_array_38
1764
+ table.move(_array_38, 1, _Length_37, _length + 1, _array)
1765
+ _length += _Length_37
1766
+ local _array_39 = pair("FormLabel", "default", {
1767
+ text = "Email",
1768
+ })
1769
+ local _Length_38 = #_array_39
1770
+ table.move(_array_39, 1, _Length_38, _length + 1, _array)
1771
+ _length += _Length_38
1772
+ local _array_40 = pair("FormLabel", "required", {
1773
+ text = "Email",
1774
+ value = true,
1775
+ })
1776
+ local _Length_39 = #_array_40
1777
+ table.move(_array_40, 1, _Length_39, _length + 1, _array)
1778
+ _length += _Length_39
1779
+ local _array_41 = pair("FormLabel", "error", {
1780
+ text = "Email",
1781
+ hasError = true,
1782
+ })
1783
+ local _Length_40 = #_array_41
1784
+ table.move(_array_41, 1, _Length_40, _length + 1, _array)
1785
+ _length += _Length_40
1786
+ local _array_42 = pair("FormHelperText", "default", {
1787
+ text = "We never share this",
1788
+ })
1789
+ local _Length_41 = #_array_42
1790
+ table.move(_array_42, 1, _Length_41, _length + 1, _array)
1791
+ _length += _Length_41
1792
+ local _array_43 = pair("FormHelperText", "error", {
1793
+ text = "Required",
1794
+ hasError = true,
1795
+ })
1796
+ local _Length_42 = #_array_43
1797
+ table.move(_array_43, 1, _Length_42, _length + 1, _array)
1798
+ _length += _Length_42
1799
+ local _array_44 = pair("Menu", "closed", {
1800
+ open = false,
1801
+ })
1802
+ local _Length_43 = #_array_44
1803
+ table.move(_array_44, 1, _Length_43, _length + 1, _array)
1804
+ _length += _Length_43
1805
+ local _array_45 = pair("Menu", "open", {
1806
+ open = true,
1807
+ })
1808
+ local _Length_44 = #_array_45
1809
+ table.move(_array_45, 1, _Length_44, _length + 1, _array)
1810
+ _length += _Length_44
1811
+ local _array_46 = pair("Menu", "empty", {
1746
1812
  open = true,
1747
1813
  options = {},
1748
1814
  })
1749
- table.move(_array_38, 1, #_array_38, _length + 1, _array)
1815
+ table.move(_array_46, 1, #_array_46, _length + 1, _array)
1750
1816
  return _array
1751
1817
  end
1752
1818
  local function concatRows(...)
@@ -1,10 +1,12 @@
1
1
  import { CustomizedProps } from "../../../../theme/index";
2
2
  import { ChoiceOption } from "../../radioGroup/index";
3
+ import { TabsOrientation } from "./tabsOrientation";
3
4
  export interface TabsProps<T> {
4
5
  value: T;
5
6
  options: ChoiceOption<T>[];
6
7
  onChange: (value: T) => void;
7
8
  disabled?: boolean;
9
+ orientation?: TabsOrientation;
8
10
  }
9
11
  declare function Tabs<T>(props: CustomizedProps<ScrollingFrame, TabsProps<T>>): JSX.Element;
10
12
  export default Tabs;
@@ -4,6 +4,7 @@ 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
5
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
6
6
  local stepChoice = TS.import(script, script.Parent.Parent.Parent, "select", "components", "stepChoice").stepChoice
7
+ local tabsIsVertical = TS.import(script, script.Parent, "tabsOrientation").tabsIsVertical
7
8
  local useTabsStyles = TS.import(script, script.Parent, "Tabs.styles").default
8
9
  local function Tabs(props)
9
10
  local _binding = props
@@ -11,11 +12,15 @@ local function Tabs(props)
11
12
  local options = _binding.options
12
13
  local onChange = _binding.onChange
13
14
  local disabled = _binding.disabled
15
+ local orientation = _binding.orientation
14
16
  local className = _binding.className
15
17
  local sx = _binding.sx
16
18
  local id = _binding.id
17
19
  local ref = _binding.ref
18
- local styles = useTabsStyles()
20
+ local styles = useTabsStyles({
21
+ orientation = orientation,
22
+ })
23
+ local vertical = tabsIsVertical(orientation)
19
24
  local choose = function(index)
20
25
  local choice = options[index + 1]
21
26
  if choice ~= nil and canActivate(disabled or choice.disabled) and choice.value ~= value then
@@ -36,9 +41,11 @@ local function Tabs(props)
36
41
  end
37
42
  -- ▲ ReadonlyArray.findIndex ▲
38
43
  local index = _result
39
- if input.KeyCode == Enum.KeyCode.Left then
44
+ local back = if vertical then Enum.KeyCode.Up else Enum.KeyCode.Left
45
+ local forward = if vertical then Enum.KeyCode.Down else Enum.KeyCode.Right
46
+ if input.KeyCode == back then
40
47
  choose(stepChoice(options, index, -1))
41
- elseif input.KeyCode == Enum.KeyCode.Right then
48
+ elseif input.KeyCode == forward then
42
49
  choose(stepChoice(options, index, 1))
43
50
  end
44
51
  end
@@ -1,2 +1,5 @@
1
- declare const useTabsStyles: () => import("../../../../theme/index").ClassNameMap<string>;
1
+ import { TabsOrientation } from "./tabsOrientation";
2
+ declare const useTabsStyles: (props: {
3
+ orientation?: TabsOrientation;
4
+ }) => import("../../../../theme/index").ClassNameMap<string>;
2
5
  export default useTabsStyles;
@@ -3,32 +3,38 @@ local TS = _G[script]
3
3
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
4
  local createStyles = _theme.createStyles
5
5
  local componentStyles = _theme.componentStyles
6
- local useTabsStyles = componentStyles("Tabs", function(theme)
6
+ local tabsIsVertical = TS.import(script, script.Parent, "tabsOrientation").tabsIsVertical
7
+ local useTabsStyles = componentStyles("Tabs", function(theme, _param)
8
+ local orientation = _param.orientation
9
+ local vertical = tabsIsVertical(orientation)
10
+ local bar = theme.padding.calc(0.5)
7
11
  return createStyles({
8
12
  root = {
9
- Size = UDim2.new(1, 0, 0, theme.spacing.calc(4)),
13
+ Size = if vertical then UDim2.new(0, theme.spacing.calc(16), 1, 0) else UDim2.new(1, 0, 0, theme.spacing.calc(4)),
10
14
  BackgroundTransparency = 1,
11
15
  BorderSizePixel = 0,
12
16
  CanvasSize = UDim2.fromScale(0, 0),
13
- AutomaticCanvasSize = Enum.AutomaticSize.X,
14
- ScrollingDirection = Enum.ScrollingDirection.X,
17
+ AutomaticCanvasSize = if vertical then Enum.AutomaticSize.Y else Enum.AutomaticSize.X,
18
+ ScrollingDirection = if vertical then Enum.ScrollingDirection.Y else Enum.ScrollingDirection.X,
15
19
  HorizontalScrollBarInset = Enum.ScrollBarInset.Always,
20
+ VerticalScrollBarInset = Enum.ScrollBarInset.Always,
16
21
  ScrollBarThickness = theme.padding.calc(0.5),
17
22
  ScrollBarImageColor3 = theme.palette.text.secondary,
18
23
  },
19
24
  list = {
20
- FillDirection = Enum.FillDirection.Horizontal,
25
+ FillDirection = if vertical then Enum.FillDirection.Vertical else Enum.FillDirection.Horizontal,
21
26
  SortOrder = Enum.SortOrder.LayoutOrder,
22
27
  },
23
28
  tab = {
24
- AutomaticSize = Enum.AutomaticSize.X,
25
- Size = UDim2.fromScale(0, 1),
29
+ AutomaticSize = if vertical then Enum.AutomaticSize.Y else Enum.AutomaticSize.X,
30
+ Size = if vertical then UDim2.new(1, 0, 0, 0) else UDim2.fromScale(0, 1),
26
31
  BackgroundTransparency = 1,
27
32
  BorderSizePixel = 0,
28
33
  AutoButtonColor = false,
29
34
  TextColor3 = theme.palette.text.secondary,
30
35
  Font = theme.typography.fontFamilies.default,
31
36
  TextSize = theme.typography.fontSizes.body,
37
+ TextXAlignment = if vertical then Enum.TextXAlignment.Left else Enum.TextXAlignment.Center,
32
38
  },
33
39
  selected = {
34
40
  TextColor3 = theme.palette.text.primary,
@@ -39,14 +45,22 @@ local useTabsStyles = componentStyles("Tabs", function(theme)
39
45
  padding = {
40
46
  PaddingLeft = UDim.new(0, theme.padding.calc(2)),
41
47
  PaddingRight = UDim.new(0, theme.padding.calc(2)),
48
+ PaddingTop = UDim.new(0, if vertical then theme.padding.calc(1) else 0),
49
+ PaddingBottom = UDim.new(0, if vertical then theme.padding.calc(1) else 0),
42
50
  },
43
- indicator = {
44
- Size = UDim2.new(1, theme.padding.calc(4), 0, theme.padding.calc(0.5)),
51
+ indicator = if vertical then ({
52
+ Size = UDim2.new(0, bar, 1, -theme.padding.calc(2)),
53
+ Position = UDim2.new(0, 0, 0.5, 0),
54
+ AnchorPoint = Vector2.new(0, 0.5),
55
+ BackgroundColor3 = theme.palette.primary.main,
56
+ BorderSizePixel = 0,
57
+ }) else ({
58
+ Size = UDim2.new(1, theme.padding.calc(4), 0, bar),
45
59
  Position = UDim2.fromScale(0.5, 1),
46
60
  AnchorPoint = Vector2.new(0.5, 1),
47
61
  BackgroundColor3 = theme.palette.primary.main,
48
62
  BorderSizePixel = 0,
49
- },
63
+ }),
50
64
  })
51
65
  end)
52
66
  local default = useTabsStyles
@@ -0,0 +1,2 @@
1
+ export type TabsOrientation = "horizontal" | "vertical";
2
+ export declare function tabsIsVertical(orientation?: TabsOrientation): orientation is "vertical";
@@ -0,0 +1,7 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local function tabsIsVertical(orientation)
3
+ return orientation == "vertical"
4
+ end
5
+ return {
6
+ tabsIsVertical = tabsIsVertical,
7
+ }
@@ -1,2 +1,3 @@
1
1
  export { default as Tabs } from "./components/Tabs";
2
2
  export { TabsProps } from "./components/Tabs";
3
+ export { TabsOrientation, tabsIsVertical } from "./components/tabsOrientation";
@@ -2,4 +2,5 @@
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
4
  exports.Tabs = TS.import(script, script, "components", "Tabs").default
5
+ exports.tabsIsVertical = TS.import(script, script, "components", "tabsOrientation").tabsIsVertical
5
6
  return exports
@@ -62,7 +62,7 @@ local useToastStyles = componentStyles("Toast", function(theme, _param)
62
62
  ZIndex = 50001,
63
63
  },
64
64
  close = {
65
- Size = UDim2.new(0, theme.spacing.calc(1), 0, theme.spacing.calc(1)),
65
+ Size = UDim2.new(0, theme.options.constants.iconSizes.small, 0, theme.options.constants.iconSizes.small),
66
66
  Position = UDim2.new(1, -theme.padding.calc(2), 0, theme.padding.calc(2)),
67
67
  AnchorPoint = Vector2.new(1, 0),
68
68
  ImageColor3 = toastColors.content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.2.0-alpha.6",
3
+ "version": "0.2.0-alpha.7",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.luau",
6
6
  "packageManager": "pnpm@11.3.0",
@@ -8,7 +8,7 @@
8
8
  "build": "rbxtsc",
9
9
  "watch": "rbxtsc -w",
10
10
  "pack:check": "node scripts/pack-check.mjs",
11
- "test": "node scripts/no-internal-refs.check.mjs && node scripts/import-case.check.mjs && node --experimental-strip-types scripts/theme-scope.check.mjs && node --experimental-strip-types scripts/style-types.check.mjs && node --experimental-strip-types scripts/style-cache.check.mjs && node --experimental-strip-types scripts/style-variants.check.mjs && node --experimental-strip-types scripts/component-styles.check.mjs && node --experimental-strip-types scripts/interaction-styles.check.mjs && node --experimental-strip-types scripts/resolve-style.check.mjs && node --experimental-strip-types scripts/density.check.mjs && node --experimental-strip-types scripts/styles.check.mjs && node --experimental-strip-types scripts/contrast.check.mjs && node --experimental-strip-types scripts/primitives.check.mjs && node --experimental-strip-types scripts/paper.check.mjs && node --experimental-strip-types scripts/list-item.check.mjs && node --experimental-strip-types scripts/menu.check.mjs && node --experimental-strip-types scripts/guard.check.mjs && node --experimental-strip-types scripts/breakpoints.check.mjs && node --experimental-strip-types scripts/focus-trap.check.mjs && node --experimental-strip-types scripts/select-typeahead.check.mjs && node --experimental-strip-types scripts/select-groups.check.mjs && node --experimental-strip-types scripts/select-multi.check.mjs && node --experimental-strip-types scripts/select-motion.check.mjs && node --experimental-strip-types scripts/select-polish.check.mjs && node --experimental-strip-types scripts/reduced-motion.check.mjs && node --experimental-strip-types scripts/card.check.mjs && node --experimental-strip-types scripts/chip.check.mjs && node --experimental-strip-types scripts/badge.check.mjs && node --experimental-strip-types scripts/avatar.check.mjs && node --experimental-strip-types scripts/drawer.check.mjs && node --experimental-strip-types scripts/breadcrumbs.check.mjs && node --experimental-strip-types scripts/pagination.check.mjs && node --experimental-strip-types scripts/stepper.check.mjs && node --experimental-strip-types scripts/accordion.check.mjs && node --experimental-strip-types scripts/snackbar.check.mjs && node --experimental-strip-types scripts/table.check.mjs && node --experimental-strip-types scripts/autocomplete.check.mjs && node --experimental-strip-types scripts/field-loading.check.mjs && node --experimental-strip-types scripts/fab.check.mjs && node --experimental-strip-types scripts/appbar.check.mjs && node --experimental-strip-types scripts/bottom-navigation.check.mjs && node --experimental-strip-types scripts/alert.check.mjs && node --experimental-strip-types scripts/toggle-button.check.mjs && node --experimental-strip-types scripts/link.check.mjs && node --experimental-strip-types scripts/rating.check.mjs && node --experimental-strip-types scripts/stack.check.mjs && node --experimental-strip-types scripts/speed-dial.check.mjs && node --experimental-strip-types scripts/form-text.check.mjs && node --experimental-strip-types scripts/box.check.mjs && node --experimental-strip-types scripts/image-list.check.mjs && node --experimental-strip-types scripts/radio-group.check.mjs && node --experimental-strip-types scripts/cframe-editor.check.mjs && node --experimental-strip-types scripts/enum-picker.check.mjs && node --experimental-strip-types scripts/number-range.check.mjs && node --experimental-strip-types scripts/rect-editor.check.mjs && node --experimental-strip-types scripts/asset-field.check.mjs && node --experimental-strip-types scripts/gradient-editor.check.mjs && node --experimental-strip-types scripts/ray-editor.check.mjs && node --experimental-strip-types scripts/physical-properties.check.mjs && node --experimental-strip-types scripts/brickcolor-picker.check.mjs",
11
+ "test": "node scripts/no-internal-refs.check.mjs && node scripts/import-case.check.mjs && node --experimental-strip-types scripts/theme-scope.check.mjs && node --experimental-strip-types scripts/style-types.check.mjs && node --experimental-strip-types scripts/style-cache.check.mjs && node --experimental-strip-types scripts/style-variants.check.mjs && node --experimental-strip-types scripts/component-styles.check.mjs && node --experimental-strip-types scripts/interaction-styles.check.mjs && node --experimental-strip-types scripts/resolve-style.check.mjs && node --experimental-strip-types scripts/density.check.mjs && node --experimental-strip-types scripts/styles.check.mjs && node --experimental-strip-types scripts/contrast.check.mjs && node --experimental-strip-types scripts/primitives.check.mjs && node --experimental-strip-types scripts/paper.check.mjs && node --experimental-strip-types scripts/list-item.check.mjs && node --experimental-strip-types scripts/menu.check.mjs && node --experimental-strip-types scripts/guard.check.mjs && node --experimental-strip-types scripts/breakpoints.check.mjs && node --experimental-strip-types scripts/focus-trap.check.mjs && node --experimental-strip-types scripts/select-typeahead.check.mjs && node --experimental-strip-types scripts/select-groups.check.mjs && node --experimental-strip-types scripts/select-multi.check.mjs && node --experimental-strip-types scripts/select-motion.check.mjs && node --experimental-strip-types scripts/select-polish.check.mjs && node --experimental-strip-types scripts/reduced-motion.check.mjs && node --experimental-strip-types scripts/card.check.mjs && node --experimental-strip-types scripts/chip.check.mjs && node --experimental-strip-types scripts/badge.check.mjs && node --experimental-strip-types scripts/avatar.check.mjs && node --experimental-strip-types scripts/drawer.check.mjs && node --experimental-strip-types scripts/breadcrumbs.check.mjs && node --experimental-strip-types scripts/pagination.check.mjs && node --experimental-strip-types scripts/stepper.check.mjs && node --experimental-strip-types scripts/accordion.check.mjs && node --experimental-strip-types scripts/snackbar.check.mjs && node --experimental-strip-types scripts/table.check.mjs && node --experimental-strip-types scripts/autocomplete.check.mjs && node --experimental-strip-types scripts/field-loading.check.mjs && node --experimental-strip-types scripts/fab.check.mjs && node --experimental-strip-types scripts/appbar.check.mjs && node --experimental-strip-types scripts/bottom-navigation.check.mjs && node --experimental-strip-types scripts/alert.check.mjs && node --experimental-strip-types scripts/toggle-button.check.mjs && node --experimental-strip-types scripts/link.check.mjs && node --experimental-strip-types scripts/rating.check.mjs && node --experimental-strip-types scripts/stack.check.mjs && node --experimental-strip-types scripts/speed-dial.check.mjs && node --experimental-strip-types scripts/form-text.check.mjs && node --experimental-strip-types scripts/box.check.mjs && node --experimental-strip-types scripts/image-list.check.mjs && node --experimental-strip-types scripts/radio-group.check.mjs && node --experimental-strip-types scripts/container.check.mjs && node --experimental-strip-types scripts/divider.check.mjs && node --experimental-strip-types scripts/tabs.check.mjs && node --experimental-strip-types scripts/dialog.check.mjs && node --experimental-strip-types scripts/backdrop.check.mjs && node --experimental-strip-types scripts/cframe-editor.check.mjs && node --experimental-strip-types scripts/enum-picker.check.mjs && node --experimental-strip-types scripts/number-range.check.mjs && node --experimental-strip-types scripts/rect-editor.check.mjs && node --experimental-strip-types scripts/asset-field.check.mjs && node --experimental-strip-types scripts/gradient-editor.check.mjs && node --experimental-strip-types scripts/ray-editor.check.mjs && node --experimental-strip-types scripts/physical-properties.check.mjs && node --experimental-strip-types scripts/brickcolor-picker.check.mjs",
12
12
  "prepublishOnly": "pnpm build"
13
13
  },
14
14
  "keywords": [