@rbxts/uiblox 0.1.29 → 0.1.31

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.
@@ -3,6 +3,7 @@ import { WriteableStyle } from "../interfaces/index";
3
3
  export interface CommonProps<T extends Instance> extends PropsWithChildren {
4
4
  className?: WriteableStyle<T>;
5
5
  component?: T;
6
+ key?: string;
6
7
  }
7
8
  export type BaseDefaultProps<T extends Instance, P> = CommonProps<T> & P;
8
9
  export type BaseCustomizedProps<T extends Instance, P> = BaseDefaultProps<T, P>;
package/out/ui/index.d.ts CHANGED
@@ -2,6 +2,9 @@ export * from "./constants/index";
2
2
  export * from "./enums/index";
3
3
  export { Divider } from "./packages/index";
4
4
  export { DividerProps } from "./packages/index";
5
+ export { ErrorBoundary } from "./packages/index";
6
+ export { ErrorBoundaryProps } from "./packages/index";
7
+ export { ErrorBoundaryState } from "./packages/index";
5
8
  export { Icon } from "./packages/index";
6
9
  export { IconProps } from "./packages/index";
7
10
  export { IconButton } from "./packages/index";
@@ -11,6 +14,10 @@ export { InputProps } from "./packages/index";
11
14
  export { InputColor } from "./packages/index";
12
15
  export { InputMargin } from "./packages/index";
13
16
  export { InputVariant } from "./packages/index";
17
+ export { Grid } from "./packages/index";
18
+ export { GridProps } from "./packages/index";
19
+ export { List } from "./packages/index";
20
+ export { ListProps } from "./packages/index";
14
21
  export { Preloader } from "./packages/index";
15
22
  export { PreloaderProps } from "./packages/index";
16
23
  export { PreloaderAssets as Assets } from "./packages/index";
package/out/ui/init.luau CHANGED
@@ -8,9 +8,12 @@ for _k, _v in TS.import(script, script, "enums") or {} do
8
8
  exports[_k] = _v
9
9
  end
10
10
  exports.Divider = TS.import(script, script, "packages").Divider
11
+ exports.ErrorBoundary = TS.import(script, script, "packages").ErrorBoundary
11
12
  exports.Icon = TS.import(script, script, "packages").Icon
12
13
  exports.IconButton = TS.import(script, script, "packages").IconButton
13
14
  exports.Input = TS.import(script, script, "packages").Input
15
+ exports.Grid = TS.import(script, script, "packages").Grid
16
+ exports.List = TS.import(script, script, "packages").List
14
17
  exports.Preloader = TS.import(script, script, "packages").Preloader
15
18
  exports.ProgressBar = TS.import(script, script, "packages").ProgressBar
16
19
  exports.Shadow = TS.import(script, script, "packages").Shadow
@@ -0,0 +1,17 @@
1
+ import React, { Component, ErrorInfo } from "@rbxts/react";
2
+ export interface ErrorBoundaryProps {
3
+ fallback?: (error: unknown) => React.Element;
4
+ }
5
+ export interface ErrorBoundaryState {
6
+ hasError: boolean;
7
+ message?: unknown;
8
+ }
9
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
10
+ state: ErrorBoundaryState;
11
+ componentDidCatch(message: unknown, info: ErrorInfo): void;
12
+ render(): boolean | ReadonlyMap<React.Key, React.ReactNode> | {
13
+ readonly [key: string]: React.ReactNode;
14
+ readonly [key: number]: React.ReactNode;
15
+ } | readonly React.ReactNode[] | JSX.Element | undefined;
16
+ }
17
+ export default ErrorBoundary;
@@ -0,0 +1,46 @@
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 React = _react
5
+ local Component = _react.Component
6
+ local ReactComponent = _react.ReactComponent
7
+ local ErrorBoundary
8
+ do
9
+ local super = Component
10
+ ErrorBoundary = setmetatable({}, {
11
+ __tostring = function()
12
+ return "ErrorBoundary"
13
+ end,
14
+ __index = super,
15
+ })
16
+ ErrorBoundary.__index = ErrorBoundary
17
+ function ErrorBoundary.new(...)
18
+ local self = setmetatable({}, ErrorBoundary)
19
+ return self:constructor(...) or self
20
+ end
21
+ function ErrorBoundary:constructor(...)
22
+ super.constructor(self, ...)
23
+ self.state = {
24
+ hasError = false,
25
+ }
26
+ end
27
+ function ErrorBoundary:componentDidCatch(message, info)
28
+ warn(message, info.componentStack)
29
+ self:setState({
30
+ hasError = true,
31
+ message = `{message} {info.componentStack}`,
32
+ })
33
+ end
34
+ function ErrorBoundary:render()
35
+ if self.state.hasError then
36
+ return if self.props.fallback ~= nil then self.props.fallback(self.state.message) else React.createElement(React.Fragment)
37
+ end
38
+ return self.props.children
39
+ end
40
+ ErrorBoundary = ReactComponent(ErrorBoundary) or ErrorBoundary
41
+ end
42
+ local default = ErrorBoundary
43
+ return {
44
+ ErrorBoundary = ErrorBoundary,
45
+ default = default,
46
+ }
@@ -0,0 +1,4 @@
1
+ export { default as ErrorBoundary } from "./components/ErrorBoundary";
2
+ export { ErrorBoundaryProps } from "./components/ErrorBoundary";
3
+ export { ErrorBoundaryState } from "./components/ErrorBoundary";
4
+ export * from "./components/ErrorBoundary";
@@ -0,0 +1,8 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ exports.ErrorBoundary = TS.import(script, script, "components", "ErrorBoundary").default
5
+ for _k, _v in TS.import(script, script, "components", "ErrorBoundary") or {} do
6
+ exports[_k] = _v
7
+ end
8
+ return exports
@@ -1,7 +1,9 @@
1
1
  export * from "./divider/index";
2
+ export * from "./errorBoundary/index";
2
3
  export * from "./icon/index";
3
4
  export * from "./iconButton/index";
4
5
  export * from "./input/index";
6
+ export * from "./layout/index";
5
7
  export * from "./preloader/index";
6
8
  export * from "./progressBar/index";
7
9
  export * from "./shadow/index";
@@ -4,6 +4,9 @@ local exports = {}
4
4
  for _k, _v in TS.import(script, script, "divider") or {} do
5
5
  exports[_k] = _v
6
6
  end
7
+ for _k, _v in TS.import(script, script, "errorBoundary") or {} do
8
+ exports[_k] = _v
9
+ end
7
10
  for _k, _v in TS.import(script, script, "icon") or {} do
8
11
  exports[_k] = _v
9
12
  end
@@ -13,6 +16,9 @@ end
13
16
  for _k, _v in TS.import(script, script, "input") or {} do
14
17
  exports[_k] = _v
15
18
  end
19
+ for _k, _v in TS.import(script, script, "layout") or {} do
20
+ exports[_k] = _v
21
+ end
16
22
  for _k, _v in TS.import(script, script, "preloader") or {} do
17
23
  exports[_k] = _v
18
24
  end
@@ -0,0 +1,13 @@
1
+ import { CustomizedProps } from "../../../../theme/index";
2
+ export interface GridProps {
3
+ cellPadding?: UDim;
4
+ cellSize?: UDim2;
5
+ fillDirection?: Enum.FillDirection;
6
+ fillDirectionMaxCells?: number;
7
+ sortOrder?: Enum.SortOrder;
8
+ startCorner: Enum.StartCorner;
9
+ horizontalAlignment?: Enum.HorizontalAlignment;
10
+ veritcalAlignment?: Enum.VerticalAlignment;
11
+ }
12
+ declare function Grid(props: CustomizedProps<Frame, GridProps>): JSX.Element;
13
+ export default Grid;
@@ -0,0 +1,93 @@
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 _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
5
+ local makeStyles = _theme.makeStyles
6
+ local createStyles = _theme.createStyles
7
+ local useGridStyles = makeStyles(function(_, props)
8
+ return createStyles({
9
+ baseGrid = {
10
+ AutomaticSize = Enum.AutomaticSize.XY,
11
+ Size = UDim2.fromScale(0, 0),
12
+ BackgroundTransparency = 0,
13
+ BorderSizePixel = 0,
14
+ },
15
+ baseLayout = {
16
+ CellPadding = props.cellPadding,
17
+ CellSize = props.cellSize,
18
+ FillDirection = props.fillDirection,
19
+ FillDirectionMaxCells = props.fillDirectionMaxCells,
20
+ SortOrder = props.sortOrder,
21
+ StartCorner = props.startCorner,
22
+ HorizontalAlignment = props.horizontalAlignment,
23
+ VerticalAlignment = props.veritcalAlignment,
24
+ },
25
+ })
26
+ end)
27
+ local function Grid(props)
28
+ local _binding = props
29
+ local cellPadding = _binding.cellPadding
30
+ if cellPadding == nil then
31
+ cellPadding = UDim.new(0, 0)
32
+ end
33
+ local cellSize = _binding.cellSize
34
+ if cellSize == nil then
35
+ cellSize = UDim2.fromOffset(100, 100)
36
+ end
37
+ local fillDirection = _binding.fillDirection
38
+ if fillDirection == nil then
39
+ fillDirection = Enum.FillDirection.Horizontal
40
+ end
41
+ local fillDirectionMaxCells = _binding.fillDirectionMaxCells
42
+ if fillDirectionMaxCells == nil then
43
+ fillDirectionMaxCells = 0
44
+ end
45
+ local sortOrder = _binding.sortOrder
46
+ if sortOrder == nil then
47
+ sortOrder = Enum.SortOrder.LayoutOrder
48
+ end
49
+ local startCorner = _binding.startCorner
50
+ if startCorner == nil then
51
+ startCorner = Enum.StartCorner.TopLeft
52
+ end
53
+ local horizontalAlignment = _binding.horizontalAlignment
54
+ if horizontalAlignment == nil then
55
+ horizontalAlignment = Enum.HorizontalAlignment.Left
56
+ end
57
+ local veritcalAlignment = _binding.veritcalAlignment
58
+ if veritcalAlignment == nil then
59
+ veritcalAlignment = Enum.VerticalAlignment.Top
60
+ end
61
+ local className = _binding.className
62
+ local children = _binding.children
63
+ local _binding_1 = useGridStyles({
64
+ cellPadding = cellPadding,
65
+ cellSize = cellSize,
66
+ fillDirection = fillDirection,
67
+ fillDirectionMaxCells = fillDirectionMaxCells,
68
+ sortOrder = sortOrder,
69
+ startCorner = startCorner,
70
+ horizontalAlignment = horizontalAlignment,
71
+ veritcalAlignment = veritcalAlignment,
72
+ })
73
+ local baseGrid = _binding_1.baseGrid
74
+ local baseLayout = _binding_1.baseLayout
75
+ local _attributes = {
76
+ key = "grid",
77
+ }
78
+ for _k, _v in baseGrid do
79
+ _attributes[_k] = _v
80
+ end
81
+ if className then
82
+ for _k, _v in className do
83
+ _attributes[_k] = _v
84
+ end
85
+ end
86
+ local _attributes_1 = table.clone(baseLayout)
87
+ setmetatable(_attributes_1, nil)
88
+ return React.createElement("frame", _attributes, React.createElement("uigridlayout", _attributes_1), children)
89
+ end
90
+ local default = Grid
91
+ return {
92
+ default = default,
93
+ }
@@ -0,0 +1,13 @@
1
+ import { CustomizedProps } from "../../../../theme/index";
2
+ export interface ListProps {
3
+ padding?: UDim;
4
+ fillDirection?: Enum.FillDirection;
5
+ sortOrder?: Enum.SortOrder;
6
+ wrap?: "wrap" | "no-wrap";
7
+ horizontalAlignment?: Enum.HorizontalAlignment;
8
+ horizontalFlex?: Enum.UIFlexAlignment;
9
+ veritcalAlignment?: Enum.VerticalAlignment;
10
+ verticalFlex?: Enum.UIFlexAlignment;
11
+ }
12
+ declare function List(props: CustomizedProps<Frame, ListProps>): JSX.Element;
13
+ export default List;
@@ -0,0 +1,89 @@
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 _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
5
+ local makeStyles = _theme.makeStyles
6
+ local createStyles = _theme.createStyles
7
+ local useListStyles = makeStyles(function(_, props)
8
+ return createStyles({
9
+ baseList = {
10
+ AutomaticSize = Enum.AutomaticSize.XY,
11
+ Size = UDim2.fromScale(0, 0),
12
+ BackgroundTransparency = 0,
13
+ BorderSizePixel = 0,
14
+ },
15
+ baseLayout = {
16
+ Padding = props.padding,
17
+ FillDirection = props.fillDirection,
18
+ SortOrder = props.sortOrder,
19
+ Wraps = props.wrap == "wrap",
20
+ HorizontalAlignment = props.horizontalAlignment,
21
+ HorizontalFlex = props.horizontalFlex,
22
+ VerticalAlignment = props.veritcalAlignment,
23
+ VerticalFlex = props.verticalFlex,
24
+ },
25
+ })
26
+ end)
27
+ local function List(props)
28
+ local _binding = props
29
+ local padding = _binding.padding
30
+ if padding == nil then
31
+ padding = UDim.new(0, 0)
32
+ end
33
+ local fillDirection = _binding.fillDirection
34
+ if fillDirection == nil then
35
+ fillDirection = Enum.FillDirection.Horizontal
36
+ end
37
+ local sortOrder = _binding.sortOrder
38
+ if sortOrder == nil then
39
+ sortOrder = Enum.SortOrder.LayoutOrder
40
+ end
41
+ local wrap = _binding.wrap
42
+ if wrap == nil then
43
+ wrap = "wrap"
44
+ end
45
+ local horizontalAlignment = _binding.horizontalAlignment
46
+ if horizontalAlignment == nil then
47
+ horizontalAlignment = Enum.HorizontalAlignment.Left
48
+ end
49
+ local horizontalFlex = _binding.horizontalFlex
50
+ if horizontalFlex == nil then
51
+ horizontalFlex = Enum.UIFlexAlignment.None
52
+ end
53
+ local veritcalAlignment = _binding.veritcalAlignment
54
+ if veritcalAlignment == nil then
55
+ veritcalAlignment = Enum.VerticalAlignment.Top
56
+ end
57
+ local verticalFlex = _binding.verticalFlex
58
+ if verticalFlex == nil then
59
+ verticalFlex = Enum.UIFlexAlignment.None
60
+ end
61
+ local className = _binding.className
62
+ local children = _binding.children
63
+ local _binding_1 = useListStyles({
64
+ padding = padding,
65
+ fillDirection = fillDirection,
66
+ sortOrder = sortOrder,
67
+ wrap = wrap,
68
+ horizontalAlignment = horizontalAlignment,
69
+ horizontalFlex = horizontalFlex,
70
+ veritcalAlignment = veritcalAlignment,
71
+ verticalFlex = verticalFlex,
72
+ })
73
+ local baseList = _binding_1.baseList
74
+ local baseLayout = _binding_1.baseLayout
75
+ local _attributes = table.clone(baseList)
76
+ setmetatable(_attributes, nil)
77
+ if className then
78
+ for _k, _v in className do
79
+ _attributes[_k] = _v
80
+ end
81
+ end
82
+ local _attributes_1 = table.clone(baseLayout)
83
+ setmetatable(_attributes_1, nil)
84
+ return React.createElement("frame", _attributes, React.createElement("uilistlayout", _attributes_1), children)
85
+ end
86
+ local default = List
87
+ return {
88
+ default = default,
89
+ }
@@ -0,0 +1,6 @@
1
+ export { default as Grid } from "./components/Grid";
2
+ export { GridProps } from "./components/Grid";
3
+ export * from "./components/Grid";
4
+ export { default as List } from "./components/List";
5
+ export { ListProps } from "./components/List";
6
+ export * from "./components/List";
@@ -0,0 +1,12 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ exports.Grid = TS.import(script, script, "components", "Grid").default
5
+ for _k, _v in TS.import(script, script, "components", "Grid") or {} do
6
+ exports[_k] = _v
7
+ end
8
+ exports.List = TS.import(script, script, "components", "List").default
9
+ for _k, _v in TS.import(script, script, "components", "List") or {} do
10
+ exports[_k] = _v
11
+ end
12
+ return exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.lua",
6
6
  "scripts": {